aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Rigby <john.rigby@linaro.org>2011-07-23 23:02:16 -0600
committerJohn Rigby <john.rigby@linaro.org>2012-04-25 07:54:05 -0600
commit86f982bb4eb8ab1bf7ddd6df1c0a7fc2db889dc1 (patch)
tree5c50ea05a46d91b676a7ad97c026d7a86f2387d9
parent5ae9995b15be2cccc23e4eed644805bec2e9e387 (diff)
downloadu-boot-linaro-stable-86f982bb4eb8ab1bf7ddd6df1c0a7fc2db889dc1.tar.gz
mx53loco: Add power init support
Increase CPU core power to 1.25v via DA9053 PMIC, and after that CPU can ran to 1GHZ and DDR 400Mhz. Signed-off-by: Jason Liu <jason.hui@linaro.org> Signed-off-by: Eric Miao <eric.miao@linaro.org>
-rw-r--r--board/freescale/mx53loco/mx53loco.c93
-rw-r--r--include/configs/mx53loco.h12
2 files changed, 105 insertions, 0 deletions
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index d736141e2..bf1c0a5ec 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -35,6 +35,7 @@
#include <mmc.h>
#include <fsl_esdhc.h>
#include <asm/gpio.h>
+#include <da9053.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -290,6 +291,93 @@ int board_mmc_init(bd_t *bis)
}
#endif
+static void setup_i2c(unsigned int port_number)
+{
+ switch (port_number) {
+ case 0:
+ /* i2c1 SDA */
+ mxc_request_iomux(MX53_PIN_CSI0_D8,
+ IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
+ mxc_iomux_set_input(MX53_I2C1_IPP_SDA_IN_SELECT_INPUT,
+ INPUT_CTL_PATH0);
+ mxc_iomux_set_pad(MX53_PIN_CSI0_D8,
+ PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+ PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
+ PAD_CTL_PUE_PULL |
+ PAD_CTL_ODE_OPENDRAIN_ENABLE);
+ /* i2c1 SCL */
+ mxc_request_iomux(MX53_PIN_CSI0_D9,
+ IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
+ mxc_iomux_set_input(MX53_I2C1_IPP_SCL_IN_SELECT_INPUT,
+ INPUT_CTL_PATH0);
+ mxc_iomux_set_pad(MX53_PIN_CSI0_D9,
+ PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+ PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
+ PAD_CTL_PUE_PULL |
+ PAD_CTL_ODE_OPENDRAIN_ENABLE);
+ break;
+ case 1:
+ /* i2c2 SDA */
+ mxc_request_iomux(MX53_PIN_KEY_ROW3,
+ IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION);
+ mxc_iomux_set_input(MX53_I2C2_IPP_SDA_IN_SELECT_INPUT,
+ INPUT_CTL_PATH0);
+ mxc_iomux_set_pad(MX53_PIN_KEY_ROW3,
+ PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+ PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
+ PAD_CTL_ODE_OPENDRAIN_ENABLE);
+
+ /* i2c2 SCL */
+ mxc_request_iomux(MX53_PIN_KEY_COL3,
+ IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION);
+ mxc_iomux_set_input(MX53_I2C2_IPP_SCL_IN_SELECT_INPUT,
+ INPUT_CTL_PATH0);
+ mxc_iomux_set_pad(MX53_PIN_KEY_COL3,
+ PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
+ PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
+ PAD_CTL_ODE_OPENDRAIN_ENABLE);
+ break;
+ default:
+ printf("Warning: Wrong I2C port number\n");
+ break;
+ }
+}
+
+static void clock_init(void)
+{
+ int ret;
+ u32 ref_clk = CONFIG_SYS_MX5_HCLK;
+ /*
+ * After increase voltage to 1.25V, We can switch
+ * CPU clokc to 1Ghz and DDR to 400Mhz safely now
+ */
+ ret = mxc_set_clock(ref_clk, 1000, MXC_ARM_CLK);
+ if (!ret)
+ printf("CPU: Switch CPU clock to 1GHZ OK\n");
+ else
+ printf("CPU: Switch CPU clock to 1GHZ failed\n");
+
+ ret = mxc_set_clock(ref_clk, 400, MXC_PERIPH_CLK);
+ ret |= mxc_set_clock(ref_clk, 400, MXC_DDR_CLK);
+ if (!ret)
+ printf("DDR: Switch DDR clock to 400MHz OK\n");
+ else
+ printf("CPU: Switch DDR clock to 1GHZ failed\n");
+}
+
+static void power_init(void)
+{
+ unsigned int val;
+
+ /* Set VDDA to 1.25V */
+ val = DA9052_BUCKCORE_BCOREEN;
+ val |= DA_BUCKCORE_VBCORE_1_250V;
+ pmic_reg_write(DA9053_BUCKCORE_REG, val);
+ val = pmic_reg_read(DA9053_SUPPLY_REG);
+ val |= DA9052_SUPPLY_VBCOREGO;
+ pmic_reg_write(DA9053_SUPPLY_REG, val);
+}
+
int board_early_init_f(void)
{
setup_iomux_uart();
@@ -302,6 +390,11 @@ int board_init(void)
{
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+#ifdef CONFIG_I2C_MXC
+ setup_i2c(0);
+ power_init();
+ clock_init();
+#endif
return 0;
}
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index 6f6d01e46..622c317c6 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -47,6 +47,18 @@
#define CONFIG_MXC_UART
#define CONFIG_MXC_UART_BASE UART1_BASE
+/* I2C Configs */
+#define CONFIG_CMD_I2C
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C_MX53_PORT1
+#define CONFIG_SYS_I2C_SPEED 100000
+#define CONFIG_SYS_I2C_SLAVE 0xfe
+
+/* PMIC Configs */
+#define CONFIG_DIALOG_PMIC
+#define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR 0x48
+
/* MMC Configs */
#define CONFIG_FSL_ESDHC
#define CONFIG_SYS_FSL_ESDHC_ADDR 0