From patchwork Wed Jan 23 10:07:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 14242 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 BDE5323EAD for ; Wed, 23 Jan 2013 10:00:22 +0000 (UTC) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by fiordland.canonical.com (Postfix) with ESMTP id 58F52A18D00 for ; Wed, 23 Jan 2013 10:00:22 +0000 (UTC) Received: by mail-ve0-f173.google.com with SMTP id b10so881917vea.4 for ; Wed, 23 Jan 2013 02:00:21 -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:x-brightmail-tracker:x-brightmail-tracker :dlp-filter:x-mtr:x-cfilter-loop:x-gm-message-state; bh=rbkRKYA+Vdr/KPbLMITM3CIaKeW/jDrskMSz4ABQALs=; b=DvXueZc2YIahihEKtgl42decS/SlNimGLw6TQjErbNeEcmSlLSzUtKimf2Aqd96Acw tGpnjkAOGdpew3XChTILDvJZ+xTrFd46qztRgrFVx1iJ7j3ukVAC76nr5bEyjCMon7TG GLwnszUIqtmFbye3O4U06/0thG7HLt9MSZRSKejp8dZWmez+h2AAFzvvHDNjRV/bejxY hbOdKte9Ul93/rc09+8eixVI5Gr9Cv3GDjdx1AxUuwS96BZCLgMMaDjkWuFCMZQjVisJ 1tUlRtACnus0CCrBJ462M3DMGS3XcxHa/YwS13USIUtHwKThMbuZyXCOsKUSe4wzHyOB Ptqg== X-Received: by 10.52.176.6 with SMTP id ce6mr569591vdc.57.1358935221739; Wed, 23 Jan 2013 02:00:21 -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 st5csp1453veb; Wed, 23 Jan 2013 02:00:20 -0800 (PST) X-Received: by 10.66.87.67 with SMTP id v3mr3019142paz.63.1358935220002; Wed, 23 Jan 2013 02:00:20 -0800 (PST) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id ko4si19959300pbc.16.2013.01.23.02.00.19; Wed, 23 Jan 2013 02:00:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MH2001ACOUVNW01@mailout4.samsung.com>; Wed, 23 Jan 2013 19:00:18 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.122]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 1C.8F.03918.2B4BFF05; Wed, 23 Jan 2013 19:00:18 +0900 (KST) X-AuditID: cbfee61a-b7f7d6d000000f4e-7e-50ffb4b26ce3 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AB.8F.03918.2B4BFF05; Wed, 23 Jan 2013 19:00:18 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MH2002PJP45GK50@mmp1.samsung.com>; Wed, 23 Jan 2013 19:00:18 +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 Subject: [PATCH 2/2 V2] SMDK5250: Add PMIC voltage settings Date: Wed, 23 Jan 2013 15:37:57 +0530 Message-id: <1358935677-10876-3-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1358935677-10876-1-git-send-email-rajeshwari.s@samsung.com> References: <1358935677-10876-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCLMWRmVeSWpSXmKPExsWyRsSkSnfTlv8BBj+2yFg8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKmHr4FFPBCo2K2acPsTUwPlXoYuTgkBAwkbh6mbeL kRPIFJO4cG89WxcjF4eQwFJGiQ8XJ7JCJEwkrl1bxQ5iCwksYpToXBYHYU9kkti1yAPEZhMw kth6chojiC0iICHxq/8qmM0sECPxev8PNhBbWMBa4nD3ZDaQvSwCqhJbbleDhHkFPCQaJt1j hlilIHFs6lewtZwCnhLrpjxkASkXAqpZNdkK5DQJgetsErcvrmMBqWEREJD4NvkQC8QrshKb DkCNkZQ4uOIGywRG4QWMDKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxAsPw9L9nUjsYVzZY HGIU4GBU4uFNePYvQIg1say4MvcQowQHs5IIr8ra/wFCvCmJlVWpRfnxRaU5qcWHGJOBlk9k lhJNzgfGSF5JvKGxibmpsamlkZGZqSlpwkrivIynngQICaQnlqRmp6YWpBbBbGHi4JRqYKyb nTIpbvPxBVm7zftk9qxKWFYUf+CK0ZSH36fxWGb+n2CvqyTz498D4euCAQtnS9S/ezmt6IZ+ iu7pgpCVi7o/vtnw0+0wQ9mEg4p2bc5zvEQ/3df9bb/l8tvLk7/MXzTFYsf7GoZ6lTMfuRkS Qh8s+sQVMmvLAR5nhjAn+W0SrxZf3fXUwfSIEktxRqKhFnNRcSIAF4Y9GYcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRmVeSWpSXmKPExsVy+t9jAd1NW/4HGOx5wmvxcP1NFosph7+w ODB53Lm2hy2AMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnF J0DXLTMHaLaSQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMWPq4VNMBSs0 KmafPsTWwPhUoYuRk0NCwETi2rVV7BC2mMSFe+vZQGwhgUWMEp3L4iDsiUwSuxZ5gNhsAkYS W09OYwSxRQQkJH71XwWzmQViJF7v/wHWKyxgLXG4ezKQzcHBIqAqseV2NUiYV8BDomHSPWaI VQoSx6Z+ZQWxOQU8JdZNecgCUi4EVLNqstUERt4FjAyrGEVTC5ILipPScw31ihNzi0vz0vWS 83M3MYLD/JnUDsaVDRaHGAU4GJV4eBOe/QsQYk0sK67MPcQowcGsJMKrsvZ/gBBvSmJlVWpR fnxRaU5q8SHGZKCbJjJLiSbnA2MwryTe0NjE3NTY1NLEwsTMkjRhJXFexlNPAoQE0hNLUrNT UwtSi2C2MHFwSjUwRs3YEL1mV9ZNz9oKk0/9asrp6zfd/tjefqPbrUCrqzYpbWZz9HXWoKet lx2ti6Xt52zYNP+opU1F+9MTtzuvGJgLBSmqVZ8T219SYrjb/nl0VmTkROVfIR2RItHp37+q 1l10/tj4+ZbBW+FXbimM4t0fGRO9+l6tj5m84YDsB72PrPVJzAVKLMUZiYZazEXFiQCvS3YU twIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQmAT5HUK6ck82QTjABbVEyhCqDDIfbYRr5dMBoLGCP4r7RU9LpDisqWBcKwbd1+sh8Cxg0s This patch adds required pmic voltage settings for SMDK5250. Acked-by: Simon Glass Signed-off-by: Rajeshwari Shinde --- Changes in V2: - Corrected the multi line comment style board/samsung/smdk5250/smdk5250.c | 113 ++++++++++++++++++++++++++++++++++++- include/power/max77686_pmic.h | 31 ++++++++++ 2 files changed, 142 insertions(+), 2 deletions(-) diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c index 7a5f132..12cc03e 100644 --- a/board/samsung/smdk5250/smdk5250.c +++ b/board/samsung/smdk5250/smdk5250.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -80,12 +82,119 @@ 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 %d register read failed\n", __func__, reg); + return -1; + } + val |= regval; + ret = pmic_reg_write(p, reg, val); + if (ret) { + debug("%s: PMIC %d register write failed\n", __func__, reg); + 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 %d register write failed\n", __func__, + MAX77686_REG_PMIC_BUCK1OUT); + 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 %d register write failed\n", __func__, + MAX77686_REG_PMIC_BUCK2DVS1); + 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 %d register write failed\n", __func__, + MAX77686_REG_PMIC_BUCK3DVS1); + 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 %d register write failed\n", __func__, + MAX77686_REG_PMIC_BUCK4DVS1); + 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..4a5355c 100644 --- a/include/power/max77686_pmic.h +++ b/include/power/max77686_pmic.h @@ -155,4 +155,35 @@ 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_ */