Michal Simek | 014d304 | 2019-01-21 15:25:02 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
Michal Simek | 53f4436 | 2023-01-06 09:38:52 +0100 | [diff] [blame] | 3 | * (C) Copyright 2014 - 2022, Xilinx, Inc. |
| 4 | * (C) Copyright 2022 - 2023, Advanced Micro Devices, Inc. |
| 5 | * |
| 6 | * Michal Simek <michal.simek@amd.com> |
Michal Simek | 014d304 | 2019-01-21 15:25:02 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 9 | #include <efi.h> |
| 10 | #include <efi_loader.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 11 | #include <env.h> |
Michal Simek | aa97561 | 2022-08-25 14:23:10 +0200 | [diff] [blame] | 12 | #include <image.h> |
Algapally Santosh Sagar | d1c1b1e | 2023-01-19 22:36:14 -0700 | [diff] [blame] | 13 | #include <init.h> |
James Hilliard | 2c23464 | 2024-03-31 17:28:59 -0600 | [diff] [blame] | 14 | #include <jffs2/load_kernel.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 15 | #include <log.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 16 | #include <asm/global_data.h> |
Michal Simek | 878ba36 | 2019-12-19 17:45:15 +0100 | [diff] [blame] | 17 | #include <asm/sections.h> |
Michal Simek | 014d304 | 2019-01-21 15:25:02 +0100 | [diff] [blame] | 18 | #include <dm/uclass.h> |
| 19 | #include <i2c.h> |
Michal Simek | b90b97e | 2020-04-08 10:51:36 +0200 | [diff] [blame] | 20 | #include <linux/sizes.h> |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 21 | #include <malloc.h> |
James Hilliard | 2c23464 | 2024-03-31 17:28:59 -0600 | [diff] [blame] | 22 | #include <mtd_node.h> |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 23 | #include "board.h" |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 24 | #include <dm.h> |
| 25 | #include <i2c_eeprom.h> |
| 26 | #include <net.h> |
Michal Simek | fe49df9 | 2020-10-26 12:26:13 +0100 | [diff] [blame] | 27 | #include <generated/dt.h> |
Venkatesh Yadav Abbarapu | e8e3c90 | 2024-01-17 08:50:13 +0530 | [diff] [blame] | 28 | #include <rng.h> |
Michal Simek | 53f4436 | 2023-01-06 09:38:52 +0100 | [diff] [blame] | 29 | #include <slre.h> |
T Karthik Reddy | c8fa40a | 2021-08-10 06:50:20 -0600 | [diff] [blame] | 30 | #include <soc.h> |
Michal Simek | e045351 | 2021-08-11 14:23:54 +0200 | [diff] [blame] | 31 | #include <linux/ctype.h> |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 32 | #include <linux/kernel.h> |
Caleb Connolly | 29cab7c | 2024-08-30 13:34:37 +0100 | [diff] [blame] | 33 | #include <u-boot/uuid.h> |
Michal Simek | 014d304 | 2019-01-21 15:25:02 +0100 | [diff] [blame] | 34 | |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 35 | #include "fru.h" |
| 36 | |
Simon Glass | b819621 | 2023-02-05 15:39:42 -0700 | [diff] [blame] | 37 | #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 38 | struct efi_fw_image fw_images[] = { |
| 39 | #if defined(XILINX_BOOT_IMAGE_GUID) |
| 40 | { |
| 41 | .image_type_id = XILINX_BOOT_IMAGE_GUID, |
| 42 | .fw_name = u"XILINX-BOOT", |
| 43 | .image_index = 1, |
| 44 | }, |
| 45 | #endif |
Michal Simek | cd03861 | 2024-02-23 17:18:42 +0100 | [diff] [blame] | 46 | #if defined(XILINX_UBOOT_IMAGE_GUID) && defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 47 | { |
| 48 | .image_type_id = XILINX_UBOOT_IMAGE_GUID, |
| 49 | .fw_name = u"XILINX-UBOOT", |
| 50 | .image_index = 2, |
| 51 | }, |
| 52 | #endif |
| 53 | }; |
| 54 | |
| 55 | struct efi_capsule_update_info update_info = { |
Masahisa Kojima | 5d2438b | 2023-06-07 14:41:51 +0900 | [diff] [blame] | 56 | .num_images = ARRAY_SIZE(fw_images), |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 57 | .images = fw_images, |
| 58 | }; |
| 59 | |
Sughosh Ganu | ccb3646 | 2022-04-15 11:29:34 +0530 | [diff] [blame] | 60 | #endif /* EFI_HAVE_CAPSULE_SUPPORT */ |
| 61 | |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 62 | #define EEPROM_HEADER_MAGIC 0xdaaddeed |
| 63 | #define EEPROM_HDR_MANUFACTURER_LEN 16 |
| 64 | #define EEPROM_HDR_NAME_LEN 16 |
| 65 | #define EEPROM_HDR_REV_LEN 8 |
| 66 | #define EEPROM_HDR_SERIAL_LEN 20 |
| 67 | #define EEPROM_HDR_NO_OF_MAC_ADDR 4 |
| 68 | #define EEPROM_HDR_ETH_ALEN ETH_ALEN |
Michal Simek | 7459d4a | 2022-07-21 16:19:17 +0200 | [diff] [blame] | 69 | #define EEPROM_HDR_UUID_LEN 16 |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 70 | |
| 71 | struct xilinx_board_description { |
| 72 | u32 header; |
| 73 | char manufacturer[EEPROM_HDR_MANUFACTURER_LEN + 1]; |
| 74 | char name[EEPROM_HDR_NAME_LEN + 1]; |
| 75 | char revision[EEPROM_HDR_REV_LEN + 1]; |
| 76 | char serial[EEPROM_HDR_SERIAL_LEN + 1]; |
| 77 | u8 mac_addr[EEPROM_HDR_NO_OF_MAC_ADDR][EEPROM_HDR_ETH_ALEN + 1]; |
Michal Simek | 7459d4a | 2022-07-21 16:19:17 +0200 | [diff] [blame] | 78 | char uuid[EEPROM_HDR_UUID_LEN + 1]; |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 79 | }; |
| 80 | |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 81 | static int highest_id = -1; |
Michal Simek | e98ae1d | 2021-08-12 12:30:36 +0200 | [diff] [blame] | 82 | static struct xilinx_board_description *board_info; |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 83 | |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 84 | #define XILINX_I2C_DETECTION_BITS sizeof(struct fru_common_hdr) |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 85 | |
| 86 | /* Variable which stores pointer to array which stores eeprom content */ |
| 87 | struct xilinx_legacy_format { |
| 88 | char board_sn[18]; /* 0x0 */ |
| 89 | char unused0[14]; /* 0x12 */ |
Michal Simek | b2df1df | 2023-01-24 16:19:26 +0100 | [diff] [blame] | 90 | char eth_mac[ETH_ALEN]; /* 0x20 */ |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 91 | char unused1[170]; /* 0x26 */ |
| 92 | char board_name[11]; /* 0xd0 */ |
| 93 | char unused2[5]; /* 0xdc */ |
| 94 | char board_revision[3]; /* 0xe0 */ |
| 95 | char unused3[29]; /* 0xe3 */ |
| 96 | }; |
| 97 | |
| 98 | static void xilinx_eeprom_legacy_cleanup(char *eeprom, int size) |
| 99 | { |
| 100 | int i; |
Venkatesh Yadav Abbarapu | 3be370d | 2022-09-26 12:22:42 +0530 | [diff] [blame] | 101 | unsigned char byte; |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 102 | |
| 103 | for (i = 0; i < size; i++) { |
| 104 | byte = eeprom[i]; |
| 105 | |
Petr Zejdl | df8123b | 2024-04-04 13:44:22 +0200 | [diff] [blame] | 106 | /* Ignore MAC address */ |
| 107 | if (i >= offsetof(struct xilinx_legacy_format, eth_mac) && |
| 108 | i < offsetof(struct xilinx_legacy_format, unused1)) { |
| 109 | continue; |
| 110 | } |
| 111 | |
| 112 | /* Remove all non printable chars */ |
| 113 | if (byte < '!' || byte > '~') { |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 114 | eeprom[i] = 0; |
Michal Simek | d432cbb | 2023-01-24 16:19:27 +0100 | [diff] [blame] | 115 | continue; |
| 116 | } |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 117 | |
| 118 | /* Convert strings to lower case */ |
| 119 | if (byte >= 'A' && byte <= 'Z') |
| 120 | eeprom[i] = byte + 'a' - 'A'; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | static int xilinx_read_eeprom_legacy(struct udevice *dev, char *name, |
| 125 | struct xilinx_board_description *desc) |
| 126 | { |
| 127 | int ret, size; |
| 128 | struct xilinx_legacy_format *eeprom_content; |
| 129 | bool eth_valid = false; |
| 130 | |
| 131 | size = sizeof(*eeprom_content); |
| 132 | |
| 133 | eeprom_content = calloc(1, size); |
| 134 | if (!eeprom_content) |
| 135 | return -ENOMEM; |
| 136 | |
| 137 | debug("%s: I2C EEPROM read pass data at %p\n", __func__, |
| 138 | eeprom_content); |
| 139 | |
| 140 | ret = dm_i2c_read(dev, 0, (uchar *)eeprom_content, size); |
| 141 | if (ret) { |
| 142 | debug("%s: I2C EEPROM read failed\n", __func__); |
| 143 | free(eeprom_content); |
| 144 | return ret; |
| 145 | } |
| 146 | |
| 147 | xilinx_eeprom_legacy_cleanup((char *)eeprom_content, size); |
| 148 | |
Michal Simek | daccab2 | 2023-01-24 16:19:28 +0100 | [diff] [blame] | 149 | /* Terminating \0 chars are the part of desc fields already */ |
| 150 | strlcpy(desc->name, eeprom_content->board_name, |
| 151 | sizeof(eeprom_content->board_name) + 1); |
| 152 | strlcpy(desc->revision, eeprom_content->board_revision, |
| 153 | sizeof(eeprom_content->board_revision) + 1); |
| 154 | strlcpy(desc->serial, eeprom_content->board_sn, |
| 155 | sizeof(eeprom_content->board_sn) + 1); |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 156 | |
| 157 | eth_valid = is_valid_ethaddr((const u8 *)eeprom_content->eth_mac); |
| 158 | if (eth_valid) |
Michal Simek | daccab2 | 2023-01-24 16:19:28 +0100 | [diff] [blame] | 159 | memcpy(desc->mac_addr[0], eeprom_content->eth_mac, ETH_ALEN); |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 160 | |
Michal Simek | daccab2 | 2023-01-24 16:19:28 +0100 | [diff] [blame] | 161 | printf("Xilinx I2C Legacy format at %s:\n", name); |
| 162 | printf(" Board name:\t%s\n", desc->name); |
| 163 | printf(" Board rev:\t%s\n", desc->revision); |
| 164 | printf(" Board SN:\t%s\n", desc->serial); |
| 165 | |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 166 | if (eth_valid) |
Michal Simek | daccab2 | 2023-01-24 16:19:28 +0100 | [diff] [blame] | 167 | printf(" Ethernet mac:\t%pM\n", desc->mac_addr); |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 168 | |
| 169 | desc->header = EEPROM_HEADER_MAGIC; |
| 170 | |
| 171 | free(eeprom_content); |
| 172 | |
| 173 | return ret; |
| 174 | } |
| 175 | |
| 176 | static bool xilinx_detect_legacy(u8 *buffer) |
| 177 | { |
| 178 | int i; |
| 179 | char c; |
| 180 | |
| 181 | for (i = 0; i < XILINX_I2C_DETECTION_BITS; i++) { |
| 182 | c = buffer[i]; |
| 183 | |
| 184 | if (c < '0' || c > '9') |
| 185 | return false; |
| 186 | } |
| 187 | |
| 188 | return true; |
| 189 | } |
| 190 | |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 191 | static int xilinx_read_eeprom_fru(struct udevice *dev, char *name, |
| 192 | struct xilinx_board_description *desc) |
| 193 | { |
Michal Simek | be5f572 | 2021-08-12 11:03:49 +0200 | [diff] [blame] | 194 | int i, ret, eeprom_size; |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 195 | u8 *fru_content; |
Ashok Reddy Soma | 9f60e44 | 2022-02-23 15:00:59 +0100 | [diff] [blame] | 196 | u8 id = 0; |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 197 | |
| 198 | /* FIXME this is shortcut - if eeprom type is wrong it will fail */ |
| 199 | eeprom_size = i2c_eeprom_size(dev); |
| 200 | |
| 201 | fru_content = calloc(1, eeprom_size); |
| 202 | if (!fru_content) |
| 203 | return -ENOMEM; |
| 204 | |
| 205 | debug("%s: I2C EEPROM read pass data at %p\n", __func__, |
| 206 | fru_content); |
| 207 | |
| 208 | ret = dm_i2c_read(dev, 0, (uchar *)fru_content, |
| 209 | eeprom_size); |
| 210 | if (ret) { |
| 211 | debug("%s: I2C EEPROM read failed\n", __func__); |
Michal Simek | aada8a6 | 2021-08-13 09:17:10 +0200 | [diff] [blame] | 212 | goto end; |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 213 | } |
| 214 | |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 215 | fru_capture((unsigned long)fru_content); |
Simon Glass | d2c5a3d | 2023-02-05 15:39:38 -0700 | [diff] [blame] | 216 | if (gd->flags & GD_FLG_RELOC || (_DEBUG && IS_ENABLED(CONFIG_DTB_RESELECT))) { |
Michal Simek | e045351 | 2021-08-11 14:23:54 +0200 | [diff] [blame] | 217 | printf("Xilinx I2C FRU format at %s:\n", name); |
| 218 | ret = fru_display(0); |
| 219 | if (ret) { |
| 220 | printf("FRU format decoding failed.\n"); |
| 221 | goto end; |
| 222 | } |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | if (desc->header == EEPROM_HEADER_MAGIC) { |
| 226 | debug("Information already filled\n"); |
Michal Simek | aada8a6 | 2021-08-13 09:17:10 +0200 | [diff] [blame] | 227 | ret = -EINVAL; |
| 228 | goto end; |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | /* It is clear that FRU was captured and structures were filled */ |
Michal Simek | b5f206e | 2022-07-21 16:19:18 +0200 | [diff] [blame] | 232 | strlcpy(desc->manufacturer, (char *)fru_data.brd.manufacturer_name, |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 233 | sizeof(desc->manufacturer)); |
Michal Simek | b5f206e | 2022-07-21 16:19:18 +0200 | [diff] [blame] | 234 | strlcpy(desc->uuid, (char *)fru_data.brd.uuid, |
Michal Simek | 7459d4a | 2022-07-21 16:19:17 +0200 | [diff] [blame] | 235 | sizeof(desc->uuid)); |
Michal Simek | b5f206e | 2022-07-21 16:19:18 +0200 | [diff] [blame] | 236 | strlcpy(desc->name, (char *)fru_data.brd.product_name, |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 237 | sizeof(desc->name)); |
Michal Simek | be5f572 | 2021-08-12 11:03:49 +0200 | [diff] [blame] | 238 | for (i = 0; i < sizeof(desc->name); i++) { |
| 239 | if (desc->name[i] == ' ') |
| 240 | desc->name[i] = '\0'; |
| 241 | } |
Michal Simek | b5f206e | 2022-07-21 16:19:18 +0200 | [diff] [blame] | 242 | strlcpy(desc->revision, (char *)fru_data.brd.rev, |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 243 | sizeof(desc->revision)); |
Michal Simek | 904fb97 | 2022-06-06 09:31:27 +0200 | [diff] [blame] | 244 | for (i = 0; i < sizeof(desc->revision); i++) { |
| 245 | if (desc->revision[i] == ' ') |
| 246 | desc->revision[i] = '\0'; |
| 247 | } |
Michal Simek | b5f206e | 2022-07-21 16:19:18 +0200 | [diff] [blame] | 248 | strlcpy(desc->serial, (char *)fru_data.brd.serial_number, |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 249 | sizeof(desc->serial)); |
Ashok Reddy Soma | 9f60e44 | 2022-02-23 15:00:59 +0100 | [diff] [blame] | 250 | |
| 251 | while (id < EEPROM_HDR_NO_OF_MAC_ADDR) { |
| 252 | if (is_valid_ethaddr((const u8 *)fru_data.mac.macid[id])) |
| 253 | memcpy(&desc->mac_addr[id], |
| 254 | (char *)fru_data.mac.macid[id], ETH_ALEN); |
| 255 | id++; |
| 256 | } |
| 257 | |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 258 | desc->header = EEPROM_HEADER_MAGIC; |
| 259 | |
Michal Simek | aada8a6 | 2021-08-13 09:17:10 +0200 | [diff] [blame] | 260 | end: |
| 261 | free(fru_content); |
| 262 | return ret; |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | static bool xilinx_detect_fru(u8 *buffer) |
| 266 | { |
| 267 | u8 checksum = 0; |
| 268 | int i; |
| 269 | |
| 270 | checksum = fru_checksum((u8 *)buffer, sizeof(struct fru_common_hdr)); |
| 271 | if (checksum) { |
| 272 | debug("%s Common header CRC FAIL\n", __func__); |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | bool all_zeros = true; |
| 277 | /* Checksum over all zeros is also zero that's why detect this case */ |
| 278 | for (i = 0; i < sizeof(struct fru_common_hdr); i++) { |
| 279 | if (buffer[i] != 0) |
| 280 | all_zeros = false; |
| 281 | } |
| 282 | |
| 283 | if (all_zeros) |
| 284 | return false; |
| 285 | |
| 286 | debug("%s Common header CRC PASS\n", __func__); |
| 287 | return true; |
| 288 | } |
| 289 | |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 290 | static int xilinx_read_eeprom_single(char *name, |
| 291 | struct xilinx_board_description *desc) |
| 292 | { |
| 293 | int ret; |
| 294 | struct udevice *dev; |
| 295 | ofnode eeprom; |
| 296 | u8 buffer[XILINX_I2C_DETECTION_BITS]; |
| 297 | |
| 298 | eeprom = ofnode_get_aliases_node(name); |
| 299 | if (!ofnode_valid(eeprom)) |
| 300 | return -ENODEV; |
| 301 | |
| 302 | ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev); |
| 303 | if (ret) |
| 304 | return ret; |
| 305 | |
| 306 | ret = dm_i2c_read(dev, 0, buffer, sizeof(buffer)); |
| 307 | if (ret) { |
| 308 | debug("%s: I2C EEPROM read failed\n", __func__); |
| 309 | return ret; |
| 310 | } |
| 311 | |
| 312 | debug("%s: i2c memory detected: %s\n", __func__, name); |
| 313 | |
Simon Glass | 631bec2 | 2023-02-05 15:36:31 -0700 | [diff] [blame] | 314 | if (IS_ENABLED(CONFIG_CMD_FRU) && xilinx_detect_fru(buffer)) |
Michal Simek | 207e062 | 2020-08-03 16:14:23 +0200 | [diff] [blame] | 315 | return xilinx_read_eeprom_fru(dev, name, desc); |
| 316 | |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 317 | if (xilinx_detect_legacy(buffer)) |
| 318 | return xilinx_read_eeprom_legacy(dev, name, desc); |
| 319 | |
| 320 | return -ENODEV; |
| 321 | } |
| 322 | |
| 323 | __maybe_unused int xilinx_read_eeprom(void) |
| 324 | { |
Michal Simek | e98ae1d | 2021-08-12 12:30:36 +0200 | [diff] [blame] | 325 | int id; |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 326 | char name_buf[8]; /* 8 bytes should be enough for nvmem+number */ |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 327 | struct xilinx_board_description *desc; |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 328 | |
| 329 | highest_id = dev_read_alias_highest_id("nvmem"); |
| 330 | /* No nvmem aliases present */ |
| 331 | if (highest_id < 0) |
| 332 | return -EINVAL; |
| 333 | |
Michal Simek | e98ae1d | 2021-08-12 12:30:36 +0200 | [diff] [blame] | 334 | board_info = calloc(1, sizeof(*desc) * (highest_id + 1)); |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 335 | if (!board_info) |
| 336 | return -ENOMEM; |
| 337 | |
| 338 | debug("%s: Highest ID %d, board_info %p\n", __func__, |
| 339 | highest_id, board_info); |
| 340 | |
| 341 | for (id = 0; id <= highest_id; id++) { |
| 342 | snprintf(name_buf, sizeof(name_buf), "nvmem%d", id); |
| 343 | |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 344 | /* Alloc structure */ |
Michal Simek | e98ae1d | 2021-08-12 12:30:36 +0200 | [diff] [blame] | 345 | desc = &board_info[id]; |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 346 | |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 347 | /* Ignoring return value for supporting multiple chips */ |
Michal Simek | e98ae1d | 2021-08-12 12:30:36 +0200 | [diff] [blame] | 348 | xilinx_read_eeprom_single(name_buf, desc); |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 349 | } |
| 350 | |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 351 | /* |
| 352 | * Consider to clean board_info structure when board/cards are not |
| 353 | * detected. |
| 354 | */ |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 355 | |
| 356 | return 0; |
| 357 | } |
| 358 | |
Michal Simek | 1a50529 | 2022-02-17 14:28:38 +0100 | [diff] [blame] | 359 | #if defined(CONFIG_OF_BOARD) |
Ilias Apalodimas | ab5348a | 2021-10-26 09:12:33 +0300 | [diff] [blame] | 360 | void *board_fdt_blob_setup(int *err) |
Ibai Erkiaga | 6f65820 | 2019-10-02 15:57:36 +0100 | [diff] [blame] | 361 | { |
Michal Simek | ddf69ae | 2020-09-04 16:21:47 +0200 | [diff] [blame] | 362 | void *fdt_blob; |
Michal Simek | c89f429 | 2020-03-19 10:23:56 +0100 | [diff] [blame] | 363 | |
Ilias Apalodimas | ab5348a | 2021-10-26 09:12:33 +0300 | [diff] [blame] | 364 | *err = 0; |
Michal Simek | 54a898c | 2024-02-14 12:52:33 +0100 | [diff] [blame] | 365 | |
| 366 | if (IS_ENABLED(CONFIG_TARGET_XILINX_MBV)) { |
| 367 | fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR; |
| 368 | |
| 369 | if (fdt_magic(fdt_blob) == FDT_MAGIC) |
| 370 | return fdt_blob; |
| 371 | } |
| 372 | |
Simon Glass | 49c24a8 | 2024-09-29 19:49:47 -0600 | [diff] [blame] | 373 | if (!IS_ENABLED(CONFIG_XPL_BUILD) && |
Michal Simek | 663c162 | 2021-01-04 11:07:28 +0100 | [diff] [blame] | 374 | !IS_ENABLED(CONFIG_VERSAL_NO_DDR) && |
Michal Simek | 6d4317b | 2021-02-02 13:33:22 +0100 | [diff] [blame] | 375 | !IS_ENABLED(CONFIG_ZYNQMP_NO_DDR)) { |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 376 | fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR; |
Ibai Erkiaga | 6f65820 | 2019-10-02 15:57:36 +0100 | [diff] [blame] | 377 | |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 378 | if (fdt_magic(fdt_blob) == FDT_MAGIC) |
| 379 | return fdt_blob; |
Michal Simek | 878ba36 | 2019-12-19 17:45:15 +0100 | [diff] [blame] | 380 | |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 381 | debug("DTB is not passed via %p\n", fdt_blob); |
| 382 | } |
Michal Simek | 878ba36 | 2019-12-19 17:45:15 +0100 | [diff] [blame] | 383 | |
Simon Glass | 49c24a8 | 2024-09-29 19:49:47 -0600 | [diff] [blame] | 384 | if (IS_ENABLED(CONFIG_XPL_BUILD)) { |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 385 | /* |
| 386 | * FDT is at end of BSS unless it is in a different memory |
| 387 | * region |
| 388 | */ |
| 389 | if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) |
Shiji Yang | eff11fa | 2023-08-03 09:47:17 +0800 | [diff] [blame] | 390 | fdt_blob = (ulong *)_image_binary_end; |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 391 | else |
Shiji Yang | eff11fa | 2023-08-03 09:47:17 +0800 | [diff] [blame] | 392 | fdt_blob = (ulong *)__bss_end; |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 393 | } else { |
| 394 | /* FDT is at end of image */ |
Shiji Yang | eff11fa | 2023-08-03 09:47:17 +0800 | [diff] [blame] | 395 | fdt_blob = (ulong *)_end; |
Michal Simek | 9b9d01e | 2021-01-04 11:03:36 +0100 | [diff] [blame] | 396 | } |
Michal Simek | 878ba36 | 2019-12-19 17:45:15 +0100 | [diff] [blame] | 397 | |
| 398 | if (fdt_magic(fdt_blob) == FDT_MAGIC) |
| 399 | return fdt_blob; |
| 400 | |
| 401 | debug("DTB is also not passed via %p\n", fdt_blob); |
Ibai Erkiaga | 6f65820 | 2019-10-02 15:57:36 +0100 | [diff] [blame] | 402 | |
Michal Simek | 1a50529 | 2022-02-17 14:28:38 +0100 | [diff] [blame] | 403 | *err = -EINVAL; |
Michal Simek | 878ba36 | 2019-12-19 17:45:15 +0100 | [diff] [blame] | 404 | return NULL; |
Ibai Erkiaga | 6f65820 | 2019-10-02 15:57:36 +0100 | [diff] [blame] | 405 | } |
| 406 | #endif |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 407 | |
Michal Simek | 67ed85d | 2020-10-22 11:14:20 +0200 | [diff] [blame] | 408 | #if defined(CONFIG_BOARD_LATE_INIT) |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 409 | static int env_set_by_index(const char *name, int index, char *data) |
| 410 | { |
| 411 | char var[32]; |
| 412 | |
| 413 | if (!index) |
| 414 | sprintf(var, "board_%s", name); |
| 415 | else |
| 416 | sprintf(var, "card%d_%s", index, name); |
| 417 | |
| 418 | return env_set(var, data); |
| 419 | } |
| 420 | |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 421 | int board_late_init_xilinx(void) |
| 422 | { |
Michal Simek | bd07b5d | 2020-08-12 12:16:49 +0200 | [diff] [blame] | 423 | u32 ret = 0; |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 424 | int i, id, macid = 0; |
| 425 | struct xilinx_board_description *desc; |
Ricardo Salveti | d35ccf2 | 2022-01-20 16:17:30 -0300 | [diff] [blame] | 426 | phys_size_t bootm_size = gd->ram_top - gd->ram_base; |
Michal Simek | bb70b77 | 2023-08-31 09:04:28 +0200 | [diff] [blame] | 427 | u64 bootscr_flash_offset, bootscr_flash_size; |
Padmarao Begari | c139962 | 2024-09-13 15:02:31 +0530 | [diff] [blame] | 428 | ulong scriptaddr; |
| 429 | u64 bootscr_address; |
| 430 | u64 bootscr_offset; |
T Karthik Reddy | 17b7f66 | 2020-04-01 06:01:21 -0600 | [diff] [blame] | 431 | |
Padmarao Begari | c139962 | 2024-09-13 15:02:31 +0530 | [diff] [blame] | 432 | /* Fetch bootscr_address/bootscr_offset from DT and update */ |
| 433 | if (!ofnode_read_bootscript_address(&bootscr_address, |
| 434 | &bootscr_offset)) { |
| 435 | if (bootscr_offset) |
| 436 | ret |= env_set_hex("scriptaddr", |
| 437 | gd->ram_base + |
| 438 | bootscr_offset); |
| 439 | else |
Algapally Santosh Sagar | 473705e | 2023-08-31 08:59:06 +0200 | [diff] [blame] | 440 | ret |= env_set_hex("scriptaddr", |
Padmarao Begari | c139962 | 2024-09-13 15:02:31 +0530 | [diff] [blame] | 441 | bootscr_address); |
| 442 | } else { |
| 443 | /* Update scriptaddr(bootscr offset) from env */ |
| 444 | scriptaddr = env_get_hex("scriptaddr", 0); |
| 445 | ret |= env_set_hex("scriptaddr", |
| 446 | gd->ram_base + scriptaddr); |
T Karthik Reddy | 17b7f66 | 2020-04-01 06:01:21 -0600 | [diff] [blame] | 447 | } |
Michal Simek | c86ce0c | 2020-08-12 12:17:53 +0200 | [diff] [blame] | 448 | |
Michal Simek | bb70b77 | 2023-08-31 09:04:28 +0200 | [diff] [blame] | 449 | if (!ofnode_read_bootscript_flash(&bootscr_flash_offset, |
| 450 | &bootscr_flash_size)) { |
| 451 | ret |= env_set_hex("script_offset_f", bootscr_flash_offset); |
| 452 | ret |= env_set_hex("script_size_f", bootscr_flash_size); |
| 453 | } else { |
| 454 | debug("!!! Please define bootscr-flash-offset via DT !!!\n"); |
| 455 | ret |= env_set_hex("script_offset_f", |
| 456 | CONFIG_BOOT_SCRIPT_OFFSET); |
| 457 | } |
| 458 | |
Simon Glass | 117038a | 2023-02-05 15:40:14 -0700 | [diff] [blame] | 459 | if (IS_ENABLED(CONFIG_ARCH_ZYNQ) || IS_ENABLED(CONFIG_MICROBLAZE)) |
Michal Simek | c86ce0c | 2020-08-12 12:17:53 +0200 | [diff] [blame] | 460 | bootm_size = min(bootm_size, (phys_size_t)(SZ_512M + SZ_256M)); |
Michal Simek | bd07b5d | 2020-08-12 12:16:49 +0200 | [diff] [blame] | 461 | |
Michal Simek | bd07b5d | 2020-08-12 12:16:49 +0200 | [diff] [blame] | 462 | ret |= env_set_addr("bootm_low", (void *)gd->ram_base); |
Michal Simek | c86ce0c | 2020-08-12 12:17:53 +0200 | [diff] [blame] | 463 | ret |= env_set_addr("bootm_size", (void *)bootm_size); |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 464 | |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 465 | for (id = 0; id <= highest_id; id++) { |
Michal Simek | e98ae1d | 2021-08-12 12:30:36 +0200 | [diff] [blame] | 466 | desc = &board_info[id]; |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 467 | if (desc && desc->header == EEPROM_HEADER_MAGIC) { |
| 468 | if (desc->manufacturer[0]) |
| 469 | ret |= env_set_by_index("manufacturer", id, |
| 470 | desc->manufacturer); |
| 471 | if (desc->name[0]) |
| 472 | ret |= env_set_by_index("name", id, |
| 473 | desc->name); |
| 474 | if (desc->revision[0]) |
| 475 | ret |= env_set_by_index("rev", id, |
| 476 | desc->revision); |
| 477 | if (desc->serial[0]) |
| 478 | ret |= env_set_by_index("serial", id, |
| 479 | desc->serial); |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 480 | |
Michal Simek | 7459d4a | 2022-07-21 16:19:17 +0200 | [diff] [blame] | 481 | if (desc->uuid[0]) { |
Venkatesh Yadav Abbarapu | 3be370d | 2022-09-26 12:22:42 +0530 | [diff] [blame] | 482 | unsigned char uuid[UUID_STR_LEN + 1]; |
| 483 | unsigned char *t = desc->uuid; |
Michal Simek | 7459d4a | 2022-07-21 16:19:17 +0200 | [diff] [blame] | 484 | |
| 485 | memset(uuid, 0, UUID_STR_LEN + 1); |
| 486 | |
| 487 | sprintf(uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", |
| 488 | t[0], t[1], t[2], t[3], t[4], t[5], |
| 489 | t[6], t[7], t[8], t[9], t[10], t[11], |
| 490 | t[12], t[13], t[14], t[15]); |
| 491 | ret |= env_set_by_index("uuid", id, uuid); |
| 492 | } |
| 493 | |
Jerome Forissier | 1ff0036 | 2024-10-16 12:04:03 +0200 | [diff] [blame] | 494 | if (!(CONFIG_IS_ENABLED(NET) || |
| 495 | CONFIG_IS_ENABLED(NET_LWIP))) |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 496 | continue; |
| 497 | |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 498 | for (i = 0; i < EEPROM_HDR_NO_OF_MAC_ADDR; i++) { |
Michal Simek | 0bb24e1 | 2020-08-03 12:57:05 +0200 | [diff] [blame] | 499 | if (is_valid_ethaddr((const u8 *)desc->mac_addr[i])) |
| 500 | ret |= eth_env_set_enetaddr_by_index("eth", |
| 501 | macid++, desc->mac_addr[i]); |
| 502 | } |
Michal Simek | 394ee24 | 2020-08-03 13:01:45 +0200 | [diff] [blame] | 503 | } |
| 504 | } |
| 505 | |
Michal Simek | bd07b5d | 2020-08-12 12:16:49 +0200 | [diff] [blame] | 506 | if (ret) |
| 507 | printf("%s: Saving run time variables FAILED\n", __func__); |
Michal Simek | 8ba62d2 | 2020-07-09 15:57:56 +0200 | [diff] [blame] | 508 | |
Michal Simek | 705d44a | 2020-03-31 12:39:37 +0200 | [diff] [blame] | 509 | return 0; |
| 510 | } |
Michal Simek | 67ed85d | 2020-10-22 11:14:20 +0200 | [diff] [blame] | 511 | #endif |
Michal Simek | fe49df9 | 2020-10-26 12:26:13 +0100 | [diff] [blame] | 512 | |
Michal Simek | c88975e | 2021-07-23 09:55:59 +0200 | [diff] [blame] | 513 | static char *board_name = DEVICE_TREE; |
| 514 | |
Michal Simek | fe49df9 | 2020-10-26 12:26:13 +0100 | [diff] [blame] | 515 | int __maybe_unused board_fit_config_name_match(const char *name) |
| 516 | { |
Michal Simek | c88975e | 2021-07-23 09:55:59 +0200 | [diff] [blame] | 517 | debug("%s: Check %s, default %s\n", __func__, name, board_name); |
Michal Simek | fe49df9 | 2020-10-26 12:26:13 +0100 | [diff] [blame] | 518 | |
Simon Glass | 49c24a8 | 2024-09-29 19:49:47 -0600 | [diff] [blame] | 519 | #if !defined(CONFIG_XPL_BUILD) |
Simon Glass | f34ccae | 2023-02-05 15:40:37 -0700 | [diff] [blame] | 520 | if (IS_ENABLED(CONFIG_REGEX)) { |
Michal Simek | 53f4436 | 2023-01-06 09:38:52 +0100 | [diff] [blame] | 521 | struct slre slre; |
| 522 | int ret; |
| 523 | |
| 524 | ret = slre_compile(&slre, name); |
| 525 | if (ret) { |
| 526 | ret = slre_match(&slre, board_name, strlen(board_name), |
| 527 | NULL); |
| 528 | debug("%s: name match ret = %d\n", __func__, ret); |
| 529 | return !ret; |
| 530 | } |
| 531 | } |
| 532 | #endif |
| 533 | |
Michal Simek | c88975e | 2021-07-23 09:55:59 +0200 | [diff] [blame] | 534 | if (!strcmp(name, board_name)) |
Michal Simek | fe49df9 | 2020-10-26 12:26:13 +0100 | [diff] [blame] | 535 | return 0; |
| 536 | |
| 537 | return -1; |
| 538 | } |
T Karthik Reddy | c8fa40a | 2021-08-10 06:50:20 -0600 | [diff] [blame] | 539 | |
Simon Glass | d2c5a3d | 2023-02-05 15:39:38 -0700 | [diff] [blame] | 540 | #if IS_ENABLED(CONFIG_DTB_RESELECT) |
Michal Simek | e045351 | 2021-08-11 14:23:54 +0200 | [diff] [blame] | 541 | #define MAX_NAME_LENGTH 50 |
| 542 | |
Michal Simek | afb2857 | 2021-07-23 09:59:59 +0200 | [diff] [blame] | 543 | char * __maybe_unused __weak board_name_decode(void) |
| 544 | { |
Michal Simek | e045351 | 2021-08-11 14:23:54 +0200 | [diff] [blame] | 545 | char *board_local_name; |
| 546 | struct xilinx_board_description *desc; |
| 547 | int i, id; |
| 548 | |
| 549 | board_local_name = calloc(1, MAX_NAME_LENGTH); |
| 550 | if (!board_info) |
| 551 | return NULL; |
| 552 | |
| 553 | for (id = 0; id <= highest_id; id++) { |
| 554 | desc = &board_info[id]; |
| 555 | |
| 556 | /* No board description */ |
| 557 | if (!desc) |
| 558 | goto error; |
| 559 | |
| 560 | /* Board is not detected */ |
| 561 | if (desc->header != EEPROM_HEADER_MAGIC) |
| 562 | continue; |
| 563 | |
| 564 | /* The first string should be soc name */ |
| 565 | if (!id) |
| 566 | strcat(board_local_name, CONFIG_SYS_BOARD); |
| 567 | |
| 568 | /* |
| 569 | * For two purpose here: |
| 570 | * soc_name- eg: zynqmp- |
| 571 | * and between base board and CC eg: ..revA-sck... |
| 572 | */ |
| 573 | strcat(board_local_name, "-"); |
| 574 | |
| 575 | if (desc->name[0]) { |
| 576 | /* For DT composition name needs to be lowercase */ |
| 577 | for (i = 0; i < sizeof(desc->name); i++) |
| 578 | desc->name[i] = tolower(desc->name[i]); |
| 579 | |
| 580 | strcat(board_local_name, desc->name); |
| 581 | } |
| 582 | if (desc->revision[0]) { |
| 583 | strcat(board_local_name, "-rev"); |
| 584 | |
| 585 | /* And revision needs to be uppercase */ |
| 586 | for (i = 0; i < sizeof(desc->revision); i++) |
| 587 | desc->revision[i] = toupper(desc->revision[i]); |
| 588 | |
| 589 | strcat(board_local_name, desc->revision); |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | /* |
| 594 | * Longer strings will end up with buffer overflow and potential |
| 595 | * attacks that's why check it |
| 596 | */ |
| 597 | if (strlen(board_local_name) >= MAX_NAME_LENGTH) |
| 598 | panic("Board name can't be determined\n"); |
| 599 | |
| 600 | if (strlen(board_local_name)) |
| 601 | return board_local_name; |
| 602 | |
| 603 | error: |
| 604 | free(board_local_name); |
Michal Simek | afb2857 | 2021-07-23 09:59:59 +0200 | [diff] [blame] | 605 | return NULL; |
| 606 | } |
| 607 | |
| 608 | bool __maybe_unused __weak board_detection(void) |
| 609 | { |
Michal Simek | e045351 | 2021-08-11 14:23:54 +0200 | [diff] [blame] | 610 | if (CONFIG_IS_ENABLED(DM_I2C) && CONFIG_IS_ENABLED(I2C_EEPROM)) { |
| 611 | int ret; |
| 612 | |
| 613 | ret = xilinx_read_eeprom(); |
| 614 | return !ret ? true : false; |
| 615 | } |
| 616 | |
Michal Simek | afb2857 | 2021-07-23 09:59:59 +0200 | [diff] [blame] | 617 | return false; |
| 618 | } |
| 619 | |
Michal Simek | 4c8e4ee | 2022-09-06 12:40:41 +0200 | [diff] [blame] | 620 | bool __maybe_unused __weak soc_detection(void) |
| 621 | { |
| 622 | return false; |
| 623 | } |
| 624 | |
| 625 | char * __maybe_unused __weak soc_name_decode(void) |
| 626 | { |
| 627 | return NULL; |
| 628 | } |
| 629 | |
Michal Simek | afb2857 | 2021-07-23 09:59:59 +0200 | [diff] [blame] | 630 | int embedded_dtb_select(void) |
| 631 | { |
Michal Simek | 4c8e4ee | 2022-09-06 12:40:41 +0200 | [diff] [blame] | 632 | if (soc_detection()) { |
| 633 | char *soc_local_name; |
| 634 | |
| 635 | soc_local_name = soc_name_decode(); |
| 636 | if (soc_local_name) { |
| 637 | board_name = soc_local_name; |
| 638 | printf("Detected SOC name: %s\n", board_name); |
| 639 | |
| 640 | /* Time to change DTB on fly */ |
| 641 | /* Both ways should work here */ |
| 642 | /* fdtdec_resetup(&rescan); */ |
| 643 | return fdtdec_setup(); |
| 644 | } |
| 645 | } |
| 646 | |
Michal Simek | afb2857 | 2021-07-23 09:59:59 +0200 | [diff] [blame] | 647 | if (board_detection()) { |
| 648 | char *board_local_name; |
| 649 | |
| 650 | board_local_name = board_name_decode(); |
| 651 | if (board_local_name) { |
| 652 | board_name = board_local_name; |
Michal Simek | e045351 | 2021-08-11 14:23:54 +0200 | [diff] [blame] | 653 | printf("Detected name: %s\n", board_name); |
Michal Simek | afb2857 | 2021-07-23 09:59:59 +0200 | [diff] [blame] | 654 | |
| 655 | /* Time to change DTB on fly */ |
| 656 | /* Both ways should work here */ |
| 657 | /* fdtdec_resetup(&rescan); */ |
| 658 | fdtdec_setup(); |
| 659 | } |
| 660 | } |
| 661 | return 0; |
| 662 | } |
| 663 | #endif |
Michal Simek | aa97561 | 2022-08-25 14:23:10 +0200 | [diff] [blame] | 664 | |
Venkatesh Yadav Abbarapu | e8e3c90 | 2024-01-17 08:50:13 +0530 | [diff] [blame] | 665 | #ifdef CONFIG_OF_BOARD_SETUP |
| 666 | #define MAX_RAND_SIZE 8 |
| 667 | int ft_board_setup(void *blob, struct bd_info *bd) |
| 668 | { |
James Hilliard | 2c23464 | 2024-03-31 17:28:59 -0600 | [diff] [blame] | 669 | static const struct node_info nodes[] = { |
| 670 | { "arm,pl353-nand-r2p1", MTD_DEV_TYPE_NAND, }, |
| 671 | }; |
| 672 | |
| 673 | if (IS_ENABLED(CONFIG_FDT_FIXUP_PARTITIONS) && IS_ENABLED(CONFIG_NAND_ZYNQ)) |
| 674 | fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); |
| 675 | |
Venkatesh Yadav Abbarapu | e8e3c90 | 2024-01-17 08:50:13 +0530 | [diff] [blame] | 676 | return 0; |
| 677 | } |
| 678 | #endif |