1 From bb46787a684ee948eff96d5d9a7e6ff1632016ea Mon Sep 17 00:00:00 2001
2 From: Fabio Estevam <fabio.estevam@freescale.com>
3 Date: Mon, 7 May 2012 10:25:59 +0000
4 Subject: [PATCH 36/56] mx53loco: Add mc34708 support and set mx53 frequency
7 Add mc34708 support and set mx53 core frequency at its maximum value of 1GHz.
9 Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
10 Acked-by: Jason Liu <r64343@freescale.com>
11 Acked-by: Stefano Babic <sbabic@denx.de>
13 board/freescale/mx53loco/mx53loco.c | 48 ++++++++++++++++++++++++++---------
14 include/configs/mx53loco.h | 2 ++
15 include/fsl_pmic.h | 10 ++++++++
16 3 files changed, 48 insertions(+), 12 deletions(-)
18 diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
19 index 7ed5c4e..8f5ded9 100644
20 --- a/board/freescale/mx53loco/mx53loco.c
21 +++ b/board/freescale/mx53loco/mx53loco.c
25 #include <dialog_pmic.h>
26 +#include <fsl_pmic.h>
28 DECLARE_GLOBAL_DATA_PTR;
30 @@ -319,23 +320,46 @@ static void setup_iomux_i2c(void)
32 static int power_init(void)
34 - unsigned int val, ret;
41 + if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR)) {
45 - /* Set VDDA to 1.25V */
46 - val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
47 - ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val);
48 + /* Set VDDA to 1.25V */
49 + val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
50 + ret = pmic_reg_write(p, DA9053_BUCKCORE_REG, val);
52 - ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val);
53 - val |= DA9052_SUPPLY_VBCOREGO;
54 - ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val);
55 + ret |= pmic_reg_read(p, DA9053_SUPPLY_REG, &val);
56 + val |= DA9052_SUPPLY_VBCOREGO;
57 + ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, val);
59 - /* Set Vcc peripheral to 1.35V */
60 - ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
61 - ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
62 + /* Set Vcc peripheral to 1.30V */
63 + ret |= pmic_reg_write(p, DA9053_BUCKPRO_REG, 0x62);
64 + ret |= pmic_reg_write(p, DA9053_SUPPLY_REG, 0x62);
67 + if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
71 + /* Set VDDGP to 1.25V for 1GHz on SW1 */
72 + pmic_reg_read(p, REG_SW_0, &val);
73 + val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_250V_MC34708;
74 + ret = pmic_reg_write(p, REG_SW_0, val);
76 + /* Set VCC as 1.30V on SW2 */
77 + pmic_reg_read(p, REG_SW_1, &val);
78 + val = (val & ~SWx_VOLT_MASK_MC34708) | SWx_1_300V_MC34708;
79 + ret |= pmic_reg_write(p, REG_SW_1, val);
81 + /* Set global reset timer to 4s */
82 + pmic_reg_read(p, REG_POWER_CTL2, &val);
83 + val = (val & ~TIMER_MASK_MC34708) | TIMER_4S_MC34708;
84 + ret |= pmic_reg_write(p, REG_POWER_CTL2, val);
89 diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
90 index 8f43eec..87f6ed1 100644
91 --- a/include/configs/mx53loco.h
92 +++ b/include/configs/mx53loco.h
95 #define CONFIG_PMIC_I2C
96 #define CONFIG_DIALOG_PMIC
97 +#define CONFIG_PMIC_FSL
98 #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR 0x48
99 +#define CONFIG_SYS_FSL_PMIC_I2C_ADDR 0x8
101 /* allow to overwrite serial and ethaddr */
102 #define CONFIG_ENV_OVERWRITE
103 diff --git a/include/fsl_pmic.h b/include/fsl_pmic.h
104 index 742f2e1..3b7cd37 100644
105 --- a/include/fsl_pmic.h
106 +++ b/include/fsl_pmic.h
107 @@ -122,4 +122,14 @@ enum {
108 /* Interrupt status 1 */
109 #define RTCRSTI (1 << 7)
111 +/* MC34708 Definitions */
112 +#define SWx_VOLT_MASK_MC34708 0x3F
113 +#define SWx_1_250V_MC34708 0x30
114 +#define SWx_1_300V_MC34708 0x34
115 +#define TIMER_MASK_MC34708 0x300
116 +#define TIMER_4S_MC34708 0x100
117 +#define VUSBSEL_MC34708 (1 << 2)
118 +#define VUSBEN_MC34708 (1 << 3)
119 +#define SWBST_CTRL 31