]> code.ossystems Code Review - meta-freescale.git/blob
d6b353bd3f3ec065c31f59ef0d41a7282ea8f17a
[meta-freescale.git] /
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
5  at 1GHz
6
7 Add mc34708 support and set mx53 core frequency at its maximum value of 1GHz.
8
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>
12 ---
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(-)
17
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
22 @@ -38,6 +38,7 @@
23  #include <asm/gpio.h>
24  #include <pmic.h>
25  #include <dialog_pmic.h>
26 +#include <fsl_pmic.h>
27  
28  DECLARE_GLOBAL_DATA_PTR;
29  
30 @@ -319,23 +320,46 @@ static void setup_iomux_i2c(void)
31  
32  static int power_init(void)
33  {
34 -       unsigned int val, ret;
35 +       unsigned int val;
36 +       int ret = -1;
37         struct pmic *p;
38  
39 -       pmic_dialog_init();
40 -       p = get_pmic();
41 +       if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR)) {
42 +               pmic_dialog_init();
43 +               p = get_pmic();
44  
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);
51  
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);
58  
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);
65 +       }
66 +
67 +       if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
68 +               pmic_init();
69 +               p = get_pmic();
70 +
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);
75 +
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);
80 +
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);
85 +       }
86  
87         return ret;
88  }
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
93 @@ -97,7 +97,9 @@
94  #define CONFIG_PMIC
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
100  
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)
110  
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
120 +
121  #endif
122 -- 
123 1.7.10
124