blob: d4f7c1d9f938ac010718967f142b2a2f4c97e83a [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/hardware.h>
Simon Glass401d1c42020-10-30 21:38:53 -060019#include <asm/global_data.h>
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053020#include <asm/gpio.h>
Lokesh Vutlaf8185032019-06-13 10:29:49 +053021#include <asm/io.h>
22#include <spl.h>
Tero Kristofa281f62020-02-14 11:18:19 +020023#include <dm.h>
24#include <dm/uclass-internal.h>
Simon Glass1e94b462023-09-14 18:21:46 -060025#include <linux/printk.h>
Lokesh Vutlaf8185032019-06-13 10:29:49 +053026
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053027#include "../common/board_detect.h"
28
29#define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \
30 board_ti_k3_is("J721EX-PM2-SOM"))
31
Sinthu Rajadfb24292022-02-09 15:06:50 +053032#define board_is_j721e_sk() (board_ti_k3_is("J721EX-EAIK") || \
33 board_ti_k3_is("J721EX-SK"))
34
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +053035#define board_is_j7200_som() (board_ti_k3_is("J7200X-PM1-SOM") || \
36 board_ti_k3_is("J7200X-PM2-SOM"))
Lokesh Vutla2cf09d72020-08-05 22:44:25 +053037
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +053038/* Max number of MAC addresses that are parsed/processed per daughter card */
39#define DAUGHTER_CARD_NO_OF_MAC_ADDR 8
40
Lokesh Vutlaf8185032019-06-13 10:29:49 +053041DECLARE_GLOBAL_DATA_PTR;
42
43int board_init(void)
44{
45 return 0;
46}
47
48int dram_init(void)
49{
50#ifdef CONFIG_PHYS_64BIT
51 gd->ram_size = 0x100000000;
52#else
53 gd->ram_size = 0x80000000;
54#endif
55
56 return 0;
57}
58
Heinrich Schuchardtd768dd82023-08-12 20:16:58 +020059phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
Lokesh Vutlaf8185032019-06-13 10:29:49 +053060{
61#ifdef CONFIG_PHYS_64BIT
62 /* Limit RAM used by U-Boot to the DDR low region */
63 if (gd->ram_top > 0x100000000)
64 return 0x100000000;
65#endif
66
67 return gd->ram_top;
68}
69
70int dram_init_banksize(void)
71{
72 /* Bank 0 declares the memory available in the DDR low region */
Tom Riniaa6e94d2022-11-16 13:10:37 -050073 gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
Lokesh Vutlaf8185032019-06-13 10:29:49 +053074 gd->bd->bi_dram[0].size = 0x80000000;
75 gd->ram_size = 0x80000000;
76
77#ifdef CONFIG_PHYS_64BIT
78 /* Bank 1 declares the memory available in the DDR high region */
Tom Riniaa6e94d2022-11-16 13:10:37 -050079 gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
Lokesh Vutlaf8185032019-06-13 10:29:49 +053080 gd->bd->bi_dram[1].size = 0x80000000;
81 gd->ram_size = 0x100000000;
82#endif
83
84 return 0;
85}
86
87#ifdef CONFIG_SPL_LOAD_FIT
88int board_fit_config_name_match(const char *name)
89{
Sinthu Rajad8004912022-02-09 15:06:52 +053090 bool eeprom_read = board_ti_was_eeprom_read();
91
92 if (!eeprom_read || board_is_j721e_som()) {
93 if (!strcmp(name, "k3-j721e-common-proc-board") ||
94 !strcmp(name, "k3-j721e-r5-common-proc-board"))
95 return 0;
96 } else if (board_is_j721e_sk()) {
97 if (!strcmp(name, "k3-j721e-sk") ||
98 !strcmp(name, "k3-j721e-r5-sk"))
99 return 0;
100 }
Lokesh Vutlaf8185032019-06-13 10:29:49 +0530101
102 return -1;
103}
104#endif
Suman Annad146af52019-06-13 10:29:50 +0530105
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530106#if CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(OF_LIBFDT)
107/* Returns 1, if onboard mux is set to hyperflash */
108static void __maybe_unused detect_enable_hyperflash(void *blob)
109{
110 struct gpio_desc desc = {0};
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530111 char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530112
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530113 if (dm_gpio_lookup_name(hypermux_sel_gpio, &desc))
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530114 return;
115
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530116 if (dm_gpio_request(&desc, hypermux_sel_gpio))
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530117 return;
118
119 if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN))
120 return;
121
122 if (dm_gpio_get_value(&desc)) {
123 int offset;
124
125 do_fixup_by_compat(blob, "ti,am654-hbmc", "status",
126 "okay", sizeof("okay"), 0);
127 offset = fdt_node_offset_by_compatible(blob, -1,
Vignesh Raghavendra5a8a7a92020-09-17 16:48:16 +0530128 "ti,am654-ospi");
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530129 fdt_setprop(blob, offset, "status", "disabled",
130 sizeof("disabled"));
131 }
132}
133#endif
134
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530135#if defined(CONFIG_SPL_BUILD) && (defined(CONFIG_TARGET_J7200_A72_EVM) || defined(CONFIG_TARGET_J7200_R5_EVM) || \
136 defined(CONFIG_TARGET_J721E_A72_EVM) || defined(CONFIG_TARGET_J721E_R5_EVM))
Vignesh Raghavendrae85382f2020-08-13 14:56:16 +0530137void spl_perform_fixups(struct spl_image_info *spl_image)
138{
139 detect_enable_hyperflash(spl_image->fdt_addr);
140}
141#endif
142
Suman Annad146af52019-06-13 10:29:50 +0530143#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
Masahiro Yamadab75d8dc2020-06-26 15:13:33 +0900144int ft_board_setup(void *blob, struct bd_info *bd)
Suman Annad146af52019-06-13 10:29:50 +0530145{
Vignesh Raghavendrad2bc9872020-08-07 00:26:57 +0530146 detect_enable_hyperflash(blob);
147
Andrew Davis30e96a22023-04-06 11:38:10 -0500148 return 0;
Suman Annad146af52019-06-13 10:29:50 +0530149}
150#endif
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530151
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530152#ifdef CONFIG_TI_I2C_BOARD_DETECT
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530153int do_board_detect(void)
154{
155 int ret;
156
Sinthu Rajad8004912022-02-09 15:06:52 +0530157 if (board_ti_was_eeprom_read())
158 return 0;
159
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530160 ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
161 CONFIG_EEPROM_CHIP_ADDRESS);
Sinthu Rajaa46c5282022-02-09 15:06:49 +0530162 if (ret) {
163 printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
164 CONFIG_EEPROM_CHIP_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS + 1);
165 ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
166 CONFIG_EEPROM_CHIP_ADDRESS + 1);
167 if (ret)
168 pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
169 CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
170 }
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530171
172 return ret;
173}
174
Lokesh Vutlac7068ab2020-01-07 13:15:55 +0530175int checkboard(void)
176{
177 struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
178
179 if (do_board_detect())
180 /* EEPROM not populated */
181 printf("Board: %s rev %s\n", "J721EX-PM1-SOM", "E2");
182 else
183 printf("Board: %s rev %s\n", ep->name, ep->version);
184
185 return 0;
186}
187
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530188/*
189 * Declaration of daughtercards to probe. Note that when adding more
190 * cards they should be grouped by the 'i2c_addr' field to allow for a
191 * more efficient probing process.
192 */
193static const struct {
194 u8 i2c_addr; /* I2C address of card EEPROM */
195 char *card_name; /* EEPROM-programmed card name */
196 char *dtbo_name; /* Device tree overlay to apply */
197 u8 eth_offset; /* ethXaddr MAC address index offset */
198} ext_cards[] = {
199 {
200 0x51,
201 "J7X-BASE-CPB",
202 "", /* No dtbo for this board */
203 0,
204 },
205 {
206 0x52,
207 "J7X-INFOTAN-EXP",
208 "", /* No dtbo for this board */
209 0,
210 },
211 {
212 0x52,
213 "J7X-GESI-EXP",
214 "", /* No dtbo for this board */
215 5, /* Start populating from eth5addr */
216 },
217 {
218 0x54,
219 "J7X-VSC8514-ETH",
220 "", /* No dtbo for this board */
221 1, /* Start populating from eth1addr */
222 },
223};
224
225static bool daughter_card_detect_flags[ARRAY_SIZE(ext_cards)];
226
227const char *board_fit_get_additionnal_images(int index, const char *type)
228{
229 int i, j;
230
231 if (strcmp(type, FIT_FDT_PROP))
232 return NULL;
233
234 j = 0;
235 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
236 if (daughter_card_detect_flags[i]) {
237 if (j == index) {
238 /*
239 * Return dtbo name only if populated,
240 * otherwise stop parsing here.
241 */
242 if (strlen(ext_cards[i].dtbo_name))
243 return ext_cards[i].dtbo_name;
244 else
245 return NULL;
246 };
247
248 j++;
249 }
250 }
251
252 return NULL;
253}
254
255static int probe_daughtercards(void)
256{
257 char mac_addr[DAUGHTER_CARD_NO_OF_MAC_ADDR][TI_EEPROM_HDR_ETH_ALEN];
258 bool eeprom_read_success;
259 struct ti_am6_eeprom ep;
260 u8 previous_i2c_addr;
261 u8 mac_addr_cnt;
262 int i;
263 int ret;
264
265 /* Mark previous I2C address variable as not populated */
266 previous_i2c_addr = 0xff;
267
268 /* No EEPROM data was read yet */
269 eeprom_read_success = false;
270
271 /* Iterate through list of daughtercards */
272 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
273 /* Obtain card-specific I2C address */
274 u8 i2c_addr = ext_cards[i].i2c_addr;
275
276 /* Read card EEPROM if not already read previously */
277 if (i2c_addr != previous_i2c_addr) {
278 /* Store I2C address so we can avoid reading twice */
279 previous_i2c_addr = i2c_addr;
280
281 /* Get and parse the daughter card EEPROM record */
282 ret = ti_i2c_eeprom_am6_get(CONFIG_EEPROM_BUS_ADDRESS,
283 i2c_addr,
284 &ep,
285 (char **)mac_addr,
286 DAUGHTER_CARD_NO_OF_MAC_ADDR,
287 &mac_addr_cnt);
288 if (ret) {
289 debug("%s: No daughtercard EEPROM at 0x%02x found %d\n",
290 __func__, i2c_addr, ret);
291 eeprom_read_success = false;
292 /* Skip to the next daughtercard to probe */
293 continue;
294 }
295
296 /* EEPROM read successful, okay to further process. */
297 eeprom_read_success = true;
298 }
299
300 /* Only continue processing if EEPROM data was read */
301 if (!eeprom_read_success)
302 continue;
303
304 /* Only process the parsed data if we found a match */
305 if (strncmp(ep.name, ext_cards[i].card_name, sizeof(ep.name)))
306 continue;
307
308 printf("Detected: %s rev %s\n", ep.name, ep.version);
309 daughter_card_detect_flags[i] = true;
310
311#ifndef CONFIG_SPL_BUILD
312 int j;
313 /*
314 * Populate any MAC addresses from daughtercard into the U-Boot
315 * environment, starting with a card-specific offset so we can
316 * have multiple ext_cards contribute to the MAC pool in a well-
317 * defined manner.
318 */
319 for (j = 0; j < mac_addr_cnt; j++) {
320 if (!is_valid_ethaddr((u8 *)mac_addr[j]))
321 continue;
322
323 eth_env_set_enetaddr_by_index("eth",
324 ext_cards[i].eth_offset + j,
325 (uchar *)mac_addr[j]);
326 }
327#endif
328 }
329#ifndef CONFIG_SPL_BUILD
330 char name_overlays[1024] = { 0 };
331
332 for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
333 if (!daughter_card_detect_flags[i])
334 continue;
335
336 /* Skip if no overlays are to be added */
337 if (!strlen(ext_cards[i].dtbo_name))
338 continue;
339
340 /*
341 * Make sure we are not running out of buffer space by checking
342 * if we can fit the new overlay, a trailing space to be used
343 * as a separator, plus the terminating zero.
344 */
345 if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
346 sizeof(name_overlays))
347 return -ENOMEM;
348
349 /* Append to our list of overlays */
350 strcat(name_overlays, ext_cards[i].dtbo_name);
351 strcat(name_overlays, " ");
352 }
353
354 /* Apply device tree overlay(s) to the U-Boot environment, if any */
355 if (strlen(name_overlays))
356 return env_set("name_overlays", name_overlays);
357#endif
358
359 return 0;
360}
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530361#endif
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530362
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530363void configure_serdes_torrent(void)
364{
365 struct udevice *dev;
366 struct phy serdes;
367 int ret;
368
369 if (!IS_ENABLED(CONFIG_PHY_CADENCE_TORRENT))
370 return;
371
372 ret = uclass_get_device_by_driver(UCLASS_PHY,
373 DM_DRIVER_GET(torrent_phy_provider),
374 &dev);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530375 if (ret) {
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530376 printf("Torrent init failed:%d\n", ret);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530377 return;
378 }
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530379
380 serdes.dev = dev;
381 serdes.id = 0;
382
383 ret = generic_phy_init(&serdes);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530384 if (ret) {
385 printf("phy_init failed!!: %d\n", ret);
386 return;
387 }
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530388
389 ret = generic_phy_power_on(&serdes);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530390 if (ret) {
391 printf("phy_power_on failed!!: %d\n", ret);
392 return;
393 }
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530394}
395
Aswath Govindrajub3614432022-01-28 13:41:38 +0530396void configure_serdes_sierra(void)
397{
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530398 struct udevice *dev, *link_dev;
399 struct phy link;
Aswath Govindrajub3614432022-01-28 13:41:38 +0530400 int ret, count, i;
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530401 int link_count = 0;
Aswath Govindrajub3614432022-01-28 13:41:38 +0530402
403 if (!IS_ENABLED(CONFIG_PHY_CADENCE_SIERRA))
404 return;
405
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530406 ret = uclass_get_device_by_driver(UCLASS_MISC,
Aswath Govindrajub3614432022-01-28 13:41:38 +0530407 DM_DRIVER_GET(sierra_phy_provider),
408 &dev);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530409 if (ret) {
Aswath Govindrajub3614432022-01-28 13:41:38 +0530410 printf("Sierra init failed:%d\n", ret);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530411 return;
412 }
Aswath Govindrajub3614432022-01-28 13:41:38 +0530413
Aswath Govindrajub3614432022-01-28 13:41:38 +0530414 count = device_get_child_count(dev);
415 for (i = 0; i < count; i++) {
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530416 ret = device_get_child(dev, i, &link_dev);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530417 if (ret) {
418 printf("probe of sierra child node %d failed: %d\n", i, ret);
419 return;
420 }
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530421 if (link_dev->driver->id == UCLASS_PHY) {
422 link.dev = link_dev;
423 link.id = link_count++;
424
425 ret = generic_phy_power_on(&link);
Aswath Govindrajue0392592022-06-10 18:23:38 +0530426 if (ret) {
427 printf("phy_power_on failed!!: %d\n", ret);
428 return;
429 }
Aswath Govindrajuf4466ab2022-03-04 17:45:26 +0530430 }
Aswath Govindrajub3614432022-01-28 13:41:38 +0530431 }
Aswath Govindrajub3614432022-01-28 13:41:38 +0530432}
433
Sinthu Rajad948fc42022-02-09 15:06:48 +0530434#ifdef CONFIG_BOARD_LATE_INIT
435static void setup_board_eeprom_env(void)
436{
437 char *name = "j721e";
438
439 if (do_board_detect())
440 goto invalid_eeprom;
441
442 if (board_is_j721e_som())
443 name = "j721e";
Sinthu Rajadfb24292022-02-09 15:06:50 +0530444 else if (board_is_j721e_sk())
445 name = "j721e-sk";
Sinthu Rajad948fc42022-02-09 15:06:48 +0530446 else if (board_is_j7200_som())
447 name = "j7200";
448 else
449 printf("Unidentified board claims %s in eeprom header\n",
450 board_ti_get_name());
451
452invalid_eeprom:
453 set_board_info_env_am6(name);
454}
455
456static void setup_serial(void)
457{
458 struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
459 unsigned long board_serial;
460 char *endp;
461 char serial_string[17] = { 0 };
462
463 if (env_get("serial#"))
464 return;
465
466 board_serial = hextoul(ep->serial, &endp);
467 if (*endp != '\0') {
468 pr_err("Error: Can't set serial# to %s\n", ep->serial);
469 return;
470 }
471
472 snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
473 env_set("serial#", serial_string);
474}
475
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530476int board_late_init(void)
477{
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530478 if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
479 setup_board_eeprom_env();
480 setup_serial();
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530481
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530482 /* Check for and probe any plugged-in daughtercards */
Sinthu Rajaee59fa42022-02-09 15:06:51 +0530483 if (board_is_j721e_som() || board_is_j7200_som())
484 probe_daughtercards();
Lokesh Vutlab29a7cd2020-08-05 22:44:14 +0530485 }
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530486
Aswath Govindraju6cfabdd2021-07-21 21:28:39 +0530487 if (board_is_j7200_som())
488 configure_serdes_torrent();
489
Aswath Govindrajub3614432022-01-28 13:41:38 +0530490 if (board_is_j721e_som())
491 configure_serdes_sierra();
492
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530493 return 0;
494}
Sinthu Rajad948fc42022-02-09 15:06:48 +0530495#endif
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530496
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530497static int __maybe_unused detect_SW3_1_state(void)
498{
499 if (IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) {
500 struct gpio_desc desc = {0};
501 int ret;
502 char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
503
504 ret = dm_gpio_lookup_name(hypermux_sel_gpio, &desc);
505 if (ret) {
506 printf("error getting GPIO lookup name: %d\n", ret);
507 return ret;
508 }
509
510 ret = dm_gpio_request(&desc, hypermux_sel_gpio);
511 if (ret) {
512 printf("error requesting GPIO: %d\n", ret);
513 goto err_free_gpio;
514 }
515
516 ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN);
517 if (ret) {
518 printf("error setting direction flag of GPIO: %d\n", ret);
519 goto err_free_gpio;
520 }
521
522 ret = dm_gpio_get_value(&desc);
523 if (ret < 0)
524 printf("error getting value of GPIO: %d\n", ret);
525
526err_free_gpio:
527 dm_gpio_free(desc.dev, &desc);
528 return ret;
529 }
530}
531
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530532void spl_board_init(void)
533{
Tero Kristofa281f62020-02-14 11:18:19 +0200534#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
535 struct udevice *dev;
536 int ret;
537#endif
538
Lokesh Vutlacf1d6862020-08-05 22:44:24 +0530539 if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) ||
540 IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) &&
Sinthu Rajaee59fa42022-02-09 15:06:51 +0530541 IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
542 if (!board_is_j721e_sk())
543 probe_daughtercards();
544 }
Tero Kristofa281f62020-02-14 11:18:19 +0200545
546#ifdef CONFIG_ESM_K3
547 if (board_ti_k3_is("J721EX-PM2-SOM")) {
548 ret = uclass_get_device_by_driver(UCLASS_MISC,
Simon Glass65e25be2020-12-28 20:34:56 -0700549 DM_DRIVER_GET(k3_esm), &dev);
Tero Kristofa281f62020-02-14 11:18:19 +0200550 if (ret)
551 printf("ESM init failed: %d\n", ret);
552 }
553#endif
554
555#ifdef CONFIG_ESM_PMIC
556 if (board_ti_k3_is("J721EX-PM2-SOM")) {
557 ret = uclass_get_device_by_driver(UCLASS_MISC,
Simon Glass65e25be2020-12-28 20:34:56 -0700558 DM_DRIVER_GET(pmic_esm),
Tero Kristofa281f62020-02-14 11:18:19 +0200559 &dev);
560 if (ret)
561 printf("ESM PMIC init failed: %d\n", ret);
562 }
563#endif
Vaishnav Achath66a33f42022-05-09 11:50:16 +0530564 if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) &&
565 IS_ENABLED(CONFIG_HBMC_AM654)) {
566 struct udevice *dev;
567 int ret;
568
569 ret = detect_SW3_1_state();
570 if (ret == 1) {
571 ret = uclass_get_device_by_driver(UCLASS_MTD,
572 DM_DRIVER_GET(hbmc_am654),
573 &dev);
574 if (ret)
575 debug("Failed to probe hyperflash\n");
576 }
577 }
Andreas Dannenberg643eb6e2020-01-07 13:15:54 +0530578}