1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
12 #include <env_internal.h>
14 #include <generic-phy.h>
21 #include <remoteproc.h>
28 #include <asm/arch/stm32.h>
29 #include <asm/arch/sys_proto.h>
30 #include <jffs2/load_kernel.h>
31 #include <power/regulator.h>
32 #include <usb/dwc2_udc.h>
34 /* SYSCFG registers */
35 #define SYSCFG_BOOTR 0x00
36 #define SYSCFG_PMCSETR 0x04
37 #define SYSCFG_IOCTRLSETR 0x18
38 #define SYSCFG_ICNR 0x1C
39 #define SYSCFG_CMPCR 0x20
40 #define SYSCFG_CMPENSETR 0x24
41 #define SYSCFG_PMCCLRR 0x44
43 #define SYSCFG_BOOTR_BOOT_MASK GENMASK(2, 0)
44 #define SYSCFG_BOOTR_BOOTPD_SHIFT 4
46 #define SYSCFG_IOCTRLSETR_HSLVEN_TRACE BIT(0)
47 #define SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI BIT(1)
48 #define SYSCFG_IOCTRLSETR_HSLVEN_ETH BIT(2)
49 #define SYSCFG_IOCTRLSETR_HSLVEN_SDMMC BIT(3)
50 #define SYSCFG_IOCTRLSETR_HSLVEN_SPI BIT(4)
52 #define SYSCFG_CMPCR_SW_CTRL BIT(1)
53 #define SYSCFG_CMPCR_READY BIT(8)
55 #define SYSCFG_CMPENSETR_MPU_EN BIT(0)
57 #define SYSCFG_PMCSETR_ETH_CLK_SEL BIT(16)
58 #define SYSCFG_PMCSETR_ETH_REF_CLK_SEL BIT(17)
60 #define SYSCFG_PMCSETR_ETH_SELMII BIT(20)
62 #define SYSCFG_PMCSETR_ETH_SEL_MASK GENMASK(23, 21)
63 #define SYSCFG_PMCSETR_ETH_SEL_GMII_MII 0
64 #define SYSCFG_PMCSETR_ETH_SEL_RGMII BIT(21)
65 #define SYSCFG_PMCSETR_ETH_SEL_RMII BIT(23)
68 * Get a global data pointer
70 DECLARE_GLOBAL_DATA_PTR;
72 #define USB_LOW_THRESHOLD_UV 200000
73 #define USB_WARNING_LOW_THRESHOLD_UV 660000
74 #define USB_START_LOW_THRESHOLD_UV 1230000
75 #define USB_START_HIGH_THRESHOLD_UV 2150000
83 const char *fdt_compat;
86 if (IS_ENABLED(CONFIG_STM32MP1_OPTEE))
87 mode = "trusted with OP-TEE";
88 else if (IS_ENABLED(CONFIG_STM32MP1_TRUSTED))
93 printf("Board: stm32mp1 in %s mode", mode);
94 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
96 if (fdt_compat && fdt_compat_len)
97 printf(" (%s)", fdt_compat);
100 ret = uclass_get_device_by_driver(UCLASS_MISC,
101 DM_GET_DRIVER(stm32mp_bsec),
105 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
107 if (ret > 0 && otp) {
108 printf("Board: MB%04x Var%d Rev.%c-%02d\n",
111 ((otp >> 8) & 0xF) - 1 + 'A',
118 static void board_key_check(void)
120 #if defined(CONFIG_FASTBOOT) || defined(CONFIG_CMD_STM32PROG)
122 struct gpio_desc gpio;
123 enum forced_boot_mode boot_mode = BOOT_NORMAL;
125 node = ofnode_path("/config");
126 if (!ofnode_valid(node)) {
127 debug("%s: no /config node?\n", __func__);
130 #ifdef CONFIG_FASTBOOT
131 if (gpio_request_by_name_nodev(node, "st,fastboot-gpios", 0,
132 &gpio, GPIOD_IS_IN)) {
133 debug("%s: could not find a /config/st,fastboot-gpios\n",
136 if (dm_gpio_get_value(&gpio)) {
137 puts("Fastboot key pressed, ");
138 boot_mode = BOOT_FASTBOOT;
141 dm_gpio_free(NULL, &gpio);
144 #ifdef CONFIG_CMD_STM32PROG
145 if (gpio_request_by_name_nodev(node, "st,stm32prog-gpios", 0,
146 &gpio, GPIOD_IS_IN)) {
147 debug("%s: could not find a /config/st,stm32prog-gpios\n",
150 if (dm_gpio_get_value(&gpio)) {
151 puts("STM32Programmer key pressed, ");
152 boot_mode = BOOT_STM32PROG;
154 dm_gpio_free(NULL, &gpio);
158 if (boot_mode != BOOT_NORMAL) {
159 puts("entering download mode...\n");
160 clrsetbits_le32(TAMP_BOOT_CONTEXT,
161 TAMP_BOOT_FORCED_MASK,
167 #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
169 /* STMicroelectronics STUSB1600 Type-C controller */
170 #define STUSB1600_CC_CONNECTION_STATUS 0x0E
172 /* STUSB1600_CC_CONNECTION_STATUS bitfields */
173 #define STUSB1600_CC_ATTACH BIT(0)
175 static int stusb1600_init(struct udevice **dev_stusb1600)
178 struct udevice *dev, *bus;
182 *dev_stusb1600 = NULL;
184 /* if node stusb1600 is present, means DK1 or DK2 board */
185 node = ofnode_by_compatible(ofnode_null(), "st,stusb1600");
186 if (!ofnode_valid(node))
189 ret = ofnode_read_u32(node, "reg", &chip_addr);
193 ret = uclass_get_device_by_ofnode(UCLASS_I2C, ofnode_get_parent(node),
196 printf("bus for stusb1600 not found\n");
200 ret = dm_i2c_probe(bus, chip_addr, 0, &dev);
202 *dev_stusb1600 = dev;
207 static int stusb1600_cable_connected(struct udevice *dev)
211 if (dm_i2c_read(dev, STUSB1600_CC_CONNECTION_STATUS, &status, 1))
214 return status & STUSB1600_CC_ATTACH;
217 #include <usb/dwc2_udc.h>
218 int g_dnl_board_usb_cable_connected(void)
220 struct udevice *stusb1600;
221 struct udevice *dwc2_udc_otg;
224 if (!stusb1600_init(&stusb1600))
225 return stusb1600_cable_connected(stusb1600);
227 ret = uclass_get_device_by_driver(UCLASS_USB_GADGET_GENERIC,
228 DM_GET_DRIVER(dwc2_udc_otg),
231 debug("dwc2_udc_otg init failed\n");
233 return dwc2_udc_B_session_valid(dwc2_udc_otg);
235 #endif /* CONFIG_USB_GADGET */
238 static int get_led(struct udevice **dev, char *led_string)
243 led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
245 pr_debug("%s: could not find %s config string\n",
246 __func__, led_string);
249 ret = led_get_by_label(led_name, dev);
251 debug("%s: get=%d\n", __func__, ret);
258 static int setup_led(enum led_state_t cmd)
263 ret = get_led(&dev, "u-boot,boot-led");
267 ret = led_set_state(dev, cmd);
272 static void __maybe_unused led_error_blink(u32 nb_blink)
284 ret = get_led(&led, "u-boot,error-led");
286 /* make u-boot,error-led blinking */
287 /* if U32_MAX and 125ms interval, for 17.02 years */
288 for (i = 0; i < 2 * nb_blink; i++) {
289 led_set_state(led, LEDST_TOGGLE);
296 /* infinite: the boot process must be stopped */
297 if (nb_blink == U32_MAX)
302 static int board_check_usb_power(void)
304 struct ofnode_phandle_args adc_args;
309 int min_uV = USB_START_HIGH_THRESHOLD_UV;
310 int ret, uV, adc_count;
313 node = ofnode_path("/config");
314 if (!ofnode_valid(node)) {
315 debug("%s: no /config node?\n", __func__);
320 * Retrieve the ADC channels devices and get measurement
323 adc_count = ofnode_count_phandle_with_args(node, "st,adc_usb_pd",
324 "#io-channel-cells");
326 if (adc_count == -ENOENT)
329 pr_err("%s: can't find adc channel (%d)\n", __func__,
335 for (i = 0; i < adc_count; i++) {
336 if (ofnode_parse_phandle_with_args(node, "st,adc_usb_pd",
337 "#io-channel-cells", 0, i,
339 pr_debug("%s: can't find /config/st,adc_usb_pd\n",
344 ret = uclass_get_device_by_ofnode(UCLASS_ADC, adc_args.node,
348 pr_err("%s: Can't get adc device(%d)\n", __func__,
353 ret = adc_channel_single_shot(adc->name, adc_args.args[0],
356 pr_err("%s: single shot failed for %s[%d]!\n",
357 __func__, adc->name, adc_args.args[0]);
361 if (!adc_raw_to_uV(adc, raw, &uV)) {
366 pr_debug("%s: %s[%02d] = %u, %d uV\n", __func__,
367 adc->name, adc_args.args[0], raw, uV);
369 pr_err("%s: Can't get uV value for %s[%d]\n",
370 __func__, adc->name, adc_args.args[0]);
375 * If highest value is inside 1.23 Volts and 2.10 Volts, that means
376 * board is plugged on an USB-C 3A power supply and boot process can
379 if (max_uV > USB_START_LOW_THRESHOLD_UV &&
380 max_uV <= USB_START_HIGH_THRESHOLD_UV &&
381 min_uV <= USB_LOW_THRESHOLD_UV)
384 pr_err("****************************************************\n");
387 * If highest and lowest value are either both below
388 * USB_LOW_THRESHOLD_UV or both above USB_LOW_THRESHOLD_UV, that
389 * means USB TYPE-C is in unattached mode, this is an issue, make
390 * u-boot,error-led blinking and stop boot process.
392 if ((max_uV > USB_LOW_THRESHOLD_UV &&
393 min_uV > USB_LOW_THRESHOLD_UV) ||
394 (max_uV <= USB_LOW_THRESHOLD_UV &&
395 min_uV <= USB_LOW_THRESHOLD_UV)) {
396 pr_err("* ERROR USB TYPE-C connection in unattached mode *\n");
397 pr_err("* Check that USB TYPE-C cable is correctly plugged *\n");
398 /* with 125ms interval, led will blink for 17.02 years ....*/
402 if (max_uV > USB_LOW_THRESHOLD_UV &&
403 max_uV <= USB_WARNING_LOW_THRESHOLD_UV &&
404 min_uV <= USB_LOW_THRESHOLD_UV) {
405 pr_err("* WARNING 500mA power supply detected *\n");
409 if (max_uV > USB_WARNING_LOW_THRESHOLD_UV &&
410 max_uV <= USB_START_LOW_THRESHOLD_UV &&
411 min_uV <= USB_LOW_THRESHOLD_UV) {
412 pr_err("* WARNING 1.5mA power supply detected *\n");
417 * If highest value is above 2.15 Volts that means that the USB TypeC
418 * supplies more than 3 Amp, this is not compliant with TypeC specification
420 if (max_uV > USB_START_HIGH_THRESHOLD_UV) {
421 pr_err("* USB TYPE-C charger not compliant with *\n");
422 pr_err("* specification *\n");
423 pr_err("****************************************************\n\n");
424 /* with 125ms interval, led will blink for 17.02 years ....*/
427 pr_err("* Current too low, use a 3A power supply! *\n");
428 pr_err("****************************************************\n\n");
431 led_error_blink(nb_blink);
435 #endif /* CONFIG_ADC */
437 static void sysconf_init(void)
439 #ifndef CONFIG_STM32MP1_TRUSTED
441 #ifdef CONFIG_DM_REGULATOR
442 struct udevice *pwr_dev;
443 struct udevice *pwr_reg;
450 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
452 /* interconnect update : select master using the port 1 */
455 /* today information is hardcoded in U-Boot */
456 writel(BIT(9), syscfg + SYSCFG_ICNR);
458 /* disable Pull-Down for boot pin connected to VDD */
459 bootr = readl(syscfg + SYSCFG_BOOTR);
460 bootr &= ~(SYSCFG_BOOTR_BOOT_MASK << SYSCFG_BOOTR_BOOTPD_SHIFT);
461 bootr |= (bootr & SYSCFG_BOOTR_BOOT_MASK) << SYSCFG_BOOTR_BOOTPD_SHIFT;
462 writel(bootr, syscfg + SYSCFG_BOOTR);
464 #ifdef CONFIG_DM_REGULATOR
465 /* High Speed Low Voltage Pad mode Enable for SPI, SDMMC, ETH, QSPI
466 * and TRACE. Needed above ~50MHz and conditioned by AFMUX selection.
467 * The customer will have to disable this for low frequencies
468 * or if AFMUX is selected but the function not used, typically for
469 * TRACE. Otherwise, impact on power consumption.
472 * enabling High Speed mode while VDD>2.7V
473 * with the OTP product_below_2v5 (OTP 18, BIT 13)
474 * erroneously set to 1 can damage the IC!
475 * => U-Boot set the register only if VDD < 2.7V (in DT)
476 * but this value need to be consistent with board design
478 ret = uclass_get_device_by_driver(UCLASS_PMIC,
479 DM_GET_DRIVER(stm32mp_pwr_pmic),
482 ret = uclass_get_device_by_driver(UCLASS_MISC,
483 DM_GET_DRIVER(stm32mp_bsec),
486 pr_err("Can't find stm32mp_bsec driver\n");
490 ret = misc_read(dev, STM32_BSEC_SHADOW(18), &otp, 4);
494 /* get VDD = vdd-supply */
495 ret = device_get_supply_regulator(pwr_dev, "vdd-supply",
498 /* check if VDD is Low Voltage */
500 if (regulator_get_value(pwr_reg) < 2700000) {
501 writel(SYSCFG_IOCTRLSETR_HSLVEN_TRACE |
502 SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI |
503 SYSCFG_IOCTRLSETR_HSLVEN_ETH |
504 SYSCFG_IOCTRLSETR_HSLVEN_SDMMC |
505 SYSCFG_IOCTRLSETR_HSLVEN_SPI,
506 syscfg + SYSCFG_IOCTRLSETR);
509 pr_err("product_below_2v5=0: HSLVEN protected by HW\n");
512 pr_err("product_below_2v5=1: HSLVEN update is destructive, no update as VDD>2.7V\n");
515 debug("VDD unknown");
520 /* activate automatic I/O compensation
521 * warning: need to ensure CSI enabled and ready in clock driver
523 writel(SYSCFG_CMPENSETR_MPU_EN, syscfg + SYSCFG_CMPENSETR);
525 while (!(readl(syscfg + SYSCFG_CMPCR) & SYSCFG_CMPCR_READY))
527 clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
531 #ifdef CONFIG_DM_REGULATOR
532 /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
533 static int dk2_i2c1_fix(void)
536 struct gpio_desc hdmi, audio;
539 node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
540 if (!ofnode_valid(node)) {
541 pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
545 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
546 &hdmi, GPIOD_IS_OUT)) {
547 pr_debug("%s: could not find reset-gpios\n",
552 node = ofnode_path("/soc/i2c@40012000/cs42l51@4a");
553 if (!ofnode_valid(node)) {
554 pr_debug("%s: no cs42l51@4a ?\n", __func__);
558 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
559 &audio, GPIOD_IS_OUT)) {
560 pr_debug("%s: could not find reset-gpios\n",
565 /* before power up, insure that HDMI and AUDIO IC is under reset */
566 ret = dm_gpio_set_value(&hdmi, 1);
568 pr_err("%s: can't set_value for hdmi_nrst gpio", __func__);
571 ret = dm_gpio_set_value(&audio, 1);
573 pr_err("%s: can't set_value for audio_nrst gpio", __func__);
577 /* power-up audio IC */
578 regulator_autoset_by_name("v1v8_audio", NULL);
580 /* power-up HDMI IC */
581 regulator_autoset_by_name("v1v2_hdmi", NULL);
582 regulator_autoset_by_name("v3v3_hdmi", NULL);
588 static bool board_is_dk2(void)
590 if (CONFIG_IS_ENABLED(TARGET_STM32MP157C_DK2) &&
591 of_machine_is_compatible("st,stm32mp157c-dk2"))
598 /* board dependent setup after realloc */
603 /* address of boot parameters */
604 gd->bd->bi_boot_params = STM32_DDR_BASE + 0x100;
606 /* probe all PINCTRL for hog */
607 for (uclass_first_device(UCLASS_PINCTRL, &dev);
609 uclass_next_device(&dev)) {
610 pr_debug("probe pincontrol = %s\n", dev->name);
615 #ifdef CONFIG_DM_REGULATOR
619 regulators_enable_boot_on(_DEBUG);
624 if (CONFIG_IS_ENABLED(CONFIG_LED))
630 int board_late_init(void)
633 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
634 const void *fdt_compat;
641 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
643 if (fdt_compat && fdt_compat_len) {
644 if (strncmp(fdt_compat, "st,", 3) != 0)
645 env_set("board_name", fdt_compat);
647 env_set("board_name", fdt_compat + 3);
649 ret = uclass_get_device_by_driver(UCLASS_MISC,
650 DM_GET_DRIVER(stm32mp_bsec),
654 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
657 snprintf(buf, sizeof(buf), "0x%04x", otp >> 16);
658 env_set("board_id", buf);
660 snprintf(buf, sizeof(buf), "0x%04x",
661 ((otp >> 8) & 0xF) - 1 + 0xA);
662 env_set("board_rev", buf);
667 /* for DK1/DK2 boards */
668 board_check_usb_power();
669 #endif /* CONFIG_ADC */
671 /* Check the boot-source to disable bootdelay */
672 boot_device = env_get("boot_device");
673 if (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb"))
674 env_set("bootdelay", "0");
679 void board_quiesce_devices(void)
682 setup_led(LEDST_OFF);
686 /* board interface eth init */
687 int board_interface_eth_init(phy_interface_t interface_type,
688 bool eth_clk_sel_reg, bool eth_ref_clk_sel_reg)
693 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
698 switch (interface_type) {
699 case PHY_INTERFACE_MODE_MII:
700 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
701 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
702 debug("%s: PHY_INTERFACE_MODE_MII\n", __func__);
704 case PHY_INTERFACE_MODE_GMII:
706 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
707 SYSCFG_PMCSETR_ETH_CLK_SEL;
709 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII;
710 debug("%s: PHY_INTERFACE_MODE_GMII\n", __func__);
712 case PHY_INTERFACE_MODE_RMII:
713 if (eth_ref_clk_sel_reg)
714 value = SYSCFG_PMCSETR_ETH_SEL_RMII |
715 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
717 value = SYSCFG_PMCSETR_ETH_SEL_RMII;
718 debug("%s: PHY_INTERFACE_MODE_RMII\n", __func__);
720 case PHY_INTERFACE_MODE_RGMII:
721 case PHY_INTERFACE_MODE_RGMII_ID:
722 case PHY_INTERFACE_MODE_RGMII_RXID:
723 case PHY_INTERFACE_MODE_RGMII_TXID:
725 value = SYSCFG_PMCSETR_ETH_SEL_RGMII |
726 SYSCFG_PMCSETR_ETH_CLK_SEL;
728 value = SYSCFG_PMCSETR_ETH_SEL_RGMII;
729 debug("%s: PHY_INTERFACE_MODE_RGMII\n", __func__);
732 debug("%s: Do not manage %d interface\n",
733 __func__, interface_type);
734 /* Do not manage others interfaces */
738 /* clear and set ETH configuration bits */
739 writel(SYSCFG_PMCSETR_ETH_SEL_MASK | SYSCFG_PMCSETR_ETH_SELMII |
740 SYSCFG_PMCSETR_ETH_REF_CLK_SEL | SYSCFG_PMCSETR_ETH_CLK_SEL,
741 syscfg + SYSCFG_PMCCLRR);
742 writel(value, syscfg + SYSCFG_PMCSETR);
747 enum env_location env_get_location(enum env_operation op, int prio)
749 u32 bootmode = get_bootmode();
754 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
755 #ifdef CONFIG_ENV_IS_IN_EXT4
757 case BOOT_FLASH_EMMC:
760 #ifdef CONFIG_ENV_IS_IN_UBI
761 case BOOT_FLASH_NAND:
764 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
766 return ENVL_SPI_FLASH;
773 #if defined(CONFIG_ENV_IS_IN_EXT4)
774 const char *env_ext4_get_intf(void)
776 u32 bootmode = get_bootmode();
778 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
780 case BOOT_FLASH_EMMC:
787 const char *env_ext4_get_dev_part(void)
789 static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
790 u32 bootmode = get_bootmode();
792 return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
796 #ifdef CONFIG_SYS_MTDPARTS_RUNTIME
798 #define MTDPARTS_LEN 256
799 #define MTDIDS_LEN 128
802 * The mtdparts_nand0 and mtdparts_nor0 variable tends to be long.
803 * If we need to access it before the env is relocated, then we need
804 * to use our own stack buffer. gd->env_buf will be too small.
806 * @param buf temporary buffer pointer MTDPARTS_LEN long
807 * @return mtdparts variable string, NULL if not found
809 static const char *env_get_mtdparts(const char *str, char *buf)
811 if (gd->flags & GD_FLG_ENV_READY)
813 if (env_get_f(str, buf, MTDPARTS_LEN) != -1)
820 * update the variables "mtdids" and "mtdparts" with content of mtdparts_<dev>
822 static void board_get_mtdparts(const char *dev,
826 char env_name[32] = "mtdparts_";
827 char tmp_mtdparts[MTDPARTS_LEN];
830 /* name of env variable to read = mtdparts_<dev> */
831 strcat(env_name, dev);
832 tmp = env_get_mtdparts(env_name, tmp_mtdparts);
834 /* mtdids: "<dev>=<dev>, ...." */
835 if (mtdids[0] != '\0')
841 /* mtdparts: "mtdparts=<dev>:<mtdparts_<dev>>;..." */
842 if (mtdparts[0] != '\0')
843 strncat(mtdparts, ";", MTDPARTS_LEN);
845 strcat(mtdparts, "mtdparts=");
846 strncat(mtdparts, dev, MTDPARTS_LEN);
847 strncat(mtdparts, ":", MTDPARTS_LEN);
848 strncat(mtdparts, tmp, MTDPARTS_LEN);
852 void board_mtdparts_default(const char **mtdids, const char **mtdparts)
855 static char parts[2 * MTDPARTS_LEN + 1];
856 static char ids[MTDIDS_LEN + 1];
857 static bool mtd_initialized;
859 if (mtd_initialized) {
865 memset(parts, 0, sizeof(parts));
866 memset(ids, 0, sizeof(ids));
868 if (!uclass_get_device(UCLASS_MTD, 0, &dev))
869 board_get_mtdparts("nand0", ids, parts);
871 if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev))
872 board_get_mtdparts("nor0", ids, parts);
874 mtd_initialized = true;
877 debug("%s:mtdids=%s & mtdparts=%s\n", __func__, ids, parts);
881 #if defined(CONFIG_OF_BOARD_SETUP)
882 int ft_board_setup(void *blob, bd_t *bd)
884 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
885 struct node_info nodes[] = {
886 { "st,stm32f469-qspi", MTD_DEV_TYPE_NOR, },
887 { "st,stm32mp15-fmc2", MTD_DEV_TYPE_NAND, },
889 fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
896 static void board_copro_image_process(ulong fw_image, size_t fw_size)
898 int ret, id = 0; /* Copro id fixed to 0 as only one coproc on mp1 */
900 if (!rproc_is_initialized())
902 printf("Remote Processor %d initialization failed\n",
907 ret = rproc_load(id, fw_image, fw_size);
908 printf("Load Remote Processor %d with data@addr=0x%08lx %u bytes:%s\n",
909 id, fw_image, fw_size, ret ? " Failed!" : " Success!");
913 env_set("copro_state", "booted");
917 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);