]> code.ossystems Code Review - meta-freescale.git/blob
e9e2c1bb954cf6a0630d7c6b4df7001a33c5e5b8
[meta-freescale.git] /
1 From f658ecfa1294ec653afde9deb6ebedb1fe7d1afd Mon Sep 17 00:00:00 2001
2 From: Fabio Estevam <festevam@gmail.com>
3 Date: Mon, 30 Apr 2012 08:12:04 +0000
4 Subject: [PATCH 19/56] mx53loco: Add support for 1GHz operation for
5  DA9053-based boards
6
7 There are two types of mx53loco boards: initial boards were built with a Dialog
8 DA9053 PMIC and more recent version is based on a Freescale MC34708 PMIC.
9
10 Add DA9053 PMIC support and adjust the required voltages and clocks for running
11 the CPU at 1GHz.
12
13 Tested on both versions of mx53loco boards.
14
15 In the case of a MC34708-based board the CPU operating voltage remains at 800MHz.
16
17 Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
18 Acked-by : Stefano Babic <sbabic@denx.de>
19 ---
20  board/freescale/mx53loco/mx53loco.c |   71 +++++++++++++++++++++++++++++++++++
21  include/configs/mx53loco.h          |   14 +++++++
22  2 files changed, 85 insertions(+)
23
24 diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
25 index 46aaeb2..0dcec9b 100644
26 --- a/board/freescale/mx53loco/mx53loco.c
27 +++ b/board/freescale/mx53loco/mx53loco.c
28 @@ -36,6 +36,8 @@
29  #include <mmc.h>
30  #include <fsl_esdhc.h>
31  #include <asm/gpio.h>
32 +#include <pmic.h>
33 +#include <dialog_pmic.h>
34  
35  DECLARE_GLOBAL_DATA_PTR;
36  
37 @@ -291,6 +293,71 @@ int board_mmc_init(bd_t *bis)
38  }
39  #endif
40  
41 +static void setup_iomux_i2c(void)
42 +{
43 +       /* I2C1 SDA */
44 +       mxc_request_iomux(MX53_PIN_CSI0_D8,
45 +               IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
46 +       mxc_iomux_set_input(MX53_I2C1_IPP_SDA_IN_SELECT_INPUT,
47 +               INPUT_CTL_PATH0);
48 +       mxc_iomux_set_pad(MX53_PIN_CSI0_D8,
49 +               PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
50 +               PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
51 +               PAD_CTL_PUE_PULL |
52 +               PAD_CTL_ODE_OPENDRAIN_ENABLE);
53 +       /* I2C1 SCL */
54 +       mxc_request_iomux(MX53_PIN_CSI0_D9,
55 +               IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
56 +       mxc_iomux_set_input(MX53_I2C1_IPP_SCL_IN_SELECT_INPUT,
57 +               INPUT_CTL_PATH0);
58 +       mxc_iomux_set_pad(MX53_PIN_CSI0_D9,
59 +               PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
60 +               PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE |
61 +               PAD_CTL_PUE_PULL |
62 +               PAD_CTL_ODE_OPENDRAIN_ENABLE);
63 +}
64 +
65 +static int power_init(void)
66 +{
67 +       unsigned int val, ret;
68 +       struct pmic *p;
69 +
70 +       pmic_init();
71 +       p = get_pmic();
72 +
73 +       /* Set VDDA to 1.25V */
74 +       val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
75 +       ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val);
76 +
77 +       ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val);
78 +       val |= DA9052_SUPPLY_VBCOREGO;
79 +       ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val);
80 +
81 +       /* Set Vcc peripheral to 1.35V */
82 +       ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
83 +       ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
84 +
85 +       return ret;
86 +}
87 +
88 +static void clock_1GHz(void)
89 +{
90 +       int ret;
91 +       u32 ref_clk = CONFIG_SYS_MX5_HCLK;
92 +       /*
93 +        * After increasing voltage to 1.25V, we can switch
94 +        * CPU clock to 1GHz and DDR to 400MHz safely
95 +        */
96 +       ret = mxc_set_clock(ref_clk, 1000, MXC_ARM_CLK);
97 +       if (ret)
98 +               printf("CPU:   Switch CPU clock to 1GHZ failed\n");
99 +
100 +       ret = mxc_set_clock(ref_clk, 400, MXC_PERIPH_CLK);
101 +       ret |= mxc_set_clock(ref_clk, 400, MXC_DDR_CLK);
102 +       if (ret)
103 +               printf("CPU:   Switch DDR clock to 400MHz failed\n");
104 +}
105 +
106  int board_early_init_f(void)
107  {
108         setup_iomux_uart();
109 @@ -316,7 +383,11 @@ int print_cpuinfo(void)
110  #ifdef CONFIG_BOARD_LATE_INIT
111  int board_late_init(void)
112  {
113 +       setup_iomux_i2c();
114 +       if (!power_init())
115 +               clock_1GHz();
116         print_cpuinfo();
117 +
118         return 0;
119  }
120  #endif
121 diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
122 index 0778bde..8f43eec 100644
123 --- a/include/configs/mx53loco.h
124 +++ b/include/configs/mx53loco.h
125 @@ -41,6 +41,7 @@
126  #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
127  
128  #define CONFIG_BOARD_EARLY_INIT_F
129 +#define CONFIG_BOARD_LATE_INIT
130  #define CONFIG_MXC_GPIO
131  
132  #define CONFIG_MXC_UART
133 @@ -85,6 +86,19 @@
134  #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
135  #define CONFIG_MXC_USB_FLAGS   0
136  
137 +/* I2C Configs */
138 +#define CONFIG_HARD_I2C
139 +#define CONFIG_I2C_MXC
140 +#define CONFIG_SYS_I2C_MX53_PORT1
141 +#define CONFIG_SYS_I2C_SPEED           100000
142 +#define CONFIG_SYS_I2C_SLAVE           0xfe
143 +
144 +/* PMIC Controller */
145 +#define CONFIG_PMIC
146 +#define CONFIG_PMIC_I2C
147 +#define CONFIG_DIALOG_PMIC
148 +#define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR        0x48
149 +
150  /* allow to overwrite serial and ethaddr */
151  #define CONFIG_ENV_OVERWRITE
152  #define CONFIG_CONS_INDEX              1
153 -- 
154 1.7.10
155