Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 |
| 4 | * Texas Instruments Incorporated, <www.ti.com> |
| 5 | * |
| 6 | * Lokesh Vutla <lokeshvutla@ti.com> |
| 7 | * |
| 8 | * Based on previous work by: |
| 9 | * Aneesh V <aneesh@ti.com> |
| 10 | * Steve Sakoman <steve@sakoman.com> |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 11 | */ |
| 12 | #include <common.h> |
Nishanth Menon | 627612c | 2013-03-26 05:20:54 +0000 | [diff] [blame] | 13 | #include <palmas.h> |
Dan Murphy | 57f29ab | 2014-02-03 06:59:02 -0600 | [diff] [blame] | 14 | #include <sata.h> |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 15 | #include <linux/string.h> |
Lokesh Vutla | be86f0e | 2014-08-04 19:42:24 +0530 | [diff] [blame] | 16 | #include <asm/gpio.h> |
Kishon Vijay Abraham I | ce61fd7 | 2015-02-23 18:40:19 +0530 | [diff] [blame] | 17 | #include <usb.h> |
| 18 | #include <linux/usb/gadget.h> |
Andreas Dannenberg | 5cf344b | 2016-06-27 09:19:22 -0500 | [diff] [blame] | 19 | #include <asm/omap_common.h> |
| 20 | #include <asm/omap_sec_common.h> |
Lokesh Vutla | be86f0e | 2014-08-04 19:42:24 +0530 | [diff] [blame] | 21 | #include <asm/arch/gpio.h> |
Lokesh Vutla | 1fd8022 | 2015-06-04 16:42:38 +0530 | [diff] [blame] | 22 | #include <asm/arch/dra7xx_iodelay.h> |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 23 | #include <asm/emif.h> |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 24 | #include <asm/arch/sys_proto.h> |
| 25 | #include <asm/arch/mmc_host_def.h> |
Roger Quadros | f019ee8 | 2013-11-11 16:56:44 +0200 | [diff] [blame] | 26 | #include <asm/arch/sata.h> |
Tom Rini | 560ef45 | 2014-04-03 07:52:56 -0400 | [diff] [blame] | 27 | #include <environment.h> |
Kishon Vijay Abraham I | ce61fd7 | 2015-02-23 18:40:19 +0530 | [diff] [blame] | 28 | #include <dwc3-uboot.h> |
| 29 | #include <dwc3-omap-uboot.h> |
Franklin S Cooper Jr | 236fca8 | 2019-02-27 13:29:36 +0530 | [diff] [blame] | 30 | #include <i2c.h> |
Kishon Vijay Abraham I | ce61fd7 | 2015-02-23 18:40:19 +0530 | [diff] [blame] | 31 | #include <ti-usb-phy-uboot.h> |
Dan Murphy | b1941f3 | 2016-03-30 12:58:37 -0500 | [diff] [blame] | 32 | #include <miiphy.h> |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 33 | |
| 34 | #include "mux_data.h" |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 35 | #include "../common/board_detect.h" |
| 36 | |
Lokesh Vutla | 1337613 | 2017-08-21 12:50:53 +0530 | [diff] [blame] | 37 | #define board_is_dra76x_evm() board_ti_is("DRA76/7x") |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 38 | #define board_is_dra74x_evm() board_ti_is("5777xCPU") |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 39 | #define board_is_dra72x_evm() board_ti_is("DRA72x-T") |
Lokesh Vutla | b9d8f8e | 2016-11-23 13:25:24 +0530 | [diff] [blame] | 40 | #define board_is_dra71x_evm() board_ti_is("DRA79x,D") |
Mugunthan V N | 3a7f10c | 2016-09-27 13:01:42 +0530 | [diff] [blame] | 41 | #define board_is_dra74x_revh_or_later() (board_is_dra74x_evm() && \ |
| 42 | (strncmp("H", board_ti_get_rev(), 1) <= 0)) |
| 43 | #define board_is_dra72x_revc_or_later() (board_is_dra72x_evm() && \ |
| 44 | (strncmp("C", board_ti_get_rev(), 1) <= 0)) |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 45 | #define board_ti_get_emif_size() board_ti_get_emif1_size() + \ |
| 46 | board_ti_get_emif2_size() |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 47 | |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 48 | #ifdef CONFIG_DRIVER_TI_CPSW |
| 49 | #include <cpsw.h> |
| 50 | #endif |
| 51 | |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 52 | DECLARE_GLOBAL_DATA_PTR; |
| 53 | |
Lokesh Vutla | be86f0e | 2014-08-04 19:42:24 +0530 | [diff] [blame] | 54 | /* GPIO 7_11 */ |
| 55 | #define GPIO_DDR_VTT_EN 203 |
| 56 | |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 57 | #define SYSINFO_BOARD_NAME_MAX_LEN 37 |
| 58 | |
Franklin S Cooper Jr | 236fca8 | 2019-02-27 13:29:36 +0530 | [diff] [blame] | 59 | /* I2C I/O Expander */ |
| 60 | #define NAND_PCF8575_ADDR 0x21 |
| 61 | #define NAND_PCF8575_I2C_BUS_NUM 0 |
| 62 | |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 63 | const struct omap_sysinfo sysinfo = { |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 64 | "Board: UNKNOWN(DRA7 EVM) REV UNKNOWN\n" |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 67 | static const struct emif_regs emif1_ddr3_532_mhz_1cs = { |
| 68 | .sdram_config_init = 0x61851ab2, |
| 69 | .sdram_config = 0x61851ab2, |
| 70 | .sdram_config2 = 0x08000000, |
| 71 | .ref_ctrl = 0x000040F1, |
| 72 | .ref_ctrl_final = 0x00001035, |
| 73 | .sdram_tim1 = 0xCCCF36B3, |
| 74 | .sdram_tim2 = 0x308F7FDA, |
| 75 | .sdram_tim3 = 0x427F88A8, |
| 76 | .read_idle_ctrl = 0x00050000, |
| 77 | .zq_config = 0x0007190B, |
| 78 | .temp_alert_config = 0x00000000, |
| 79 | .emif_ddr_phy_ctlr_1_init = 0x0024400B, |
| 80 | .emif_ddr_phy_ctlr_1 = 0x0E24400B, |
| 81 | .emif_ddr_ext_phy_ctrl_1 = 0x10040100, |
| 82 | .emif_ddr_ext_phy_ctrl_2 = 0x00910091, |
| 83 | .emif_ddr_ext_phy_ctrl_3 = 0x00950095, |
| 84 | .emif_ddr_ext_phy_ctrl_4 = 0x009B009B, |
| 85 | .emif_ddr_ext_phy_ctrl_5 = 0x009E009E, |
| 86 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 87 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 88 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 89 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 90 | }; |
| 91 | |
| 92 | static const struct emif_regs emif2_ddr3_532_mhz_1cs = { |
| 93 | .sdram_config_init = 0x61851B32, |
| 94 | .sdram_config = 0x61851B32, |
| 95 | .sdram_config2 = 0x08000000, |
| 96 | .ref_ctrl = 0x000040F1, |
| 97 | .ref_ctrl_final = 0x00001035, |
| 98 | .sdram_tim1 = 0xCCCF36B3, |
| 99 | .sdram_tim2 = 0x308F7FDA, |
| 100 | .sdram_tim3 = 0x427F88A8, |
| 101 | .read_idle_ctrl = 0x00050000, |
| 102 | .zq_config = 0x0007190B, |
| 103 | .temp_alert_config = 0x00000000, |
| 104 | .emif_ddr_phy_ctlr_1_init = 0x0024400B, |
| 105 | .emif_ddr_phy_ctlr_1 = 0x0E24400B, |
| 106 | .emif_ddr_ext_phy_ctrl_1 = 0x10040100, |
| 107 | .emif_ddr_ext_phy_ctrl_2 = 0x00910091, |
| 108 | .emif_ddr_ext_phy_ctrl_3 = 0x00950095, |
| 109 | .emif_ddr_ext_phy_ctrl_4 = 0x009B009B, |
| 110 | .emif_ddr_ext_phy_ctrl_5 = 0x009E009E, |
| 111 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 112 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 113 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 114 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 115 | }; |
| 116 | |
| 117 | static const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es1 = { |
| 118 | .sdram_config_init = 0x61862B32, |
| 119 | .sdram_config = 0x61862B32, |
| 120 | .sdram_config2 = 0x08000000, |
| 121 | .ref_ctrl = 0x0000514C, |
| 122 | .ref_ctrl_final = 0x0000144A, |
| 123 | .sdram_tim1 = 0xD113781C, |
| 124 | .sdram_tim2 = 0x30717FE3, |
| 125 | .sdram_tim3 = 0x409F86A8, |
| 126 | .read_idle_ctrl = 0x00050000, |
| 127 | .zq_config = 0x5007190B, |
| 128 | .temp_alert_config = 0x00000000, |
| 129 | .emif_ddr_phy_ctlr_1_init = 0x0024400D, |
| 130 | .emif_ddr_phy_ctlr_1 = 0x0E24400D, |
| 131 | .emif_ddr_ext_phy_ctrl_1 = 0x10040100, |
| 132 | .emif_ddr_ext_phy_ctrl_2 = 0x00A400A4, |
| 133 | .emif_ddr_ext_phy_ctrl_3 = 0x00A900A9, |
| 134 | .emif_ddr_ext_phy_ctrl_4 = 0x00B000B0, |
| 135 | .emif_ddr_ext_phy_ctrl_5 = 0x00B000B0, |
| 136 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 137 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 138 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 139 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 140 | }; |
| 141 | |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 142 | const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra_es2 = { |
| 143 | .sdram_config_init = 0x61862BB2, |
| 144 | .sdram_config = 0x61862BB2, |
| 145 | .sdram_config2 = 0x00000000, |
| 146 | .ref_ctrl = 0x0000514D, |
| 147 | .ref_ctrl_final = 0x0000144A, |
| 148 | .sdram_tim1 = 0xD1137824, |
| 149 | .sdram_tim2 = 0x30B37FE3, |
| 150 | .sdram_tim3 = 0x409F8AD8, |
| 151 | .read_idle_ctrl = 0x00050000, |
| 152 | .zq_config = 0x5007190B, |
| 153 | .temp_alert_config = 0x00000000, |
| 154 | .emif_ddr_phy_ctlr_1_init = 0x0824400E, |
| 155 | .emif_ddr_phy_ctlr_1 = 0x0E24400E, |
| 156 | .emif_ddr_ext_phy_ctrl_1 = 0x04040100, |
| 157 | .emif_ddr_ext_phy_ctrl_2 = 0x006B009F, |
| 158 | .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2, |
| 159 | .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8, |
| 160 | .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8, |
| 161 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 162 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 163 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 164 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 165 | }; |
| 166 | |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 167 | const struct emif_regs emif1_ddr3_532_mhz_1cs_2G = { |
| 168 | .sdram_config_init = 0x61851ab2, |
| 169 | .sdram_config = 0x61851ab2, |
| 170 | .sdram_config2 = 0x08000000, |
| 171 | .ref_ctrl = 0x000040F1, |
| 172 | .ref_ctrl_final = 0x00001035, |
| 173 | .sdram_tim1 = 0xCCCF36B3, |
| 174 | .sdram_tim2 = 0x30BF7FDA, |
| 175 | .sdram_tim3 = 0x427F8BA8, |
| 176 | .read_idle_ctrl = 0x00050000, |
| 177 | .zq_config = 0x0007190B, |
| 178 | .temp_alert_config = 0x00000000, |
| 179 | .emif_ddr_phy_ctlr_1_init = 0x0024400B, |
| 180 | .emif_ddr_phy_ctlr_1 = 0x0E24400B, |
| 181 | .emif_ddr_ext_phy_ctrl_1 = 0x10040100, |
| 182 | .emif_ddr_ext_phy_ctrl_2 = 0x00910091, |
| 183 | .emif_ddr_ext_phy_ctrl_3 = 0x00950095, |
| 184 | .emif_ddr_ext_phy_ctrl_4 = 0x009B009B, |
| 185 | .emif_ddr_ext_phy_ctrl_5 = 0x009E009E, |
| 186 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 187 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 188 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 189 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 190 | }; |
| 191 | |
| 192 | const struct emif_regs emif2_ddr3_532_mhz_1cs_2G = { |
| 193 | .sdram_config_init = 0x61851B32, |
| 194 | .sdram_config = 0x61851B32, |
| 195 | .sdram_config2 = 0x08000000, |
| 196 | .ref_ctrl = 0x000040F1, |
| 197 | .ref_ctrl_final = 0x00001035, |
| 198 | .sdram_tim1 = 0xCCCF36B3, |
| 199 | .sdram_tim2 = 0x308F7FDA, |
| 200 | .sdram_tim3 = 0x427F88A8, |
| 201 | .read_idle_ctrl = 0x00050000, |
| 202 | .zq_config = 0x0007190B, |
| 203 | .temp_alert_config = 0x00000000, |
| 204 | .emif_ddr_phy_ctlr_1_init = 0x0024400B, |
| 205 | .emif_ddr_phy_ctlr_1 = 0x0E24400B, |
| 206 | .emif_ddr_ext_phy_ctrl_1 = 0x10040100, |
| 207 | .emif_ddr_ext_phy_ctrl_2 = 0x00910091, |
| 208 | .emif_ddr_ext_phy_ctrl_3 = 0x00950095, |
| 209 | .emif_ddr_ext_phy_ctrl_4 = 0x009B009B, |
| 210 | .emif_ddr_ext_phy_ctrl_5 = 0x009E009E, |
| 211 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 212 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 213 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 214 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 215 | }; |
| 216 | |
Lokesh Vutla | 6f1038f | 2017-08-21 12:50:55 +0530 | [diff] [blame] | 217 | const struct emif_regs emif_1_regs_ddr3_666_mhz_1cs_dra76 = { |
| 218 | .sdram_config_init = 0x61862B32, |
| 219 | .sdram_config = 0x61862B32, |
| 220 | .sdram_config2 = 0x00000000, |
| 221 | .ref_ctrl = 0x0000514C, |
| 222 | .ref_ctrl_final = 0x0000144A, |
| 223 | .sdram_tim1 = 0xD113783C, |
| 224 | .sdram_tim2 = 0x30B47FE3, |
| 225 | .sdram_tim3 = 0x409F8AD8, |
| 226 | .read_idle_ctrl = 0x00050000, |
| 227 | .zq_config = 0x5007190B, |
| 228 | .temp_alert_config = 0x00000000, |
| 229 | .emif_ddr_phy_ctlr_1_init = 0x0824400D, |
| 230 | .emif_ddr_phy_ctlr_1 = 0x0E24400D, |
| 231 | .emif_ddr_ext_phy_ctrl_1 = 0x04040100, |
| 232 | .emif_ddr_ext_phy_ctrl_2 = 0x006B009F, |
| 233 | .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2, |
| 234 | .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8, |
| 235 | .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8, |
| 236 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 237 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 238 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 239 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 240 | }; |
| 241 | |
| 242 | const struct emif_regs emif_2_regs_ddr3_666_mhz_1cs_dra76 = { |
| 243 | .sdram_config_init = 0x61862B32, |
| 244 | .sdram_config = 0x61862B32, |
| 245 | .sdram_config2 = 0x00000000, |
| 246 | .ref_ctrl = 0x0000514C, |
| 247 | .ref_ctrl_final = 0x0000144A, |
| 248 | .sdram_tim1 = 0xD113781C, |
| 249 | .sdram_tim2 = 0x30B47FE3, |
| 250 | .sdram_tim3 = 0x409F8AD8, |
| 251 | .read_idle_ctrl = 0x00050000, |
| 252 | .zq_config = 0x5007190B, |
| 253 | .temp_alert_config = 0x00000000, |
| 254 | .emif_ddr_phy_ctlr_1_init = 0x0824400D, |
| 255 | .emif_ddr_phy_ctlr_1 = 0x0E24400D, |
| 256 | .emif_ddr_ext_phy_ctrl_1 = 0x04040100, |
| 257 | .emif_ddr_ext_phy_ctrl_2 = 0x006B009F, |
| 258 | .emif_ddr_ext_phy_ctrl_3 = 0x006B00A2, |
| 259 | .emif_ddr_ext_phy_ctrl_4 = 0x006B00A8, |
| 260 | .emif_ddr_ext_phy_ctrl_5 = 0x006B00A8, |
| 261 | .emif_rd_wr_lvl_rmp_win = 0x00000000, |
| 262 | .emif_rd_wr_lvl_rmp_ctl = 0x80000000, |
| 263 | .emif_rd_wr_lvl_ctl = 0x00000000, |
| 264 | .emif_rd_wr_exec_thresh = 0x00000305 |
| 265 | }; |
| 266 | |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 267 | void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs) |
| 268 | { |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 269 | u64 ram_size; |
| 270 | |
| 271 | ram_size = board_ti_get_emif_size(); |
| 272 | |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 273 | switch (omap_revision()) { |
| 274 | case DRA752_ES1_0: |
| 275 | case DRA752_ES1_1: |
| 276 | case DRA752_ES2_0: |
| 277 | switch (emif_nr) { |
| 278 | case 1: |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 279 | if (ram_size > CONFIG_MAX_MEM_MAPPED) |
| 280 | *regs = &emif1_ddr3_532_mhz_1cs_2G; |
| 281 | else |
| 282 | *regs = &emif1_ddr3_532_mhz_1cs; |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 283 | break; |
| 284 | case 2: |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 285 | if (ram_size > CONFIG_MAX_MEM_MAPPED) |
| 286 | *regs = &emif2_ddr3_532_mhz_1cs_2G; |
| 287 | else |
| 288 | *regs = &emif2_ddr3_532_mhz_1cs; |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 289 | break; |
| 290 | } |
| 291 | break; |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 292 | case DRA762_ABZ_ES1_0: |
| 293 | case DRA762_ACD_ES1_0: |
Lokesh Vutla | 6f1038f | 2017-08-21 12:50:55 +0530 | [diff] [blame] | 294 | case DRA762_ES1_0: |
| 295 | if (emif_nr == 1) |
| 296 | *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra76; |
| 297 | else |
| 298 | *regs = &emif_2_regs_ddr3_666_mhz_1cs_dra76; |
| 299 | break; |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 300 | case DRA722_ES1_0: |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 301 | case DRA722_ES2_0: |
Vishal Mahaveer | 42d25eb | 2017-08-26 16:51:22 -0500 | [diff] [blame] | 302 | case DRA722_ES2_1: |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 303 | if (ram_size < CONFIG_MAX_MEM_MAPPED) |
| 304 | *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es1; |
| 305 | else |
| 306 | *regs = &emif_1_regs_ddr3_666_mhz_1cs_dra_es2; |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 307 | break; |
| 308 | default: |
| 309 | *regs = &emif1_ddr3_532_mhz_1cs; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | static const struct dmm_lisa_map_regs lisa_map_dra7_1536MB = { |
| 314 | .dmm_lisa_map_0 = 0x0, |
| 315 | .dmm_lisa_map_1 = 0x80640300, |
| 316 | .dmm_lisa_map_2 = 0xC0500220, |
| 317 | .dmm_lisa_map_3 = 0xFF020100, |
| 318 | .is_ma_present = 0x1 |
| 319 | }; |
| 320 | |
| 321 | static const struct dmm_lisa_map_regs lisa_map_2G_x_2 = { |
| 322 | .dmm_lisa_map_0 = 0x0, |
| 323 | .dmm_lisa_map_1 = 0x0, |
| 324 | .dmm_lisa_map_2 = 0x80600100, |
| 325 | .dmm_lisa_map_3 = 0xFF020100, |
| 326 | .is_ma_present = 0x1 |
| 327 | }; |
| 328 | |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 329 | const struct dmm_lisa_map_regs lisa_map_dra7_2GB = { |
| 330 | .dmm_lisa_map_0 = 0x0, |
| 331 | .dmm_lisa_map_1 = 0x0, |
| 332 | .dmm_lisa_map_2 = 0x80740300, |
| 333 | .dmm_lisa_map_3 = 0xFF020100, |
| 334 | .is_ma_present = 0x1 |
| 335 | }; |
| 336 | |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 337 | /* |
| 338 | * DRA722 EVM EMIF1 2GB CONFIGURATION |
| 339 | * EMIF1 4 devices of 512Mb x 8 Micron |
| 340 | */ |
| 341 | const struct dmm_lisa_map_regs lisa_map_2G_x_4 = { |
| 342 | .dmm_lisa_map_0 = 0x0, |
| 343 | .dmm_lisa_map_1 = 0x0, |
| 344 | .dmm_lisa_map_2 = 0x80700100, |
| 345 | .dmm_lisa_map_3 = 0xFF020100, |
| 346 | .is_ma_present = 0x1 |
| 347 | }; |
| 348 | |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 349 | void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) |
| 350 | { |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 351 | u64 ram_size; |
| 352 | |
| 353 | ram_size = board_ti_get_emif_size(); |
| 354 | |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 355 | switch (omap_revision()) { |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 356 | case DRA762_ABZ_ES1_0: |
| 357 | case DRA762_ACD_ES1_0: |
Lokesh Vutla | 6f1038f | 2017-08-21 12:50:55 +0530 | [diff] [blame] | 358 | case DRA762_ES1_0: |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 359 | case DRA752_ES1_0: |
| 360 | case DRA752_ES1_1: |
| 361 | case DRA752_ES2_0: |
Lokesh Vutla | b85fbcd | 2016-03-08 09:18:08 +0530 | [diff] [blame] | 362 | if (ram_size > CONFIG_MAX_MEM_MAPPED) |
| 363 | *dmm_lisa_regs = &lisa_map_dra7_2GB; |
| 364 | else |
| 365 | *dmm_lisa_regs = &lisa_map_dra7_1536MB; |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 366 | break; |
| 367 | case DRA722_ES1_0: |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 368 | case DRA722_ES2_0: |
Vishal Mahaveer | 42d25eb | 2017-08-26 16:51:22 -0500 | [diff] [blame] | 369 | case DRA722_ES2_1: |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 370 | default: |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 371 | if (ram_size < CONFIG_MAX_MEM_MAPPED) |
| 372 | *dmm_lisa_regs = &lisa_map_2G_x_2; |
| 373 | else |
| 374 | *dmm_lisa_regs = &lisa_map_2G_x_4; |
| 375 | break; |
Lokesh Vutla | 41963ee | 2016-03-08 09:18:06 +0530 | [diff] [blame] | 376 | } |
| 377 | } |
| 378 | |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 379 | struct vcores_data dra752_volts = { |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 380 | .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM, |
| 381 | .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 382 | .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 383 | .mpu.addr = TPS659038_REG_ADDR_SMPS12, |
| 384 | .mpu.pmic = &tps659038, |
| 385 | .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK, |
| 386 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 387 | .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM, |
| 388 | .eve.value[OPP_OD] = VDD_EVE_DRA7_OD, |
| 389 | .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH, |
| 390 | .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM, |
| 391 | .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD, |
| 392 | .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 393 | .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 394 | .eve.addr = TPS659038_REG_ADDR_SMPS45, |
| 395 | .eve.pmic = &tps659038, |
| 396 | .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK, |
| 397 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 398 | .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM, |
| 399 | .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD, |
| 400 | .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH, |
| 401 | .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM, |
| 402 | .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD, |
| 403 | .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 404 | .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 405 | .gpu.addr = TPS659038_REG_ADDR_SMPS6, |
| 406 | .gpu.pmic = &tps659038, |
| 407 | .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK, |
| 408 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 409 | .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM, |
| 410 | .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 411 | .core.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 412 | .core.addr = TPS659038_REG_ADDR_SMPS7, |
| 413 | .core.pmic = &tps659038, |
| 414 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 415 | .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM, |
| 416 | .iva.value[OPP_OD] = VDD_IVA_DRA7_OD, |
| 417 | .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH, |
| 418 | .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM, |
| 419 | .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD, |
| 420 | .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 421 | .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 422 | .iva.addr = TPS659038_REG_ADDR_SMPS8, |
| 423 | .iva.pmic = &tps659038, |
| 424 | .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK, |
| 425 | }; |
| 426 | |
Keerthy | 1b21f55 | 2017-08-21 12:50:54 +0530 | [diff] [blame] | 427 | struct vcores_data dra76x_volts = { |
| 428 | .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM, |
| 429 | .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM, |
| 430 | .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 431 | .mpu.addr = LP87565_REG_ADDR_BUCK01, |
| 432 | .mpu.pmic = &lp87565, |
| 433 | .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK, |
| 434 | |
| 435 | .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM, |
| 436 | .eve.value[OPP_OD] = VDD_EVE_DRA7_OD, |
| 437 | .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH, |
| 438 | .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM, |
| 439 | .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD, |
| 440 | .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH, |
| 441 | .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 442 | .eve.addr = TPS65917_REG_ADDR_SMPS1, |
| 443 | .eve.pmic = &tps659038, |
| 444 | .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK, |
| 445 | |
| 446 | .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM, |
| 447 | .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD, |
| 448 | .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH, |
| 449 | .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM, |
| 450 | .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD, |
| 451 | .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH, |
| 452 | .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 453 | .gpu.addr = LP87565_REG_ADDR_BUCK23, |
| 454 | .gpu.pmic = &lp87565, |
| 455 | .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK, |
| 456 | |
| 457 | .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM, |
| 458 | .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM, |
| 459 | .core.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 460 | .core.addr = TPS65917_REG_ADDR_SMPS3, |
| 461 | .core.pmic = &tps659038, |
| 462 | |
| 463 | .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM, |
| 464 | .iva.value[OPP_OD] = VDD_IVA_DRA7_OD, |
| 465 | .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH, |
| 466 | .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM, |
| 467 | .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD, |
| 468 | .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH, |
| 469 | .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 470 | .iva.addr = TPS65917_REG_ADDR_SMPS4, |
| 471 | .iva.pmic = &tps659038, |
| 472 | .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK, |
| 473 | }; |
| 474 | |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 475 | struct vcores_data dra722_volts = { |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 476 | .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM, |
| 477 | .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 478 | .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 479 | .mpu.addr = TPS65917_REG_ADDR_SMPS1, |
| 480 | .mpu.pmic = &tps659038, |
| 481 | .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK, |
| 482 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 483 | .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM, |
| 484 | .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 485 | .core.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 486 | .core.addr = TPS65917_REG_ADDR_SMPS2, |
| 487 | .core.pmic = &tps659038, |
| 488 | |
| 489 | /* |
| 490 | * The DSPEVE, GPU and IVA rails are usually grouped on DRA72x |
| 491 | * designs and powered by TPS65917 SMPS3, as on the J6Eco EVM. |
| 492 | */ |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 493 | .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM, |
| 494 | .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD, |
| 495 | .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH, |
| 496 | .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM, |
| 497 | .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD, |
| 498 | .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 499 | .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 500 | .gpu.addr = TPS65917_REG_ADDR_SMPS3, |
| 501 | .gpu.pmic = &tps659038, |
| 502 | .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK, |
| 503 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 504 | .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM, |
| 505 | .eve.value[OPP_OD] = VDD_EVE_DRA7_OD, |
| 506 | .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH, |
| 507 | .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM, |
| 508 | .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD, |
| 509 | .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 510 | .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 511 | .eve.addr = TPS65917_REG_ADDR_SMPS3, |
| 512 | .eve.pmic = &tps659038, |
| 513 | .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK, |
| 514 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 515 | .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM, |
| 516 | .iva.value[OPP_OD] = VDD_IVA_DRA7_OD, |
| 517 | .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH, |
| 518 | .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM, |
| 519 | .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD, |
| 520 | .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH, |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 521 | .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 522 | .iva.addr = TPS65917_REG_ADDR_SMPS3, |
| 523 | .iva.pmic = &tps659038, |
| 524 | .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK, |
| 525 | }; |
| 526 | |
Keerthy | 4d4e34b | 2016-11-23 13:25:27 +0530 | [diff] [blame] | 527 | struct vcores_data dra718_volts = { |
| 528 | /* |
| 529 | * In the case of dra71x GPU MPU and CORE |
| 530 | * are all powered up by BUCK0 of LP873X PMIC |
| 531 | */ |
| 532 | .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM, |
| 533 | .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM, |
| 534 | .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 535 | .mpu.addr = LP873X_REG_ADDR_BUCK0, |
| 536 | .mpu.pmic = &lp8733, |
| 537 | .mpu.abb_tx_done_mask = OMAP_ABB_MPU_TXDONE_MASK, |
| 538 | |
| 539 | .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM, |
| 540 | .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM, |
| 541 | .core.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 542 | .core.addr = LP873X_REG_ADDR_BUCK0, |
| 543 | .core.pmic = &lp8733, |
| 544 | |
| 545 | .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM, |
| 546 | .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM, |
| 547 | .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 548 | .gpu.addr = LP873X_REG_ADDR_BUCK0, |
| 549 | .gpu.pmic = &lp8733, |
| 550 | .gpu.abb_tx_done_mask = OMAP_ABB_GPU_TXDONE_MASK, |
| 551 | |
| 552 | /* |
| 553 | * The DSPEVE and IVA rails are grouped on DRA71x-evm |
| 554 | * and are powered by BUCK1 of LP873X PMIC |
| 555 | */ |
| 556 | .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM, |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 557 | .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH, |
Keerthy | 4d4e34b | 2016-11-23 13:25:27 +0530 | [diff] [blame] | 558 | .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM, |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 559 | .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH, |
Keerthy | 4d4e34b | 2016-11-23 13:25:27 +0530 | [diff] [blame] | 560 | .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 561 | .eve.addr = LP873X_REG_ADDR_BUCK1, |
| 562 | .eve.pmic = &lp8733, |
| 563 | .eve.abb_tx_done_mask = OMAP_ABB_EVE_TXDONE_MASK, |
| 564 | |
| 565 | .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM, |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 566 | .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH, |
Keerthy | 4d4e34b | 2016-11-23 13:25:27 +0530 | [diff] [blame] | 567 | .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM, |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 568 | .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH, |
Keerthy | 4d4e34b | 2016-11-23 13:25:27 +0530 | [diff] [blame] | 569 | .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS, |
| 570 | .iva.addr = LP873X_REG_ADDR_BUCK1, |
| 571 | .iva.pmic = &lp8733, |
| 572 | .iva.abb_tx_done_mask = OMAP_ABB_IVA_TXDONE_MASK, |
| 573 | }; |
| 574 | |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 575 | int get_voltrail_opp(int rail_offset) |
| 576 | { |
| 577 | int opp; |
| 578 | |
| 579 | switch (rail_offset) { |
| 580 | case VOLT_MPU: |
| 581 | opp = DRA7_MPU_OPP; |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 582 | /* DRA71x supports only OPP_NOM for MPU */ |
| 583 | if (board_is_dra71x_evm()) |
| 584 | opp = OPP_NOM; |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 585 | break; |
| 586 | case VOLT_CORE: |
| 587 | opp = DRA7_CORE_OPP; |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 588 | /* DRA71x supports only OPP_NOM for CORE */ |
| 589 | if (board_is_dra71x_evm()) |
| 590 | opp = OPP_NOM; |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 591 | break; |
| 592 | case VOLT_GPU: |
| 593 | opp = DRA7_GPU_OPP; |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 594 | /* DRA71x supports only OPP_NOM for GPU */ |
| 595 | if (board_is_dra71x_evm()) |
| 596 | opp = OPP_NOM; |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 597 | break; |
| 598 | case VOLT_EVE: |
| 599 | opp = DRA7_DSPEVE_OPP; |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 600 | /* |
| 601 | * DRA71x does not support OPP_OD for EVE. |
| 602 | * If OPP_OD is selected by menuconfig, fallback |
| 603 | * to OPP_NOM. |
| 604 | */ |
| 605 | if (board_is_dra71x_evm() && opp == OPP_OD) |
| 606 | opp = OPP_NOM; |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 607 | break; |
| 608 | case VOLT_IVA: |
| 609 | opp = DRA7_IVA_OPP; |
Lokesh Vutla | cae8428 | 2017-04-20 14:07:52 +0530 | [diff] [blame] | 610 | /* |
| 611 | * DRA71x does not support OPP_OD for IVA. |
| 612 | * If OPP_OD is selected by menuconfig, fallback |
| 613 | * to OPP_NOM. |
| 614 | */ |
| 615 | if (board_is_dra71x_evm() && opp == OPP_OD) |
| 616 | opp = OPP_NOM; |
Lokesh Vutla | 6ede0fd | 2016-11-23 12:54:39 +0530 | [diff] [blame] | 617 | break; |
| 618 | default: |
| 619 | opp = OPP_NOM; |
| 620 | } |
| 621 | |
| 622 | return opp; |
| 623 | } |
| 624 | |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 625 | /** |
| 626 | * @brief board_init |
| 627 | * |
| 628 | * @return 0 |
| 629 | */ |
| 630 | int board_init(void) |
| 631 | { |
| 632 | gpmc_init(); |
| 633 | gd->bd->bi_boot_params = (0x80000000 + 0x100); /* boot param addr */ |
| 634 | |
| 635 | return 0; |
| 636 | } |
| 637 | |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 638 | int dram_init_banksize(void) |
Lokesh Vutla | 0deb333 | 2016-03-08 09:18:09 +0530 | [diff] [blame] | 639 | { |
| 640 | u64 ram_size; |
| 641 | |
| 642 | ram_size = board_ti_get_emif_size(); |
| 643 | |
| 644 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
| 645 | gd->bd->bi_dram[0].size = get_effective_memsize(); |
| 646 | if (ram_size > CONFIG_MAX_MEM_MAPPED) { |
| 647 | gd->bd->bi_dram[1].start = 0x200000000; |
| 648 | gd->bd->bi_dram[1].size = ram_size - CONFIG_MAX_MEM_MAPPED; |
| 649 | } |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 650 | |
| 651 | return 0; |
Lokesh Vutla | 0deb333 | 2016-03-08 09:18:09 +0530 | [diff] [blame] | 652 | } |
| 653 | |
Jean-Jacques Hiblot | a58fe0a | 2018-11-29 10:57:41 +0100 | [diff] [blame] | 654 | #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) |
| 655 | static int device_okay(const char *path) |
| 656 | { |
| 657 | int node; |
| 658 | |
| 659 | node = fdt_path_offset(gd->fdt_blob, path); |
| 660 | if (node < 0) |
| 661 | return 0; |
| 662 | |
| 663 | return fdtdec_get_is_enabled(gd->fdt_blob, node); |
| 664 | } |
| 665 | #endif |
| 666 | |
Roger Quadros | f019ee8 | 2013-11-11 16:56:44 +0200 | [diff] [blame] | 667 | int board_late_init(void) |
| 668 | { |
Lokesh Vutla | 6d576a7 | 2014-07-14 19:57:58 +0530 | [diff] [blame] | 669 | #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 670 | char *name = "unknown"; |
| 671 | |
Lokesh Vutla | 9e23ab5 | 2016-06-29 14:50:41 +0530 | [diff] [blame] | 672 | if (is_dra72x()) { |
| 673 | if (board_is_dra72x_revc_or_later()) |
| 674 | name = "dra72x-revc"; |
Lokesh Vutla | b9d8f8e | 2016-11-23 13:25:24 +0530 | [diff] [blame] | 675 | else if (board_is_dra71x_evm()) |
| 676 | name = "dra71x"; |
Lokesh Vutla | 9e23ab5 | 2016-06-29 14:50:41 +0530 | [diff] [blame] | 677 | else |
| 678 | name = "dra72x"; |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 679 | } else if (is_dra76x_abz()) { |
| 680 | name = "dra76x_abz"; |
| 681 | } else if (is_dra76x_acd()) { |
| 682 | name = "dra76x_acd"; |
Lokesh Vutla | 9e23ab5 | 2016-06-29 14:50:41 +0530 | [diff] [blame] | 683 | } else { |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 684 | name = "dra7xx"; |
Lokesh Vutla | 9e23ab5 | 2016-06-29 14:50:41 +0530 | [diff] [blame] | 685 | } |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 686 | |
| 687 | set_board_info_env(name); |
Dileep Katta | 7354dfc | 2015-03-25 04:04:51 +0530 | [diff] [blame] | 688 | |
Lokesh Vutla | 73368b7 | 2016-11-29 11:58:01 +0530 | [diff] [blame] | 689 | /* |
| 690 | * Default FIT boot on HS devices. Non FIT images are not allowed |
| 691 | * on HS devices. |
| 692 | */ |
| 693 | if (get_device_type() == HS_DEVICE) |
Simon Glass | 6a38e41 | 2017-08-03 12:22:09 -0600 | [diff] [blame] | 694 | env_set("boot_fit", "1"); |
Lokesh Vutla | 73368b7 | 2016-11-29 11:58:01 +0530 | [diff] [blame] | 695 | |
Paul Kocialkowski | 2edadee | 2015-08-27 19:37:12 +0200 | [diff] [blame] | 696 | omap_die_id_serial(); |
Semen Protsenko | 4a84532 | 2017-05-22 19:16:42 +0300 | [diff] [blame] | 697 | omap_set_fastboot_vars(); |
Keerthy | be0c1f1 | 2017-10-12 10:18:45 +0530 | [diff] [blame] | 698 | |
| 699 | /* |
| 700 | * Hook the LDO1 regulator to EN pin. This applies only to LP8733 |
| 701 | * Rest all regulators are hooked to EN Pin at reset. |
| 702 | */ |
| 703 | if (board_is_dra71x_evm()) |
| 704 | palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7); |
Lokesh Vutla | 6d576a7 | 2014-07-14 19:57:58 +0530 | [diff] [blame] | 705 | #endif |
Jean-Jacques Hiblot | a58fe0a | 2018-11-29 10:57:41 +0100 | [diff] [blame] | 706 | #if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) |
| 707 | if (device_okay("/ocp/omap_dwc3_1@48880000")) |
| 708 | enable_usb_clocks(0); |
| 709 | if (device_okay("/ocp/omap_dwc3_2@488c0000")) |
| 710 | enable_usb_clocks(1); |
| 711 | #endif |
Roger Quadros | f019ee8 | 2013-11-11 16:56:44 +0200 | [diff] [blame] | 712 | return 0; |
| 713 | } |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 714 | |
| 715 | #ifdef CONFIG_SPL_BUILD |
| 716 | void do_board_detect(void) |
| 717 | { |
| 718 | int rc; |
| 719 | |
| 720 | rc = ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS, |
| 721 | CONFIG_EEPROM_CHIP_ADDRESS); |
| 722 | if (rc) |
| 723 | printf("ti_i2c_eeprom_init failed %d\n", rc); |
| 724 | } |
| 725 | |
| 726 | #else |
| 727 | |
| 728 | void do_board_detect(void) |
| 729 | { |
| 730 | char *bname = NULL; |
| 731 | int rc; |
| 732 | |
| 733 | rc = ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS, |
| 734 | CONFIG_EEPROM_CHIP_ADDRESS); |
| 735 | if (rc) |
| 736 | printf("ti_i2c_eeprom_init failed %d\n", rc); |
| 737 | |
| 738 | if (board_is_dra74x_evm()) { |
| 739 | bname = "DRA74x EVM"; |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 740 | } else if (board_is_dra72x_evm()) { |
| 741 | bname = "DRA72x EVM"; |
Lokesh Vutla | b9d8f8e | 2016-11-23 13:25:24 +0530 | [diff] [blame] | 742 | } else if (board_is_dra71x_evm()) { |
| 743 | bname = "DRA71x EVM"; |
Lokesh Vutla | 1337613 | 2017-08-21 12:50:53 +0530 | [diff] [blame] | 744 | } else if (board_is_dra76x_evm()) { |
| 745 | bname = "DRA76x EVM"; |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 746 | } else { |
Ravi Babu | e103108 | 2016-03-15 18:09:14 -0500 | [diff] [blame] | 747 | /* If EEPROM is not populated */ |
Lokesh Vutla | 3c7dc01 | 2016-03-08 09:18:05 +0530 | [diff] [blame] | 748 | if (is_dra72x()) |
| 749 | bname = "DRA72x EVM"; |
| 750 | else |
| 751 | bname = "DRA74x EVM"; |
| 752 | } |
| 753 | |
| 754 | if (bname) |
| 755 | snprintf(sysinfo.board_string, SYSINFO_BOARD_NAME_MAX_LEN, |
| 756 | "Board: %s REV %s\n", bname, board_ti_get_rev()); |
| 757 | } |
| 758 | #endif /* CONFIG_SPL_BUILD */ |
Roger Quadros | f019ee8 | 2013-11-11 16:56:44 +0200 | [diff] [blame] | 759 | |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 760 | void vcores_init(void) |
| 761 | { |
| 762 | if (board_is_dra74x_evm()) { |
| 763 | *omap_vcores = &dra752_volts; |
| 764 | } else if (board_is_dra72x_evm()) { |
| 765 | *omap_vcores = &dra722_volts; |
Keerthy | 4d4e34b | 2016-11-23 13:25:27 +0530 | [diff] [blame] | 766 | } else if (board_is_dra71x_evm()) { |
| 767 | *omap_vcores = &dra718_volts; |
Keerthy | 1b21f55 | 2017-08-21 12:50:54 +0530 | [diff] [blame] | 768 | } else if (board_is_dra76x_evm()) { |
| 769 | *omap_vcores = &dra76x_volts; |
Keerthy | c805623 | 2016-06-07 16:05:25 +0530 | [diff] [blame] | 770 | } else { |
| 771 | /* If EEPROM is not populated */ |
| 772 | if (is_dra72x()) |
| 773 | *omap_vcores = &dra722_volts; |
| 774 | else |
| 775 | *omap_vcores = &dra752_volts; |
| 776 | } |
| 777 | } |
| 778 | |
Paul Kocialkowski | a00b1e5 | 2016-02-27 19:18:56 +0100 | [diff] [blame] | 779 | void set_muxconf_regs(void) |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 780 | { |
| 781 | do_set_mux32((*ctrl)->control_padconf_core_base, |
Lokesh Vutla | 1fd8022 | 2015-06-04 16:42:38 +0530 | [diff] [blame] | 782 | early_padconf, ARRAY_SIZE(early_padconf)); |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 783 | } |
Franklin S Cooper Jr | 236fca8 | 2019-02-27 13:29:36 +0530 | [diff] [blame] | 784 | |
| 785 | #if defined(CONFIG_NAND) |
| 786 | static int nand_sw_detect(void) |
| 787 | { |
| 788 | int rc; |
| 789 | uchar data[2]; |
| 790 | struct udevice *dev; |
| 791 | |
| 792 | rc = i2c_get_chip_for_busnum(NAND_PCF8575_I2C_BUS_NUM, |
| 793 | NAND_PCF8575_ADDR, 0, &dev); |
| 794 | if (rc) |
| 795 | return -1; |
| 796 | |
| 797 | rc = dm_i2c_read(dev, 0, (uint8_t *)&data, sizeof(data)); |
| 798 | if (rc) |
| 799 | return -1; |
| 800 | |
| 801 | /* We are only interested in P10 and P11 on PCF8575 which is equal to |
| 802 | * bits 8 and 9. |
| 803 | */ |
| 804 | data[1] = data[1] & 0x3; |
| 805 | |
| 806 | /* Ensure only P11 is set and P10 is cleared. This ensures only |
| 807 | * NAND (P10) is configured and not NOR (P11) which are both low |
| 808 | * true signals. NAND and NOR settings should not be enabled at |
| 809 | * the same time. |
| 810 | */ |
| 811 | if (data[1] == 0x2) |
| 812 | return 0; |
| 813 | |
| 814 | return -1; |
| 815 | } |
| 816 | #else |
| 817 | int nand_sw_detect(void) |
| 818 | { |
| 819 | return -1; |
| 820 | } |
| 821 | #endif |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 822 | |
Lokesh Vutla | 1fd8022 | 2015-06-04 16:42:38 +0530 | [diff] [blame] | 823 | #ifdef CONFIG_IODELAY_RECALIBRATION |
| 824 | void recalibrate_iodelay(void) |
| 825 | { |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 826 | struct pad_conf_entry const *pads, *delta_pads = NULL; |
Nishanth Menon | 6759e7f | 2015-08-13 09:50:59 -0500 | [diff] [blame] | 827 | struct iodelay_cfg_entry const *iodelay; |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 828 | int npads, niodelays, delta_npads = 0; |
| 829 | int ret; |
Nishanth Menon | 6759e7f | 2015-08-13 09:50:59 -0500 | [diff] [blame] | 830 | |
| 831 | switch (omap_revision()) { |
| 832 | case DRA722_ES1_0: |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 833 | case DRA722_ES2_0: |
Vishal Mahaveer | 42d25eb | 2017-08-26 16:51:22 -0500 | [diff] [blame] | 834 | case DRA722_ES2_1: |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 835 | pads = dra72x_core_padconf_array_common; |
| 836 | npads = ARRAY_SIZE(dra72x_core_padconf_array_common); |
Lokesh Vutla | 52ac1fe | 2016-11-23 13:25:25 +0530 | [diff] [blame] | 837 | if (board_is_dra71x_evm()) { |
| 838 | pads = dra71x_core_padconf_array; |
| 839 | npads = ARRAY_SIZE(dra71x_core_padconf_array); |
| 840 | iodelay = dra71_iodelay_cfg_array; |
| 841 | niodelays = ARRAY_SIZE(dra71_iodelay_cfg_array); |
Franklin S Cooper Jr | 236fca8 | 2019-02-27 13:29:36 +0530 | [diff] [blame] | 842 | /* If SW8 on the EVM is set to enable NAND then |
| 843 | * overwrite the pins used by VOUT3 with NAND. |
| 844 | */ |
| 845 | if (!nand_sw_detect()) { |
| 846 | delta_pads = dra71x_nand_padconf_array; |
| 847 | delta_npads = |
| 848 | ARRAY_SIZE(dra71x_nand_padconf_array); |
| 849 | } else { |
| 850 | delta_pads = dra71x_vout3_padconf_array; |
| 851 | delta_npads = |
| 852 | ARRAY_SIZE(dra71x_vout3_padconf_array); |
| 853 | } |
| 854 | |
Lokesh Vutla | 52ac1fe | 2016-11-23 13:25:25 +0530 | [diff] [blame] | 855 | } else if (board_is_dra72x_revc_or_later()) { |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 856 | delta_pads = dra72x_rgmii_padconf_array_revc; |
| 857 | delta_npads = |
| 858 | ARRAY_SIZE(dra72x_rgmii_padconf_array_revc); |
| 859 | iodelay = dra72_iodelay_cfg_array_revc; |
| 860 | niodelays = ARRAY_SIZE(dra72_iodelay_cfg_array_revc); |
| 861 | } else { |
| 862 | delta_pads = dra72x_rgmii_padconf_array_revb; |
| 863 | delta_npads = |
| 864 | ARRAY_SIZE(dra72x_rgmii_padconf_array_revb); |
| 865 | iodelay = dra72_iodelay_cfg_array_revb; |
| 866 | niodelays = ARRAY_SIZE(dra72_iodelay_cfg_array_revb); |
| 867 | } |
Nishanth Menon | 6759e7f | 2015-08-13 09:50:59 -0500 | [diff] [blame] | 868 | break; |
| 869 | case DRA752_ES1_0: |
| 870 | case DRA752_ES1_1: |
| 871 | pads = dra74x_core_padconf_array; |
| 872 | npads = ARRAY_SIZE(dra74x_core_padconf_array); |
| 873 | iodelay = dra742_es1_1_iodelay_cfg_array; |
| 874 | niodelays = ARRAY_SIZE(dra742_es1_1_iodelay_cfg_array); |
| 875 | break; |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 876 | case DRA762_ACD_ES1_0: |
Lokesh Vutla | 7e7d476 | 2017-08-21 12:50:56 +0530 | [diff] [blame] | 877 | case DRA762_ES1_0: |
| 878 | pads = dra76x_core_padconf_array; |
| 879 | npads = ARRAY_SIZE(dra76x_core_padconf_array); |
| 880 | iodelay = dra76x_es1_0_iodelay_cfg_array; |
| 881 | niodelays = ARRAY_SIZE(dra76x_es1_0_iodelay_cfg_array); |
| 882 | break; |
Nishanth Menon | 6759e7f | 2015-08-13 09:50:59 -0500 | [diff] [blame] | 883 | default: |
| 884 | case DRA752_ES2_0: |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 885 | case DRA762_ABZ_ES1_0: |
Nishanth Menon | 6759e7f | 2015-08-13 09:50:59 -0500 | [diff] [blame] | 886 | pads = dra74x_core_padconf_array; |
| 887 | npads = ARRAY_SIZE(dra74x_core_padconf_array); |
| 888 | iodelay = dra742_es2_0_iodelay_cfg_array; |
| 889 | niodelays = ARRAY_SIZE(dra742_es2_0_iodelay_cfg_array); |
Nishanth Menon | be3a553 | 2015-08-13 09:51:00 -0500 | [diff] [blame] | 890 | /* Setup port1 and port2 for rgmii with 'no-id' mode */ |
| 891 | clrset_spare_register(1, 0, RGMII2_ID_MODE_N_MASK | |
| 892 | RGMII1_ID_MODE_N_MASK); |
Nishanth Menon | 6759e7f | 2015-08-13 09:50:59 -0500 | [diff] [blame] | 893 | break; |
Nishanth Menon | 97313b5 | 2015-06-04 16:42:39 +0530 | [diff] [blame] | 894 | } |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 895 | /* Setup I/O isolation */ |
| 896 | ret = __recalibrate_iodelay_start(); |
| 897 | if (ret) |
| 898 | goto err; |
| 899 | |
| 900 | /* Do the muxing here */ |
| 901 | do_set_mux32((*ctrl)->control_padconf_core_base, pads, npads); |
| 902 | |
| 903 | /* Now do the weird minor deltas that should be safe */ |
| 904 | if (delta_npads) |
| 905 | do_set_mux32((*ctrl)->control_padconf_core_base, |
| 906 | delta_pads, delta_npads); |
| 907 | |
Vignesh R | 0e0835e | 2017-12-12 17:14:27 +0530 | [diff] [blame] | 908 | if (is_dra76x()) |
| 909 | /* Set mux for MCAN instead of DCAN1 */ |
| 910 | clrsetbits_le32((*ctrl)->control_core_control_spare_rw, |
| 911 | MCAN_SEL_ALT_MASK, MCAN_SEL); |
| 912 | |
Nishanth Menon | d3b7d85 | 2016-03-15 18:09:17 -0500 | [diff] [blame] | 913 | /* Setup IOdelay configuration */ |
| 914 | ret = do_set_iodelay((*ctrl)->iodelay_config_base, iodelay, niodelays); |
| 915 | err: |
| 916 | /* Closeup.. remove isolation */ |
| 917 | __recalibrate_iodelay_end(ret); |
Lokesh Vutla | 1fd8022 | 2015-06-04 16:42:38 +0530 | [diff] [blame] | 918 | } |
| 919 | #endif |
| 920 | |
Masahiro Yamada | 0a78017 | 2017-05-09 20:31:39 +0900 | [diff] [blame] | 921 | #if defined(CONFIG_MMC) |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 922 | int board_mmc_init(bd_t *bis) |
| 923 | { |
| 924 | omap_mmc_init(0, 0, 0, -1, -1); |
| 925 | omap_mmc_init(1, 0, 0, -1, -1); |
| 926 | return 0; |
| 927 | } |
Lokesh Vutla | 8352d27 | 2017-08-21 12:50:49 +0530 | [diff] [blame] | 928 | |
| 929 | void board_mmc_poweron_ldo(uint voltage) |
| 930 | { |
| 931 | if (board_is_dra71x_evm()) { |
| 932 | if (voltage == LDO_VOLT_3V0) |
| 933 | voltage = 0x19; |
| 934 | else if (voltage == LDO_VOLT_1V8) |
| 935 | voltage = 0xa; |
| 936 | lp873x_mmc1_poweron_ldo(voltage); |
Lokesh Vutla | 4712cc4 | 2017-08-21 12:50:57 +0530 | [diff] [blame] | 937 | } else if (board_is_dra76x_evm()) { |
| 938 | palmas_mmc1_poweron_ldo(LDO4_VOLTAGE, LDO4_CTRL, voltage); |
Lokesh Vutla | 8352d27 | 2017-08-21 12:50:49 +0530 | [diff] [blame] | 939 | } else { |
Lokesh Vutla | 22fa819 | 2017-08-21 12:50:50 +0530 | [diff] [blame] | 940 | palmas_mmc1_poweron_ldo(LDO1_VOLTAGE, LDO1_CTRL, voltage); |
Lokesh Vutla | 8352d27 | 2017-08-21 12:50:49 +0530 | [diff] [blame] | 941 | } |
| 942 | } |
Kishon Vijay Abraham I | 110ed01 | 2018-01-30 16:01:52 +0100 | [diff] [blame] | 943 | |
| 944 | static const struct mmc_platform_fixups dra7x_es1_1_mmc1_fixups = { |
| 945 | .hw_rev = "rev11", |
| 946 | .unsupported_caps = MMC_CAP(MMC_HS_200) | |
| 947 | MMC_CAP(UHS_SDR104), |
| 948 | .max_freq = 96000000, |
| 949 | }; |
| 950 | |
| 951 | static const struct mmc_platform_fixups dra7x_es1_1_mmc23_fixups = { |
| 952 | .hw_rev = "rev11", |
| 953 | .unsupported_caps = MMC_CAP(MMC_HS_200) | |
| 954 | MMC_CAP(UHS_SDR104) | |
| 955 | MMC_CAP(UHS_SDR50), |
| 956 | .max_freq = 48000000, |
| 957 | }; |
| 958 | |
| 959 | const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr) |
| 960 | { |
| 961 | switch (omap_revision()) { |
| 962 | case DRA752_ES1_0: |
| 963 | case DRA752_ES1_1: |
| 964 | if (addr == OMAP_HSMMC1_BASE) |
| 965 | return &dra7x_es1_1_mmc1_fixups; |
| 966 | else |
| 967 | return &dra7x_es1_1_mmc23_fixups; |
| 968 | default: |
| 969 | return NULL; |
| 970 | } |
| 971 | } |
Lokesh Vutla | 40700ad | 2013-02-12 21:29:08 +0000 | [diff] [blame] | 972 | #endif |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 973 | |
Tom Rini | 560ef45 | 2014-04-03 07:52:56 -0400 | [diff] [blame] | 974 | #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT) |
| 975 | int spl_start_uboot(void) |
| 976 | { |
| 977 | /* break into full u-boot on 'c' */ |
| 978 | if (serial_tstc() && serial_getc() == 'c') |
| 979 | return 1; |
| 980 | |
| 981 | #ifdef CONFIG_SPL_ENV_SUPPORT |
| 982 | env_init(); |
Simon Glass | 1753957 | 2017-08-03 12:22:07 -0600 | [diff] [blame] | 983 | env_load(); |
Simon Glass | 22c34c2 | 2017-08-03 12:22:13 -0600 | [diff] [blame] | 984 | if (env_get_yesno("boot_os") != 1) |
Tom Rini | 560ef45 | 2014-04-03 07:52:56 -0400 | [diff] [blame] | 985 | return 1; |
| 986 | #endif |
| 987 | |
| 988 | return 0; |
| 989 | } |
| 990 | #endif |
| 991 | |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 992 | #ifdef CONFIG_DRIVER_TI_CPSW |
Mugunthan V N | de170b3 | 2014-05-22 14:37:12 +0530 | [diff] [blame] | 993 | extern u32 *const omap_si_rev; |
| 994 | |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 995 | static void cpsw_control(int enabled) |
| 996 | { |
| 997 | /* VTP can be added here */ |
| 998 | |
| 999 | return; |
| 1000 | } |
| 1001 | |
| 1002 | static struct cpsw_slave_data cpsw_slaves[] = { |
| 1003 | { |
| 1004 | .slave_reg_ofs = 0x208, |
| 1005 | .sliver_reg_ofs = 0xd80, |
Mugunthan V N | 4944f37 | 2014-02-18 07:31:52 -0500 | [diff] [blame] | 1006 | .phy_addr = 2, |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1007 | }, |
| 1008 | { |
| 1009 | .slave_reg_ofs = 0x308, |
| 1010 | .sliver_reg_ofs = 0xdc0, |
Mugunthan V N | 4944f37 | 2014-02-18 07:31:52 -0500 | [diff] [blame] | 1011 | .phy_addr = 3, |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1012 | }, |
| 1013 | }; |
| 1014 | |
| 1015 | static struct cpsw_platform_data cpsw_data = { |
| 1016 | .mdio_base = CPSW_MDIO_BASE, |
| 1017 | .cpsw_base = CPSW_BASE, |
| 1018 | .mdio_div = 0xff, |
| 1019 | .channels = 8, |
| 1020 | .cpdma_reg_ofs = 0x800, |
Mugunthan V N | de170b3 | 2014-05-22 14:37:12 +0530 | [diff] [blame] | 1021 | .slaves = 2, |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1022 | .slave_data = cpsw_slaves, |
| 1023 | .ale_reg_ofs = 0xd00, |
| 1024 | .ale_entries = 1024, |
| 1025 | .host_port_reg_ofs = 0x108, |
| 1026 | .hw_stats_reg_ofs = 0x900, |
| 1027 | .bd_ram_ofs = 0x2000, |
| 1028 | .mac_control = (1 << 5), |
| 1029 | .control = cpsw_control, |
| 1030 | .host_port_num = 0, |
| 1031 | .version = CPSW_CTRL_VERSION_2, |
| 1032 | }; |
| 1033 | |
| 1034 | int board_eth_init(bd_t *bis) |
| 1035 | { |
| 1036 | int ret; |
| 1037 | uint8_t mac_addr[6]; |
| 1038 | uint32_t mac_hi, mac_lo; |
| 1039 | uint32_t ctrl_val; |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1040 | |
| 1041 | /* try reading mac address from efuse */ |
| 1042 | mac_lo = readl((*ctrl)->control_core_mac_id_0_lo); |
| 1043 | mac_hi = readl((*ctrl)->control_core_mac_id_0_hi); |
Mugunthan V N | f8b45c2 | 2014-01-07 19:57:38 +0530 | [diff] [blame] | 1044 | mac_addr[0] = (mac_hi & 0xFF0000) >> 16; |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1045 | mac_addr[1] = (mac_hi & 0xFF00) >> 8; |
Mugunthan V N | f8b45c2 | 2014-01-07 19:57:38 +0530 | [diff] [blame] | 1046 | mac_addr[2] = mac_hi & 0xFF; |
| 1047 | mac_addr[3] = (mac_lo & 0xFF0000) >> 16; |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1048 | mac_addr[4] = (mac_lo & 0xFF00) >> 8; |
Mugunthan V N | f8b45c2 | 2014-01-07 19:57:38 +0530 | [diff] [blame] | 1049 | mac_addr[5] = mac_lo & 0xFF; |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1050 | |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 1051 | if (!env_get("ethaddr")) { |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1052 | printf("<ethaddr> not set. Validating first E-fuse MAC\n"); |
| 1053 | |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 1054 | if (is_valid_ethaddr(mac_addr)) |
Simon Glass | 8551d55 | 2017-08-03 12:22:11 -0600 | [diff] [blame] | 1055 | eth_env_set_enetaddr("ethaddr", mac_addr); |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1056 | } |
Mugunthan V N | 1991b5c | 2014-02-18 07:31:56 -0500 | [diff] [blame] | 1057 | |
| 1058 | mac_lo = readl((*ctrl)->control_core_mac_id_1_lo); |
| 1059 | mac_hi = readl((*ctrl)->control_core_mac_id_1_hi); |
| 1060 | mac_addr[0] = (mac_hi & 0xFF0000) >> 16; |
| 1061 | mac_addr[1] = (mac_hi & 0xFF00) >> 8; |
| 1062 | mac_addr[2] = mac_hi & 0xFF; |
| 1063 | mac_addr[3] = (mac_lo & 0xFF0000) >> 16; |
| 1064 | mac_addr[4] = (mac_lo & 0xFF00) >> 8; |
| 1065 | mac_addr[5] = mac_lo & 0xFF; |
| 1066 | |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 1067 | if (!env_get("eth1addr")) { |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 1068 | if (is_valid_ethaddr(mac_addr)) |
Simon Glass | 8551d55 | 2017-08-03 12:22:11 -0600 | [diff] [blame] | 1069 | eth_env_set_enetaddr("eth1addr", mac_addr); |
Mugunthan V N | 1991b5c | 2014-02-18 07:31:56 -0500 | [diff] [blame] | 1070 | } |
| 1071 | |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1072 | ctrl_val = readl((*ctrl)->control_core_control_io1) & (~0x33); |
| 1073 | ctrl_val |= 0x22; |
| 1074 | writel(ctrl_val, (*ctrl)->control_core_control_io1); |
| 1075 | |
Mugunthan V N | de170b3 | 2014-05-22 14:37:12 +0530 | [diff] [blame] | 1076 | if (*omap_si_rev == DRA722_ES1_0) |
| 1077 | cpsw_data.active_slave = 1; |
| 1078 | |
Dan Murphy | b1941f3 | 2016-03-30 12:58:37 -0500 | [diff] [blame] | 1079 | if (board_is_dra72x_revc_or_later()) { |
| 1080 | cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RGMII_ID; |
| 1081 | cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RGMII_ID; |
| 1082 | } |
| 1083 | |
Mugunthan V N | ab48f78 | 2013-07-08 16:04:41 +0530 | [diff] [blame] | 1084 | ret = cpsw_register(&cpsw_data); |
| 1085 | if (ret < 0) |
| 1086 | printf("Error %d registering CPSW switch\n", ret); |
| 1087 | |
| 1088 | return ret; |
| 1089 | } |
| 1090 | #endif |
Lokesh Vutla | be86f0e | 2014-08-04 19:42:24 +0530 | [diff] [blame] | 1091 | |
| 1092 | #ifdef CONFIG_BOARD_EARLY_INIT_F |
| 1093 | /* VTT regulator enable */ |
| 1094 | static inline void vtt_regulator_enable(void) |
| 1095 | { |
| 1096 | if (omap_hw_init_context() == OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL) |
| 1097 | return; |
| 1098 | |
Lokesh Vutla | 6f1038f | 2017-08-21 12:50:55 +0530 | [diff] [blame] | 1099 | /* Do not enable VTT for DRA722 or DRA76x */ |
| 1100 | if (is_dra72x() || is_dra76x()) |
Lokesh Vutla | be86f0e | 2014-08-04 19:42:24 +0530 | [diff] [blame] | 1101 | return; |
| 1102 | |
| 1103 | /* |
| 1104 | * EVM Rev G and later use gpio7_11 for DDR3 termination. |
| 1105 | * This is safe enough to do on older revs. |
| 1106 | */ |
| 1107 | gpio_request(GPIO_DDR_VTT_EN, "ddr_vtt_en"); |
| 1108 | gpio_direction_output(GPIO_DDR_VTT_EN, 1); |
| 1109 | } |
| 1110 | |
| 1111 | int board_early_init_f(void) |
| 1112 | { |
| 1113 | vtt_regulator_enable(); |
| 1114 | return 0; |
| 1115 | } |
| 1116 | #endif |
Daniel Allred | 7ceffb2 | 2016-05-19 19:10:54 -0500 | [diff] [blame] | 1117 | |
| 1118 | #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) |
| 1119 | int ft_board_setup(void *blob, bd_t *bd) |
| 1120 | { |
| 1121 | ft_cpu_setup(blob, bd); |
| 1122 | |
| 1123 | return 0; |
| 1124 | } |
| 1125 | #endif |
Lokesh Vutla | f4de472 | 2016-05-16 10:51:23 +0530 | [diff] [blame] | 1126 | |
| 1127 | #ifdef CONFIG_SPL_LOAD_FIT |
| 1128 | int board_fit_config_name_match(const char *name) |
| 1129 | { |
Mugunthan V N | b8c6b02 | 2016-09-27 13:01:41 +0530 | [diff] [blame] | 1130 | if (is_dra72x()) { |
Lokesh Vutla | f0d5517 | 2016-11-23 13:25:30 +0530 | [diff] [blame] | 1131 | if (board_is_dra71x_evm()) { |
| 1132 | if (!strcmp(name, "dra71-evm")) |
| 1133 | return 0; |
| 1134 | }else if(board_is_dra72x_revc_or_later()) { |
Mugunthan V N | b8c6b02 | 2016-09-27 13:01:41 +0530 | [diff] [blame] | 1135 | if (!strcmp(name, "dra72-evm-revc")) |
| 1136 | return 0; |
| 1137 | } else if (!strcmp(name, "dra72-evm")) { |
| 1138 | return 0; |
| 1139 | } |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 1140 | } else if (is_dra76x_acd() && !strcmp(name, "dra76-evm")) { |
Lokesh Vutla | 635848f | 2017-08-21 12:51:01 +0530 | [diff] [blame] | 1141 | return 0; |
Lokesh Vutla | 69483e6 | 2017-12-29 11:47:51 +0530 | [diff] [blame] | 1142 | } else if (!is_dra72x() && !is_dra76x_acd() && |
| 1143 | !strcmp(name, "dra7-evm")) { |
Lokesh Vutla | f4de472 | 2016-05-16 10:51:23 +0530 | [diff] [blame] | 1144 | return 0; |
Mugunthan V N | b8c6b02 | 2016-09-27 13:01:41 +0530 | [diff] [blame] | 1145 | } |
| 1146 | |
| 1147 | return -1; |
Lokesh Vutla | f4de472 | 2016-05-16 10:51:23 +0530 | [diff] [blame] | 1148 | } |
| 1149 | #endif |
Andreas Dannenberg | 5cf344b | 2016-06-27 09:19:22 -0500 | [diff] [blame] | 1150 | |
Andrew F. Davis | d355583 | 2019-02-11 08:00:08 -0600 | [diff] [blame] | 1151 | #if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE) |
| 1152 | int fastboot_set_reboot_flag(void) |
| 1153 | { |
| 1154 | printf("Setting reboot to fastboot flag ...\n"); |
| 1155 | env_set("dofastboot", "1"); |
| 1156 | env_save(); |
| 1157 | return 0; |
| 1158 | } |
| 1159 | #endif |
| 1160 | |
Andreas Dannenberg | 5cf344b | 2016-06-27 09:19:22 -0500 | [diff] [blame] | 1161 | #ifdef CONFIG_TI_SECURE_DEVICE |
| 1162 | void board_fit_image_post_process(void **p_image, size_t *p_size) |
| 1163 | { |
| 1164 | secure_boot_verify_image(p_image, p_size); |
| 1165 | } |
Andrew F. Davis | d216a4c | 2016-11-29 16:33:25 -0600 | [diff] [blame] | 1166 | |
| 1167 | void board_tee_image_process(ulong tee_image, size_t tee_size) |
| 1168 | { |
| 1169 | secure_tee_install((u32)tee_image); |
| 1170 | } |
| 1171 | |
| 1172 | U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process); |
Andreas Dannenberg | 5cf344b | 2016-06-27 09:19:22 -0500 | [diff] [blame] | 1173 | #endif |