From patchwork Tue Dec 6 17:38:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Matheus Lima X-Patchwork-Id: 703274 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 3tY8LZ4nNxz9vQ5 for ; Wed, 7 Dec 2016 04:51:02 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A961BA75B4; Tue, 6 Dec 2016 18:50:59 +0100 (CET) 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 j9moDBFm-h6j; Tue, 6 Dec 2016 18:50:59 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C5369A75A9; Tue, 6 Dec 2016 18:50:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D093BA75A9 for ; Tue, 6 Dec 2016 18:50:55 +0100 (CET) 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 XMf6WHodUNiV for ; Tue, 6 Dec 2016 18:50:55 +0100 (CET) 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 NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0068.outbound.protection.outlook.com [104.47.37.68]) by theia.denx.de (Postfix) with ESMTPS id 237C74A01C for ; Tue, 6 Dec 2016 18:50:51 +0100 (CET) Received: from DM2PR03CA0031.namprd03.prod.outlook.com (10.141.96.30) by BY2PR0301MB0744.namprd03.prod.outlook.com (10.160.63.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Tue, 6 Dec 2016 17:36:29 +0000 Received: from BN1BFFO11FD003.protection.gbl (2a01:111:f400:7c10::1:196) by DM2PR03CA0031.outlook.office365.com (2a01:111:e400:2428::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10 via Frontend Transport; Tue, 6 Dec 2016 17:36:28 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD003.mail.protection.outlook.com (10.58.144.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Tue, 6 Dec 2016 17:36:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:739; Count:10 Received: from b58964-3.am.freescale.net ([10.29.244.171]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uB6HaF8G006668; Tue, 6 Dec 2016 10:36:26 -0700 From: Breno Lima To: Date: Tue, 6 Dec 2016 15:38:25 -0200 Message-ID: <1481045906-2562-2-git-send-email-breno.lima@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481045906-2562-1-git-send-email-breno.lima@nxp.com> References: <1481045906-2562-1-git-send-email-breno.lima@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131255193886225414; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(336004)(199003)(189002)(4326007)(86362001)(2906002)(68736007)(8676002)(50986999)(92566002)(47776003)(8936002)(76176999)(81156014)(2351001)(33646002)(105606002)(36756003)(575784001)(106466001)(50226002)(97736004)(104016004)(81166006)(5660300001)(39060400001)(50466002)(39410400001)(39380400001)(38730400001)(39400400001)(48376002)(77096006)(5003940100001)(626004)(39450400002)(39840400001)(7846002)(39860400001)(110136003)(356003)(2950100002)(305945005)(6916009)(189998001)(39850400001)(85426001)(8666005)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0744; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD003; 1:MCYE0D8qIEUB7ZaX2gC/V5RTxKGrIefwf78IDc7jKOx1rpULa0FP1gpwAEQ/13gEiwEZ0A36oRGsbrld20rws9KUmGbZzs9Qyp1P+hQAW6OMiVBT+0W2OBorm+zFc8E7vqQRov6HsVMRiNqU6/iBesspuYHChTLhN+IHTgPxKwHvMlkcY83wYr2iu5M3bIgyXyYG55L60bHbfkmrB0JPNFu/FF2+ZgKJVchp+X5GaFhGq3ClLg+HEa7jMGXZ+PdQBQuyqJifSeRuEViEOrhm/uXlq0EntUG8L9JF6XtUh4XxpsbvCF1YOeKeMhpnW1DHKJKUAfUFKURc+bJRPpwihU4L2N6cucor882LO27j4NUuVMRPbo3LSoMmPPWYp//uxoheqeNaQwjP7dcO3e8uCbqCFvOOjXIeQ7vB1YXx+IqVbX98luNIxIZfefue6LPx1TbYfFk9ReoWtr5dmu7AtirbDcYMYUFjbLoKgVBxxaUKXh4SPGsXmCdjYpJJe0MtQu2floFrK6djR64HimiWkUE6oapn+GX7U8f1SAmvWXgCjVpDDDYnDU48kq1iKdeH2pjoZ72LjkxnBJoktFkXPZmvyGuEY4SySIpaPM9A2qnRtiRJE0EiiuURErL/Z5jesdnfq6YJkocgAw2heEXXN6VkNm2wjHLAndf5rHLaK1dgl8QfRGxoleWEOTRfbuKwxQ6icq5O/now0DKDvcqzNpMoicDatqgRHf+OwsB8aC8= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 18ef716d-6448-4dbd-12a6-08d41dfe68f8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0744; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0744; 3:vmXyPMAn1nKcg/JpgngSe5DUhZ7fP33fBRND8O45o/20K4MnIKbPonWHqLkPvBWCW40lnjFb+M2taxBpOWMyqkFy3WBV8OgkAKHEw8Y6q9twnuSjgO6AVf6WjUZayX9NQ8GLgupX/Pp4sA07MhATTqcD4ERwiKkCRlhD004JJuOnLMVtC61a45G1svH1oofoX4UtVaSCJt40KD27xXS71OIPyxH+cVFNrAG95K4xh8VvulrWMTAU/xa2Dk49G4PfJMrRm4vSwIzx6YSEOGPW//IjOhs0WZpI5NlpuednVIj2EPbz+vd1PdK101rzdNwRiwI1aUHbj7dJs7POsvRrGKzrog7D7FmvF9PUoZxr7hF1T8b0ASVcfyC1X49qvNH8; 25:y05vjI/IY+r7mjcYNa2onpDCijv0Jo1zjLd5YvoWmiFu6DY5I+B41mE47lTX43IznQ600Cej4uSArIVm6aXrNv680l4ipYxgxIIPdOEorkFBkuonbjszf+VerAeHIhOcs6bUNfrj4T2IiIIG35b1lChIf1PiO9qACutJrDzl82s8vTK6dhi3AxTQzdYo2qJ5iEIT+DXC6/IbISqaPCp+374NfhwWRXvx3EAkbYD66FaBxJicHYJHAnZ02o+2Ekpya0/Ik6qf9xkpiGKXJz7zR00v28ePOsMV4wfdZGL9Va7sOoIH0QMmDRkDHTrsBUivQpBGBCBfIvHBykHfZq38AlGtPc8u/b/WWcsoyvUKKAR6oDvnvs6V70y+ORziB4Ki3iaDW9fpzE7rmEs20HfuD0xUCFNL9uCjThXK21ROy3SwWqHiD7n18Vb9dT2/f9n2PHxbAntkYnXZg/W6Hy0HRw== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0744; 31:GhUjajzZI6POggIn3/M+EORQaoNo6CypSzcc/4fcTPMCi+b2LSKp19Q/gM/F82PN1E3V6mFkxHBhw2UQRJZfF6WFq0A6X1XKZt0fsWLIbgajhP/Mpumk4m+XnYQLm7rzxRkvyLr/m06n/KbsgocMyar7vItmHrlz82KidRMAe6UBi7KweT+Qw1CY0Ag+YvWP0hMoH1seAhY3MTkBhhz05X9H+6L5pOBVqYQPjnie6NALnx9pPP0ef3C1HGh98eNDwCeonBec4wdAKeN7WIrWxg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(8121501046)(5005006)(13017025)(13015025)(13023025)(13024025)(13018025)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123556025)(20161123565025)(20161123561025)(20161123559025); SRVR:BY2PR0301MB0744; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0744; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0744; 4:SmATKgJKZxX1p5PQ+SFCjQnCuflaBN10qpCV5TjzRDPqXBJtzAcVaj0lH0e6Y+NKPMITKSWfZHaXwNPJSa95wBUWh0LTIk4KOk5Z0d8qAENgrwOvAhvX9kH+7kmBx50nmy6biIEBeHmv8f8ka0csDEwuZVWqe+BvWDHJAlin+4BkZfTQpouWcVEdWJQl5coEwmojBikGLZFeokiuAIovkbOeHgaEBd6wvj+biPEeP6Hg3d9z5EqM2/0EO9GwtSvHdzfH6cmtgNn3ocQ5TpYlDTO4h6fYcnIpcPUhfHP2aHBf4aCKiVsrWO+bULyQcRYx1j52eofy2wnSRYFX/dwWsbmsBkQtF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8kZEXYCqWFsdmOy9/kyiNYUScku1e8QVpDrmsAg6?= =?us-ascii?Q?AVlN9i4/X3u6kiYXatnvdRYbbWwPfuLG7mviXIONwFbhkZQCLEMhuQm+ODjy?= =?us-ascii?Q?03Oe9ieouVc6li42bL2EQCSyNJwzLrtiBfNFpAr9uu3AuklcIMcnZw4QE8zg?= =?us-ascii?Q?B8nxFGZxZlWvm/0JWPf2aY9XjQ7vAWzFyudopBkQjM6Uod7vpwWH9BoD8r7g?= =?us-ascii?Q?LzJznKtRqPLor6Yyu1Be0qN3LnYSzfCu+27y8FO5uWnKwCmtD9da88Kkvb6a?= =?us-ascii?Q?ptkTOSHJqyShuzb8krWbUx03He+MJsgkIkkWry3d7HCo4HWNw0gL7TedsF5Q?= =?us-ascii?Q?jyvMCGij2mrSX8wCpfq03oSKy22izhJMwtRc3ETeB7VWcuwSPNRiK/GxOQFJ?= =?us-ascii?Q?KkLTRBiCaVZtkqSKAHle70FqRCNWmDwmnDT3pLmOfRLhn8GWbYLRLyUxSupx?= =?us-ascii?Q?/QHZEe//48Btrdp9/L0njL9HCgaDMhKXi5UDZeNPKn3pXCUQzAjpgHaBkX3V?= =?us-ascii?Q?6nct7EPWkhYK1GAGx/DHBlinpvCbvz7jwvfFs9HDQpQA5UXWaZQf0fll4Kiu?= =?us-ascii?Q?akEgTEsmemoHgKR0Efl4h5792AY+EbXlAupUFB50QGe5VVoM7RQ5uFbR9hPT?= =?us-ascii?Q?guIb7FEK4OiwTHJrWno3BROVmXpibPffUw027XMXhY8KfaGc8aPOzbzdc+BF?= =?us-ascii?Q?irnV3yU0FX2HjSete4IJVxAB3AujDRcCrqeAooS2z7PqYTTsKb6Xw5j+FJRW?= =?us-ascii?Q?E00viv4YK77lv26cdbkF6LoF6ayMMeCWLvQDCcA5mlehe1E4e5bX+r8ohpUy?= =?us-ascii?Q?HXgpgBdgFt60XTmUAgeahYNE1oloU8kQ+bNxFOEv60TRp?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR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zFOiu6RCKlhAnsrrsgmPih/XKMESNHc0g4nGYTH6WNQGdyAD+NfoFA8GwD0qjDu/Wfrt2ED+tpKUKH2MCqjQHyY5ZdU5vg6H12kXGDpeYsfQeHxw/41ehLlyoIik0gDvf+U5g2YmqEslJ22Eo9P03u9udyuyk9CSNvWh9O99SPWDnL8BTI6ssPuLGmqNlliZoQs5uWWv9f/F074Nx4O1/rmRoFzuIeneNrypVveD/6sFHBuY0x/w== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2016 17:36:28.2637 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0744 Cc: Breno Lima , u-boot@lists.denx.de, francesco.montefoschi@udoo.org, fabio.estevam@nxp.com, brenomatheus@gmail.com Subject: [U-Boot] [PATCH 2/3] udoo_neo: Add PFUZE300 PMIC support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" UDOO Neo boards has a PFUZE300 connected to I2C1 bus. Tested on a UDOO Neo Full with "pmic PFUZE3000 dump" command. Signed-off-by: Breno Lima --- board/udoo/neo/neo.c | 143 +++++++++++++++++++++++++++++++++++++++++++++ include/configs/udoo_neo.h | 13 +++++ 2 files changed, 156 insertions(+) diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c index cfeed6f..ad7452c 100644 --- a/board/udoo/neo/neo.c +++ b/board/udoo/neo/neo.c @@ -19,10 +19,14 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -41,6 +45,11 @@ enum { PAD_CTL_PUS_22K_UP | PAD_CTL_SPEED_LOW | \ PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS) +#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ + PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ + PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ + PAD_CTL_ODE) + #define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm) @@ -56,6 +65,136 @@ int dram_init(void) return 0; } +#ifdef CONFIG_SYS_I2C_MXC +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) +/* I2C1 for PMIC */ +static struct i2c_pads_info i2c_pad_info1 = { + .scl = { + .i2c_mode = MX6_PAD_GPIO1_IO00__I2C1_SCL | PC, + .gpio_mode = MX6_PAD_GPIO1_IO00__GPIO1_IO_0 | PC, + .gp = IMX_GPIO_NR(1, 0), + }, + .sda = { + .i2c_mode = MX6_PAD_GPIO1_IO01__I2C1_SDA | PC, + .gpio_mode = MX6_PAD_GPIO1_IO01__GPIO1_IO_1 | PC, + .gp = IMX_GPIO_NR(1, 1), + }, +}; +#endif + +#ifdef CONFIG_POWER +int power_init_board(void) +{ + struct pmic *p; + int ret; + unsigned int reg, rev_id; + + ret = power_pfuze3000_init(PFUZE3000_I2C_BUS); + if (ret) + return ret; + + p = pmic_get("PFUZE3000"); + ret = pmic_probe(p); + if (ret) + return ret; + + pmic_reg_read(p, PFUZE3000_DEVICEID, ®); + pmic_reg_read(p, PFUZE3000_REVID, &rev_id); + printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id); + + /* disable Low Power Mode during standby mode */ + pmic_reg_read(p, PFUZE3000_LDOGCTL, ®); + reg |= 0x1; + ret = pmic_reg_write(p, PFUZE3000_LDOGCTL, reg); + if (ret) + return ret; + + ret = pmic_reg_write(p, PFUZE3000_SW1AMODE, 0xc); + if (ret) + return ret; + + ret = pmic_reg_write(p, PFUZE3000_SW1BMODE, 0xc); + if (ret) + return ret; + + ret = pmic_reg_write(p, PFUZE3000_SW2MODE, 0xc); + if (ret) + return ret; + + ret = pmic_reg_write(p, PFUZE3000_SW3MODE, 0xc); + if (ret) + return ret; + + /* set SW1A standby voltage 0.975V */ + pmic_reg_read(p, PFUZE3000_SW1ASTBY, ®); + reg &= ~0x3f; + reg |= PFUZE3000_SW1AB_SETP(9750); + ret = pmic_reg_write(p, PFUZE3000_SW1ASTBY, reg); + if (ret) + return ret; + + /* set SW1B standby voltage 0.975V */ + pmic_reg_read(p, PFUZE3000_SW1BSTBY, ®); + reg &= ~0x3f; + reg |= PFUZE3000_SW1AB_SETP(9750); + ret = pmic_reg_write(p, PFUZE3000_SW1BSTBY, reg); + if (ret) + return ret; + + /* set SW1A/VDD_ARM_IN step ramp up time from 16us to 4us/25mV */ + pmic_reg_read(p, PFUZE3000_SW1ACONF, ®); + reg &= ~0xc0; + reg |= 0x40; + ret = pmic_reg_write(p, PFUZE3000_SW1ACONF, reg); + if (ret) + return ret; + + /* set SW1B/VDD_SOC_IN step ramp up time from 16us to 4us/25mV */ + pmic_reg_read(p, PFUZE3000_SW1BCONF, ®); + reg &= ~0xc0; + reg |= 0x40; + ret = pmic_reg_write(p, PFUZE3000_SW1BCONF, reg); + if (ret) + return ret; + + /* set VDD_ARM_IN to 1.350V */ + pmic_reg_read(p, PFUZE3000_SW1AVOLT, ®); + reg &= ~0x3f; + reg |= PFUZE3000_SW1AB_SETP(13500); + ret = pmic_reg_write(p, PFUZE3000_SW1AVOLT, reg); + if (ret) + return ret; + + /* set VDD_SOC_IN to 1.350V */ + pmic_reg_read(p, PFUZE3000_SW1BVOLT, ®); + reg &= ~0x3f; + reg |= PFUZE3000_SW1AB_SETP(13500); + ret = pmic_reg_write(p, PFUZE3000_SW1BVOLT, reg); + if (ret) + return ret; + + /* set DDR_1_5V to 1.350V */ + pmic_reg_read(p, PFUZE3000_SW3VOLT, ®); + reg &= ~0x0f; + reg |= PFUZE3000_SW3_SETP(13500); + ret = pmic_reg_write(p, PFUZE3000_SW3VOLT, reg); + if (ret) + return ret; + + /* set VGEN2_1V5 to 1.5V */ + pmic_reg_read(p, PFUZE3000_VLDO2CTL, ®); + reg &= ~0x0f; + reg |= PFUZE3000_VLDO_SETP(15000); + /* enable */ + reg |= 0x10; + ret = pmic_reg_write(p, PFUZE3000_VLDO2CTL, reg); + if (ret) + return ret; + + return 0; +} +#endif + static iomux_v3_cfg_t const uart1_pads[] = { MX6_PAD_GPIO1_IO04__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL), MX6_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL), @@ -115,6 +254,10 @@ int board_init(void) /* Active high for ncp692 */ gpio_direction_output(IMX_GPIO_NR(4, 16) , 1); + #ifdef CONFIG_SYS_I2C_MXC + setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); + #endif + return 0; } diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h index 0357631..0c59068 100644 --- a/include/configs/udoo_neo.h +++ b/include/configs/udoo_neo.h @@ -90,4 +90,17 @@ #define CONFIG_IMX_THERMAL +/* I2C configs */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_I2C_MXC_I2C1 +#define CONFIG_SYS_I2C_SPEED 100000 + +/* PMIC */ +#define CONFIG_POWER +#define CONFIG_POWER_I2C +#define CONFIG_POWER_PFUZE3000 +#define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08 +#define PFUZE3000_I2C_BUS 0 + #endif /* __CONFIG_H */