From patchwork Fri Sep 14 15:40:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 183961 X-Patchwork-Delegate: promsoft@gmail.com 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 5B9582C009C for ; Sat, 15 Sep 2012 01:43:34 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CBB9C281BD; Fri, 14 Sep 2012 17:42:37 +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 Uf6XUJyvFV2X; Fri, 14 Sep 2012 17:42:37 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AB04628221; Fri, 14 Sep 2012 17:42:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1F6F028220 for ; Fri, 14 Sep 2012 17:42:00 +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 aaHvtanO3c7h for ; Fri, 14 Sep 2012 17:41:58 +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 mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by theia.denx.de (Postfix) with ESMTP id 8A70128181 for ; Fri, 14 Sep 2012 17:41:23 +0200 (CEST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MAC00GZ5JJELC10@mailout2.samsung.com> for u-boot@lists.denx.de; Sat, 15 Sep 2012 00:41:22 +0900 (KST) X-AuditID: cbfee61a-b7fb46d00000656d-92-505350222ca4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 8E.B8.25965.22053505; Sat, 15 Sep 2012 00:41:22 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MAC002HNJJ64M80@mmp2.samsung.com> for u-boot@lists.denx.de; Sat, 15 Sep 2012 00:41:22 +0900 (KST) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Fri, 14 Sep 2012 17:40:15 +0200 Message-id: <1347637215-4830-17-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1347637215-4830-1-git-send-email-l.majewski@samsung.com> References: <1347637215-4830-1-git-send-email-l.majewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jQV2lgOAAg+sP+Sze7u1kd2D0OHtn B2MAYxSXTUpqTmZZapG+XQJXxvWlrYwFl4UrljyawNjAuFqgi5GTQ0LAROLWhkmMELaYxIV7 69m6GLk4hASmM0os+dfFBOEsZpJovnaIHaSKTUBP4vPdp0wgtoiAhMSv/quMIEXMAi1MEi8P XgYrEhZIkXi0vBGsiEVAVeL5r5fMIDavgJvEi9kfWSHWyUs8vd/HBmJzAsU/Pe8EquEA2uYq cexS5gRG3gWMDKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxgr3+TGoH48oGi0OMAhyMSjy8 CTxBAUKsiWXFlbmHGCU4mJVEeG21gUK8KYmVValF+fFFpTmpxYcYpTlYlMR5hT8FBggJpCeW pGanphakFsFkmTg4pRoYrWIyVXZ4MqvvzNuSONO/Mf6tvEbd5o02Nw/6i6fI892esW2nzUfb jLY6sY0HXrTdFtHunKbncD3KM+qEyC/X18sVltUXrFuUp9H8WypsZ3bLo4mVx1Z/YynjeFp4 sGa5/F2Ng0+fJ/j62u7l2riae17ncZHr88/edHG9IFxwRcFCPP/uhZ+nlFiKMxINtZiLihMB uQ+t0/YBAAA= Cc: Lukasz Majewski , Kyungmin Park , Tom Rini Subject: [U-Boot] [PATCH 16/16] arm:trats:pmic: Power consumption reduction state for Samsung's TRATS board 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When charging battery is necessary, the development board needs to be turned into low power mode for better efficiency. Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Minkyu Kang --- board/samsung/trats/trats.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index 21050c8..f213d72 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -89,6 +89,48 @@ void i2c_init_board(void) s5p_gpio_direction_output(&gpio2->y4, 1, 1); } +static void trats_low_power_mode(void) +{ + struct exynos4_clock *clk = + (struct exynos4_clock *)samsung_get_base_clock(); + struct exynos4_power *pwr = + (struct exynos4_power *)samsung_get_base_power(); + + /* Power down CORE1 */ + writel(0x0, &pwr->arm_core1_configuration); + + /* Change the APLL frequency */ + writel(0xa0c80604, &clk->apll_con0); + /* Change CPU0 clock divider */ + writel(0x00000100, &clk->div_cpu0); + /* CLK_DIV_STAT_CPU0 - wait until clock gets stable */ + while (readl(&clk->div_stat_cpu0) & 0x1111111) + ; + + /* Change clock divider ratio for DMC */ + writel(0x13113117, &clk->div_dmc0); + while (readl(&clk->div_stat_dmc0) & 0x11111111) + ; + + /* Turn off unnecessary power domains */ + writel(0x0, &pwr->xxti_configuration); /* XXTI */ + writel(0x0, &pwr->cam_configuration); /* CAM */ + writel(0x0, &pwr->tv_configuration); /* TV */ + writel(0x0, &pwr->mfc_configuration); /* MFC */ + writel(0x0, &pwr->g3d_configuration); /* G3D */ + writel(0x0, &pwr->gps_configuration); /* GPS */ + writel(0x0, &pwr->gps_alive_configuration); /* GPS_ALIVE */ + + /* Turn off unnecessary clocks */ + writel(0x0, &clk->gate_ip_cam); /* CAM */ + writel(0x0, &clk->gate_ip_tv); /* TV */ + writel(0x0, &clk->gate_ip_mfc); /* MFC */ + writel(0x0, &clk->gate_ip_g3d); /* G3D */ + writel(0x0, &clk->gate_ip_image); /* IMAGE */ + writel(0x0, &clk->gate_ip_gps); /* GPS */ +} + + static int pmic_init_max8997(void) { struct pmic *p = pmic_get("MAX8997_PMIC"); @@ -262,6 +304,7 @@ int power_board_init(void) power_check_battery(&bat); if (bat.state == CHARGE && chrg == CHARGER_USB) { + trats_low_power_mode(); puts("CHARGER ENABLE\n"); if (pmic_charger_state(CHARGER_ENABLE, 450)) return -1;