SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * HW data initialization for OMAP4 |
| 4 | * |
| 5 | * (C) Copyright 2013 |
| 6 | * Texas Instruments, <www.ti.com> |
| 7 | * |
| 8 | * Sricharan R <r.sricharan@ti.com> |
| 9 | * |
| 10 | * See file CREDITS for list of people who contributed to this |
| 11 | * project. |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU General Public License as |
| 15 | * published by the Free Software Foundation; either version 2 of |
| 16 | * the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program; if not, write to the Free Software |
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 26 | * MA 02111-1307 USA |
| 27 | */ |
| 28 | #include <common.h> |
| 29 | #include <asm/arch/omap.h> |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 30 | #include <asm/arch/sys_proto.h> |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 31 | #include <asm/omap_common.h> |
Lokesh Vutla | 61c517f | 2013-05-30 02:54:32 +0000 | [diff] [blame] | 32 | #include <asm/arch/clock.h> |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 33 | #include <asm/omap_gpio.h> |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 34 | #include <asm/io.h> |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 35 | |
| 36 | struct prcm_regs const **prcm = |
| 37 | (struct prcm_regs const **) OMAP_SRAM_SCRATCH_PRCM_PTR; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 38 | struct dplls const **dplls_data = |
| 39 | (struct dplls const **) OMAP_SRAM_SCRATCH_DPLLS_PTR; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 40 | struct vcores_data const **omap_vcores = |
| 41 | (struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR; |
Lokesh Vutla | 834b6b0 | 2013-02-04 04:22:04 +0000 | [diff] [blame] | 42 | struct omap_sys_ctrl_regs const **ctrl = |
SRICHARAN R | 4b1b61c | 2013-04-24 00:41:22 +0000 | [diff] [blame] | 43 | (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 44 | |
| 45 | /* |
| 46 | * The M & N values in the following tables are created using the |
| 47 | * following tool: |
| 48 | * tools/omap/clocks_get_m_n.c |
| 49 | * Please use this tool for creating the table for any new frequency. |
| 50 | */ |
| 51 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 52 | /* |
| 53 | * dpll locked at 1400 MHz MPU clk at 700 MHz(OPP100) - DCC OFF |
| 54 | * OMAP4460 OPP_NOM frequency |
| 55 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 56 | static const struct dpll_params mpu_dpll_params_1400mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 57 | {175, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 58 | {700, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 59 | {125, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 60 | {401, 10, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 61 | {350, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 62 | {700, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 63 | {638, 34, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 66 | /* |
| 67 | * dpll locked at 1600 MHz - MPU clk at 800 MHz(OPP Turbo 4430) |
| 68 | * OMAP4430 OPP_TURBO frequency |
| 69 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 70 | static const struct dpll_params mpu_dpll_params_1600mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 71 | {200, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 72 | {800, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 73 | {619, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 74 | {125, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 75 | {400, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 76 | {800, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 77 | {125, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 80 | /* |
| 81 | * dpll locked at 1200 MHz - MPU clk at 600 MHz |
| 82 | * OMAP4430 OPP_NOM frequency |
| 83 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 84 | static const struct dpll_params mpu_dpll_params_1200mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 85 | {50, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 86 | {600, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 87 | {250, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 88 | {125, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 89 | {300, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 90 | {200, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 91 | {125, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 92 | }; |
| 93 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 94 | /* OMAP4460 OPP_NOM frequency */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 95 | static const struct dpll_params core_dpll_params_1600mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 96 | {200, 2, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 97 | {800, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 98 | {619, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 99 | {125, 2, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 100 | {400, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 101 | {800, 26, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 102 | {125, 5, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 103 | }; |
| 104 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 105 | /* OMAP4430 ES1 OPP_NOM frequency */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 106 | static const struct dpll_params core_dpll_params_es1_1524mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 107 | {127, 1, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 108 | {762, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 109 | {635, 13, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 110 | {635, 15, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 111 | {381, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 112 | {254, 8, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 113 | {496, 24, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 114 | }; |
| 115 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 116 | /* OMAP4430 ES2.X OPP_NOM frequency */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 117 | static const struct dpll_params |
| 118 | core_dpll_params_es2_1600mhz_ddr200mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 119 | {200, 2, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 120 | {800, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 121 | {619, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 122 | {125, 2, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 123 | {400, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 124 | {800, 26, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 125 | {125, 5, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | static const struct dpll_params per_dpll_params_1536mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 129 | {64, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 130 | {768, 12, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 131 | {320, 6, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 132 | {40, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 133 | {384, 12, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 134 | {256, 8, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 135 | {20, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | static const struct dpll_params iva_dpll_params_1862mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 139 | {931, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 140 | {931, 12, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 141 | {665, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 142 | {727, 14, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 143 | {931, 25, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 144 | {931, 26, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 145 | {291, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | /* ABE M & N values with sys_clk as source */ |
| 149 | static const struct dpll_params |
| 150 | abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 151 | {49, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 152 | {68, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 153 | {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 154 | {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 155 | {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 156 | {29, 7, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 157 | {64, 24, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | /* ABE M & N values with 32K clock as source */ |
| 161 | static const struct dpll_params abe_dpll_params_32k_196608khz = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 162 | 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1 |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 166 | {80, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 167 | {960, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 168 | {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 169 | {50, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 170 | {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 171 | {320, 8, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 172 | {25, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1} /* 38.4 MHz */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | struct dplls omap4430_dplls_es1 = { |
| 176 | .mpu = mpu_dpll_params_1200mhz, |
| 177 | .core = core_dpll_params_es1_1524mhz, |
| 178 | .per = per_dpll_params_1536mhz, |
| 179 | .iva = iva_dpll_params_1862mhz, |
| 180 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 181 | .abe = abe_dpll_params_sysclk_196608khz, |
| 182 | #else |
| 183 | .abe = &abe_dpll_params_32k_196608khz, |
| 184 | #endif |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 185 | .usb = usb_dpll_params_1920mhz, |
| 186 | .ddr = NULL |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 187 | }; |
| 188 | |
| 189 | struct dplls omap4430_dplls = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 190 | .mpu = mpu_dpll_params_1200mhz, |
| 191 | .core = core_dpll_params_1600mhz, |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 192 | .per = per_dpll_params_1536mhz, |
| 193 | .iva = iva_dpll_params_1862mhz, |
| 194 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 195 | .abe = abe_dpll_params_sysclk_196608khz, |
| 196 | #else |
| 197 | .abe = &abe_dpll_params_32k_196608khz, |
| 198 | #endif |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 199 | .usb = usb_dpll_params_1920mhz, |
| 200 | .ddr = NULL |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 201 | }; |
| 202 | |
| 203 | struct dplls omap4460_dplls = { |
| 204 | .mpu = mpu_dpll_params_1400mhz, |
| 205 | .core = core_dpll_params_1600mhz, |
| 206 | .per = per_dpll_params_1536mhz, |
| 207 | .iva = iva_dpll_params_1862mhz, |
| 208 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 209 | .abe = abe_dpll_params_sysclk_196608khz, |
| 210 | #else |
| 211 | .abe = &abe_dpll_params_32k_196608khz, |
| 212 | #endif |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 213 | .usb = usb_dpll_params_1920mhz, |
| 214 | .ddr = NULL |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 215 | }; |
| 216 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 217 | struct pmic_data twl6030_4430es1 = { |
| 218 | .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 219 | .step = 12660, /* 12.66 mV represented in uV */ |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 220 | /* The code starts at 1 not 0 */ |
| 221 | .start_code = 1, |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame^] | 222 | .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR, |
| 223 | .pmic_bus_init = sri2c_init, |
| 224 | .pmic_write = omap_vc_bypass_send_value, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 225 | }; |
| 226 | |
| 227 | struct pmic_data twl6030 = { |
| 228 | .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 229 | .step = 12660, /* 12.66 mV represented in uV */ |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 230 | /* The code starts at 1 not 0 */ |
| 231 | .start_code = 1, |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame^] | 232 | .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR, |
| 233 | .pmic_bus_init = sri2c_init, |
| 234 | .pmic_write = omap_vc_bypass_send_value, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 235 | }; |
| 236 | |
| 237 | struct pmic_data tps62361 = { |
| 238 | .base_offset = TPS62361_BASE_VOLT_MV, |
| 239 | .step = 10000, /* 10 mV represented in uV */ |
| 240 | .start_code = 0, |
| 241 | .gpio = TPS62361_VSEL0_GPIO, |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame^] | 242 | .gpio_en = 1, |
| 243 | .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR, |
| 244 | .pmic_bus_init = sri2c_init, |
| 245 | .pmic_write = omap_vc_bypass_send_value, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | struct vcores_data omap4430_volts_es1 = { |
| 249 | .mpu.value = 1325, |
| 250 | .mpu.addr = SMPS_REG_ADDR_VCORE1, |
| 251 | .mpu.pmic = &twl6030_4430es1, |
| 252 | |
| 253 | .core.value = 1200, |
| 254 | .core.addr = SMPS_REG_ADDR_VCORE3, |
| 255 | .core.pmic = &twl6030_4430es1, |
| 256 | |
| 257 | .mm.value = 1200, |
| 258 | .mm.addr = SMPS_REG_ADDR_VCORE2, |
| 259 | .mm.pmic = &twl6030_4430es1, |
| 260 | }; |
| 261 | |
| 262 | struct vcores_data omap4430_volts = { |
| 263 | .mpu.value = 1325, |
| 264 | .mpu.addr = SMPS_REG_ADDR_VCORE1, |
| 265 | .mpu.pmic = &twl6030, |
| 266 | |
| 267 | .core.value = 1200, |
| 268 | .core.addr = SMPS_REG_ADDR_VCORE3, |
| 269 | .core.pmic = &twl6030, |
| 270 | |
| 271 | .mm.value = 1200, |
| 272 | .mm.addr = SMPS_REG_ADDR_VCORE2, |
| 273 | .mm.pmic = &twl6030, |
| 274 | }; |
| 275 | |
| 276 | struct vcores_data omap4460_volts = { |
| 277 | .mpu.value = 1203, |
| 278 | .mpu.addr = TPS62361_REG_ADDR_SET1, |
| 279 | .mpu.pmic = &tps62361, |
| 280 | |
| 281 | .core.value = 1200, |
| 282 | .core.addr = SMPS_REG_ADDR_VCORE1, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 283 | .core.pmic = &twl6030, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 284 | |
| 285 | .mm.value = 1200, |
| 286 | .mm.addr = SMPS_REG_ADDR_VCORE2, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 287 | .mm.pmic = &twl6030, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 288 | }; |
| 289 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 290 | /* |
| 291 | * Enable essential clock domains, modules and |
| 292 | * do some additional special settings needed |
| 293 | */ |
| 294 | void enable_basic_clocks(void) |
| 295 | { |
| 296 | u32 const clk_domains_essential[] = { |
| 297 | (*prcm)->cm_l4per_clkstctrl, |
| 298 | (*prcm)->cm_l3init_clkstctrl, |
| 299 | (*prcm)->cm_memif_clkstctrl, |
| 300 | (*prcm)->cm_l4cfg_clkstctrl, |
| 301 | 0 |
| 302 | }; |
| 303 | |
| 304 | u32 const clk_modules_hw_auto_essential[] = { |
Lokesh Vutla | 15c2c70 | 2013-02-17 23:33:37 +0000 | [diff] [blame] | 305 | (*prcm)->cm_l3_gpmc_clkctrl, |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 306 | (*prcm)->cm_memif_emif_1_clkctrl, |
| 307 | (*prcm)->cm_memif_emif_2_clkctrl, |
| 308 | (*prcm)->cm_l4cfg_l4_cfg_clkctrl, |
| 309 | (*prcm)->cm_wkup_gpio1_clkctrl, |
| 310 | (*prcm)->cm_l4per_gpio2_clkctrl, |
| 311 | (*prcm)->cm_l4per_gpio3_clkctrl, |
| 312 | (*prcm)->cm_l4per_gpio4_clkctrl, |
| 313 | (*prcm)->cm_l4per_gpio5_clkctrl, |
| 314 | (*prcm)->cm_l4per_gpio6_clkctrl, |
| 315 | 0 |
| 316 | }; |
| 317 | |
| 318 | u32 const clk_modules_explicit_en_essential[] = { |
| 319 | (*prcm)->cm_wkup_gptimer1_clkctrl, |
| 320 | (*prcm)->cm_l3init_hsmmc1_clkctrl, |
| 321 | (*prcm)->cm_l3init_hsmmc2_clkctrl, |
| 322 | (*prcm)->cm_l4per_gptimer2_clkctrl, |
| 323 | (*prcm)->cm_wkup_wdtimer2_clkctrl, |
| 324 | (*prcm)->cm_l4per_uart3_clkctrl, |
| 325 | 0 |
| 326 | }; |
| 327 | |
| 328 | /* Enable optional additional functional clock for GPIO4 */ |
| 329 | setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl, |
| 330 | GPIO4_CLKCTRL_OPTFCLKEN_MASK); |
| 331 | |
| 332 | /* Enable 96 MHz clock for MMC1 & MMC2 */ |
| 333 | setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl, |
| 334 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 335 | setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl, |
| 336 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 337 | |
| 338 | /* Select 32KHz clock as the source of GPTIMER1 */ |
| 339 | setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl, |
| 340 | GPTIMER1_CLKCTRL_CLKSEL_MASK); |
| 341 | |
| 342 | /* Enable optional 48M functional clock for USB PHY */ |
| 343 | setbits_le32((*prcm)->cm_l3init_usbphy_clkctrl, |
| 344 | USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK); |
| 345 | |
| 346 | do_enable_clocks(clk_domains_essential, |
| 347 | clk_modules_hw_auto_essential, |
| 348 | clk_modules_explicit_en_essential, |
| 349 | 1); |
| 350 | } |
| 351 | |
| 352 | void enable_basic_uboot_clocks(void) |
| 353 | { |
| 354 | u32 const clk_domains_essential[] = { |
| 355 | 0 |
| 356 | }; |
| 357 | |
| 358 | u32 const clk_modules_hw_auto_essential[] = { |
| 359 | (*prcm)->cm_l3init_hsusbotg_clkctrl, |
| 360 | (*prcm)->cm_l3init_usbphy_clkctrl, |
| 361 | (*prcm)->cm_l3init_usbphy_clkctrl, |
| 362 | (*prcm)->cm_clksel_usb_60mhz, |
| 363 | (*prcm)->cm_l3init_hsusbtll_clkctrl, |
| 364 | 0 |
| 365 | }; |
| 366 | |
| 367 | u32 const clk_modules_explicit_en_essential[] = { |
| 368 | (*prcm)->cm_l4per_mcspi1_clkctrl, |
| 369 | (*prcm)->cm_l4per_i2c1_clkctrl, |
| 370 | (*prcm)->cm_l4per_i2c2_clkctrl, |
| 371 | (*prcm)->cm_l4per_i2c3_clkctrl, |
| 372 | (*prcm)->cm_l4per_i2c4_clkctrl, |
| 373 | (*prcm)->cm_l3init_hsusbhost_clkctrl, |
| 374 | 0 |
| 375 | }; |
| 376 | |
| 377 | do_enable_clocks(clk_domains_essential, |
| 378 | clk_modules_hw_auto_essential, |
| 379 | clk_modules_explicit_en_essential, |
| 380 | 1); |
| 381 | } |
| 382 | |
| 383 | /* |
| 384 | * Enable non-essential clock domains, modules and |
| 385 | * do some additional special settings needed |
| 386 | */ |
| 387 | void enable_non_essential_clocks(void) |
| 388 | { |
| 389 | u32 const clk_domains_non_essential[] = { |
| 390 | (*prcm)->cm_mpu_m3_clkstctrl, |
| 391 | (*prcm)->cm_ivahd_clkstctrl, |
| 392 | (*prcm)->cm_dsp_clkstctrl, |
| 393 | (*prcm)->cm_dss_clkstctrl, |
| 394 | (*prcm)->cm_sgx_clkstctrl, |
| 395 | (*prcm)->cm1_abe_clkstctrl, |
| 396 | (*prcm)->cm_c2c_clkstctrl, |
| 397 | (*prcm)->cm_cam_clkstctrl, |
| 398 | (*prcm)->cm_dss_clkstctrl, |
| 399 | (*prcm)->cm_sdma_clkstctrl, |
| 400 | 0 |
| 401 | }; |
| 402 | |
| 403 | u32 const clk_modules_hw_auto_non_essential[] = { |
| 404 | (*prcm)->cm_l3instr_l3_3_clkctrl, |
| 405 | (*prcm)->cm_l3instr_l3_instr_clkctrl, |
| 406 | (*prcm)->cm_l3instr_intrconn_wp1_clkctrl, |
| 407 | (*prcm)->cm_l3init_hsi_clkctrl, |
| 408 | 0 |
| 409 | }; |
| 410 | |
| 411 | u32 const clk_modules_explicit_en_non_essential[] = { |
| 412 | (*prcm)->cm1_abe_aess_clkctrl, |
| 413 | (*prcm)->cm1_abe_pdm_clkctrl, |
| 414 | (*prcm)->cm1_abe_dmic_clkctrl, |
| 415 | (*prcm)->cm1_abe_mcasp_clkctrl, |
| 416 | (*prcm)->cm1_abe_mcbsp1_clkctrl, |
| 417 | (*prcm)->cm1_abe_mcbsp2_clkctrl, |
| 418 | (*prcm)->cm1_abe_mcbsp3_clkctrl, |
| 419 | (*prcm)->cm1_abe_slimbus_clkctrl, |
| 420 | (*prcm)->cm1_abe_timer5_clkctrl, |
| 421 | (*prcm)->cm1_abe_timer6_clkctrl, |
| 422 | (*prcm)->cm1_abe_timer7_clkctrl, |
| 423 | (*prcm)->cm1_abe_timer8_clkctrl, |
| 424 | (*prcm)->cm1_abe_wdt3_clkctrl, |
| 425 | (*prcm)->cm_l4per_gptimer9_clkctrl, |
| 426 | (*prcm)->cm_l4per_gptimer10_clkctrl, |
| 427 | (*prcm)->cm_l4per_gptimer11_clkctrl, |
| 428 | (*prcm)->cm_l4per_gptimer3_clkctrl, |
| 429 | (*prcm)->cm_l4per_gptimer4_clkctrl, |
| 430 | (*prcm)->cm_l4per_hdq1w_clkctrl, |
| 431 | (*prcm)->cm_l4per_mcbsp4_clkctrl, |
| 432 | (*prcm)->cm_l4per_mcspi2_clkctrl, |
| 433 | (*prcm)->cm_l4per_mcspi3_clkctrl, |
| 434 | (*prcm)->cm_l4per_mcspi4_clkctrl, |
| 435 | (*prcm)->cm_l4per_mmcsd3_clkctrl, |
| 436 | (*prcm)->cm_l4per_mmcsd4_clkctrl, |
| 437 | (*prcm)->cm_l4per_mmcsd5_clkctrl, |
| 438 | (*prcm)->cm_l4per_uart1_clkctrl, |
| 439 | (*prcm)->cm_l4per_uart2_clkctrl, |
| 440 | (*prcm)->cm_l4per_uart4_clkctrl, |
| 441 | (*prcm)->cm_wkup_keyboard_clkctrl, |
| 442 | (*prcm)->cm_wkup_wdtimer2_clkctrl, |
| 443 | (*prcm)->cm_cam_iss_clkctrl, |
| 444 | (*prcm)->cm_cam_fdif_clkctrl, |
| 445 | (*prcm)->cm_dss_dss_clkctrl, |
| 446 | (*prcm)->cm_sgx_sgx_clkctrl, |
| 447 | 0 |
| 448 | }; |
| 449 | |
| 450 | /* Enable optional functional clock for ISS */ |
| 451 | setbits_le32((*prcm)->cm_cam_iss_clkctrl, ISS_CLKCTRL_OPTFCLKEN_MASK); |
| 452 | |
| 453 | /* Enable all optional functional clocks of DSS */ |
| 454 | setbits_le32((*prcm)->cm_dss_dss_clkctrl, DSS_CLKCTRL_OPTFCLKEN_MASK); |
| 455 | |
| 456 | do_enable_clocks(clk_domains_non_essential, |
| 457 | clk_modules_hw_auto_non_essential, |
| 458 | clk_modules_explicit_en_non_essential, |
| 459 | 0); |
| 460 | |
| 461 | /* Put camera module in no sleep mode */ |
| 462 | clrsetbits_le32((*prcm)->cm_cam_clkstctrl, |
| 463 | MODULE_CLKCTRL_MODULEMODE_MASK, |
| 464 | CD_CLKCTRL_CLKTRCTRL_NO_SLEEP << |
| 465 | MODULE_CLKCTRL_MODULEMODE_SHIFT); |
| 466 | } |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 467 | |
| 468 | void hw_data_init(void) |
| 469 | { |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 470 | u32 omap_rev = omap_revision(); |
| 471 | |
| 472 | (*prcm) = &omap4_prcm; |
| 473 | |
| 474 | switch (omap_rev) { |
| 475 | |
| 476 | case OMAP4430_ES1_0: |
| 477 | *dplls_data = &omap4430_dplls_es1; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 478 | *omap_vcores = &omap4430_volts_es1; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 479 | break; |
| 480 | |
| 481 | case OMAP4430_ES2_0: |
| 482 | case OMAP4430_ES2_1: |
| 483 | case OMAP4430_ES2_2: |
| 484 | case OMAP4430_ES2_3: |
| 485 | *dplls_data = &omap4430_dplls; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 486 | *omap_vcores = &omap4430_volts; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 487 | break; |
| 488 | |
| 489 | case OMAP4460_ES1_0: |
| 490 | case OMAP4460_ES1_1: |
| 491 | *dplls_data = &omap4460_dplls; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 492 | *omap_vcores = &omap4460_volts; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 493 | break; |
| 494 | |
| 495 | default: |
| 496 | printf("\n INVALID OMAP REVISION "); |
| 497 | } |
| 498 | |
Lokesh Vutla | 834b6b0 | 2013-02-04 04:22:04 +0000 | [diff] [blame] | 499 | *ctrl = &omap4_ctrl; |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 500 | } |