blob: d6a461d9d79919b9cc37dd55a6f5271b6807b942 [file] [log] [blame]
Lokesh Vutla1a9dd212019-06-13 10:29:49 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Board specific initialization for J721E EVM
4 *
Nishanth Menoneaa39c62023-11-01 15:56:03 -05005 * Copyright (C) 2018-2019 Texas Instruments Incorporated - https://www.ti.com/
Lokesh Vutla1a9dd212019-06-13 10:29:49 +05306 * Lokesh Vutla <lokeshvutla@ti.com>
7 *
8 */
9
Aswath Govindraju1e2b4202021-07-21 21:28:39 +053010#include <generic-phy.h>
Simon Glass2dc9c342020-05-10 11:40:01 -060011#include <image.h>
Simon Glass274e0b02020-05-10 11:39:56 -060012#include <net.h>
Andreas Dannenbergd036a212020-01-07 13:15:54 +053013#include <asm/arch/hardware.h>
14#include <asm/gpio.h>
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053015#include <spl.h>
Tero Kristo1a2c7ba2020-02-14 11:18:19 +020016#include <dm.h>
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053017
Andreas Dannenbergd036a212020-01-07 13:15:54 +053018#include "../common/board_detect.h"
19
20#define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \
21 board_ti_k3_is("J721EX-PM2-SOM"))
22
Sinthu Raja1c24ab42022-02-09 15:06:50 +053023#define board_is_j721e_sk() (board_ti_k3_is("J721EX-EAIK") || \
24 board_ti_k3_is("J721EX-SK"))
25
Aswath Govindraju1e2b4202021-07-21 21:28:39 +053026#define board_is_j7200_som() (board_ti_k3_is("J7200X-PM1-SOM") || \
27 board_ti_k3_is("J7200X-PM2-SOM"))
Lokesh Vutlae2af9662020-08-05 22:44:25 +053028
Andreas Dannenbergd036a212020-01-07 13:15:54 +053029/* Max number of MAC addresses that are parsed/processed per daughter card */
30#define DAUGHTER_CARD_NO_OF_MAC_ADDR 8
31
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053032DECLARE_GLOBAL_DATA_PTR;
33
34int board_init(void)
35{
36 return 0;
37}
38
39int dram_init(void)
40{
41#ifdef CONFIG_PHYS_64BIT
42 gd->ram_size = 0x100000000;
43#else
44 gd->ram_size = 0x80000000;
45#endif
46
47 return 0;
48}
49
Heinrich Schuchardt51a9aac2023-08-12 20:16:58 +020050phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053051{
52#ifdef CONFIG_PHYS_64BIT
53 /* Limit RAM used by U-Boot to the DDR low region */
54 if (gd->ram_top > 0x100000000)
55 return 0x100000000;
56#endif
57
58 return gd->ram_top;
59}
60
61int dram_init_banksize(void)
62{
63 /* Bank 0 declares the memory available in the DDR low region */
Tom Rinibb4dd962022-11-16 13:10:37 -050064 gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053065 gd->bd->bi_dram[0].size = 0x80000000;
66 gd->ram_size = 0x80000000;
67
68#ifdef CONFIG_PHYS_64BIT
69 /* Bank 1 declares the memory available in the DDR high region */
Tom Rinibb4dd962022-11-16 13:10:37 -050070 gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053071 gd->bd->bi_dram[1].size = 0x80000000;
72 gd->ram_size = 0x100000000;
73#endif
74
75 return 0;
76}
77
78#ifdef CONFIG_SPL_LOAD_FIT
79int board_fit_config_name_match(const char *name)
80{
Sinthu Raja944ff632022-02-09 15:06:52 +053081 bool eeprom_read = board_ti_was_eeprom_read();
82
83 if (!eeprom_read || board_is_j721e_som()) {
84 if (!strcmp(name, "k3-j721e-common-proc-board") ||
85 !strcmp(name, "k3-j721e-r5-common-proc-board"))
86 return 0;
87 } else if (board_is_j721e_sk()) {
88 if (!strcmp(name, "k3-j721e-sk") ||
89 !strcmp(name, "k3-j721e-r5-sk"))
90 return 0;
91 }
Lokesh Vutla1a9dd212019-06-13 10:29:49 +053092
93 return -1;
94}
95#endif
Suman Anna8eac9e62019-06-13 10:29:50 +053096
Vignesh Raghavendra685d8652020-08-07 00:26:57 +053097#if CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(OF_LIBFDT)
98/* Returns 1, if onboard mux is set to hyperflash */
99static void __maybe_unused detect_enable_hyperflash(void *blob)
100{
101 struct gpio_desc desc = {0};
Vaishnav Achathb8b17442022-05-09 11:50:16 +0530102 char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
Vignesh Raghavendra685d8652020-08-07 00:26:57 +0530103
Vaishnav Achathb8b17442022-05-09 11:50:16 +0530104 if (dm_gpio_lookup_name(hypermux_sel_gpio, &desc))
Vignesh Raghavendra685d8652020-08-07 00:26:57 +0530105 return;
106
Vaishnav Achathb8b17442022-05-09 11:50:16 +0530107 if (dm_gpio_request(&desc, hypermux_sel_gpio))
Vignesh Raghavendra685d8652020-08-07 00:26:57 +0530108 return;
109
110 if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN))
111 return;
112
113 if (dm_gpio_get_value(&desc)) {
114 int offset;
115
116 do_fixup_by_compat(blob, "ti,am654-hbmc", "status",
117 "okay", sizeof("okay"), 0);
118 offset = fdt_node_offset_by_compatible(blob, -1,
Vignesh Raghavendra57b78362020-09-17 16:48:16 +0530119 "ti,am654-ospi");
Vignesh Raghavendra685d8652020-08-07 00:26:57 +0530120 fdt_setprop(blob, offset, "status", "disabled",
121 sizeof("disabled"));
122 }
123}
124#endif
125
Vaishnav Achathb8b17442022-05-09 11:50:16 +0530126#if defined(CONFIG_SPL_BUILD) && (defined(CONFIG_TARGET_J7200_A72_EVM) || defined(CONFIG_TARGET_J7200_R5_EVM) || \
127 defined(CONFIG_TARGET_J721E_A72_EVM) || defined(CONFIG_TARGET_J721E_R5_EVM))
Vignesh Raghavendra4c3c3d22020-08-13 14:56:16 +0530128void spl_perform_fixups(struct spl_image_info *spl_image)
129{
130 detect_enable_hyperflash(spl_image->fdt_addr);
131}
132#endif
133
Suman Anna8eac9e62019-06-13 10:29:50 +0530134#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900135int ft_board_setup(void *blob, struct bd_info *bd)
Suman Anna8eac9e62019-06-13 10:29:50 +0530136{
Vignesh Raghavendra685d8652020-08-07 00:26:57 +0530137 detect_enable_hyperflash(blob);
138
Andrew Davisb1c29792023-04-06 11:38:10 -0500139 return 0;
Suman Anna8eac9e62019-06-13 10:29:50 +0530140}
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530141#endif
142
Lokesh Vutla5a08e652020-08-05 22:44:14 +0530143#ifdef CONFIG_TI_I2C_BOARD_DETECT
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530144int do_board_detect(void)
145{
146 int ret;
147
Sinthu Raja944ff632022-02-09 15:06:52 +0530148 if (board_ti_was_eeprom_read())
149 return 0;
150
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530151 ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
152 CONFIG_EEPROM_CHIP_ADDRESS);
Sinthu Raja812364f2022-02-09 15:06:49 +0530153 if (ret) {
154 printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
155 CONFIG_EEPROM_CHIP_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS + 1);
156 ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
157 CONFIG_EEPROM_CHIP_ADDRESS + 1);
158 if (ret)
159 pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
160 CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
161 }
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530162
163 return ret;
164}
165
Lokesh Vutla1db6b642020-01-07 13:15:55 +0530166int checkboard(void)
167{
168 struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
169
170 if (do_board_detect())
171 /* EEPROM not populated */
172 printf("Board: %s rev %s\n", "J721EX-PM1-SOM", "E2");
173 else
174 printf("Board: %s rev %s\n", ep->name, ep->version);
175
176 return 0;
177}
178
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530179/*
180 * Declaration of daughtercards to probe. Note that when adding more
181 * cards they should be grouped by the 'i2c_addr' field to allow for a
182 * more efficient probing process.
183 */
184static const struct {
185 u8 i2c_addr; /* I2C address of card EEPROM */
186 char *card_name; /* EEPROM-programmed card name */
187 char *dtbo_name; /* Device tree overlay to apply */
188 u8 eth_offset; /* ethXaddr MAC address index offset */
189} ext_cards[] = {
190 {
191 0x51,
192 "J7X-BASE-CPB",
193 "", /* No dtbo for this board */
194 0,
195 },
196 {
197 0x52,
198 "J7X-INFOTAN-EXP",
199 "", /* No dtbo for this board */
200 0,
201 },
202 {
203 0x52,
204 "J7X-GESI-EXP",
205 "", /* No dtbo for this board */
206 5, /* Start populating from eth5addr */
207 },
208 {
209 0x54,
210 "J7X-VSC8514-ETH",
211 "", /* No dtbo for this board */
212 1, /* Start populating from eth1addr */
213 },
214};
215
216static bool daughter_card_detect_flags[ARRAY_SIZE(ext_cards)];
217
218const char *board_fit_get_additionnal_images(int index, const char *type)
219{
220 int i, j;
221
222 if (strcmp(type, FIT_FDT_PROP))
223 return NULL;
224
225 j = 0;
226 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
227 if (daughter_card_detect_flags[i]) {
228 if (j == index) {
229 /*
230 * Return dtbo name only if populated,
231 * otherwise stop parsing here.
232 */
233 if (strlen(ext_cards[i].dtbo_name))
234 return ext_cards[i].dtbo_name;
235 else
236 return NULL;
237 };
238
239 j++;
240 }
241 }
242
243 return NULL;
244}
245
246static int probe_daughtercards(void)
247{
248 char mac_addr[DAUGHTER_CARD_NO_OF_MAC_ADDR][TI_EEPROM_HDR_ETH_ALEN];
249 bool eeprom_read_success;
250 struct ti_am6_eeprom ep;
251 u8 previous_i2c_addr;
252 u8 mac_addr_cnt;
253 int i;
254 int ret;
255
256 /* Mark previous I2C address variable as not populated */
257 previous_i2c_addr = 0xff;
258
259 /* No EEPROM data was read yet */
260 eeprom_read_success = false;
261
262 /* Iterate through list of daughtercards */
263 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
264 /* Obtain card-specific I2C address */
265 u8 i2c_addr = ext_cards[i].i2c_addr;
266
267 /* Read card EEPROM if not already read previously */
268 if (i2c_addr != previous_i2c_addr) {
269 /* Store I2C address so we can avoid reading twice */
270 previous_i2c_addr = i2c_addr;
271
272 /* Get and parse the daughter card EEPROM record */
273 ret = ti_i2c_eeprom_am6_get(CONFIG_EEPROM_BUS_ADDRESS,
274 i2c_addr,
275 &ep,
276 (char **)mac_addr,
277 DAUGHTER_CARD_NO_OF_MAC_ADDR,
278 &mac_addr_cnt);
279 if (ret) {
280 debug("%s: No daughtercard EEPROM at 0x%02x found %d\n",
281 __func__, i2c_addr, ret);
282 eeprom_read_success = false;
283 /* Skip to the next daughtercard to probe */
284 continue;
285 }
286
287 /* EEPROM read successful, okay to further process. */
288 eeprom_read_success = true;
289 }
290
291 /* Only continue processing if EEPROM data was read */
292 if (!eeprom_read_success)
293 continue;
294
295 /* Only process the parsed data if we found a match */
296 if (strncmp(ep.name, ext_cards[i].card_name, sizeof(ep.name)))
297 continue;
298
299 printf("Detected: %s rev %s\n", ep.name, ep.version);
300 daughter_card_detect_flags[i] = true;
301
302#ifndef CONFIG_SPL_BUILD
303 int j;
304 /*
305 * Populate any MAC addresses from daughtercard into the U-Boot
306 * environment, starting with a card-specific offset so we can
307 * have multiple ext_cards contribute to the MAC pool in a well-
308 * defined manner.
309 */
310 for (j = 0; j < mac_addr_cnt; j++) {
311 if (!is_valid_ethaddr((u8 *)mac_addr[j]))
312 continue;
313
314 eth_env_set_enetaddr_by_index("eth",
315 ext_cards[i].eth_offset + j,
316 (uchar *)mac_addr[j]);
317 }
Suman Anna8eac9e62019-06-13 10:29:50 +0530318#endif
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530319 }
320#ifndef CONFIG_SPL_BUILD
321 char name_overlays[1024] = { 0 };
322
323 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
324 if (!daughter_card_detect_flags[i])
325 continue;
326
327 /* Skip if no overlays are to be added */
328 if (!strlen(ext_cards[i].dtbo_name))
329 continue;
330
331 /*
332 * Make sure we are not running out of buffer space by checking
333 * if we can fit the new overlay, a trailing space to be used
334 * as a separator, plus the terminating zero.
335 */
336 if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
337 sizeof(name_overlays))
338 return -ENOMEM;
339
340 /* Append to our list of overlays */
341 strcat(name_overlays, ext_cards[i].dtbo_name);
342 strcat(name_overlays, " ");
343 }
344
345 /* Apply device tree overlay(s) to the U-Boot environment, if any */
346 if (strlen(name_overlays))
347 return env_set("name_overlays", name_overlays);
348#endif
349
350 return 0;
351}
Lokesh Vutla5a08e652020-08-05 22:44:14 +0530352#endif
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530353
Aswath Govindraju1e2b4202021-07-21 21:28:39 +0530354void configure_serdes_torrent(void)
355{
356 struct udevice *dev;
357 struct phy serdes;
358 int ret;
359
360 if (!IS_ENABLED(CONFIG_PHY_CADENCE_TORRENT))
361 return;
362
363 ret = uclass_get_device_by_driver(UCLASS_PHY,
364 DM_DRIVER_GET(torrent_phy_provider),
365 &dev);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530366 if (ret) {
Aswath Govindraju1e2b4202021-07-21 21:28:39 +0530367 printf("Torrent init failed:%d\n", ret);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530368 return;
369 }
Aswath Govindraju1e2b4202021-07-21 21:28:39 +0530370
371 serdes.dev = dev;
372 serdes.id = 0;
373
374 ret = generic_phy_init(&serdes);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530375 if (ret) {
376 printf("phy_init failed!!: %d\n", ret);
377 return;
378 }
Aswath Govindraju1e2b4202021-07-21 21:28:39 +0530379
380 ret = generic_phy_power_on(&serdes);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530381 if (ret) {
382 printf("phy_power_on failed!!: %d\n", ret);
383 return;
384 }
Aswath Govindraju1e2b4202021-07-21 21:28:39 +0530385}
386
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530387void configure_serdes_sierra(void)
388{
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530389 struct udevice *dev, *link_dev;
390 struct phy link;
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530391 int ret, count, i;
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530392 int link_count = 0;
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530393
394 if (!IS_ENABLED(CONFIG_PHY_CADENCE_SIERRA))
395 return;
396
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530397 ret = uclass_get_device_by_driver(UCLASS_MISC,
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530398 DM_DRIVER_GET(sierra_phy_provider),
399 &dev);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530400 if (ret) {
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530401 printf("Sierra init failed:%d\n", ret);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530402 return;
403 }
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530404
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530405 count = device_get_child_count(dev);
406 for (i = 0; i < count; i++) {
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530407 ret = device_get_child(dev, i, &link_dev);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530408 if (ret) {
409 printf("probe of sierra child node %d failed: %d\n", i, ret);
410 return;
411 }
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530412 if (link_dev->driver->id == UCLASS_PHY) {
413 link.dev = link_dev;
414 link.id = link_count++;
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530415
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530416 ret = generic_phy_power_on(&link);
Aswath Govindraju6dc4f6a2022-06-10 18:23:38 +0530417 if (ret) {
418 printf("phy_power_on failed!!: %d\n", ret);
419 return;
420 }
Aswath Govindraju5930ad22022-03-04 17:45:26 +0530421 }
422 }
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530423}
424
Sinthu Rajae861aa92022-02-09 15:06:48 +0530425#ifdef CONFIG_BOARD_LATE_INIT
426static void setup_board_eeprom_env(void)
427{
428 char *name = "j721e";
429
430 if (do_board_detect())
431 goto invalid_eeprom;
432
433 if (board_is_j721e_som())
434 name = "j721e";
Sinthu Raja1c24ab42022-02-09 15:06:50 +0530435 else if (board_is_j721e_sk())
436 name = "j721e-sk";
Sinthu Rajae861aa92022-02-09 15:06:48 +0530437 else if (board_is_j7200_som())
438 name = "j7200";
439 else
440 printf("Unidentified board claims %s in eeprom header\n",
441 board_ti_get_name());
442
443invalid_eeprom:
444 set_board_info_env_am6(name);
445}
446
447static void setup_serial(void)
448{
449 struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
450 unsigned long board_serial;
451 char *endp;
452 char serial_string[17] = { 0 };
453
454 if (env_get("serial#"))
455 return;
456
457 board_serial = hextoul(ep->serial, &endp);
458 if (*endp != '\0') {
459 pr_err("Error: Can't set serial# to %s\n", ep->serial);
460 return;
461 }
462
463 snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
464 env_set("serial#", serial_string);
465}
466
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530467int board_late_init(void)
468{
Lokesh Vutla5a08e652020-08-05 22:44:14 +0530469 if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
470 setup_board_eeprom_env();
471 setup_serial();
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530472
Lokesh Vutla5a08e652020-08-05 22:44:14 +0530473 /* Check for and probe any plugged-in daughtercards */
Sinthu Raja9a4fa302022-02-09 15:06:51 +0530474 if (board_is_j721e_som() || board_is_j7200_som())
475 probe_daughtercards();
Lokesh Vutla5a08e652020-08-05 22:44:14 +0530476 }
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530477
Aswath Govindraju1e2b4202021-07-21 21:28:39 +0530478 if (board_is_j7200_som())
479 configure_serdes_torrent();
480
Aswath Govindrajua2775f32022-01-28 13:41:38 +0530481 if (board_is_j721e_som())
482 configure_serdes_sierra();
483
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530484 return 0;
485}
Sinthu Rajae861aa92022-02-09 15:06:48 +0530486#endif
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530487
Vaishnav Achathb8b17442022-05-09 11:50:16 +0530488static int __maybe_unused detect_SW3_1_state(void)
489{
490 if (IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) {
491 struct gpio_desc desc = {0};
492 int ret;
493 char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
494
495 ret = dm_gpio_lookup_name(hypermux_sel_gpio, &desc);
496 if (ret) {
497 printf("error getting GPIO lookup name: %d\n", ret);
498 return ret;
499 }
500
501 ret = dm_gpio_request(&desc, hypermux_sel_gpio);
502 if (ret) {
503 printf("error requesting GPIO: %d\n", ret);
504 goto err_free_gpio;
505 }
506
507 ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN);
508 if (ret) {
509 printf("error setting direction flag of GPIO: %d\n", ret);
510 goto err_free_gpio;
511 }
512
513 ret = dm_gpio_get_value(&desc);
514 if (ret < 0)
515 printf("error getting value of GPIO: %d\n", ret);
516
517err_free_gpio:
518 dm_gpio_free(desc.dev, &desc);
519 return ret;
520 }
521}
522
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530523void spl_board_init(void)
524{
Tero Kristo1a2c7ba2020-02-14 11:18:19 +0200525#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
526 struct udevice *dev;
527 int ret;
528#endif
529
Lokesh Vutla046ad432020-08-05 22:44:24 +0530530 if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) ||
531 IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) &&
Sinthu Raja9a4fa302022-02-09 15:06:51 +0530532 IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
533 if (!board_is_j721e_sk())
534 probe_daughtercards();
535 }
Tero Kristo1a2c7ba2020-02-14 11:18:19 +0200536
537#ifdef CONFIG_ESM_K3
538 if (board_ti_k3_is("J721EX-PM2-SOM")) {
539 ret = uclass_get_device_by_driver(UCLASS_MISC,
Simon Glass65130cd2020-12-28 20:34:56 -0700540 DM_DRIVER_GET(k3_esm), &dev);
Tero Kristo1a2c7ba2020-02-14 11:18:19 +0200541 if (ret)
542 printf("ESM init failed: %d\n", ret);
543 }
544#endif
545
546#ifdef CONFIG_ESM_PMIC
547 if (board_ti_k3_is("J721EX-PM2-SOM")) {
548 ret = uclass_get_device_by_driver(UCLASS_MISC,
Simon Glass65130cd2020-12-28 20:34:56 -0700549 DM_DRIVER_GET(pmic_esm),
Tero Kristo1a2c7ba2020-02-14 11:18:19 +0200550 &dev);
551 if (ret)
552 printf("ESM PMIC init failed: %d\n", ret);
553 }
554#endif
Vaishnav Achathb8b17442022-05-09 11:50:16 +0530555 if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) &&
556 IS_ENABLED(CONFIG_HBMC_AM654)) {
557 struct udevice *dev;
558 int ret;
559
560 ret = detect_SW3_1_state();
561 if (ret == 1) {
562 ret = uclass_get_device_by_driver(UCLASS_MTD,
563 DM_DRIVER_GET(hbmc_am654),
564 &dev);
565 if (ret)
566 debug("Failed to probe hyperflash\n");
567 }
568 }
Andreas Dannenbergd036a212020-01-07 13:15:54 +0530569}