1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
12 #include <env_internal.h>
13 #include <fdt_support.h>
15 #include <generic-phy.h>
27 #include <remoteproc.h>
34 #include <asm/arch/stm32.h>
35 #include <asm/arch/sys_proto.h>
36 #include <jffs2/load_kernel.h>
37 #include <linux/err.h>
38 #include <linux/iopoll.h>
39 #include <power/regulator.h>
40 #include <usb/dwc2_udc.h>
42 /* SYSCFG registers */
43 #define SYSCFG_BOOTR 0x00
44 #define SYSCFG_PMCSETR 0x04
45 #define SYSCFG_IOCTRLSETR 0x18
46 #define SYSCFG_ICNR 0x1C
47 #define SYSCFG_CMPCR 0x20
48 #define SYSCFG_CMPENSETR 0x24
49 #define SYSCFG_PMCCLRR 0x44
51 #define SYSCFG_BOOTR_BOOT_MASK GENMASK(2, 0)
52 #define SYSCFG_BOOTR_BOOTPD_SHIFT 4
54 #define SYSCFG_IOCTRLSETR_HSLVEN_TRACE BIT(0)
55 #define SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI BIT(1)
56 #define SYSCFG_IOCTRLSETR_HSLVEN_ETH BIT(2)
57 #define SYSCFG_IOCTRLSETR_HSLVEN_SDMMC BIT(3)
58 #define SYSCFG_IOCTRLSETR_HSLVEN_SPI BIT(4)
60 #define SYSCFG_CMPCR_SW_CTRL BIT(1)
61 #define SYSCFG_CMPCR_READY BIT(8)
63 #define SYSCFG_CMPENSETR_MPU_EN BIT(0)
65 #define SYSCFG_PMCSETR_ETH_CLK_SEL BIT(16)
66 #define SYSCFG_PMCSETR_ETH_REF_CLK_SEL BIT(17)
68 #define SYSCFG_PMCSETR_ETH_SELMII BIT(20)
70 #define SYSCFG_PMCSETR_ETH_SEL_MASK GENMASK(23, 21)
71 #define SYSCFG_PMCSETR_ETH_SEL_GMII_MII 0
72 #define SYSCFG_PMCSETR_ETH_SEL_RGMII BIT(21)
73 #define SYSCFG_PMCSETR_ETH_SEL_RMII BIT(23)
76 * Get a global data pointer
78 DECLARE_GLOBAL_DATA_PTR;
80 #define USB_LOW_THRESHOLD_UV 200000
81 #define USB_WARNING_LOW_THRESHOLD_UV 660000
82 #define USB_START_LOW_THRESHOLD_UV 1230000
83 #define USB_START_HIGH_THRESHOLD_UV 2150000
91 const char *fdt_compat;
94 if (IS_ENABLED(CONFIG_TFABOOT))
99 printf("Board: stm32mp1 in %s mode", mode);
100 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
102 if (fdt_compat && fdt_compat_len)
103 printf(" (%s)", fdt_compat);
106 /* display the STMicroelectronics board identification */
107 if (CONFIG_IS_ENABLED(CMD_STBOARD)) {
108 ret = uclass_get_device_by_driver(UCLASS_MISC,
109 DM_GET_DRIVER(stm32mp_bsec),
112 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
115 printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
119 ((otp >> 8) & 0xF) - 1 + 'A',
126 static void board_key_check(void)
128 #if defined(CONFIG_FASTBOOT) || defined(CONFIG_CMD_STM32PROG)
130 struct gpio_desc gpio;
131 enum forced_boot_mode boot_mode = BOOT_NORMAL;
133 node = ofnode_path("/config");
134 if (!ofnode_valid(node)) {
135 debug("%s: no /config node?\n", __func__);
138 #ifdef CONFIG_FASTBOOT
139 if (gpio_request_by_name_nodev(node, "st,fastboot-gpios", 0,
140 &gpio, GPIOD_IS_IN)) {
141 debug("%s: could not find a /config/st,fastboot-gpios\n",
144 if (dm_gpio_get_value(&gpio)) {
145 puts("Fastboot key pressed, ");
146 boot_mode = BOOT_FASTBOOT;
149 dm_gpio_free(NULL, &gpio);
152 #ifdef CONFIG_CMD_STM32PROG
153 if (gpio_request_by_name_nodev(node, "st,stm32prog-gpios", 0,
154 &gpio, GPIOD_IS_IN)) {
155 debug("%s: could not find a /config/st,stm32prog-gpios\n",
158 if (dm_gpio_get_value(&gpio)) {
159 puts("STM32Programmer key pressed, ");
160 boot_mode = BOOT_STM32PROG;
162 dm_gpio_free(NULL, &gpio);
166 if (boot_mode != BOOT_NORMAL) {
167 puts("entering download mode...\n");
168 clrsetbits_le32(TAMP_BOOT_CONTEXT,
169 TAMP_BOOT_FORCED_MASK,
175 #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
177 /* STMicroelectronics STUSB1600 Type-C controller */
178 #define STUSB1600_CC_CONNECTION_STATUS 0x0E
180 /* STUSB1600_CC_CONNECTION_STATUS bitfields */
181 #define STUSB1600_CC_ATTACH BIT(0)
183 static int stusb1600_init(struct udevice **dev_stusb1600)
186 struct udevice *dev, *bus;
190 *dev_stusb1600 = NULL;
192 /* if node stusb1600 is present, means DK1 or DK2 board */
193 node = ofnode_by_compatible(ofnode_null(), "st,stusb1600");
194 if (!ofnode_valid(node))
197 ret = ofnode_read_u32(node, "reg", &chip_addr);
201 ret = uclass_get_device_by_ofnode(UCLASS_I2C, ofnode_get_parent(node),
204 printf("bus for stusb1600 not found\n");
208 ret = dm_i2c_probe(bus, chip_addr, 0, &dev);
210 *dev_stusb1600 = dev;
215 static int stusb1600_cable_connected(struct udevice *dev)
219 if (dm_i2c_read(dev, STUSB1600_CC_CONNECTION_STATUS, &status, 1))
222 return status & STUSB1600_CC_ATTACH;
225 #include <usb/dwc2_udc.h>
226 int g_dnl_board_usb_cable_connected(void)
228 struct udevice *stusb1600;
229 struct udevice *dwc2_udc_otg;
232 if (!stusb1600_init(&stusb1600))
233 return stusb1600_cable_connected(stusb1600);
235 ret = uclass_get_device_by_driver(UCLASS_USB_GADGET_GENERIC,
236 DM_GET_DRIVER(dwc2_udc_otg),
239 debug("dwc2_udc_otg init failed\n");
241 return dwc2_udc_B_session_valid(dwc2_udc_otg);
244 #define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
245 #define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
247 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
249 if (!strcmp(name, "usb_dnl_dfu"))
250 put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, &dev->idProduct);
251 else if (!strcmp(name, "usb_dnl_fastboot"))
252 put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,
255 put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
260 #endif /* CONFIG_USB_GADGET */
262 static int get_led(struct udevice **dev, char *led_string)
267 led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
269 pr_debug("%s: could not find %s config string\n",
270 __func__, led_string);
273 ret = led_get_by_label(led_name, dev);
275 debug("%s: get=%d\n", __func__, ret);
282 static int setup_led(enum led_state_t cmd)
287 if (!CONFIG_IS_ENABLED(LED))
290 ret = get_led(&dev, "u-boot,boot-led");
294 ret = led_set_state(dev, cmd);
298 static void __maybe_unused led_error_blink(u32 nb_blink)
307 if (CONFIG_IS_ENABLED(LED)) {
308 ret = get_led(&led, "u-boot,error-led");
310 /* make u-boot,error-led blinking */
311 /* if U32_MAX and 125ms interval, for 17.02 years */
312 for (i = 0; i < 2 * nb_blink; i++) {
313 led_set_state(led, LEDST_TOGGLE);
317 led_set_state(led, LEDST_ON);
321 /* infinite: the boot process must be stopped */
322 if (nb_blink == U32_MAX)
327 static int board_check_usb_power(void)
329 struct ofnode_phandle_args adc_args;
334 int min_uV = USB_START_HIGH_THRESHOLD_UV;
335 int ret, uV, adc_count;
338 node = ofnode_path("/config");
339 if (!ofnode_valid(node)) {
340 debug("%s: no /config node?\n", __func__);
345 * Retrieve the ADC channels devices and get measurement
348 adc_count = ofnode_count_phandle_with_args(node, "st,adc_usb_pd",
349 "#io-channel-cells");
351 if (adc_count == -ENOENT)
354 pr_err("%s: can't find adc channel (%d)\n", __func__,
360 for (i = 0; i < adc_count; i++) {
361 if (ofnode_parse_phandle_with_args(node, "st,adc_usb_pd",
362 "#io-channel-cells", 0, i,
364 pr_debug("%s: can't find /config/st,adc_usb_pd\n",
369 ret = uclass_get_device_by_ofnode(UCLASS_ADC, adc_args.node,
373 pr_err("%s: Can't get adc device(%d)\n", __func__,
378 ret = adc_channel_single_shot(adc->name, adc_args.args[0],
381 pr_err("%s: single shot failed for %s[%d]!\n",
382 __func__, adc->name, adc_args.args[0]);
386 if (!adc_raw_to_uV(adc, raw, &uV)) {
391 pr_debug("%s: %s[%02d] = %u, %d uV\n", __func__,
392 adc->name, adc_args.args[0], raw, uV);
394 pr_err("%s: Can't get uV value for %s[%d]\n",
395 __func__, adc->name, adc_args.args[0]);
400 * If highest value is inside 1.23 Volts and 2.10 Volts, that means
401 * board is plugged on an USB-C 3A power supply and boot process can
404 if (max_uV > USB_START_LOW_THRESHOLD_UV &&
405 max_uV <= USB_START_HIGH_THRESHOLD_UV &&
406 min_uV <= USB_LOW_THRESHOLD_UV)
409 pr_err("****************************************************\n");
412 * If highest and lowest value are either both below
413 * USB_LOW_THRESHOLD_UV or both above USB_LOW_THRESHOLD_UV, that
414 * means USB TYPE-C is in unattached mode, this is an issue, make
415 * u-boot,error-led blinking and stop boot process.
417 if ((max_uV > USB_LOW_THRESHOLD_UV &&
418 min_uV > USB_LOW_THRESHOLD_UV) ||
419 (max_uV <= USB_LOW_THRESHOLD_UV &&
420 min_uV <= USB_LOW_THRESHOLD_UV)) {
421 pr_err("* ERROR USB TYPE-C connection in unattached mode *\n");
422 pr_err("* Check that USB TYPE-C cable is correctly plugged *\n");
423 /* with 125ms interval, led will blink for 17.02 years ....*/
427 if (max_uV > USB_LOW_THRESHOLD_UV &&
428 max_uV <= USB_WARNING_LOW_THRESHOLD_UV &&
429 min_uV <= USB_LOW_THRESHOLD_UV) {
430 pr_err("* WARNING 500mA power supply detected *\n");
434 if (max_uV > USB_WARNING_LOW_THRESHOLD_UV &&
435 max_uV <= USB_START_LOW_THRESHOLD_UV &&
436 min_uV <= USB_LOW_THRESHOLD_UV) {
437 pr_err("* WARNING 1.5A power supply detected *\n");
442 * If highest value is above 2.15 Volts that means that the USB TypeC
443 * supplies more than 3 Amp, this is not compliant with TypeC specification
445 if (max_uV > USB_START_HIGH_THRESHOLD_UV) {
446 pr_err("* USB TYPE-C charger not compliant with *\n");
447 pr_err("* specification *\n");
448 pr_err("****************************************************\n\n");
449 /* with 125ms interval, led will blink for 17.02 years ....*/
452 pr_err("* Current too low, use a 3A power supply! *\n");
453 pr_err("****************************************************\n\n");
456 led_error_blink(nb_blink);
460 #endif /* CONFIG_ADC */
462 static void sysconf_init(void)
464 #ifndef CONFIG_TFABOOT
466 #ifdef CONFIG_DM_REGULATOR
467 struct udevice *pwr_dev;
468 struct udevice *pwr_reg;
475 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
477 /* interconnect update : select master using the port 1 */
480 /* today information is hardcoded in U-Boot */
481 writel(BIT(9), syscfg + SYSCFG_ICNR);
483 /* disable Pull-Down for boot pin connected to VDD */
484 bootr = readl(syscfg + SYSCFG_BOOTR);
485 bootr &= ~(SYSCFG_BOOTR_BOOT_MASK << SYSCFG_BOOTR_BOOTPD_SHIFT);
486 bootr |= (bootr & SYSCFG_BOOTR_BOOT_MASK) << SYSCFG_BOOTR_BOOTPD_SHIFT;
487 writel(bootr, syscfg + SYSCFG_BOOTR);
489 #ifdef CONFIG_DM_REGULATOR
490 /* High Speed Low Voltage Pad mode Enable for SPI, SDMMC, ETH, QSPI
491 * and TRACE. Needed above ~50MHz and conditioned by AFMUX selection.
492 * The customer will have to disable this for low frequencies
493 * or if AFMUX is selected but the function not used, typically for
494 * TRACE. Otherwise, impact on power consumption.
497 * enabling High Speed mode while VDD>2.7V
498 * with the OTP product_below_2v5 (OTP 18, BIT 13)
499 * erroneously set to 1 can damage the IC!
500 * => U-Boot set the register only if VDD < 2.7V (in DT)
501 * but this value need to be consistent with board design
503 ret = uclass_get_device_by_driver(UCLASS_PMIC,
504 DM_GET_DRIVER(stm32mp_pwr_pmic),
507 ret = uclass_get_device_by_driver(UCLASS_MISC,
508 DM_GET_DRIVER(stm32mp_bsec),
511 pr_err("Can't find stm32mp_bsec driver\n");
515 ret = misc_read(dev, STM32_BSEC_SHADOW(18), &otp, 4);
519 /* get VDD = vdd-supply */
520 ret = device_get_supply_regulator(pwr_dev, "vdd-supply",
523 /* check if VDD is Low Voltage */
525 if (regulator_get_value(pwr_reg) < 2700000) {
526 writel(SYSCFG_IOCTRLSETR_HSLVEN_TRACE |
527 SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI |
528 SYSCFG_IOCTRLSETR_HSLVEN_ETH |
529 SYSCFG_IOCTRLSETR_HSLVEN_SDMMC |
530 SYSCFG_IOCTRLSETR_HSLVEN_SPI,
531 syscfg + SYSCFG_IOCTRLSETR);
534 pr_err("product_below_2v5=0: HSLVEN protected by HW\n");
537 pr_err("product_below_2v5=1: HSLVEN update is destructive, no update as VDD>2.7V\n");
540 debug("VDD unknown");
545 /* activate automatic I/O compensation
546 * warning: need to ensure CSI enabled and ready in clock driver
548 writel(SYSCFG_CMPENSETR_MPU_EN, syscfg + SYSCFG_CMPENSETR);
550 /* poll until ready (1s timeout) */
551 ret = readl_poll_timeout(syscfg + SYSCFG_CMPCR, val,
552 val & SYSCFG_CMPCR_READY,
555 pr_err("SYSCFG: I/O compensation failed, timeout.\n");
559 clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
563 #ifdef CONFIG_DM_REGULATOR
564 /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
565 static int dk2_i2c1_fix(void)
568 struct gpio_desc hdmi, audio;
571 node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
572 if (!ofnode_valid(node)) {
573 pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
577 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
578 &hdmi, GPIOD_IS_OUT)) {
579 pr_debug("%s: could not find reset-gpios\n",
584 node = ofnode_path("/soc/i2c@40012000/cs42l51@4a");
585 if (!ofnode_valid(node)) {
586 pr_debug("%s: no cs42l51@4a ?\n", __func__);
590 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
591 &audio, GPIOD_IS_OUT)) {
592 pr_debug("%s: could not find reset-gpios\n",
597 /* before power up, insure that HDMI and AUDIO IC is under reset */
598 ret = dm_gpio_set_value(&hdmi, 1);
600 pr_err("%s: can't set_value for hdmi_nrst gpio", __func__);
603 ret = dm_gpio_set_value(&audio, 1);
605 pr_err("%s: can't set_value for audio_nrst gpio", __func__);
609 /* power-up audio IC */
610 regulator_autoset_by_name("v1v8_audio", NULL);
612 /* power-up HDMI IC */
613 regulator_autoset_by_name("v1v2_hdmi", NULL);
614 regulator_autoset_by_name("v3v3_hdmi", NULL);
620 static bool board_is_dk2(void)
622 if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
623 of_machine_is_compatible("st,stm32mp157c-dk2"))
630 static bool board_is_ev1(void)
632 if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
633 (of_machine_is_compatible("st,stm32mp157a-ev1") ||
634 of_machine_is_compatible("st,stm32mp157c-ev1") ||
635 of_machine_is_compatible("st,stm32mp157d-ev1") ||
636 of_machine_is_compatible("st,stm32mp157f-ev1")))
642 /* touchscreen driver: only used for pincontrol configuration */
643 static const struct udevice_id goodix_ids[] = {
644 { .compatible = "goodix,gt9147", },
648 U_BOOT_DRIVER(goodix) = {
651 .of_match = goodix_ids,
654 static void board_ev1_init(void)
658 /* configure IRQ line on EV1 for touchscreen before LCD reset */
659 uclass_get_device_by_driver(UCLASS_NOP, DM_GET_DRIVER(goodix), &dev);
662 /* board dependent setup after realloc */
667 /* address of boot parameters */
668 gd->bd->bi_boot_params = STM32_DDR_BASE + 0x100;
670 /* probe all PINCTRL for hog */
671 for (uclass_first_device(UCLASS_PINCTRL, &dev);
673 uclass_next_device(&dev)) {
674 pr_debug("probe pincontrol = %s\n", dev->name);
682 #ifdef CONFIG_DM_REGULATOR
686 regulators_enable_boot_on(_DEBUG);
691 if (CONFIG_IS_ENABLED(LED))
699 int board_late_init(void)
701 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
702 const void *fdt_compat;
709 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
711 if (fdt_compat && fdt_compat_len) {
712 if (strncmp(fdt_compat, "st,", 3) != 0) {
713 env_set("board_name", fdt_compat);
716 int buf_len = sizeof(dtb_name);
718 env_set("board_name", fdt_compat + 3);
720 strncpy(dtb_name, fdt_compat + 3, buf_len);
721 buf_len -= strlen(fdt_compat + 3);
722 strncat(dtb_name, ".dtb", buf_len);
723 env_set("fdtfile", dtb_name);
726 ret = uclass_get_device_by_driver(UCLASS_MISC,
727 DM_GET_DRIVER(stm32mp_bsec),
731 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
734 snprintf(buf, sizeof(buf), "0x%04x", otp >> 16);
735 env_set("board_id", buf);
737 snprintf(buf, sizeof(buf), "0x%04x",
738 ((otp >> 8) & 0xF) - 1 + 0xA);
739 env_set("board_rev", buf);
744 /* for DK1/DK2 boards */
745 board_check_usb_power();
746 #endif /* CONFIG_ADC */
751 void board_quiesce_devices(void)
753 setup_led(LEDST_OFF);
756 /* eth init function : weak called in eqos driver */
757 int board_interface_eth_init(struct udevice *dev,
758 phy_interface_t interface_type)
762 bool eth_clk_sel_reg = false;
763 bool eth_ref_clk_sel_reg = false;
765 /* Gigabit Ethernet 125MHz clock selection. */
766 eth_clk_sel_reg = dev_read_bool(dev, "st,eth_clk_sel");
768 /* Ethernet 50Mhz RMII clock selection */
769 eth_ref_clk_sel_reg =
770 dev_read_bool(dev, "st,eth_ref_clk_sel");
772 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
777 switch (interface_type) {
778 case PHY_INTERFACE_MODE_MII:
779 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
780 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
781 debug("%s: PHY_INTERFACE_MODE_MII\n", __func__);
783 case PHY_INTERFACE_MODE_GMII:
785 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
786 SYSCFG_PMCSETR_ETH_CLK_SEL;
788 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII;
789 debug("%s: PHY_INTERFACE_MODE_GMII\n", __func__);
791 case PHY_INTERFACE_MODE_RMII:
792 if (eth_ref_clk_sel_reg)
793 value = SYSCFG_PMCSETR_ETH_SEL_RMII |
794 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
796 value = SYSCFG_PMCSETR_ETH_SEL_RMII;
797 debug("%s: PHY_INTERFACE_MODE_RMII\n", __func__);
799 case PHY_INTERFACE_MODE_RGMII:
800 case PHY_INTERFACE_MODE_RGMII_ID:
801 case PHY_INTERFACE_MODE_RGMII_RXID:
802 case PHY_INTERFACE_MODE_RGMII_TXID:
804 value = SYSCFG_PMCSETR_ETH_SEL_RGMII |
805 SYSCFG_PMCSETR_ETH_CLK_SEL;
807 value = SYSCFG_PMCSETR_ETH_SEL_RGMII;
808 debug("%s: PHY_INTERFACE_MODE_RGMII\n", __func__);
811 debug("%s: Do not manage %d interface\n",
812 __func__, interface_type);
813 /* Do not manage others interfaces */
817 /* clear and set ETH configuration bits */
818 writel(SYSCFG_PMCSETR_ETH_SEL_MASK | SYSCFG_PMCSETR_ETH_SELMII |
819 SYSCFG_PMCSETR_ETH_REF_CLK_SEL | SYSCFG_PMCSETR_ETH_CLK_SEL,
820 syscfg + SYSCFG_PMCCLRR);
821 writel(value, syscfg + SYSCFG_PMCSETR);
826 enum env_location env_get_location(enum env_operation op, int prio)
828 u32 bootmode = get_bootmode();
833 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
834 #ifdef CONFIG_ENV_IS_IN_EXT4
836 case BOOT_FLASH_EMMC:
839 #ifdef CONFIG_ENV_IS_IN_UBI
840 case BOOT_FLASH_NAND:
841 case BOOT_FLASH_SPINAND:
844 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
846 return ENVL_SPI_FLASH;
853 #if defined(CONFIG_ENV_IS_IN_EXT4)
854 const char *env_ext4_get_intf(void)
856 u32 bootmode = get_bootmode();
858 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
860 case BOOT_FLASH_EMMC:
867 const char *env_ext4_get_dev_part(void)
869 static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
870 u32 bootmode = get_bootmode();
872 return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
876 #if defined(CONFIG_OF_BOARD_SETUP)
877 int ft_board_setup(void *blob, bd_t *bd)
879 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
880 struct node_info nodes[] = {
881 { "st,stm32f469-qspi", MTD_DEV_TYPE_NOR, },
882 { "st,stm32f469-qspi", MTD_DEV_TYPE_SPINAND},
883 { "st,stm32mp15-fmc2", MTD_DEV_TYPE_NAND, },
885 fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
892 static void board_copro_image_process(ulong fw_image, size_t fw_size)
894 int ret, id = 0; /* Copro id fixed to 0 as only one coproc on mp1 */
896 if (!rproc_is_initialized())
898 printf("Remote Processor %d initialization failed\n",
903 ret = rproc_load(id, fw_image, fw_size);
904 printf("Load Remote Processor %d with data@addr=0x%08lx %u bytes:%s\n",
905 id, fw_image, fw_size, ret ? " Failed!" : " Success!");
911 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);