From patchwork Wed Sep 10 09:08:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ye.Li" X-Patchwork-Id: 387661 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D1F031400DD for ; Wed, 10 Sep 2014 19:24:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2608F4B664; Wed, 10 Sep 2014 11:24:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O8UNUaPrznJI; Wed, 10 Sep 2014 11:24:11 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 38A904B652; Wed, 10 Sep 2014 11:24:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7DAA84B652 for ; Wed, 10 Sep 2014 11:24:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6j0jG9nPm7AF for ; Wed, 10 Sep 2014 11:24:02 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0133.outbound.protection.outlook.com [157.56.111.133]) by theia.denx.de (Postfix) with ESMTPS id 1148E4B64D for ; Wed, 10 Sep 2014 11:23:59 +0200 (CEST) Received: from BY2PR03MB253.namprd03.prod.outlook.com (10.242.37.15) by BY2PR03MB255.namprd03.prod.outlook.com (10.242.37.22) with Microsoft SMTP Server (TLS) id 15.0.1024.12; Wed, 10 Sep 2014 09:09:34 +0000 Received: from BN3PR0301CA0046.namprd03.prod.outlook.com (25.160.152.142) by BY2PR03MB253.namprd03.prod.outlook.com (10.242.37.15) with Microsoft SMTP Server (TLS) id 15.0.1024.12; Wed, 10 Sep 2014 09:09:32 +0000 Received: from BN1BFFO11FD053.protection.gbl (2a01:111:f400:7c10::1:191) by BN3PR0301CA0046.outlook.office365.com (2a01:111:e400:401e::14) with Microsoft SMTP Server (TLS) id 15.0.1024.12 via Frontend Transport; Wed, 10 Sep 2014 09:09:32 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD053.mail.protection.outlook.com (10.58.145.8) with Microsoft SMTP Server (TLS) id 15.0.1019.14 via Frontend Transport; Wed, 10 Sep 2014 09:09:32 +0000 Received: from leyoen-ubuntu.localdomain ([10.192.185.229]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s8A99Jlu021923; Wed, 10 Sep 2014 02:09:29 -0700 From: Ye.Li To: Date: Wed, 10 Sep 2014 17:08:17 +0800 Message-ID: <1410340097-19804-4-git-send-email-B37916@freescale.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1410340097-19804-1-git-send-email-B37916@freescale.com> References: <1410340097-19804-1-git-send-email-B37916@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019019)(6009001)(199003)(189002)(4396001)(44976005)(107046002)(79102001)(6806004)(64706001)(2351001)(76176999)(97736003)(104166001)(106466001)(99396002)(31966008)(83322001)(102836001)(92566001)(50986999)(74502001)(77982001)(19580395003)(20776003)(110136001)(50226001)(46102001)(26826002)(229853001)(80022001)(19580405001)(69596002)(76482001)(77156001)(21056001)(81542001)(68736004)(47776003)(50466002)(84676001)(88136002)(93916002)(36756003)(87936001)(95666004)(74662001)(87286001)(89996001)(81156004)(81342001)(92726001)(90102001)(62966002)(48376002)(105606002)(83072002)(85306004)(85852003)(104016003); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR03MB253; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:;UriScan:; X-Forefront-PRVS: 033054F29A Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Ye.Li@freescale.com; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:; X-OriginatorOrg: freescale.com Cc: fabio.estevam@freescale.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/4] imx: mx6: Set Pfuze mode to decrease power number for DSM X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Set all switches APS mode in normal and PFM mode in standby. So when mx6 entering DSM mode, the power number can be decreased. There is no impact for mx6 in run mode. Changes for boards: -mx6 sabreauto -mx6 sabresd -mx6slevk -mx6sxsabresd Signed-off-by: Ye.Li --- board/freescale/mx6qsabreauto/mx6qsabreauto.c | 36 +++++++++++++++++++++++++ board/freescale/mx6sabresd/mx6sabresd.c | 36 +++++++++++++++++++++++++ board/freescale/mx6slevk/mx6slevk.c | 36 +++++++++++++++++++++++++ board/freescale/mx6sxsabresd/mx6sxsabresd.c | 36 +++++++++++++++++++++++++ 4 files changed, 144 insertions(+), 0 deletions(-) diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c index 76b024b..9e79915 100644 --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c @@ -263,6 +263,37 @@ int board_init(void) return 0; } +/* set all switches APS in normal and PFM mode in standby */ +static int pfuze_setup_mode(struct pmic *p, int chip) +{ + unsigned char offset, i, switch_num, value; + + if (!chip) { + /* pfuze100 */ + switch_num = 6; + offset = 0x31; + } else { + /* pfuze200 */ + switch_num = 4; + offset = 0x38; + } + + value = 0xc; + if (pmic_reg_write(p, 0x23, value)) { + printf("Set SW1AB mode error!\n"); + return -1; + } + + for (i = 0; i < switch_num - 1; i++) { + if (pmic_reg_write(p, offset + i * 7, value)) { + printf("Set switch%x mode error!\n", offset); + return -1; + } + } + + return 0; +} + static int pfuze_init(void) { struct pmic *p; @@ -281,6 +312,11 @@ static int pfuze_init(void) pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); + if (pfuze_setup_mode(p, (reg & 0xf))) { + printf("setup pfuze mode error!\n"); + return -1; + } + /* Set SW1AB stanby volage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1ABSTBY, ®); reg &= ~0x3f; diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index 72d6562..810fe13 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -456,6 +456,37 @@ int board_init(void) return 0; } +/* set all switches APS in normal and PFM mode in standby */ +static int pfuze_setup_mode(struct pmic *p, int chip) +{ + unsigned char offset, i, switch_num, value; + + if (!chip) { + /* pfuze100 */ + switch_num = 6; + offset = 0x31; + } else { + /* pfuze200 */ + switch_num = 4; + offset = 0x38; + } + + value = 0xc; + if (pmic_reg_write(p, 0x23, value)) { + printf("Set SW1AB mode error!\n"); + return -1; + } + + for (i = 0; i < switch_num - 1; i++) { + if (pmic_reg_write(p, offset + i * 7, value)) { + printf("Set switch%x mode error!\n", offset); + return -1; + } + } + + return 0; +} + static int pfuze_init(void) { struct pmic *p; @@ -475,6 +506,11 @@ static int pfuze_init(void) printf("PMIC: PFUZE%s ID=0x%02x\n", ((reg & 0xf) == 0) ? "100" : "200", reg); + if (pfuze_setup_mode(p, (reg & 0xf))) { + printf("setup pfuze mode error!\n"); + return -1; + } + /* Increase VGEN3 from 2.5 to 2.8V */ pmic_reg_read(p, PFUZE100_VGEN3VOL, ®); reg &= ~0xf; diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c index 8b6a79c..fe5e37d 100644 --- a/board/freescale/mx6slevk/mx6slevk.c +++ b/board/freescale/mx6slevk/mx6slevk.c @@ -195,6 +195,37 @@ int board_init(void) return 0; } +/* set all switches APS in normal and PFM mode in standby */ +static int pfuze_setup_mode(struct pmic *p, int chip) +{ + unsigned char offset, i, switch_num, value; + + if (!chip) { + /* pfuze100 */ + switch_num = 6; + offset = 0x31; + } else { + /* pfuze200 */ + switch_num = 4; + offset = 0x38; + } + + value = 0xc; + if (pmic_reg_write(p, 0x23, value)) { + printf("Set SW1AB mode error!\n"); + return -1; + } + + for (i = 0; i < switch_num - 1; i++) { + if (pmic_reg_write(p, offset + i * 7, value)) { + printf("Set switch%x mode error!\n", offset); + return -1; + } + } + + return 0; +} + static int pfuze_init(void) { struct pmic *p; @@ -214,6 +245,11 @@ static int pfuze_init(void) printf("PMIC: PFUZE%s ID=0x%02x\n", ((reg & 0xf) == 0) ? "100" : "200", reg); + if (pfuze_setup_mode(p, (reg & 0xf))) { + printf("setup pfuze mode error!\n"); + return -1; + } + /* Set SW1AB stanby volage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1ABSTBY, ®); reg &= ~0x3f; diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c index 80d2d99..d6a33cd 100644 --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c @@ -170,6 +170,37 @@ struct i2c_pads_info i2c_pad_info1 = { }, }; +/* set all switches APS in normal and PFM mode in standby */ +static int pfuze_setup_mode(struct pmic *p, int chip) +{ + unsigned char offset, i, switch_num, value; + + if (!chip) { + /* pfuze100 */ + switch_num = 6; + offset = 0x31; + } else { + /* pfuze200 */ + switch_num = 4; + offset = 0x38; + } + + value = 0xc; + if (pmic_reg_write(p, 0x23, value)) { + printf("Set SW1AB mode error!\n"); + return -1; + } + + for (i = 0; i < switch_num - 1; i++) { + if (pmic_reg_write(p, offset + i * 7, value)) { + printf("Set switch%x mode error!\n", offset); + return -1; + } + } + + return 0; +} + static int pfuze_init(void) { struct pmic *p; @@ -188,6 +219,11 @@ static int pfuze_init(void) pmic_reg_read(p, PFUZE100_DEVICEID, ®); printf("PMIC: PFUZE100 ID=0x%02x\n", reg); + if (pfuze_setup_mode(p, (reg & 0xf))) { + printf("setup pfuze mode error!\n"); + return -1; + } + /* Set SW1AB standby voltage to 0.975V */ pmic_reg_read(p, PFUZE100_SW1ABSTBY, ®); reg &= ~0x3f;