blob: 3ab6e8873d8464e53daa31f078b308cf8e9747c3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stefan Roese6edf27e2016-05-17 15:04:16 +02002/*
3 * Copyright (C) 2016 Stefan Roese <sr@denx.de>
Stefan Roese6edf27e2016-05-17 15:04:16 +02004 */
5
6#include <common.h>
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +02007#include <dm.h>
Pali Rohárf1000632020-12-21 11:09:10 +01008#include <dm/device-internal.h>
Andre Heiderac81fa02020-09-11 06:35:10 +02009#include <env.h>
Pali Roháre8928992020-12-23 12:21:29 +010010#include <env_internal.h>
Stefan Roese6edf27e2016-05-17 15:04:16 +020011#include <i2c.h>
Simon Glass97589732020-05-10 11:40:02 -060012#include <init.h>
Pali Rohár71388ee2020-11-25 19:20:10 +010013#include <mmc.h>
Marek Behún56a776e2022-04-27 12:41:48 +020014#include <miiphy.h>
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +020015#include <phy.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Stefan Roese6edf27e2016-05-17 15:04:16 +020017#include <asm/io.h>
18#include <asm/arch/cpu.h>
19#include <asm/arch/soc.h>
Simon Glassdbd79542020-05-10 11:40:11 -060020#include <linux/delay.h>
Stefan Roese6edf27e2016-05-17 15:04:16 +020021
22DECLARE_GLOBAL_DATA_PTR;
23
24/* IO expander I2C device */
25#define I2C_IO_EXP_ADDR 0x22
26#define I2C_IO_CFG_REG_0 0x6
27#define I2C_IO_DATA_OUT_REG_0 0x2
28#define I2C_IO_REG_0_SATA_OFF 2
29#define I2C_IO_REG_0_USB_H_OFF 1
30
Konstantin Porotchkinb65ffc42017-02-16 13:52:32 +020031/* The pin control values are the same for DB and Espressobin */
Konstantin Porotchkincfa88a32017-02-16 13:52:26 +020032#define PINCTRL_NB_REG_VALUE 0x000173fa
33#define PINCTRL_SB_REG_VALUE 0x00007a23
34
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +020035/* Ethernet switch registers */
36/* SMI addresses for multi-chip mode */
37#define MVEBU_PORT_CTRL_SMI_ADDR(p) (16 + (p))
38#define MVEBU_SW_G2_SMI_ADDR (28)
39
40/* Multi-chip mode */
41#define MVEBU_SW_SMI_DATA_REG (1)
42#define MVEBU_SW_SMI_CMD_REG (0)
43 #define SW_SMI_CMD_REG_ADDR_OFF 0
44 #define SW_SMI_CMD_DEV_ADDR_OFF 5
45 #define SW_SMI_CMD_SMI_OP_OFF 10
46 #define SW_SMI_CMD_SMI_MODE_OFF 12
47 #define SW_SMI_CMD_SMI_BUSY_OFF 15
48
49/* Single-chip mode */
50/* Switch Port Registers */
51#define MVEBU_SW_LINK_CTRL_REG (1)
52#define MVEBU_SW_PORT_CTRL_REG (4)
Pali Rohár7325a812020-08-17 16:36:38 +020053#define MVEBU_SW_PORT_BASE_VLAN (6)
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +020054
55/* Global 2 Registers */
56#define MVEBU_G2_SMI_PHY_CMD_REG (24)
57#define MVEBU_G2_SMI_PHY_DATA_REG (25)
58
Andre Heiderac81fa02020-09-11 06:35:10 +020059/*
60 * Memory Controller Registers
61 *
62 * Assembled based on public information:
Pali Rohár5f852242022-01-21 12:01:15 +010063 * https://gitlab.nic.cz/turris/mox-boot-builder/-/blob/v2020.11.26/wtmi/main.c#L332-336
Andre Heiderac81fa02020-09-11 06:35:10 +020064 * https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/blob/mv_ddr-armada-18.12/drivers/mv_ddr_mc6.h#L309-L332
65 *
66 * And checked against the written register values for the various topologies:
Pali Rohár5f852242022-01-21 12:01:15 +010067 * https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/blob/master/a3700/mv_ddr_tim.h
Andre Heiderac81fa02020-09-11 06:35:10 +020068 */
69#define A3700_CH0_MC_CTRL2_REG MVEBU_REGISTER(0x002c4)
70#define A3700_MC_CTRL2_SDRAM_TYPE_MASK 0xf
71#define A3700_MC_CTRL2_SDRAM_TYPE_OFFS 4
72#define A3700_MC_CTRL2_SDRAM_TYPE_DDR3 2
73#define A3700_MC_CTRL2_SDRAM_TYPE_DDR4 3
74
Stefan Roese6edf27e2016-05-17 15:04:16 +020075int board_early_init_f(void)
76{
Stefan Roese6edf27e2016-05-17 15:04:16 +020077 return 0;
78}
79
80int board_init(void)
81{
82 /* adress of boot parameters */
Tom Rinibb4dd962022-11-16 13:10:37 -050083 gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
Stefan Roese6edf27e2016-05-17 15:04:16 +020084
85 return 0;
86}
Andre Heiderac81fa02020-09-11 06:35:10 +020087
88#ifdef CONFIG_BOARD_LATE_INIT
89int board_late_init(void)
90{
Marek Behún73d25342021-10-22 15:47:24 +020091 char *ptr = &default_environment[0];
Pali Rohárf1000632020-12-21 11:09:10 +010092 struct udevice *dev;
Pali Rohár71388ee2020-11-25 19:20:10 +010093 struct mmc *mmc_dev;
Andre Heiderac81fa02020-09-11 06:35:10 +020094 bool ddr4, emmc;
Pali Rohár88d349a2020-12-23 12:21:30 +010095 const char *mac;
96 char eth[10];
97 int i;
Andre Heiderac81fa02020-09-11 06:35:10 +020098
Andre Heider3d33c1d2020-10-02 07:51:12 +020099 if (!of_machine_is_compatible("globalscale,espressobin"))
Andre Heiderac81fa02020-09-11 06:35:10 +0200100 return 0;
101
Derek LaHousse0bf72a92022-12-12 07:34:17 +0100102 /*
103 * Find free space for new variables in default_environment[] array.
104 * Free space is after the last variable, each variable is termined
105 * by nul byte and after the last variable is additional nul byte.
106 * Move ptr to the position where new variable can be filled.
107 */
108 while (*ptr != '\0') {
109 do { ptr++; } while (*ptr != '\0');
110 ptr++;
111 }
Pali Roháre8928992020-12-23 12:21:29 +0100112
Pali Rohár88d349a2020-12-23 12:21:30 +0100113 /*
114 * Ensure that 'env default -a' does not erase permanent MAC addresses
115 * stored in env variables: $ethaddr, $eth1addr, $eth2addr and $eth3addr
116 */
117
118 mac = env_get("ethaddr");
119 if (mac && strlen(mac) <= 17)
120 ptr += sprintf(ptr, "ethaddr=%s", mac) + 1;
121
122 for (i = 1; i <= 3; i++) {
123 sprintf(eth, "eth%daddr", i);
124 mac = env_get(eth);
125 if (mac && strlen(mac) <= 17)
126 ptr += sprintf(ptr, "%s=%s", eth, mac) + 1;
127 }
128
Andre Heiderac81fa02020-09-11 06:35:10 +0200129 /* If the memory controller has been configured for DDR4, we're running on v7 */
130 ddr4 = ((readl(A3700_CH0_MC_CTRL2_REG) >> A3700_MC_CTRL2_SDRAM_TYPE_OFFS)
131 & A3700_MC_CTRL2_SDRAM_TYPE_MASK) == A3700_MC_CTRL2_SDRAM_TYPE_DDR4;
132
Pali Rohár71388ee2020-11-25 19:20:10 +0100133 /* eMMC is mmc dev num 1 */
134 mmc_dev = find_mmc_device(1);
Pali Rohár7c639622021-07-14 16:37:29 +0200135 emmc = (mmc_dev && mmc_get_op_cond(mmc_dev, true) == 0);
Andre Heiderac81fa02020-09-11 06:35:10 +0200136
Pali Rohárf1000632020-12-21 11:09:10 +0100137 /* if eMMC is not present then remove it from DM */
138 if (!emmc && mmc_dev) {
139 dev = mmc_dev->dev;
140 device_remove(dev, DM_REMOVE_NORMAL);
141 device_unbind(dev);
Pali Rohárf71edd42022-08-27 14:00:51 +0200142 if (of_live_active())
143 ofnode_set_enabled(dev_ofnode(dev), false);
Pali Rohárf1000632020-12-21 11:09:10 +0100144 }
145
Pali Roháre8928992020-12-23 12:21:29 +0100146 /* Ensure that 'env default -a' set correct value to $fdtfile */
Andre Heiderac81fa02020-09-11 06:35:10 +0200147 if (ddr4 && emmc)
Pali Roháre8928992020-12-23 12:21:29 +0100148 strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
Andre Heiderac81fa02020-09-11 06:35:10 +0200149 else if (ddr4)
Pali Roháre8928992020-12-23 12:21:29 +0100150 strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7.dtb");
Andre Heiderac81fa02020-09-11 06:35:10 +0200151 else if (emmc)
Pali Roháre8928992020-12-23 12:21:29 +0100152 strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-emmc.dtb");
Andre Heiderac81fa02020-09-11 06:35:10 +0200153 else
Pali Roháre8928992020-12-23 12:21:29 +0100154 strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
Derek LaHousse0bf72a92022-12-12 07:34:17 +0100155 ptr += strlen(ptr) + 1;
156
157 /*
158 * After the last variable (which is nul term string) append another nul
159 * byte which terminates the list. So everything after ptr is ignored.
160 */
161 *ptr = '\0';
Pali Roháre8928992020-12-23 12:21:29 +0100162
Andre Heiderac81fa02020-09-11 06:35:10 +0200163 return 0;
164}
165#endif
Stefan Roese6edf27e2016-05-17 15:04:16 +0200166
167/* Board specific AHCI / SATA enable code */
168int board_ahci_enable(void)
169{
170 struct udevice *dev;
171 int ret;
172 u8 buf[8];
173
Konstantin Porotchkinb65ffc42017-02-16 13:52:32 +0200174 /* Only DB requres this configuration */
175 if (!of_machine_is_compatible("marvell,armada-3720-db"))
176 return 0;
177
Stefan Roese6edf27e2016-05-17 15:04:16 +0200178 /* Configure IO exander PCA9555: 7bit address 0x22 */
179 ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev);
180 if (ret) {
181 printf("Cannot find PCA9555: %d\n", ret);
182 return 0;
183 }
184
185 ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1);
186 if (ret) {
187 printf("Failed to read IO expander value via I2C\n");
188 return -EIO;
189 }
190
191 /*
192 * Enable SATA power via IO expander connected via I2C by setting
193 * the corresponding bit to output mode to enable power for SATA
194 */
195 buf[0] &= ~(1 << I2C_IO_REG_0_SATA_OFF);
196 ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1);
197 if (ret) {
198 printf("Failed to set IO expander via I2C\n");
199 return -EIO;
200 }
201
202 return 0;
203}
204
205/* Board specific xHCI enable code */
Jon Nettletona81f47c2017-11-06 10:33:19 +0200206int board_xhci_enable(fdt_addr_t base)
Stefan Roese6edf27e2016-05-17 15:04:16 +0200207{
208 struct udevice *dev;
209 int ret;
210 u8 buf[8];
211
Konstantin Porotchkinb65ffc42017-02-16 13:52:32 +0200212 /* Only DB requres this configuration */
213 if (!of_machine_is_compatible("marvell,armada-3720-db"))
214 return 0;
215
Stefan Roese6edf27e2016-05-17 15:04:16 +0200216 /* Configure IO exander PCA9555: 7bit address 0x22 */
217 ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev);
218 if (ret) {
219 printf("Cannot find PCA9555: %d\n", ret);
220 return 0;
221 }
222
223 printf("Enable USB VBUS\n");
224
225 /*
226 * Read configuration (direction) and set VBUS pin as output
227 * (reset pin = output)
228 */
229 ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1);
230 if (ret) {
231 printf("Failed to read IO expander value via I2C\n");
232 return -EIO;
233 }
234 buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF);
235 ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1);
236 if (ret) {
237 printf("Failed to set IO expander via I2C\n");
238 return -EIO;
239 }
240
241 /* Read VBUS output value and disable it */
242 ret = dm_i2c_read(dev, I2C_IO_DATA_OUT_REG_0, buf, 1);
243 if (ret) {
244 printf("Failed to read IO expander value via I2C\n");
245 return -EIO;
246 }
247 buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF);
248 ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1);
249 if (ret) {
250 printf("Failed to set IO expander via I2C\n");
251 return -EIO;
252 }
253
254 /*
255 * Required delay for configuration to settle - must wait for
256 * power on port is disabled in case VBUS signal was high,
257 * required 3 seconds delay to let VBUS signal fully settle down
258 */
259 mdelay(3000);
260
261 /* Enable VBUS power: Set output value of VBUS pin as enabled */
262 buf[0] |= (1 << I2C_IO_REG_0_USB_H_OFF);
263 ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1);
264 if (ret) {
265 printf("Failed to set IO expander via I2C\n");
266 return -EIO;
267 }
268
269 mdelay(500); /* required delay to let output value settle */
270
271 return 0;
272}
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200273
Marek Behún56a776e2022-04-27 12:41:48 +0200274#ifdef CONFIG_LAST_STAGE_INIT
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200275/* Helper function for accessing switch devices in multi-chip connection mode */
Marek Behún56a776e2022-04-27 12:41:48 +0200276static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr,
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200277 int smi_addr, int reg, u16 value)
278{
279 u16 smi_cmd = 0;
280
Marek Behún56a776e2022-04-27 12:41:48 +0200281 if (dm_mdio_write(bus, dev_smi_addr, MDIO_DEVAD_NONE,
282 MVEBU_SW_SMI_DATA_REG, value) != 0) {
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200283 printf("Error writing to the PHY addr=%02x reg=%02x\n",
284 smi_addr, reg);
285 return -EFAULT;
286 }
287
288 smi_cmd = (1 << SW_SMI_CMD_SMI_BUSY_OFF) |
289 (1 << SW_SMI_CMD_SMI_MODE_OFF) |
290 (1 << SW_SMI_CMD_SMI_OP_OFF) |
291 (smi_addr << SW_SMI_CMD_DEV_ADDR_OFF) |
292 (reg << SW_SMI_CMD_REG_ADDR_OFF);
Marek Behún56a776e2022-04-27 12:41:48 +0200293 if (dm_mdio_write(bus, dev_smi_addr, MDIO_DEVAD_NONE,
294 MVEBU_SW_SMI_CMD_REG, smi_cmd) != 0) {
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200295 printf("Error writing to the PHY addr=%02x reg=%02x\n",
296 smi_addr, reg);
297 return -EFAULT;
298 }
299
300 return 0;
301}
302
303/* Bring-up board-specific network stuff */
Marek Behún56a776e2022-04-27 12:41:48 +0200304int last_stage_init(void)
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200305{
Marek Behún56a776e2022-04-27 12:41:48 +0200306 struct udevice *bus;
307 ofnode node;
308
Andre Heider3d33c1d2020-10-02 07:51:12 +0200309 if (!of_machine_is_compatible("globalscale,espressobin"))
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200310 return 0;
311
Marek Behún56a776e2022-04-27 12:41:48 +0200312 node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio");
313 if (!ofnode_valid(node) ||
314 uclass_get_device_by_ofnode(UCLASS_MDIO, node, &bus) ||
315 device_probe(bus)) {
316 printf("Cannot find MDIO bus\n");
317 return 0;
318 }
319
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200320 /*
321 * FIXME: remove this code once Topaz driver gets available
322 * A3720 Community Board Only
323 * Configure Topaz switch (88E6341)
Pali Rohár7325a812020-08-17 16:36:38 +0200324 * Restrict output to ports 1,2,3 only from port 0 (CPU)
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200325 * Set port 0,1,2,3 to forwarding Mode (through Switch Port registers)
326 */
Pali Rohár7325a812020-08-17 16:36:38 +0200327 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(1),
328 MVEBU_SW_PORT_BASE_VLAN, BIT(0));
329 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(2),
330 MVEBU_SW_PORT_BASE_VLAN, BIT(0));
331 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(3),
332 MVEBU_SW_PORT_BASE_VLAN, BIT(0));
333
Konstantin Porotchkinf4d32b42017-02-16 13:52:29 +0200334 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(0),
335 MVEBU_SW_PORT_CTRL_REG, 0x7f);
336 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(1),
337 MVEBU_SW_PORT_CTRL_REG, 0x7f);
338 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(2),
339 MVEBU_SW_PORT_CTRL_REG, 0x7f);
340 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(3),
341 MVEBU_SW_PORT_CTRL_REG, 0x7f);
342
343 /* RGMII Delay on Port 0 (CPU port), force link to 1000Mbps */
344 mii_multi_chip_mode_write(bus, 1, MVEBU_PORT_CTRL_SMI_ADDR(0),
345 MVEBU_SW_LINK_CTRL_REG, 0xe002);
346
347 /* Power up PHY 1, 2, 3 (through Global 2 registers) */
348 mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR,
349 MVEBU_G2_SMI_PHY_DATA_REG, 0x1140);
350 mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR,
351 MVEBU_G2_SMI_PHY_CMD_REG, 0x9620);
352 mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR,
353 MVEBU_G2_SMI_PHY_CMD_REG, 0x9640);
354 mii_multi_chip_mode_write(bus, 1, MVEBU_SW_G2_SMI_ADDR,
355 MVEBU_G2_SMI_PHY_CMD_REG, 0x9660);
356
357 return 0;
358}
Marek Behún56a776e2022-04-27 12:41:48 +0200359#endif
Pali Rohárcb00c182020-08-19 16:24:17 +0200360
Rogier Stame0e10d42022-02-09 00:27:00 +0100361#ifdef CONFIG_OF_BOARD_SETUP
Pali Rohárcb00c182020-08-19 16:24:17 +0200362int ft_board_setup(void *blob, struct bd_info *bd)
363{
Rogier Stame0e10d42022-02-09 00:27:00 +0100364#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
Pali Rohárcb00c182020-08-19 16:24:17 +0200365 int ret;
366 int spi_off;
367 int parts_off;
368 int part_off;
369
370 /* Fill SPI MTD partitions for Linux kernel on Espressobin */
Andre Heider3d33c1d2020-10-02 07:51:12 +0200371 if (!of_machine_is_compatible("globalscale,espressobin"))
Pali Rohárcb00c182020-08-19 16:24:17 +0200372 return 0;
373
374 spi_off = fdt_node_offset_by_compatible(blob, -1, "jedec,spi-nor");
375 if (spi_off < 0)
376 return 0;
377
378 /* Do not touch partitions if they are already defined */
379 if (fdt_subnode_offset(blob, spi_off, "partitions") >= 0)
380 return 0;
381
382 parts_off = fdt_add_subnode(blob, spi_off, "partitions");
383 if (parts_off < 0) {
384 printf("Can't add partitions node: %s\n", fdt_strerror(parts_off));
385 return 0;
386 }
387
388 ret = fdt_setprop_string(blob, parts_off, "compatible", "fixed-partitions");
389 if (ret < 0) {
390 printf("Can't set compatible property: %s\n", fdt_strerror(ret));
391 return 0;
392 }
393
394 ret = fdt_setprop_u32(blob, parts_off, "#address-cells", 1);
395 if (ret < 0) {
396 printf("Can't set #address-cells property: %s\n", fdt_strerror(ret));
397 return 0;
398 }
399
400 ret = fdt_setprop_u32(blob, parts_off, "#size-cells", 1);
401 if (ret < 0) {
402 printf("Can't set #size-cells property: %s\n", fdt_strerror(ret));
403 return 0;
404 }
405
406 /* Add u-boot-env partition */
407
408 part_off = fdt_add_subnode(blob, parts_off, "partition@u-boot-env");
409 if (part_off < 0) {
410 printf("Can't add partition@u-boot-env node: %s\n", fdt_strerror(part_off));
411 return 0;
412 }
413
414 ret = fdt_setprop_u32(blob, part_off, "reg", CONFIG_ENV_OFFSET);
415 if (ret < 0) {
416 printf("Can't set partition@u-boot-env reg property: %s\n", fdt_strerror(ret));
417 return 0;
418 }
419
420 ret = fdt_appendprop_u32(blob, part_off, "reg", CONFIG_ENV_SIZE);
421 if (ret < 0) {
422 printf("Can't set partition@u-boot-env reg property: %s\n", fdt_strerror(ret));
423 return 0;
424 }
425
426 ret = fdt_setprop_string(blob, part_off, "label", "u-boot-env");
427 if (ret < 0) {
428 printf("Can't set partition@u-boot-env label property: %s\n", fdt_strerror(ret));
429 return 0;
430 }
431
432 /* Add firmware partition */
433
434 part_off = fdt_add_subnode(blob, parts_off, "partition@firmware");
435 if (part_off < 0) {
436 printf("Can't add partition@firmware node: %s\n", fdt_strerror(part_off));
437 return 0;
438 }
439
440 ret = fdt_setprop_u32(blob, part_off, "reg", 0);
441 if (ret < 0) {
442 printf("Can't set partition@firmware reg property: %s\n", fdt_strerror(ret));
443 return 0;
444 }
445
446 ret = fdt_appendprop_u32(blob, part_off, "reg", CONFIG_ENV_OFFSET);
447 if (ret < 0) {
448 printf("Can't set partition@firmware reg property: %s\n", fdt_strerror(ret));
449 return 0;
450 }
451
452 ret = fdt_setprop_string(blob, part_off, "label", "firmware");
453 if (ret < 0) {
454 printf("Can't set partition@firmware label property: %s\n", fdt_strerror(ret));
455 return 0;
456 }
457
Rogier Stame0e10d42022-02-09 00:27:00 +0100458#endif
Pali Rohárcb00c182020-08-19 16:24:17 +0200459 return 0;
460}
461#endif