From patchwork Mon Jan 7 13:08:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 13882 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9C99423E27 for ; Mon, 7 Jan 2013 13:04:20 +0000 (UTC) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by fiordland.canonical.com (Postfix) with ESMTP id 35E17A18062 for ; Mon, 7 Jan 2013 13:04:20 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id fl11so19450902vcb.1 for ; Mon, 07 Jan 2013 05:04:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:dlp-filter:x-mtr:x-brightmail-tracker :x-brightmail-tracker:x-cfilter-loop:x-gm-message-state; bh=TlUk1VPOg6zj6yECGGp/8iLukMxmcRuGQurfzrxz3M8=; b=n+EKLoI12UWrV6sDvveTJqi8MlR0sR5dvhbhgznlXE4dTjkZy5yk1Yiox2n5wAHbl6 ncYIYSr9dRN6nSIYrJM4kuvO+WHiRv44ugjAVtpT9vZBFaka7s/IyclcSomag6hwrUJk cYBWvi6z50VXqxiAMS/ufUGA5059TUczeqKcKhTJ6n/lGee0FwC0vdFzBYYQPTEpdk9T 5Fnf2zK5sMHrUjv42HAPuXl86DxQrhm+zzY1AfDx4Lx8YwGI+y/WX7CZF3QjYBAlJDFf m+ntlHneBzCynAdOiGbQBCLsNwhTY/rg36SkQfs2oMuVVi7++IiJ5pgki2rDswhejPba q/Pg== X-Received: by 10.58.210.65 with SMTP id ms1mr83526478vec.59.1357563859650; Mon, 07 Jan 2013 05:04:19 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp59971veb; Mon, 7 Jan 2013 05:04:18 -0800 (PST) X-Received: by 10.68.137.41 with SMTP id qf9mr185813843pbb.103.1357563858095; Mon, 07 Jan 2013 05:04:18 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id o4si59466601paw.344.2013.01.07.05.04.17; Mon, 07 Jan 2013 05:04:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.25 as permitted sender) smtp.mail=rajeshwari.s@samsung.com 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 <0MG9002JDAYY10C0@mailout2.samsung.com>; Mon, 07 Jan 2013 22:04:16 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F4.A0.01231.0D7CAE05; Mon, 07 Jan 2013 22:04:16 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-01-50eac7d0fe23 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 94.A0.01231.0D7CAE05; Mon, 07 Jan 2013 22:04:16 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MG900HHWAUUOH80@mmp2.samsung.com>; Mon, 07 Jan 2013 22:04:16 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, kmpark@infradead.org Subject: [PATCH 3/4 V2] SMDK5250: Add PMIC voltage settings Date: Mon, 07 Jan 2013 18:38:45 +0530 Message-id: <1357564126-13275-4-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1357564126-13275-1-git-send-email-rajeshwari.s@samsung.com> References: <1357564126-13275-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsWyRsSkTvfC8VcBBk9m61g8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DK2PHrG3vBPfWKm0/7mBsY9yh0MXJySAiYSByctIEN whaTuHBvPZDNxSEksJRRYtaNNUwwRZ2z/jJBJKYzSpzef5MZJCEkMJFJ4t7CXBCbTcBIYuvJ aYwgtoiAhMSv/qtgNrNAkcTU7sWsILawgLXEzwsLwWwWAVWJNccPgG3mFfCQODJtHgvEMgWJ Y1O/gtVwCnhKdP6fBbXLQ+LSn92MEL0CEt8mHwKq5wCql5XYdIAZ5DYJgdtsEpsvTIWaIylx cMUNlgmMwgsYGVYxiqYWJBcUJ6XnGuoVJ+YWl+al6yXn525iBIbj6X/PpHYwrmywOMQowMGo xMN70eBVgBBrYllxZe4hRgkOZiURXpsuoBBvSmJlVWpRfnxRaU5q8SFGH6BLJjJLiSbnA2Ml ryTe0NjE3NTY1NLIyMzUFIewkjgv46knAUIC6YklqdmpqQWpRTDjmDg4pRoYC+LbFPoepx6r tV98YLrylE/PtIXEjllIHzX6Vf7xipi9zbSqCK1dx7vfJLCIrAlkPlcrenbXjn52zkuNDL0s R43lYy0+cpx8VPVvvUp51e9j+1ketLieO737leZS/YXzc7s0pn+u1rksz9mQ8UNwvs/sqOZ9 OVO/ehXtPGW96sSe0q6W9+tylFiKMxINtZiLihMBrA/oMnQCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsVy+t9jQd0Lx18FGDz8LG/xcP1NFosph7+w ODB53Lm2hy2AMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnF J0DXLTMHaLaSQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMWPHr2/sBffU K24+7WNuYNyj0MXIySEhYCLROesvE4QtJnHh3nq2LkYuDiGB6YwSp/ffZAZJCAlMZJK4tzAX xGYTMJLYenIaI4gtIiAh8av/KpjNLFAkMbV7MSuILSxgLfHzwkIwm0VAVWLN8QNsIDavgIfE kWnzWCCWKUgcm/oVrIZTwFOi8/8sqF0eEpf+7GacwMi7gJFhFaNoakFyQXFSeq6hXnFibnFp Xrpecn7uJkZwsD+T2sG4ssHiEKMAB6MSD+9Fg1cBQqyJZcWVuYcYJTiYlUR4bbqAQrwpiZVV qUX58UWlOanFhxh9gK6ayCwlmpwPjMS8knhDYxNzU2NTSxMLEzNLHMJK4ryMp54ECAmkJ5ak ZqemFqQWwYxj4uCUamBU/G1xc1PgX6Yw1pjvcqqekdlTOha78i9csbSgp6fbgn3F/HCNohL9 ZzLaX17qse/d/6d+t/YPjstRnR2XNpxL+nM3pKzRo22jrk+b2J2DFmamR+/c/Llrz071+HCN R8yXL7tFiq/jXjTXc9rCzRc2/jn4PW3qjnOBVr/4/v2w5fbZcfWC+w8vJZbijERDLeai4kQA P3B6naMCAAA= X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQn7eXIJek1vf+5loOusExCCRnv1cwMd2A6wJTa57GpzH8vMeNEXkIUqCdaV5lS5PAuJievx This patch adds required pmic voltage settings for SMDK5250. Signed-off-by: Rajeshwari Shinde --- Changes in V2: - Added pmic_reg_update static function. - Added error check. board/samsung/smdk5250/smdk5250.c | 110 ++++++++++++++++++++++++++++++++++++- include/power/max77686_pmic.h | 30 ++++++++++ 2 files changed, 138 insertions(+), 2 deletions(-) diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c index 73c3ec0..9b0fe39 100644 --- a/board/samsung/smdk5250/smdk5250.c +++ b/board/samsung/smdk5250/smdk5250.c @@ -24,14 +24,17 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -58,12 +61,115 @@ int dram_init(void) } #if defined(CONFIG_POWER) +static int pmic_reg_update(struct pmic *p, int reg, uint regval) +{ + u32 val; + int ret = 0; + + ret = pmic_reg_read(p, reg, &val); + if (ret) { + debug("%s: PMIC register read failed\n", __func__); + return -1; + } + val |= regval; + ret = pmic_reg_write(p, reg, val); + if (ret) { + debug("%s: PMIC register write failed\n", __func__); + return -1; + } + return 0; +} + int power_init_board(void) { + struct pmic *p; + + power_ps_hold_setup(); + + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + if (pmic_init(I2C_PMIC)) return -1; - else - return 0; + + p = pmic_get("MAX77686_PMIC"); + if (!p) + return -ENODEV; + + if (pmic_probe(p)) + return -1; + + if (pmic_reg_update(p, MAX77686_REG_PMIC_32KHZ, MAX77686_32KHCP_EN)) + return -1; + + if (pmic_reg_update(p, MAX77686_REG_PMIC_BBAT, + (MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V))) + return -1; + + /* VDD_MIF */ + if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK1OUT, + MAX77686_BUCK1OUT_1V)) { + debug("%s: PMIC BUCK1OUT register write failed\n", __func__); + return -1; + } + + if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK1CRTL, + MAX77686_BUCK1CTRL_EN)) + return -1; + + /* VDD_ARM */ + if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK2DVS1, + MAX77686_BUCK2DVS1_1_3V)) { + debug("%s: PMIC BUCK2DVS1 register write failed\n", __func__); + return -1; + } + + if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK2CTRL1, + MAX77686_BUCK2CTRL_ON)) + return -1; + + /* VDD_INT */ + if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK3DVS1, + MAX77686_BUCK3DVS1_1_0125V)) { + debug("%s: PMIC BUCK3DVS1 register write failed\n", __func__); + return -1; + } + + if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK3CTRL, + MAX77686_BUCK3CTRL_ON)) + return -1; + + /* VDD_G3D */ + if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK4DVS1, + MAX77686_BUCK4DVS1_1_2V)) { + debug("%s: PMIC BUCK4DVS1 register write failed\n", __func__); + return -1; + } + + if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK4CTRL1, + MAX77686_BUCK3CTRL_ON)) + return -1; + + /* VDD_LDO2 */ + if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO2CTRL1, + (MAX77686_LD02CTRL1_1_5V | EN_LDO))) + return -1; + + /* VDD_LDO3 */ + if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO3CTRL1, + (MAX77686_LD03CTRL1_1_8V | EN_LDO))) + return -1; + + /* VDD_LDO5 */ + if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO5CTRL1, + (MAX77686_LD05CTRL1_1_8V | EN_LDO))) + return -1; + + /* VDD_LDO10 */ + if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO10CTRL1, + (MAX77686_LD10CTRL1_1_8V | EN_LDO))) + return -1; + + return 0; } #endif diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h index d949ace..5b7b6ce 100644 --- a/include/power/max77686_pmic.h +++ b/include/power/max77686_pmic.h @@ -155,4 +155,34 @@ enum { EN_LDO = (0x3 << 6), }; +/* Buck1 1 volt value */ +#define MAX77686_BUCK1OUT_1V 0x5 +#define MAX77686_BUCK1CTRL_EN (3 << 0) +/* Buck2 1.3 volt value */ +#define MAX77686_BUCK2DVS1_1_3V 0x38 +#define MAX77686_BUCK2CTRL_ON (1 << 4) +/* Buck3 1.0125 volt value */ +#define MAX77686_BUCK3DVS1_1_0125V 0x21 +#define MAX77686_BUCK3CTRL_ON (1 << 4) +/* Buck4 1.2 volt value */ +#define MAX77686_BUCK4DVS1_1_2V 0x30 +#define MAX77686_BUCK4CTRL_ON (1 << 4) +/* LDO2 1.5 volt value */ +#define MAX77686_LD02CTRL1_1_5V 0x1c +/* LDO3 1.8 volt value */ +#define MAX77686_LD03CTRL1_1_8V 0x14 +/* LDO5 1.8 volt value */ +#define MAX77686_LD05CTRL1_1_8V 0x14 +/* LDO10 1.8 volt value */ +#define MAX77686_LD10CTRL1_1_8V 0x14 +/* MAX77686_REG_PMIC_32KHZ set to 32KH CP + * output is activated + */ +#define MAX77686_32KHCP_EN (1 << 1) +/* MAX77686_REG_PMIC_BBAT set to + * Back up batery charger on and + * limit voltage setting to 3.5v + */ +#define MAX77686_BBCHOSTEN (1 << 0) +#define MAX77686_BBCVS_3_5V (3 << 3) #endif /* __MAX77686_PMIC_H_ */