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/bitops.h>
38 #include <linux/delay.h>
39 #include <linux/err.h>
40 #include <linux/iopoll.h>
41 #include <power/regulator.h>
42 #include <usb/dwc2_udc.h>
44 /* SYSCFG registers */
45 #define SYSCFG_BOOTR 0x00
46 #define SYSCFG_PMCSETR 0x04
47 #define SYSCFG_IOCTRLSETR 0x18
48 #define SYSCFG_ICNR 0x1C
49 #define SYSCFG_CMPCR 0x20
50 #define SYSCFG_CMPENSETR 0x24
51 #define SYSCFG_PMCCLRR 0x44
53 #define SYSCFG_BOOTR_BOOT_MASK GENMASK(2, 0)
54 #define SYSCFG_BOOTR_BOOTPD_SHIFT 4
56 #define SYSCFG_IOCTRLSETR_HSLVEN_TRACE BIT(0)
57 #define SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI BIT(1)
58 #define SYSCFG_IOCTRLSETR_HSLVEN_ETH BIT(2)
59 #define SYSCFG_IOCTRLSETR_HSLVEN_SDMMC BIT(3)
60 #define SYSCFG_IOCTRLSETR_HSLVEN_SPI BIT(4)
62 #define SYSCFG_CMPCR_SW_CTRL BIT(1)
63 #define SYSCFG_CMPCR_READY BIT(8)
65 #define SYSCFG_CMPENSETR_MPU_EN BIT(0)
67 #define SYSCFG_PMCSETR_ETH_CLK_SEL BIT(16)
68 #define SYSCFG_PMCSETR_ETH_REF_CLK_SEL BIT(17)
70 #define SYSCFG_PMCSETR_ETH_SELMII BIT(20)
72 #define SYSCFG_PMCSETR_ETH_SEL_MASK GENMASK(23, 21)
73 #define SYSCFG_PMCSETR_ETH_SEL_GMII_MII 0
74 #define SYSCFG_PMCSETR_ETH_SEL_RGMII BIT(21)
75 #define SYSCFG_PMCSETR_ETH_SEL_RMII BIT(23)
78 * Get a global data pointer
80 DECLARE_GLOBAL_DATA_PTR;
82 #define USB_LOW_THRESHOLD_UV 200000
83 #define USB_WARNING_LOW_THRESHOLD_UV 660000
84 #define USB_START_LOW_THRESHOLD_UV 1230000
85 #define USB_START_HIGH_THRESHOLD_UV 2150000
93 const char *fdt_compat;
96 if (IS_ENABLED(CONFIG_TFABOOT))
101 printf("Board: stm32mp1 in %s mode", mode);
102 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
104 if (fdt_compat && fdt_compat_len)
105 printf(" (%s)", fdt_compat);
108 /* display the STMicroelectronics board identification */
109 if (CONFIG_IS_ENABLED(CMD_STBOARD)) {
110 ret = uclass_get_device_by_driver(UCLASS_MISC,
111 DM_GET_DRIVER(stm32mp_bsec),
114 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
117 printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
121 ((otp >> 8) & 0xF) - 1 + 'A',
128 static void board_key_check(void)
130 #if defined(CONFIG_FASTBOOT) || defined(CONFIG_CMD_STM32PROG)
132 struct gpio_desc gpio;
133 enum forced_boot_mode boot_mode = BOOT_NORMAL;
135 node = ofnode_path("/config");
136 if (!ofnode_valid(node)) {
137 debug("%s: no /config node?\n", __func__);
140 #ifdef CONFIG_FASTBOOT
141 if (gpio_request_by_name_nodev(node, "st,fastboot-gpios", 0,
142 &gpio, GPIOD_IS_IN)) {
143 debug("%s: could not find a /config/st,fastboot-gpios\n",
146 if (dm_gpio_get_value(&gpio)) {
147 puts("Fastboot key pressed, ");
148 boot_mode = BOOT_FASTBOOT;
151 dm_gpio_free(NULL, &gpio);
154 #ifdef CONFIG_CMD_STM32PROG
155 if (gpio_request_by_name_nodev(node, "st,stm32prog-gpios", 0,
156 &gpio, GPIOD_IS_IN)) {
157 debug("%s: could not find a /config/st,stm32prog-gpios\n",
160 if (dm_gpio_get_value(&gpio)) {
161 puts("STM32Programmer key pressed, ");
162 boot_mode = BOOT_STM32PROG;
164 dm_gpio_free(NULL, &gpio);
168 if (boot_mode != BOOT_NORMAL) {
169 puts("entering download mode...\n");
170 clrsetbits_le32(TAMP_BOOT_CONTEXT,
171 TAMP_BOOT_FORCED_MASK,
177 #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
179 /* STMicroelectronics STUSB1600 Type-C controller */
180 #define STUSB1600_CC_CONNECTION_STATUS 0x0E
182 /* STUSB1600_CC_CONNECTION_STATUS bitfields */
183 #define STUSB1600_CC_ATTACH BIT(0)
185 static int stusb1600_init(struct udevice **dev_stusb1600)
188 struct udevice *dev, *bus;
192 *dev_stusb1600 = NULL;
194 /* if node stusb1600 is present, means DK1 or DK2 board */
195 node = ofnode_by_compatible(ofnode_null(), "st,stusb1600");
196 if (!ofnode_valid(node))
199 ret = ofnode_read_u32(node, "reg", &chip_addr);
203 ret = uclass_get_device_by_ofnode(UCLASS_I2C, ofnode_get_parent(node),
206 printf("bus for stusb1600 not found\n");
210 ret = dm_i2c_probe(bus, chip_addr, 0, &dev);
212 *dev_stusb1600 = dev;
217 static int stusb1600_cable_connected(struct udevice *dev)
221 if (dm_i2c_read(dev, STUSB1600_CC_CONNECTION_STATUS, &status, 1))
224 return status & STUSB1600_CC_ATTACH;
227 #include <usb/dwc2_udc.h>
228 int g_dnl_board_usb_cable_connected(void)
230 struct udevice *stusb1600;
231 struct udevice *dwc2_udc_otg;
234 if (!stusb1600_init(&stusb1600))
235 return stusb1600_cable_connected(stusb1600);
237 ret = uclass_get_device_by_driver(UCLASS_USB_GADGET_GENERIC,
238 DM_GET_DRIVER(dwc2_udc_otg),
241 debug("dwc2_udc_otg init failed\n");
243 return dwc2_udc_B_session_valid(dwc2_udc_otg);
246 #define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
247 #define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
249 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
251 if (!strcmp(name, "usb_dnl_dfu"))
252 put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, &dev->idProduct);
253 else if (!strcmp(name, "usb_dnl_fastboot"))
254 put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,
257 put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
262 #endif /* CONFIG_USB_GADGET */
264 static int get_led(struct udevice **dev, char *led_string)
269 led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
271 pr_debug("%s: could not find %s config string\n",
272 __func__, led_string);
275 ret = led_get_by_label(led_name, dev);
277 debug("%s: get=%d\n", __func__, ret);
284 static int setup_led(enum led_state_t cmd)
289 if (!CONFIG_IS_ENABLED(LED))
292 ret = get_led(&dev, "u-boot,boot-led");
296 ret = led_set_state(dev, cmd);
300 static void __maybe_unused led_error_blink(u32 nb_blink)
309 if (CONFIG_IS_ENABLED(LED)) {
310 ret = get_led(&led, "u-boot,error-led");
312 /* make u-boot,error-led blinking */
313 /* if U32_MAX and 125ms interval, for 17.02 years */
314 for (i = 0; i < 2 * nb_blink; i++) {
315 led_set_state(led, LEDST_TOGGLE);
319 led_set_state(led, LEDST_ON);
323 /* infinite: the boot process must be stopped */
324 if (nb_blink == U32_MAX)
329 static int board_check_usb_power(void)
331 struct ofnode_phandle_args adc_args;
336 int min_uV = USB_START_HIGH_THRESHOLD_UV;
337 int ret, uV, adc_count;
340 node = ofnode_path("/config");
341 if (!ofnode_valid(node)) {
342 debug("%s: no /config node?\n", __func__);
347 * Retrieve the ADC channels devices and get measurement
350 adc_count = ofnode_count_phandle_with_args(node, "st,adc_usb_pd",
351 "#io-channel-cells");
353 if (adc_count == -ENOENT)
356 pr_err("%s: can't find adc channel (%d)\n", __func__,
362 for (i = 0; i < adc_count; i++) {
363 if (ofnode_parse_phandle_with_args(node, "st,adc_usb_pd",
364 "#io-channel-cells", 0, i,
366 pr_debug("%s: can't find /config/st,adc_usb_pd\n",
371 ret = uclass_get_device_by_ofnode(UCLASS_ADC, adc_args.node,
375 pr_err("%s: Can't get adc device(%d)\n", __func__,
380 ret = adc_channel_single_shot(adc->name, adc_args.args[0],
383 pr_err("%s: single shot failed for %s[%d]!\n",
384 __func__, adc->name, adc_args.args[0]);
388 if (!adc_raw_to_uV(adc, raw, &uV)) {
393 pr_debug("%s: %s[%02d] = %u, %d uV\n", __func__,
394 adc->name, adc_args.args[0], raw, uV);
396 pr_err("%s: Can't get uV value for %s[%d]\n",
397 __func__, adc->name, adc_args.args[0]);
402 * If highest value is inside 1.23 Volts and 2.10 Volts, that means
403 * board is plugged on an USB-C 3A power supply and boot process can
406 if (max_uV > USB_START_LOW_THRESHOLD_UV &&
407 max_uV <= USB_START_HIGH_THRESHOLD_UV &&
408 min_uV <= USB_LOW_THRESHOLD_UV)
411 pr_err("****************************************************\n");
414 * If highest and lowest value are either both below
415 * USB_LOW_THRESHOLD_UV or both above USB_LOW_THRESHOLD_UV, that
416 * means USB TYPE-C is in unattached mode, this is an issue, make
417 * u-boot,error-led blinking and stop boot process.
419 if ((max_uV > USB_LOW_THRESHOLD_UV &&
420 min_uV > USB_LOW_THRESHOLD_UV) ||
421 (max_uV <= USB_LOW_THRESHOLD_UV &&
422 min_uV <= USB_LOW_THRESHOLD_UV)) {
423 pr_err("* ERROR USB TYPE-C connection in unattached mode *\n");
424 pr_err("* Check that USB TYPE-C cable is correctly plugged *\n");
425 /* with 125ms interval, led will blink for 17.02 years ....*/
429 if (max_uV > USB_LOW_THRESHOLD_UV &&
430 max_uV <= USB_WARNING_LOW_THRESHOLD_UV &&
431 min_uV <= USB_LOW_THRESHOLD_UV) {
432 pr_err("* WARNING 500mA power supply detected *\n");
436 if (max_uV > USB_WARNING_LOW_THRESHOLD_UV &&
437 max_uV <= USB_START_LOW_THRESHOLD_UV &&
438 min_uV <= USB_LOW_THRESHOLD_UV) {
439 pr_err("* WARNING 1.5A power supply detected *\n");
444 * If highest value is above 2.15 Volts that means that the USB TypeC
445 * supplies more than 3 Amp, this is not compliant with TypeC specification
447 if (max_uV > USB_START_HIGH_THRESHOLD_UV) {
448 pr_err("* USB TYPE-C charger not compliant with *\n");
449 pr_err("* specification *\n");
450 pr_err("****************************************************\n\n");
451 /* with 125ms interval, led will blink for 17.02 years ....*/
454 pr_err("* Current too low, use a 3A power supply! *\n");
455 pr_err("****************************************************\n\n");
458 led_error_blink(nb_blink);
462 #endif /* CONFIG_ADC */
464 static void sysconf_init(void)
466 #ifndef CONFIG_TFABOOT
468 #ifdef CONFIG_DM_REGULATOR
469 struct udevice *pwr_dev;
470 struct udevice *pwr_reg;
477 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
479 /* interconnect update : select master using the port 1 */
482 /* today information is hardcoded in U-Boot */
483 writel(BIT(9), syscfg + SYSCFG_ICNR);
485 /* disable Pull-Down for boot pin connected to VDD */
486 bootr = readl(syscfg + SYSCFG_BOOTR);
487 bootr &= ~(SYSCFG_BOOTR_BOOT_MASK << SYSCFG_BOOTR_BOOTPD_SHIFT);
488 bootr |= (bootr & SYSCFG_BOOTR_BOOT_MASK) << SYSCFG_BOOTR_BOOTPD_SHIFT;
489 writel(bootr, syscfg + SYSCFG_BOOTR);
491 #ifdef CONFIG_DM_REGULATOR
492 /* High Speed Low Voltage Pad mode Enable for SPI, SDMMC, ETH, QSPI
493 * and TRACE. Needed above ~50MHz and conditioned by AFMUX selection.
494 * The customer will have to disable this for low frequencies
495 * or if AFMUX is selected but the function not used, typically for
496 * TRACE. Otherwise, impact on power consumption.
499 * enabling High Speed mode while VDD>2.7V
500 * with the OTP product_below_2v5 (OTP 18, BIT 13)
501 * erroneously set to 1 can damage the IC!
502 * => U-Boot set the register only if VDD < 2.7V (in DT)
503 * but this value need to be consistent with board design
505 ret = uclass_get_device_by_driver(UCLASS_PMIC,
506 DM_GET_DRIVER(stm32mp_pwr_pmic),
509 ret = uclass_get_device_by_driver(UCLASS_MISC,
510 DM_GET_DRIVER(stm32mp_bsec),
513 pr_err("Can't find stm32mp_bsec driver\n");
517 ret = misc_read(dev, STM32_BSEC_SHADOW(18), &otp, 4);
521 /* get VDD = vdd-supply */
522 ret = device_get_supply_regulator(pwr_dev, "vdd-supply",
525 /* check if VDD is Low Voltage */
527 if (regulator_get_value(pwr_reg) < 2700000) {
528 writel(SYSCFG_IOCTRLSETR_HSLVEN_TRACE |
529 SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI |
530 SYSCFG_IOCTRLSETR_HSLVEN_ETH |
531 SYSCFG_IOCTRLSETR_HSLVEN_SDMMC |
532 SYSCFG_IOCTRLSETR_HSLVEN_SPI,
533 syscfg + SYSCFG_IOCTRLSETR);
536 pr_err("product_below_2v5=0: HSLVEN protected by HW\n");
539 pr_err("product_below_2v5=1: HSLVEN update is destructive, no update as VDD>2.7V\n");
542 debug("VDD unknown");
547 /* activate automatic I/O compensation
548 * warning: need to ensure CSI enabled and ready in clock driver
550 writel(SYSCFG_CMPENSETR_MPU_EN, syscfg + SYSCFG_CMPENSETR);
552 /* poll until ready (1s timeout) */
553 ret = readl_poll_timeout(syscfg + SYSCFG_CMPCR, val,
554 val & SYSCFG_CMPCR_READY,
557 pr_err("SYSCFG: I/O compensation failed, timeout.\n");
561 clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
565 #ifdef CONFIG_DM_REGULATOR
566 /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
567 static int dk2_i2c1_fix(void)
570 struct gpio_desc hdmi, audio;
573 node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
574 if (!ofnode_valid(node)) {
575 pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
579 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
580 &hdmi, GPIOD_IS_OUT)) {
581 pr_debug("%s: could not find reset-gpios\n",
586 node = ofnode_path("/soc/i2c@40012000/cs42l51@4a");
587 if (!ofnode_valid(node)) {
588 pr_debug("%s: no cs42l51@4a ?\n", __func__);
592 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
593 &audio, GPIOD_IS_OUT)) {
594 pr_debug("%s: could not find reset-gpios\n",
599 /* before power up, insure that HDMI and AUDIO IC is under reset */
600 ret = dm_gpio_set_value(&hdmi, 1);
602 pr_err("%s: can't set_value for hdmi_nrst gpio", __func__);
605 ret = dm_gpio_set_value(&audio, 1);
607 pr_err("%s: can't set_value for audio_nrst gpio", __func__);
611 /* power-up audio IC */
612 regulator_autoset_by_name("v1v8_audio", NULL);
614 /* power-up HDMI IC */
615 regulator_autoset_by_name("v1v2_hdmi", NULL);
616 regulator_autoset_by_name("v3v3_hdmi", NULL);
622 static bool board_is_dk2(void)
624 if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
625 of_machine_is_compatible("st,stm32mp157c-dk2"))
632 static bool board_is_ev1(void)
634 if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
635 (of_machine_is_compatible("st,stm32mp157a-ev1") ||
636 of_machine_is_compatible("st,stm32mp157c-ev1") ||
637 of_machine_is_compatible("st,stm32mp157d-ev1") ||
638 of_machine_is_compatible("st,stm32mp157f-ev1")))
644 /* touchscreen driver: only used for pincontrol configuration */
645 static const struct udevice_id goodix_ids[] = {
646 { .compatible = "goodix,gt9147", },
650 U_BOOT_DRIVER(goodix) = {
653 .of_match = goodix_ids,
656 static void board_ev1_init(void)
660 /* configure IRQ line on EV1 for touchscreen before LCD reset */
661 uclass_get_device_by_driver(UCLASS_NOP, DM_GET_DRIVER(goodix), &dev);
664 /* board dependent setup after realloc */
669 /* address of boot parameters */
670 gd->bd->bi_boot_params = STM32_DDR_BASE + 0x100;
672 /* probe all PINCTRL for hog */
673 for (uclass_first_device(UCLASS_PINCTRL, &dev);
675 uclass_next_device(&dev)) {
676 pr_debug("probe pincontrol = %s\n", dev->name);
684 #ifdef CONFIG_DM_REGULATOR
688 regulators_enable_boot_on(_DEBUG);
693 if (CONFIG_IS_ENABLED(LED))
701 int board_late_init(void)
703 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
704 const void *fdt_compat;
711 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
713 if (fdt_compat && fdt_compat_len) {
714 if (strncmp(fdt_compat, "st,", 3) != 0) {
715 env_set("board_name", fdt_compat);
718 int buf_len = sizeof(dtb_name);
720 env_set("board_name", fdt_compat + 3);
722 strncpy(dtb_name, fdt_compat + 3, buf_len);
723 buf_len -= strlen(fdt_compat + 3);
724 strncat(dtb_name, ".dtb", buf_len);
725 env_set("fdtfile", dtb_name);
728 ret = uclass_get_device_by_driver(UCLASS_MISC,
729 DM_GET_DRIVER(stm32mp_bsec),
733 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
736 snprintf(buf, sizeof(buf), "0x%04x", otp >> 16);
737 env_set("board_id", buf);
739 snprintf(buf, sizeof(buf), "0x%04x",
740 ((otp >> 8) & 0xF) - 1 + 0xA);
741 env_set("board_rev", buf);
746 /* for DK1/DK2 boards */
747 board_check_usb_power();
748 #endif /* CONFIG_ADC */
753 void board_quiesce_devices(void)
755 setup_led(LEDST_OFF);
758 /* eth init function : weak called in eqos driver */
759 int board_interface_eth_init(struct udevice *dev,
760 phy_interface_t interface_type)
764 bool eth_clk_sel_reg = false;
765 bool eth_ref_clk_sel_reg = false;
767 /* Gigabit Ethernet 125MHz clock selection. */
768 eth_clk_sel_reg = dev_read_bool(dev, "st,eth_clk_sel");
770 /* Ethernet 50Mhz RMII clock selection */
771 eth_ref_clk_sel_reg =
772 dev_read_bool(dev, "st,eth_ref_clk_sel");
774 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
779 switch (interface_type) {
780 case PHY_INTERFACE_MODE_MII:
781 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
782 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
783 debug("%s: PHY_INTERFACE_MODE_MII\n", __func__);
785 case PHY_INTERFACE_MODE_GMII:
787 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
788 SYSCFG_PMCSETR_ETH_CLK_SEL;
790 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII;
791 debug("%s: PHY_INTERFACE_MODE_GMII\n", __func__);
793 case PHY_INTERFACE_MODE_RMII:
794 if (eth_ref_clk_sel_reg)
795 value = SYSCFG_PMCSETR_ETH_SEL_RMII |
796 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
798 value = SYSCFG_PMCSETR_ETH_SEL_RMII;
799 debug("%s: PHY_INTERFACE_MODE_RMII\n", __func__);
801 case PHY_INTERFACE_MODE_RGMII:
802 case PHY_INTERFACE_MODE_RGMII_ID:
803 case PHY_INTERFACE_MODE_RGMII_RXID:
804 case PHY_INTERFACE_MODE_RGMII_TXID:
806 value = SYSCFG_PMCSETR_ETH_SEL_RGMII |
807 SYSCFG_PMCSETR_ETH_CLK_SEL;
809 value = SYSCFG_PMCSETR_ETH_SEL_RGMII;
810 debug("%s: PHY_INTERFACE_MODE_RGMII\n", __func__);
813 debug("%s: Do not manage %d interface\n",
814 __func__, interface_type);
815 /* Do not manage others interfaces */
819 /* clear and set ETH configuration bits */
820 writel(SYSCFG_PMCSETR_ETH_SEL_MASK | SYSCFG_PMCSETR_ETH_SELMII |
821 SYSCFG_PMCSETR_ETH_REF_CLK_SEL | SYSCFG_PMCSETR_ETH_CLK_SEL,
822 syscfg + SYSCFG_PMCCLRR);
823 writel(value, syscfg + SYSCFG_PMCSETR);
828 enum env_location env_get_location(enum env_operation op, int prio)
830 u32 bootmode = get_bootmode();
835 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
836 #ifdef CONFIG_ENV_IS_IN_EXT4
838 case BOOT_FLASH_EMMC:
841 #ifdef CONFIG_ENV_IS_IN_UBI
842 case BOOT_FLASH_NAND:
843 case BOOT_FLASH_SPINAND:
846 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
848 return ENVL_SPI_FLASH;
855 #if defined(CONFIG_ENV_IS_IN_EXT4)
856 const char *env_ext4_get_intf(void)
858 u32 bootmode = get_bootmode();
860 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
862 case BOOT_FLASH_EMMC:
869 const char *env_ext4_get_dev_part(void)
871 static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
872 u32 bootmode = get_bootmode();
874 return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
878 #if defined(CONFIG_OF_BOARD_SETUP)
879 int ft_board_setup(void *blob, bd_t *bd)
881 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
882 struct node_info nodes[] = {
883 { "st,stm32f469-qspi", MTD_DEV_TYPE_NOR, },
884 { "st,stm32f469-qspi", MTD_DEV_TYPE_SPINAND},
885 { "st,stm32mp15-fmc2", MTD_DEV_TYPE_NAND, },
887 fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
894 static void board_copro_image_process(ulong fw_image, size_t fw_size)
896 int ret, id = 0; /* Copro id fixed to 0 as only one coproc on mp1 */
898 if (!rproc_is_initialized())
900 printf("Remote Processor %d initialization failed\n",
905 ret = rproc_load(id, fw_image, fw_size);
906 printf("Load Remote Processor %d with data@addr=0x%08lx %u bytes:%s\n",
907 id, fw_image, fw_size, ret ? " Failed!" : " Success!");
913 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);