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