Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * HW data initialization for OMAP4 |
| 5 | * |
| 6 | * (C) Copyright 2013 |
| 7 | * Texas Instruments, <www.ti.com> |
| 8 | * |
| 9 | * Sricharan R <r.sricharan@ti.com> |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 10 | */ |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 11 | #include <asm/arch/omap.h> |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 12 | #include <asm/arch/sys_proto.h> |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 13 | #include <asm/omap_common.h> |
Lokesh Vutla | 61c517f | 2013-05-30 02:54:32 +0000 | [diff] [blame] | 14 | #include <asm/arch/clock.h> |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 15 | #include <asm/omap_gpio.h> |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 16 | #include <asm/io.h> |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 17 | |
| 18 | struct prcm_regs const **prcm = |
| 19 | (struct prcm_regs const **) OMAP_SRAM_SCRATCH_PRCM_PTR; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 20 | struct dplls const **dplls_data = |
| 21 | (struct dplls const **) OMAP_SRAM_SCRATCH_DPLLS_PTR; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 22 | struct vcores_data const **omap_vcores = |
| 23 | (struct vcores_data const **) OMAP_SRAM_SCRATCH_VCORES_PTR; |
Lokesh Vutla | 834b6b0 | 2013-02-04 04:22:04 +0000 | [diff] [blame] | 24 | struct omap_sys_ctrl_regs const **ctrl = |
SRICHARAN R | 4b1b61c | 2013-04-24 00:41:22 +0000 | [diff] [blame] | 25 | (struct omap_sys_ctrl_regs const **)OMAP_SRAM_SCRATCH_SYS_CTRL; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * The M & N values in the following tables are created using the |
| 29 | * following tool: |
| 30 | * tools/omap/clocks_get_m_n.c |
| 31 | * Please use this tool for creating the table for any new frequency. |
| 32 | */ |
| 33 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 34 | /* |
| 35 | * dpll locked at 1400 MHz MPU clk at 700 MHz(OPP100) - DCC OFF |
| 36 | * OMAP4460 OPP_NOM frequency |
| 37 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 38 | static const struct dpll_params mpu_dpll_params_1400mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 39 | {175, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 40 | {700, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 41 | {125, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 42 | {401, 10, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 43 | {350, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 44 | {700, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 45 | {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] | 46 | }; |
| 47 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 48 | /* |
| 49 | * dpll locked at 1600 MHz - MPU clk at 800 MHz(OPP Turbo 4430) |
| 50 | * OMAP4430 OPP_TURBO frequency |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 51 | * OMAP4470 OPP_NOM frequency |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 52 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 53 | static const struct dpll_params mpu_dpll_params_1600mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 54 | {200, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 55 | {800, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 56 | {619, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 57 | {125, 2, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 58 | {400, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 59 | {800, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 60 | {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] | 61 | }; |
| 62 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 63 | /* |
| 64 | * dpll locked at 1200 MHz - MPU clk at 600 MHz |
| 65 | * OMAP4430 OPP_NOM frequency |
| 66 | */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 67 | static const struct dpll_params mpu_dpll_params_1200mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 68 | {50, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 69 | {600, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 70 | {250, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 71 | {125, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 72 | {300, 12, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 73 | {200, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 74 | {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] | 75 | }; |
| 76 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 77 | /* OMAP4460 OPP_NOM frequency */ |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 78 | /* OMAP4470 OPP_NOM (Low Power) frequency */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 79 | static const struct dpll_params core_dpll_params_1600mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 80 | {200, 2, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 81 | {800, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 82 | {619, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 83 | {125, 2, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 84 | {400, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 85 | {800, 26, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 86 | {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] | 87 | }; |
| 88 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 89 | /* OMAP4430 ES1 OPP_NOM frequency */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 90 | 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] | 91 | {127, 1, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 92 | {762, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 93 | {635, 13, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 94 | {635, 15, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 95 | {381, 12, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 96 | {254, 8, 1, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 97 | {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] | 98 | }; |
| 99 | |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 100 | /* OMAP4430 ES2.X OPP_NOM frequency */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 101 | static const struct dpll_params |
| 102 | core_dpll_params_es2_1600mhz_ddr200mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 103 | {200, 2, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 104 | {800, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 105 | {619, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 106 | {125, 2, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 107 | {400, 12, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 108 | {800, 26, 2, 5, 8, 4, 6, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 109 | {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] | 110 | }; |
| 111 | |
| 112 | static const struct dpll_params per_dpll_params_1536mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 113 | {64, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 12 MHz */ |
| 114 | {768, 12, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 13 MHz */ |
| 115 | {320, 6, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 116 | {40, 0, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 117 | {384, 12, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 26 MHz */ |
| 118 | {256, 8, 8, 6, 12, 9, 4, 5, -1, -1, -1, -1}, /* 27 MHz */ |
| 119 | {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] | 120 | }; |
| 121 | |
| 122 | static const struct dpll_params iva_dpll_params_1862mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 123 | {931, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 124 | {931, 12, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 125 | {665, 11, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 126 | {727, 14, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 127 | {931, 25, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 128 | {931, 26, -1, -1, 4, 7, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 129 | {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] | 130 | }; |
| 131 | |
| 132 | /* ABE M & N values with sys_clk as source */ |
Lokesh Vutla | 221db4c | 2017-01-17 08:52:58 +0530 | [diff] [blame] | 133 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 134 | static const struct dpll_params |
| 135 | abe_dpll_params_sysclk_196608khz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 136 | {49, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 137 | {68, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 138 | {35, 5, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 139 | {46, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 140 | {34, 8, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 141 | {29, 7, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 142 | {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] | 143 | }; |
Lokesh Vutla | 221db4c | 2017-01-17 08:52:58 +0530 | [diff] [blame] | 144 | #else |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 145 | /* ABE M & N values with 32K clock as source */ |
| 146 | static const struct dpll_params abe_dpll_params_32k_196608khz = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 147 | 750, 0, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1 |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 148 | }; |
Lokesh Vutla | 221db4c | 2017-01-17 08:52:58 +0530 | [diff] [blame] | 149 | #endif |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 150 | |
| 151 | static const struct dpll_params usb_dpll_params_1920mhz[NUM_SYS_CLKS] = { |
SRICHARAN R | a04ed14 | 2013-02-12 01:33:43 +0000 | [diff] [blame] | 152 | {80, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 12 MHz */ |
| 153 | {960, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 13 MHz */ |
| 154 | {400, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 16.8 MHz */ |
| 155 | {50, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 19.2 MHz */ |
| 156 | {480, 12, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 26 MHz */ |
| 157 | {320, 8, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* 27 MHz */ |
| 158 | {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] | 159 | }; |
| 160 | |
| 161 | struct dplls omap4430_dplls_es1 = { |
| 162 | .mpu = mpu_dpll_params_1200mhz, |
| 163 | .core = core_dpll_params_es1_1524mhz, |
| 164 | .per = per_dpll_params_1536mhz, |
| 165 | .iva = iva_dpll_params_1862mhz, |
| 166 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 167 | .abe = abe_dpll_params_sysclk_196608khz, |
| 168 | #else |
| 169 | .abe = &abe_dpll_params_32k_196608khz, |
| 170 | #endif |
Lokesh Vutla | 5e70e29 | 2013-02-12 21:29:05 +0000 | [diff] [blame] | 171 | .usb = usb_dpll_params_1920mhz, |
| 172 | .ddr = NULL |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 173 | }; |
| 174 | |
Janne Grunau | d2b0a89 | 2014-02-16 21:57:18 +0100 | [diff] [blame] | 175 | struct dplls omap4430_dplls_es20 = { |
| 176 | .mpu = mpu_dpll_params_1200mhz, |
| 177 | .core = core_dpll_params_es2_1600mhz_ddr200mhz, |
| 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 |
| 185 | .usb = usb_dpll_params_1920mhz, |
| 186 | .ddr = NULL |
| 187 | }; |
| 188 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 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 | |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 217 | struct dplls omap4470_dplls = { |
| 218 | .mpu = mpu_dpll_params_1600mhz, |
| 219 | .core = core_dpll_params_1600mhz, |
| 220 | .per = per_dpll_params_1536mhz, |
| 221 | .iva = iva_dpll_params_1862mhz, |
| 222 | #ifdef CONFIG_SYS_OMAP_ABE_SYSCK |
| 223 | .abe = abe_dpll_params_sysclk_196608khz, |
| 224 | #else |
| 225 | .abe = &abe_dpll_params_32k_196608khz, |
| 226 | #endif |
| 227 | .usb = usb_dpll_params_1920mhz, |
| 228 | .ddr = NULL |
| 229 | }; |
| 230 | |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 231 | struct pmic_data twl6030_4430es1 = { |
| 232 | .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 233 | .step = 12660, /* 12.66 mV represented in uV */ |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 234 | /* The code starts at 1 not 0 */ |
| 235 | .start_code = 1, |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame] | 236 | .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR, |
| 237 | .pmic_bus_init = sri2c_init, |
| 238 | .pmic_write = omap_vc_bypass_send_value, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 239 | }; |
| 240 | |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 241 | /* twl6030 struct is used for TWL6030 and TWL6032 PMIC */ |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 242 | struct pmic_data twl6030 = { |
| 243 | .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 244 | .step = 12660, /* 12.66 mV represented in uV */ |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 245 | /* The code starts at 1 not 0 */ |
| 246 | .start_code = 1, |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame] | 247 | .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR, |
| 248 | .pmic_bus_init = sri2c_init, |
| 249 | .pmic_write = omap_vc_bypass_send_value, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 250 | }; |
| 251 | |
| 252 | struct pmic_data tps62361 = { |
| 253 | .base_offset = TPS62361_BASE_VOLT_MV, |
| 254 | .step = 10000, /* 10 mV represented in uV */ |
| 255 | .start_code = 0, |
| 256 | .gpio = TPS62361_VSEL0_GPIO, |
Lokesh Vutla | ae49f6d | 2013-05-30 02:54:33 +0000 | [diff] [blame] | 257 | .gpio_en = 1, |
| 258 | .i2c_slave_addr = SMPS_I2C_SLAVE_ADDR, |
| 259 | .pmic_bus_init = sri2c_init, |
| 260 | .pmic_write = omap_vc_bypass_send_value, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 261 | }; |
| 262 | |
| 263 | struct vcores_data omap4430_volts_es1 = { |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 264 | .mpu.value[OPP_NOM] = 1325, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 265 | .mpu.addr = SMPS_REG_ADDR_VCORE1, |
| 266 | .mpu.pmic = &twl6030_4430es1, |
| 267 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 268 | .core.value[OPP_NOM] = 1200, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 269 | .core.addr = SMPS_REG_ADDR_VCORE3, |
| 270 | .core.pmic = &twl6030_4430es1, |
| 271 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 272 | .mm.value[OPP_NOM] = 1200, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 273 | .mm.addr = SMPS_REG_ADDR_VCORE2, |
| 274 | .mm.pmic = &twl6030_4430es1, |
| 275 | }; |
| 276 | |
| 277 | struct vcores_data omap4430_volts = { |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 278 | .mpu.value[OPP_NOM] = 1325, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 279 | .mpu.addr = SMPS_REG_ADDR_VCORE1, |
| 280 | .mpu.pmic = &twl6030, |
| 281 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 282 | .core.value[OPP_NOM] = 1200, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 283 | .core.addr = SMPS_REG_ADDR_VCORE3, |
| 284 | .core.pmic = &twl6030, |
| 285 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 286 | .mm.value[OPP_NOM] = 1200, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 287 | .mm.addr = SMPS_REG_ADDR_VCORE2, |
| 288 | .mm.pmic = &twl6030, |
| 289 | }; |
| 290 | |
| 291 | struct vcores_data omap4460_volts = { |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 292 | .mpu.value[OPP_NOM] = 1203, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 293 | .mpu.addr = TPS62361_REG_ADDR_SET1, |
| 294 | .mpu.pmic = &tps62361, |
| 295 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 296 | .core.value[OPP_NOM] = 1200, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 297 | .core.addr = SMPS_REG_ADDR_VCORE1, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 298 | .core.pmic = &twl6030, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 299 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 300 | .mm.value[OPP_NOM] = 1200, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 301 | .mm.addr = SMPS_REG_ADDR_VCORE2, |
Lubomir Popov | c8a3e76 | 2013-04-08 22:05:33 +0000 | [diff] [blame] | 302 | .mm.pmic = &twl6030, |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 303 | }; |
| 304 | |
Lubomir Popov | 4ec12e9 | 2013-11-20 15:32:17 +0200 | [diff] [blame] | 305 | /* |
| 306 | * Take closest integer part of the mV value corresponding to a TWL6032 SMPS |
| 307 | * voltage selection code. Aligned with OMAP4470 ES1.0 OCA V.0.7. |
| 308 | */ |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 309 | struct vcores_data omap4470_volts = { |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 310 | .mpu.value[OPP_NOM] = 1202, |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 311 | .mpu.addr = SMPS_REG_ADDR_SMPS1, |
| 312 | .mpu.pmic = &twl6030, |
| 313 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 314 | .core.value[OPP_NOM] = 1126, |
Lubomir Popov | 4ec12e9 | 2013-11-20 15:32:17 +0200 | [diff] [blame] | 315 | .core.addr = SMPS_REG_ADDR_SMPS2, |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 316 | .core.pmic = &twl6030, |
| 317 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 318 | .mm.value[OPP_NOM] = 1139, |
Lubomir Popov | 4ec12e9 | 2013-11-20 15:32:17 +0200 | [diff] [blame] | 319 | .mm.addr = SMPS_REG_ADDR_SMPS5, |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 320 | .mm.pmic = &twl6030, |
| 321 | }; |
| 322 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 323 | /* |
| 324 | * Enable essential clock domains, modules and |
| 325 | * do some additional special settings needed |
| 326 | */ |
| 327 | void enable_basic_clocks(void) |
| 328 | { |
| 329 | u32 const clk_domains_essential[] = { |
| 330 | (*prcm)->cm_l4per_clkstctrl, |
| 331 | (*prcm)->cm_l3init_clkstctrl, |
| 332 | (*prcm)->cm_memif_clkstctrl, |
| 333 | (*prcm)->cm_l4cfg_clkstctrl, |
| 334 | 0 |
| 335 | }; |
| 336 | |
| 337 | u32 const clk_modules_hw_auto_essential[] = { |
Lokesh Vutla | 15c2c70 | 2013-02-17 23:33:37 +0000 | [diff] [blame] | 338 | (*prcm)->cm_l3_gpmc_clkctrl, |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 339 | (*prcm)->cm_memif_emif_1_clkctrl, |
| 340 | (*prcm)->cm_memif_emif_2_clkctrl, |
| 341 | (*prcm)->cm_l4cfg_l4_cfg_clkctrl, |
| 342 | (*prcm)->cm_wkup_gpio1_clkctrl, |
| 343 | (*prcm)->cm_l4per_gpio2_clkctrl, |
| 344 | (*prcm)->cm_l4per_gpio3_clkctrl, |
| 345 | (*prcm)->cm_l4per_gpio4_clkctrl, |
| 346 | (*prcm)->cm_l4per_gpio5_clkctrl, |
| 347 | (*prcm)->cm_l4per_gpio6_clkctrl, |
| 348 | 0 |
| 349 | }; |
| 350 | |
| 351 | u32 const clk_modules_explicit_en_essential[] = { |
| 352 | (*prcm)->cm_wkup_gptimer1_clkctrl, |
| 353 | (*prcm)->cm_l3init_hsmmc1_clkctrl, |
| 354 | (*prcm)->cm_l3init_hsmmc2_clkctrl, |
| 355 | (*prcm)->cm_l4per_gptimer2_clkctrl, |
| 356 | (*prcm)->cm_wkup_wdtimer2_clkctrl, |
| 357 | (*prcm)->cm_l4per_uart3_clkctrl, |
Paul Kocialkowski | 4313fd5 | 2016-02-27 19:18:59 +0100 | [diff] [blame] | 358 | (*prcm)->cm_l4per_i2c1_clkctrl, |
| 359 | (*prcm)->cm_l4per_i2c2_clkctrl, |
| 360 | (*prcm)->cm_l4per_i2c3_clkctrl, |
| 361 | (*prcm)->cm_l4per_i2c4_clkctrl, |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 362 | 0 |
| 363 | }; |
| 364 | |
| 365 | /* Enable optional additional functional clock for GPIO4 */ |
| 366 | setbits_le32((*prcm)->cm_l4per_gpio4_clkctrl, |
| 367 | GPIO4_CLKCTRL_OPTFCLKEN_MASK); |
| 368 | |
| 369 | /* Enable 96 MHz clock for MMC1 & MMC2 */ |
| 370 | setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl, |
| 371 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 372 | setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl, |
| 373 | HSMMC_CLKCTRL_CLKSEL_MASK); |
| 374 | |
| 375 | /* Select 32KHz clock as the source of GPTIMER1 */ |
| 376 | setbits_le32((*prcm)->cm_wkup_gptimer1_clkctrl, |
| 377 | GPTIMER1_CLKCTRL_CLKSEL_MASK); |
| 378 | |
Paul Kocialkowski | c7f3bb1 | 2016-02-27 19:18:58 +0100 | [diff] [blame] | 379 | /* Enable optional 48M functional clock for USB PHY */ |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 380 | setbits_le32((*prcm)->cm_l3init_usbphy_clkctrl, |
| 381 | USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK); |
| 382 | |
Paul Kocialkowski | 913349f | 2016-02-27 19:19:02 +0100 | [diff] [blame] | 383 | /* Enable 32 KHz clock for USB PHY */ |
| 384 | setbits_le32((*prcm)->cm_coreaon_usb_phy1_core_clkctrl, |
| 385 | USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K); |
| 386 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 387 | do_enable_clocks(clk_domains_essential, |
| 388 | clk_modules_hw_auto_essential, |
| 389 | clk_modules_explicit_en_essential, |
| 390 | 1); |
| 391 | } |
| 392 | |
| 393 | void enable_basic_uboot_clocks(void) |
| 394 | { |
| 395 | u32 const clk_domains_essential[] = { |
| 396 | 0 |
| 397 | }; |
| 398 | |
| 399 | u32 const clk_modules_hw_auto_essential[] = { |
| 400 | (*prcm)->cm_l3init_hsusbotg_clkctrl, |
| 401 | (*prcm)->cm_l3init_usbphy_clkctrl, |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 402 | (*prcm)->cm_clksel_usb_60mhz, |
| 403 | (*prcm)->cm_l3init_hsusbtll_clkctrl, |
| 404 | 0 |
| 405 | }; |
| 406 | |
| 407 | u32 const clk_modules_explicit_en_essential[] = { |
| 408 | (*prcm)->cm_l4per_mcspi1_clkctrl, |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 409 | (*prcm)->cm_l3init_hsusbhost_clkctrl, |
| 410 | 0 |
| 411 | }; |
| 412 | |
| 413 | do_enable_clocks(clk_domains_essential, |
| 414 | clk_modules_hw_auto_essential, |
| 415 | clk_modules_explicit_en_essential, |
| 416 | 1); |
| 417 | } |
| 418 | |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 419 | void hw_data_init(void) |
| 420 | { |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 421 | u32 omap_rev = omap_revision(); |
| 422 | |
| 423 | (*prcm) = &omap4_prcm; |
| 424 | |
| 425 | switch (omap_rev) { |
| 426 | |
| 427 | case OMAP4430_ES1_0: |
| 428 | *dplls_data = &omap4430_dplls_es1; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 429 | *omap_vcores = &omap4430_volts_es1; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 430 | break; |
| 431 | |
| 432 | case OMAP4430_ES2_0: |
Janne Grunau | d2b0a89 | 2014-02-16 21:57:18 +0100 | [diff] [blame] | 433 | *dplls_data = &omap4430_dplls_es20; |
| 434 | *omap_vcores = &omap4430_volts; |
| 435 | break; |
| 436 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 437 | case OMAP4430_ES2_1: |
| 438 | case OMAP4430_ES2_2: |
| 439 | case OMAP4430_ES2_3: |
| 440 | *dplls_data = &omap4430_dplls; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 441 | *omap_vcores = &omap4430_volts; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 442 | break; |
| 443 | |
| 444 | case OMAP4460_ES1_0: |
| 445 | case OMAP4460_ES1_1: |
| 446 | *dplls_data = &omap4460_dplls; |
SRICHARAN R | 00d328c | 2013-02-04 04:22:02 +0000 | [diff] [blame] | 447 | *omap_vcores = &omap4460_volts; |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 448 | break; |
| 449 | |
Taras Kondratiuk | 6d2e261 | 2013-08-06 15:18:49 +0300 | [diff] [blame] | 450 | case OMAP4470_ES1_0: |
| 451 | *dplls_data = &omap4470_dplls; |
| 452 | *omap_vcores = &omap4470_volts; |
| 453 | break; |
| 454 | |
SRICHARAN R | 1a79cab | 2013-02-04 04:22:01 +0000 | [diff] [blame] | 455 | default: |
| 456 | printf("\n INVALID OMAP REVISION "); |
| 457 | } |
| 458 | |
Lokesh Vutla | 834b6b0 | 2013-02-04 04:22:04 +0000 | [diff] [blame] | 459 | *ctrl = &omap4_ctrl; |
SRICHARAN R | fb6aa1f | 2013-02-04 04:22:00 +0000 | [diff] [blame] | 460 | } |