blob: 00ce009d3e850049b485ad607be92be6dcf55932 [file] [log] [blame]
Lokesh Vutlaf8185032019-06-13 10:29:49 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Board specific initialization for J721E EVM
4 *
5 * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
6 * Lokesh Vutla <lokeshvutla@ti.com>
7 *
8 */
9
10#include <common.h>
Simon Glass09140112020-05-10 11:40:03 -060011#include <env.h>
Simon Glass4d72caa2020-05-10 11:40:01 -060012#include <fdt_support.h>
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +053013#include <generic-phy.h>
Simon Glass4d72caa2020-05-10 11:40:01 -060014#include <image.h>
Simon Glass67c4e9f2019-11-14 12:57:45 -070015#include <init.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060016#include <log.h>
Simon Glass90526e92020-05-10 11:39:56 -060017#include <net.h>
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053018#include <asm/arch/sys_proto.h>
19#include <asm/arch/hardware.h>
Simon Glass401d1c42020-10-30 21:38:53 -060020#include <asm/global_data.h>
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053021#include <asm/gpio.h>
Lokesh Vutlaf8185032019-06-13 10:29:49 +053022#include <asm/io.h>
23#include <spl.h>
Suman Annad146af52019-06-13 10:29:50 +053024#include <asm/arch/sys_proto.h>
Tero Kristofa281f62020-02-14 11:18:19 +020025#include <dm.h>
26#include <dm/uclass-internal.h>
Lokesh Vutlaf8185032019-06-13 10:29:49 +053027
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053028#include "../common/board_detect.h"
29
30#define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \
31 board_ti_k3_is("J721EX-PM2-SOM"))
32
Sinthu Rajadfb24292022-02-09 15:06:50 +053033#define board_is_j721e_sk() (board_ti_k3_is("J721EX-EAIK") || \
34 board_ti_k3_is("J721EX-SK"))
35
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +053036#define board_is_j7200_som() (board_ti_k3_is("J7200X-PM1-SOM") || \
37 board_ti_k3_is("J7200X-PM2-SOM"))
Lokesh Vutla2cf09d72020-08-05 22:44:25 +053038
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053039/* Max number of MAC addresses that are parsed/processed per daughter card */
40#define DAUGHTER_CARD_NO_OF_MAC_ADDR 8
41
Lokesh Vutlaf8185032019-06-13 10:29:49 +053042DECLARE_GLOBAL_DATA_PTR;
43
44int board_init(void)
45{
46 return 0;
47}
48
49int dram_init(void)
50{
51#ifdef CONFIG_PHYS_64BIT
52 gd->ram_size = 0x100000000;
53#else
54 gd->ram_size = 0x80000000;
55#endif
56
57 return 0;
58}
59
Pali Rohár049704f2022-09-09 17:32:40 +020060phys_size_t board_get_usable_ram_top(phys_size_t total_size)
Lokesh Vutlaf8185032019-06-13 10:29:49 +053061{
62#ifdef CONFIG_PHYS_64BIT
63 /* Limit RAM used by U-Boot to the DDR low region */
64 if (gd->ram_top > 0x100000000)
65 return 0x100000000;
66#endif
67
68 return gd->ram_top;
69}
70
71int dram_init_banksize(void)
72{
73 /* Bank 0 declares the memory available in the DDR low region */
Tom Riniaa6e94d2022-11-16 13:10:37 -050074 gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
Lokesh Vutlaf8185032019-06-13 10:29:49 +053075 gd->bd->bi_dram[0].size = 0x80000000;
76 gd->ram_size = 0x80000000;
77
78#ifdef CONFIG_PHYS_64BIT
79 /* Bank 1 declares the memory available in the DDR high region */
Tom Riniaa6e94d2022-11-16 13:10:37 -050080 gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
Lokesh Vutlaf8185032019-06-13 10:29:49 +053081 gd->bd->bi_dram[1].size = 0x80000000;
82 gd->ram_size = 0x100000000;
83#endif
84
85 return 0;
86}
87
88#ifdef CONFIG_SPL_LOAD_FIT
89int board_fit_config_name_match(const char *name)
90{
Sinthu Rajad8004912022-02-09 15:06:52 +053091 bool eeprom_read = board_ti_was_eeprom_read();
92
93 if (!eeprom_read || board_is_j721e_som()) {
94 if (!strcmp(name, "k3-j721e-common-proc-board") ||
95 !strcmp(name, "k3-j721e-r5-common-proc-board"))
96 return 0;
97 } else if (board_is_j721e_sk()) {
98 if (!strcmp(name, "k3-j721e-sk") ||
99 !strcmp(name, "k3-j721e-r5-sk"))
100 return 0;
101 }
Lokesh Vutlaf8185032019-06-13 10:29:49 +0530102
103 return -1;
104}
105#endif
Suman Annad146af52019-06-13 10:29:50 +0530106
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530107#if CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(OF_LIBFDT)
108/* Returns 1, if onboard mux is set to hyperflash */
109static void __maybe_unused detect_enable_hyperflash(void *blob)
110{
111 struct gpio_desc desc = {0};
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530112 char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530113
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530114 if (dm_gpio_lookup_name(hypermux_sel_gpio, &desc))
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530115 return;
116
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530117 if (dm_gpio_request(&desc, hypermux_sel_gpio))
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530118 return;
119
120 if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN))
121 return;
122
123 if (dm_gpio_get_value(&desc)) {
124 int offset;
125
126 do_fixup_by_compat(blob, "ti,am654-hbmc", "status",
127 "okay", sizeof("okay"), 0);
128 offset = fdt_node_offset_by_compatible(blob, -1,
Vignesh Raghavendra5a8a7a92020-09-17 16:48:16 +0530129 "ti,am654-ospi");
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530130 fdt_setprop(blob, offset, "status", "disabled",
131 sizeof("disabled"));
132 }
133}
134#endif
135
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530136#if defined(CONFIG_SPL_BUILD) && (defined(CONFIG_TARGET_J7200_A72_EVM) || defined(CONFIG_TARGET_J7200_R5_EVM) || \
137 defined(CONFIG_TARGET_J721E_A72_EVM) || defined(CONFIG_TARGET_J721E_R5_EVM))
Vignesh Raghavendrae85382f2020-08-13 14:56:16 +0530138void spl_perform_fixups(struct spl_image_info *spl_image)
139{
140 detect_enable_hyperflash(spl_image->fdt_addr);
141}
142#endif
143
Suman Annad146af52019-06-13 10:29:50 +0530144#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
Masahiro Yamadab75d8dc2020-06-26 15:13:33 +0900145int ft_board_setup(void *blob, struct bd_info *bd)
Suman Annad146af52019-06-13 10:29:50 +0530146{
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530147 detect_enable_hyperflash(blob);
148
Andrew Davis30e96a22023-04-06 11:38:10 -0500149 return 0;
Suman Annad146af52019-06-13 10:29:50 +0530150}
151#endif
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530152
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530153#ifdef CONFIG_TI_I2C_BOARD_DETECT
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530154int do_board_detect(void)
155{
156 int ret;
157
Sinthu Rajad8004912022-02-09 15:06:52 +0530158 if (board_ti_was_eeprom_read())
159 return 0;
160
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530161 ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
162 CONFIG_EEPROM_CHIP_ADDRESS);
Sinthu Rajaa46c5282022-02-09 15:06:49 +0530163 if (ret) {
164 printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
165 CONFIG_EEPROM_CHIP_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS + 1);
166 ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
167 CONFIG_EEPROM_CHIP_ADDRESS + 1);
168 if (ret)
169 pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
170 CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
171 }
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530172
173 return ret;
174}
175
Lokesh Vutlac7068ab2020-01-07 13:15:55 +0530176int checkboard(void)
177{
178 struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
179
180 if (do_board_detect())
181 /* EEPROM not populated */
182 printf("Board: %s rev %s\n", "J721EX-PM1-SOM", "E2");
183 else
184 printf("Board: %s rev %s\n", ep->name, ep->version);
185
186 return 0;
187}
188
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530189/*
190 * Declaration of daughtercards to probe. Note that when adding more
191 * cards they should be grouped by the 'i2c_addr' field to allow for a
192 * more efficient probing process.
193 */
194static const struct {
195 u8 i2c_addr; /* I2C address of card EEPROM */
196 char *card_name; /* EEPROM-programmed card name */
197 char *dtbo_name; /* Device tree overlay to apply */
198 u8 eth_offset; /* ethXaddr MAC address index offset */
199} ext_cards[] = {
200 {
201 0x51,
202 "J7X-BASE-CPB",
203 "", /* No dtbo for this board */
204 0,
205 },
206 {
207 0x52,
208 "J7X-INFOTAN-EXP",
209 "", /* No dtbo for this board */
210 0,
211 },
212 {
213 0x52,
214 "J7X-GESI-EXP",
215 "", /* No dtbo for this board */
216 5, /* Start populating from eth5addr */
217 },
218 {
219 0x54,
220 "J7X-VSC8514-ETH",
221 "", /* No dtbo for this board */
222 1, /* Start populating from eth1addr */
223 },
224};
225
226static bool daughter_card_detect_flags[ARRAY_SIZE(ext_cards)];
227
228const char *board_fit_get_additionnal_images(int index, const char *type)
229{
230 int i, j;
231
232 if (strcmp(type, FIT_FDT_PROP))
233 return NULL;
234
235 j = 0;
236 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
237 if (daughter_card_detect_flags[i]) {
238 if (j == index) {
239 /*
240 * Return dtbo name only if populated,
241 * otherwise stop parsing here.
242 */
243 if (strlen(ext_cards[i].dtbo_name))
244 return ext_cards[i].dtbo_name;
245 else
246 return NULL;
247 };
248
249 j++;
250 }
251 }
252
253 return NULL;
254}
255
256static int probe_daughtercards(void)
257{
258 char mac_addr[DAUGHTER_CARD_NO_OF_MAC_ADDR][TI_EEPROM_HDR_ETH_ALEN];
259 bool eeprom_read_success;
260 struct ti_am6_eeprom ep;
261 u8 previous_i2c_addr;
262 u8 mac_addr_cnt;
263 int i;
264 int ret;
265
266 /* Mark previous I2C address variable as not populated */
267 previous_i2c_addr = 0xff;
268
269 /* No EEPROM data was read yet */
270 eeprom_read_success = false;
271
272 /* Iterate through list of daughtercards */
273 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
274 /* Obtain card-specific I2C address */
275 u8 i2c_addr = ext_cards[i].i2c_addr;
276
277 /* Read card EEPROM if not already read previously */
278 if (i2c_addr != previous_i2c_addr) {
279 /* Store I2C address so we can avoid reading twice */
280 previous_i2c_addr = i2c_addr;
281
282 /* Get and parse the daughter card EEPROM record */
283 ret = ti_i2c_eeprom_am6_get(CONFIG_EEPROM_BUS_ADDRESS,
284 i2c_addr,
285 &ep,
286 (char **)mac_addr,
287 DAUGHTER_CARD_NO_OF_MAC_ADDR,
288 &mac_addr_cnt);
289 if (ret) {
290 debug("%s: No daughtercard EEPROM at 0x%02x found %d\n",
291 __func__, i2c_addr, ret);
292 eeprom_read_success = false;
293 /* Skip to the next daughtercard to probe */
294 continue;
295 }
296
297 /* EEPROM read successful, okay to further process. */
298 eeprom_read_success = true;
299 }
300
301 /* Only continue processing if EEPROM data was read */
302 if (!eeprom_read_success)
303 continue;
304
305 /* Only process the parsed data if we found a match */
306 if (strncmp(ep.name, ext_cards[i].card_name, sizeof(ep.name)))
307 continue;
308
309 printf("Detected: %s rev %s\n", ep.name, ep.version);
310 daughter_card_detect_flags[i] = true;
311
312#ifndef CONFIG_SPL_BUILD
313 int j;
314 /*
315 * Populate any MAC addresses from daughtercard into the U-Boot
316 * environment, starting with a card-specific offset so we can
317 * have multiple ext_cards contribute to the MAC pool in a well-
318 * defined manner.
319 */
320 for (j = 0; j < mac_addr_cnt; j++) {
321 if (!is_valid_ethaddr((u8 *)mac_addr[j]))
322 continue;
323
324 eth_env_set_enetaddr_by_index("eth",
325 ext_cards[i].eth_offset + j,
326 (uchar *)mac_addr[j]);
327 }
328#endif
329 }
330#ifndef CONFIG_SPL_BUILD
331 char name_overlays[1024] = { 0 };
332
333 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
334 if (!daughter_card_detect_flags[i])
335 continue;
336
337 /* Skip if no overlays are to be added */
338 if (!strlen(ext_cards[i].dtbo_name))
339 continue;
340
341 /*
342 * Make sure we are not running out of buffer space by checking
343 * if we can fit the new overlay, a trailing space to be used
344 * as a separator, plus the terminating zero.
345 */
346 if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
347 sizeof(name_overlays))
348 return -ENOMEM;
349
350 /* Append to our list of overlays */
351 strcat(name_overlays, ext_cards[i].dtbo_name);
352 strcat(name_overlays, " ");
353 }
354
355 /* Apply device tree overlay(s) to the U-Boot environment, if any */
356 if (strlen(name_overlays))
357 return env_set("name_overlays", name_overlays);
358#endif
359
360 return 0;
361}
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530362#endif
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530363
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530364void configure_serdes_torrent(void)
365{
366 struct udevice *dev;
367 struct phy serdes;
368 int ret;
369
370 if (!IS_ENABLED(CONFIG_PHY_CADENCE_TORRENT))
371 return;
372
373 ret = uclass_get_device_by_driver(UCLASS_PHY,
374 DM_DRIVER_GET(torrent_phy_provider),
375 &dev);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530376 if (ret) {
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530377 printf("Torrent init failed:%d\n", ret);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530378 return;
379 }
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530380
381 serdes.dev = dev;
382 serdes.id = 0;
383
384 ret = generic_phy_init(&serdes);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530385 if (ret) {
386 printf("phy_init failed!!: %d\n", ret);
387 return;
388 }
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530389
390 ret = generic_phy_power_on(&serdes);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530391 if (ret) {
392 printf("phy_power_on failed!!: %d\n", ret);
393 return;
394 }
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530395}
396
Aswath Govindrajub3614432022-01-28 13:41:38 +0530397void configure_serdes_sierra(void)
398{
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530399 struct udevice *dev, *link_dev;
400 struct phy link;
Aswath Govindrajub3614432022-01-28 13:41:38 +0530401 int ret, count, i;
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530402 int link_count = 0;
Aswath Govindrajub3614432022-01-28 13:41:38 +0530403
404 if (!IS_ENABLED(CONFIG_PHY_CADENCE_SIERRA))
405 return;
406
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530407 ret = uclass_get_device_by_driver(UCLASS_MISC,
Aswath Govindrajub3614432022-01-28 13:41:38 +0530408 DM_DRIVER_GET(sierra_phy_provider),
409 &dev);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530410 if (ret) {
Aswath Govindrajub3614432022-01-28 13:41:38 +0530411 printf("Sierra init failed:%d\n", ret);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530412 return;
413 }
Aswath Govindrajub3614432022-01-28 13:41:38 +0530414
Aswath Govindrajub3614432022-01-28 13:41:38 +0530415 count = device_get_child_count(dev);
416 for (i = 0; i < count; i++) {
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530417 ret = device_get_child(dev, i, &link_dev);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530418 if (ret) {
419 printf("probe of sierra child node %d failed: %d\n", i, ret);
420 return;
421 }
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530422 if (link_dev->driver->id == UCLASS_PHY) {
423 link.dev = link_dev;
424 link.id = link_count++;
425
426 ret = generic_phy_power_on(&link);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530427 if (ret) {
428 printf("phy_power_on failed!!: %d\n", ret);
429 return;
430 }
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530431 }
Aswath Govindrajub3614432022-01-28 13:41:38 +0530432 }
Aswath Govindrajub3614432022-01-28 13:41:38 +0530433}
434
Sinthu Rajad948fc42022-02-09 15:06:48 +0530435#ifdef CONFIG_BOARD_LATE_INIT
436static void setup_board_eeprom_env(void)
437{
438 char *name = "j721e";
439
440 if (do_board_detect())
441 goto invalid_eeprom;
442
443 if (board_is_j721e_som())
444 name = "j721e";
Sinthu Rajadfb24292022-02-09 15:06:50 +0530445 else if (board_is_j721e_sk())
446 name = "j721e-sk";
Sinthu Rajad948fc42022-02-09 15:06:48 +0530447 else if (board_is_j7200_som())
448 name = "j7200";
449 else
450 printf("Unidentified board claims %s in eeprom header\n",
451 board_ti_get_name());
452
453invalid_eeprom:
454 set_board_info_env_am6(name);
455}
456
457static void setup_serial(void)
458{
459 struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
460 unsigned long board_serial;
461 char *endp;
462 char serial_string[17] = { 0 };
463
464 if (env_get("serial#"))
465 return;
466
467 board_serial = hextoul(ep->serial, &endp);
468 if (*endp != '\0') {
469 pr_err("Error: Can't set serial# to %s\n", ep->serial);
470 return;
471 }
472
473 snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
474 env_set("serial#", serial_string);
475}
476
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530477int board_late_init(void)
478{
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530479 if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
480 setup_board_eeprom_env();
481 setup_serial();
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530482
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530483 /* Check for and probe any plugged-in daughtercards */
Sinthu Rajaee59fa42022-02-09 15:06:51 +0530484 if (board_is_j721e_som() || board_is_j7200_som())
485 probe_daughtercards();
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530486 }
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530487
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530488 if (board_is_j7200_som())
489 configure_serdes_torrent();
490
Aswath Govindrajub3614432022-01-28 13:41:38 +0530491 if (board_is_j721e_som())
492 configure_serdes_sierra();
493
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530494 return 0;
495}
Sinthu Rajad948fc42022-02-09 15:06:48 +0530496#endif
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530497
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530498static int __maybe_unused detect_SW3_1_state(void)
499{
500 if (IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) {
501 struct gpio_desc desc = {0};
502 int ret;
503 char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
504
505 ret = dm_gpio_lookup_name(hypermux_sel_gpio, &desc);
506 if (ret) {
507 printf("error getting GPIO lookup name: %d\n", ret);
508 return ret;
509 }
510
511 ret = dm_gpio_request(&desc, hypermux_sel_gpio);
512 if (ret) {
513 printf("error requesting GPIO: %d\n", ret);
514 goto err_free_gpio;
515 }
516
517 ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN);
518 if (ret) {
519 printf("error setting direction flag of GPIO: %d\n", ret);
520 goto err_free_gpio;
521 }
522
523 ret = dm_gpio_get_value(&desc);
524 if (ret < 0)
525 printf("error getting value of GPIO: %d\n", ret);
526
527err_free_gpio:
528 dm_gpio_free(desc.dev, &desc);
529 return ret;
530 }
531}
532
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530533void spl_board_init(void)
534{
Tero Kristofa281f62020-02-14 11:18:19 +0200535#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
536 struct udevice *dev;
537 int ret;
538#endif
539
Lokesh Vutlacf1d6862020-08-05 22:44:24 +0530540 if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) ||
541 IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) &&
Sinthu Rajaee59fa42022-02-09 15:06:51 +0530542 IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
543 if (!board_is_j721e_sk())
544 probe_daughtercards();
545 }
Tero Kristofa281f62020-02-14 11:18:19 +0200546
547#ifdef CONFIG_ESM_K3
548 if (board_ti_k3_is("J721EX-PM2-SOM")) {
549 ret = uclass_get_device_by_driver(UCLASS_MISC,
Simon Glass65e25be2020-12-28 20:34:56 -0700550 DM_DRIVER_GET(k3_esm), &dev);
Tero Kristofa281f62020-02-14 11:18:19 +0200551 if (ret)
552 printf("ESM init failed: %d\n", ret);
553 }
554#endif
555
556#ifdef CONFIG_ESM_PMIC
557 if (board_ti_k3_is("J721EX-PM2-SOM")) {
558 ret = uclass_get_device_by_driver(UCLASS_MISC,
Simon Glass65e25be2020-12-28 20:34:56 -0700559 DM_DRIVER_GET(pmic_esm),
Tero Kristofa281f62020-02-14 11:18:19 +0200560 &dev);
561 if (ret)
562 printf("ESM PMIC init failed: %d\n", ret);
563 }
564#endif
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530565 if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) &&
566 IS_ENABLED(CONFIG_HBMC_AM654)) {
567 struct udevice *dev;
568 int ret;
569
570 ret = detect_SW3_1_state();
571 if (ret == 1) {
572 ret = uclass_get_device_by_driver(UCLASS_MTD,
573 DM_DRIVER_GET(hbmc_am654),
574 &dev);
575 if (ret)
576 debug("Failed to probe hyperflash\n");
577 }
578 }
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530579}