From patchwork Mon May 7 20:25:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 157413 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 9FDAEB6FA4 for ; Tue, 8 May 2012 06:26:38 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4A2B8280EE; Mon, 7 May 2012 22:26:28 +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 1C95hw76KqvM; Mon, 7 May 2012 22:26:28 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5A70C280F2; Mon, 7 May 2012 22:26:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CCCFE280E7 for ; Mon, 7 May 2012 22:26:16 +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 uRkor+xB6QrN for ; Mon, 7 May 2012 22:26:16 +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 mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by theia.denx.de (Postfix) with ESMTPS id 07A9E280E2 for ; Mon, 7 May 2012 22:26:14 +0200 (CEST) Received: by yenq13 with SMTP id q13so773075yen.3 for ; Mon, 07 May 2012 13:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=hlrETzyX81DbA8gVrvbZg1vzSFzuMXTMqaC7+bGCQUs=; b=pkYmbNNx0Uq2p5XQbTzwPuLfx6W3eSLM6s5Hghcuq8MUsz+Gt+ezLoZiHr3Jx9ObIF 2N/C8K7Sgm5+uJK/Rpt4NL2cZGX2biuutQ6cR04B/rqFIEJIToWCsYtuFX8Uj0A9N/Za FqCmLBNqQhdnu+onD+wMo31z4mPauVeoQRdg7++05Lpg1tk++vyN5CZaBn5jzDcTgCPz iEo4LiLMMb9uDq+t0Z9J53AK+UEvCB4bYC9dBMNFcNiQeBJeCPtPBSgQy2fTHptcyrIc KFdV5tsE6Mji/YL11h2dWc/jOb2d0bZ6aXOQiL4zpHTwd4Ee3PVyMrKZCIxoXoTgek90 ZLyA== Received: by 10.236.155.6 with SMTP id i6mr4546089yhk.11.1336422373255; Mon, 07 May 2012 13:26:13 -0700 (PDT) Received: from localhost.localdomain ([201.82.161.72]) by mx.google.com with ESMTPS id h72sm19295998yhm.5.2012.05.07.13.26.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 May 2012 13:26:12 -0700 (PDT) From: Fabio Estevam To: u-boot@lists.denx.de Date: Mon, 7 May 2012 17:25:59 -0300 Message-Id: <1336422361-14245-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1336422361-14245-1-git-send-email-festevam@gmail.com> References: <1336422361-14245-1-git-send-email-festevam@gmail.com> Cc: Fabio Estevam Subject: [U-Boot] [PATCH 2/4] mx53loco: Add mc34708 support and set mx53 frequency at 1GHz 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 From: Fabio Estevam Add mc34708 support and set mx53 core frequency at its maximum value of 1GHz. Signed-off-by: Fabio Estevam Acked-by: Jason Liu Acked-by: Stefano Babic --- board/freescale/mx53loco/mx53loco.c | 52 +++++++++++++++++++++++++--------- include/configs/mx53loco.h | 2 + include/fsl_pmic.h | 10 +++++++ 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c index 7ed5c4e..8c18b99 100644 --- a/board/freescale/mx53loco/mx53loco.c +++ b/board/freescale/mx53loco/mx53loco.c @@ -38,6 +38,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -319,23 +320,46 @@ static void setup_iomux_i2c(void) static int power_init(void) { - unsigned int val, ret; + unsigned int val; + int ret = -1; struct pmic *p; - pmic_dialog_init(); - p = get_pmic(); - - /* Set VDDA to 1.25V */ - val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V; - ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val); - - ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val); - val |= DA9052_SUPPLY_VBCOREGO; - ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val); + if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR)) { + pmic_dialog_init(); + p = get_pmic(); + + /* Set VDDA to 1.25V */ + val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V; + ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val); + + ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val); + val |= DA9052_SUPPLY_VBCOREGO; + ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val); + + /* Set Vcc peripheral to 1.30V */ + ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62); + ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62); + } - /* Set Vcc peripheral to 1.35V */ - ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62); - ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62); + if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) { + pmic_init(); + p = get_pmic(); + + /* Set VDDGP to 1.25V for 1GHz on SW1 */ + pmic_reg_read(p, REG_SW_0, &val); + val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_250V_MC34708; + ret = pmic_reg_write(p, REG_SW_0, val); + + /* Set VCC as 1.30V on SW2 */ + pmic_reg_read(p, REG_SW_1, &val); + val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_300V_MC34708; + ret |= pmic_reg_write(p, REG_SW_1, val); + + /* Set global reset timer to 4s */ + pmic_reg_read(p, REG_POWER_CTL2, &val); + val = (val & ~TIMER_MASK_MC34708) | TIMER_4S_MC34708; + ret |= pmic_reg_write(p, REG_POWER_CTL2, val); + } return ret; } diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h index 8f43eec..87f6ed1 100644 --- a/include/configs/mx53loco.h +++ b/include/configs/mx53loco.h @@ -97,7 +97,9 @@ #define CONFIG_PMIC #define CONFIG_PMIC_I2C #define CONFIG_DIALOG_PMIC +#define CONFIG_PMIC_FSL #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR 0x48 +#define CONFIG_SYS_FSL_PMIC_I2C_ADDR 0x8 /* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE diff --git a/include/fsl_pmic.h b/include/fsl_pmic.h index 742f2e1..3b7cd37 100644 --- a/include/fsl_pmic.h +++ b/include/fsl_pmic.h @@ -122,4 +122,14 @@ enum { /* Interrupt status 1 */ #define RTCRSTI (1 << 7) +/* MC34708 Definitions */ +#define SWx_VOLT_MASK_MC34708 0x3F +#define SWx_1_250V_MC34708 0x30 +#define SWx_1_300V_MC34708 0x34 +#define TIMER_MASK_MC34708 0x300 +#define TIMER_4S_MC34708 0x100 +#define VUSBSEL_MC34708 (1 << 2) +#define VUSBEN_MC34708 (1 << 3) +#define SWBST_CTRL 31 + #endif