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/delay.h>
38 #include <linux/err.h>
39 #include <linux/iopoll.h>
40 #include <power/regulator.h>
41 #include <usb/dwc2_udc.h>
43 /* SYSCFG registers */
44 #define SYSCFG_BOOTR 0x00
45 #define SYSCFG_PMCSETR 0x04
46 #define SYSCFG_IOCTRLSETR 0x18
47 #define SYSCFG_ICNR 0x1C
48 #define SYSCFG_CMPCR 0x20
49 #define SYSCFG_CMPENSETR 0x24
50 #define SYSCFG_PMCCLRR 0x44
52 #define SYSCFG_BOOTR_BOOT_MASK GENMASK(2, 0)
53 #define SYSCFG_BOOTR_BOOTPD_SHIFT 4
55 #define SYSCFG_IOCTRLSETR_HSLVEN_TRACE BIT(0)
56 #define SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI BIT(1)
57 #define SYSCFG_IOCTRLSETR_HSLVEN_ETH BIT(2)
58 #define SYSCFG_IOCTRLSETR_HSLVEN_SDMMC BIT(3)
59 #define SYSCFG_IOCTRLSETR_HSLVEN_SPI BIT(4)
61 #define SYSCFG_CMPCR_SW_CTRL BIT(1)
62 #define SYSCFG_CMPCR_READY BIT(8)
64 #define SYSCFG_CMPENSETR_MPU_EN BIT(0)
66 #define SYSCFG_PMCSETR_ETH_CLK_SEL BIT(16)
67 #define SYSCFG_PMCSETR_ETH_REF_CLK_SEL BIT(17)
69 #define SYSCFG_PMCSETR_ETH_SELMII BIT(20)
71 #define SYSCFG_PMCSETR_ETH_SEL_MASK GENMASK(23, 21)
72 #define SYSCFG_PMCSETR_ETH_SEL_GMII_MII 0
73 #define SYSCFG_PMCSETR_ETH_SEL_RGMII BIT(21)
74 #define SYSCFG_PMCSETR_ETH_SEL_RMII BIT(23)
77 * Get a global data pointer
79 DECLARE_GLOBAL_DATA_PTR;
81 #define USB_LOW_THRESHOLD_UV 200000
82 #define USB_WARNING_LOW_THRESHOLD_UV 660000
83 #define USB_START_LOW_THRESHOLD_UV 1230000
84 #define USB_START_HIGH_THRESHOLD_UV 2150000
92 const char *fdt_compat;
95 if (IS_ENABLED(CONFIG_TFABOOT))
100 printf("Board: stm32mp1 in %s mode", mode);
101 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
103 if (fdt_compat && fdt_compat_len)
104 printf(" (%s)", fdt_compat);
107 /* display the STMicroelectronics board identification */
108 if (CONFIG_IS_ENABLED(CMD_STBOARD)) {
109 ret = uclass_get_device_by_driver(UCLASS_MISC,
110 DM_GET_DRIVER(stm32mp_bsec),
113 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
116 printf("Board: MB%04x Var%d.%d Rev.%c-%02d\n",
120 ((otp >> 8) & 0xF) - 1 + 'A',
127 static void board_key_check(void)
129 #if defined(CONFIG_FASTBOOT) || defined(CONFIG_CMD_STM32PROG)
131 struct gpio_desc gpio;
132 enum forced_boot_mode boot_mode = BOOT_NORMAL;
134 node = ofnode_path("/config");
135 if (!ofnode_valid(node)) {
136 debug("%s: no /config node?\n", __func__);
139 #ifdef CONFIG_FASTBOOT
140 if (gpio_request_by_name_nodev(node, "st,fastboot-gpios", 0,
141 &gpio, GPIOD_IS_IN)) {
142 debug("%s: could not find a /config/st,fastboot-gpios\n",
145 if (dm_gpio_get_value(&gpio)) {
146 puts("Fastboot key pressed, ");
147 boot_mode = BOOT_FASTBOOT;
150 dm_gpio_free(NULL, &gpio);
153 #ifdef CONFIG_CMD_STM32PROG
154 if (gpio_request_by_name_nodev(node, "st,stm32prog-gpios", 0,
155 &gpio, GPIOD_IS_IN)) {
156 debug("%s: could not find a /config/st,stm32prog-gpios\n",
159 if (dm_gpio_get_value(&gpio)) {
160 puts("STM32Programmer key pressed, ");
161 boot_mode = BOOT_STM32PROG;
163 dm_gpio_free(NULL, &gpio);
167 if (boot_mode != BOOT_NORMAL) {
168 puts("entering download mode...\n");
169 clrsetbits_le32(TAMP_BOOT_CONTEXT,
170 TAMP_BOOT_FORCED_MASK,
176 #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
178 /* STMicroelectronics STUSB1600 Type-C controller */
179 #define STUSB1600_CC_CONNECTION_STATUS 0x0E
181 /* STUSB1600_CC_CONNECTION_STATUS bitfields */
182 #define STUSB1600_CC_ATTACH BIT(0)
184 static int stusb1600_init(struct udevice **dev_stusb1600)
187 struct udevice *dev, *bus;
191 *dev_stusb1600 = NULL;
193 /* if node stusb1600 is present, means DK1 or DK2 board */
194 node = ofnode_by_compatible(ofnode_null(), "st,stusb1600");
195 if (!ofnode_valid(node))
198 ret = ofnode_read_u32(node, "reg", &chip_addr);
202 ret = uclass_get_device_by_ofnode(UCLASS_I2C, ofnode_get_parent(node),
205 printf("bus for stusb1600 not found\n");
209 ret = dm_i2c_probe(bus, chip_addr, 0, &dev);
211 *dev_stusb1600 = dev;
216 static int stusb1600_cable_connected(struct udevice *dev)
220 if (dm_i2c_read(dev, STUSB1600_CC_CONNECTION_STATUS, &status, 1))
223 return status & STUSB1600_CC_ATTACH;
226 #include <usb/dwc2_udc.h>
227 int g_dnl_board_usb_cable_connected(void)
229 struct udevice *stusb1600;
230 struct udevice *dwc2_udc_otg;
233 if (!stusb1600_init(&stusb1600))
234 return stusb1600_cable_connected(stusb1600);
236 ret = uclass_get_device_by_driver(UCLASS_USB_GADGET_GENERIC,
237 DM_GET_DRIVER(dwc2_udc_otg),
240 debug("dwc2_udc_otg init failed\n");
242 return dwc2_udc_B_session_valid(dwc2_udc_otg);
245 #define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
246 #define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
248 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
250 if (!strcmp(name, "usb_dnl_dfu"))
251 put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, &dev->idProduct);
252 else if (!strcmp(name, "usb_dnl_fastboot"))
253 put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,
256 put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
261 #endif /* CONFIG_USB_GADGET */
263 static int get_led(struct udevice **dev, char *led_string)
268 led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
270 pr_debug("%s: could not find %s config string\n",
271 __func__, led_string);
274 ret = led_get_by_label(led_name, dev);
276 debug("%s: get=%d\n", __func__, ret);
283 static int setup_led(enum led_state_t cmd)
288 if (!CONFIG_IS_ENABLED(LED))
291 ret = get_led(&dev, "u-boot,boot-led");
295 ret = led_set_state(dev, cmd);
299 static void __maybe_unused led_error_blink(u32 nb_blink)
308 if (CONFIG_IS_ENABLED(LED)) {
309 ret = get_led(&led, "u-boot,error-led");
311 /* make u-boot,error-led blinking */
312 /* if U32_MAX and 125ms interval, for 17.02 years */
313 for (i = 0; i < 2 * nb_blink; i++) {
314 led_set_state(led, LEDST_TOGGLE);
318 led_set_state(led, LEDST_ON);
322 /* infinite: the boot process must be stopped */
323 if (nb_blink == U32_MAX)
328 static int board_check_usb_power(void)
330 struct ofnode_phandle_args adc_args;
335 int min_uV = USB_START_HIGH_THRESHOLD_UV;
336 int ret, uV, adc_count;
339 node = ofnode_path("/config");
340 if (!ofnode_valid(node)) {
341 debug("%s: no /config node?\n", __func__);
346 * Retrieve the ADC channels devices and get measurement
349 adc_count = ofnode_count_phandle_with_args(node, "st,adc_usb_pd",
350 "#io-channel-cells");
352 if (adc_count == -ENOENT)
355 pr_err("%s: can't find adc channel (%d)\n", __func__,
361 for (i = 0; i < adc_count; i++) {
362 if (ofnode_parse_phandle_with_args(node, "st,adc_usb_pd",
363 "#io-channel-cells", 0, i,
365 pr_debug("%s: can't find /config/st,adc_usb_pd\n",
370 ret = uclass_get_device_by_ofnode(UCLASS_ADC, adc_args.node,
374 pr_err("%s: Can't get adc device(%d)\n", __func__,
379 ret = adc_channel_single_shot(adc->name, adc_args.args[0],
382 pr_err("%s: single shot failed for %s[%d]!\n",
383 __func__, adc->name, adc_args.args[0]);
387 if (!adc_raw_to_uV(adc, raw, &uV)) {
392 pr_debug("%s: %s[%02d] = %u, %d uV\n", __func__,
393 adc->name, adc_args.args[0], raw, uV);
395 pr_err("%s: Can't get uV value for %s[%d]\n",
396 __func__, adc->name, adc_args.args[0]);
401 * If highest value is inside 1.23 Volts and 2.10 Volts, that means
402 * board is plugged on an USB-C 3A power supply and boot process can
405 if (max_uV > USB_START_LOW_THRESHOLD_UV &&
406 max_uV <= USB_START_HIGH_THRESHOLD_UV &&
407 min_uV <= USB_LOW_THRESHOLD_UV)
410 pr_err("****************************************************\n");
413 * If highest and lowest value are either both below
414 * USB_LOW_THRESHOLD_UV or both above USB_LOW_THRESHOLD_UV, that
415 * means USB TYPE-C is in unattached mode, this is an issue, make
416 * u-boot,error-led blinking and stop boot process.
418 if ((max_uV > USB_LOW_THRESHOLD_UV &&
419 min_uV > USB_LOW_THRESHOLD_UV) ||
420 (max_uV <= USB_LOW_THRESHOLD_UV &&
421 min_uV <= USB_LOW_THRESHOLD_UV)) {
422 pr_err("* ERROR USB TYPE-C connection in unattached mode *\n");
423 pr_err("* Check that USB TYPE-C cable is correctly plugged *\n");
424 /* with 125ms interval, led will blink for 17.02 years ....*/
428 if (max_uV > USB_LOW_THRESHOLD_UV &&
429 max_uV <= USB_WARNING_LOW_THRESHOLD_UV &&
430 min_uV <= USB_LOW_THRESHOLD_UV) {
431 pr_err("* WARNING 500mA power supply detected *\n");
435 if (max_uV > USB_WARNING_LOW_THRESHOLD_UV &&
436 max_uV <= USB_START_LOW_THRESHOLD_UV &&
437 min_uV <= USB_LOW_THRESHOLD_UV) {
438 pr_err("* WARNING 1.5A power supply detected *\n");
443 * If highest value is above 2.15 Volts that means that the USB TypeC
444 * supplies more than 3 Amp, this is not compliant with TypeC specification
446 if (max_uV > USB_START_HIGH_THRESHOLD_UV) {
447 pr_err("* USB TYPE-C charger not compliant with *\n");
448 pr_err("* specification *\n");
449 pr_err("****************************************************\n\n");
450 /* with 125ms interval, led will blink for 17.02 years ....*/
453 pr_err("* Current too low, use a 3A power supply! *\n");
454 pr_err("****************************************************\n\n");
457 led_error_blink(nb_blink);
461 #endif /* CONFIG_ADC */
463 static void sysconf_init(void)
465 #ifndef CONFIG_TFABOOT
467 #ifdef CONFIG_DM_REGULATOR
468 struct udevice *pwr_dev;
469 struct udevice *pwr_reg;
476 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
478 /* interconnect update : select master using the port 1 */
481 /* today information is hardcoded in U-Boot */
482 writel(BIT(9), syscfg + SYSCFG_ICNR);
484 /* disable Pull-Down for boot pin connected to VDD */
485 bootr = readl(syscfg + SYSCFG_BOOTR);
486 bootr &= ~(SYSCFG_BOOTR_BOOT_MASK << SYSCFG_BOOTR_BOOTPD_SHIFT);
487 bootr |= (bootr & SYSCFG_BOOTR_BOOT_MASK) << SYSCFG_BOOTR_BOOTPD_SHIFT;
488 writel(bootr, syscfg + SYSCFG_BOOTR);
490 #ifdef CONFIG_DM_REGULATOR
491 /* High Speed Low Voltage Pad mode Enable for SPI, SDMMC, ETH, QSPI
492 * and TRACE. Needed above ~50MHz and conditioned by AFMUX selection.
493 * The customer will have to disable this for low frequencies
494 * or if AFMUX is selected but the function not used, typically for
495 * TRACE. Otherwise, impact on power consumption.
498 * enabling High Speed mode while VDD>2.7V
499 * with the OTP product_below_2v5 (OTP 18, BIT 13)
500 * erroneously set to 1 can damage the IC!
501 * => U-Boot set the register only if VDD < 2.7V (in DT)
502 * but this value need to be consistent with board design
504 ret = uclass_get_device_by_driver(UCLASS_PMIC,
505 DM_GET_DRIVER(stm32mp_pwr_pmic),
508 ret = uclass_get_device_by_driver(UCLASS_MISC,
509 DM_GET_DRIVER(stm32mp_bsec),
512 pr_err("Can't find stm32mp_bsec driver\n");
516 ret = misc_read(dev, STM32_BSEC_SHADOW(18), &otp, 4);
520 /* get VDD = vdd-supply */
521 ret = device_get_supply_regulator(pwr_dev, "vdd-supply",
524 /* check if VDD is Low Voltage */
526 if (regulator_get_value(pwr_reg) < 2700000) {
527 writel(SYSCFG_IOCTRLSETR_HSLVEN_TRACE |
528 SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI |
529 SYSCFG_IOCTRLSETR_HSLVEN_ETH |
530 SYSCFG_IOCTRLSETR_HSLVEN_SDMMC |
531 SYSCFG_IOCTRLSETR_HSLVEN_SPI,
532 syscfg + SYSCFG_IOCTRLSETR);
535 pr_err("product_below_2v5=0: HSLVEN protected by HW\n");
538 pr_err("product_below_2v5=1: HSLVEN update is destructive, no update as VDD>2.7V\n");
541 debug("VDD unknown");
546 /* activate automatic I/O compensation
547 * warning: need to ensure CSI enabled and ready in clock driver
549 writel(SYSCFG_CMPENSETR_MPU_EN, syscfg + SYSCFG_CMPENSETR);
551 /* poll until ready (1s timeout) */
552 ret = readl_poll_timeout(syscfg + SYSCFG_CMPCR, val,
553 val & SYSCFG_CMPCR_READY,
556 pr_err("SYSCFG: I/O compensation failed, timeout.\n");
560 clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
564 #ifdef CONFIG_DM_REGULATOR
565 /* Fix to make I2C1 usable on DK2 for touchscreen usage in kernel */
566 static int dk2_i2c1_fix(void)
569 struct gpio_desc hdmi, audio;
572 node = ofnode_path("/soc/i2c@40012000/hdmi-transmitter@39");
573 if (!ofnode_valid(node)) {
574 pr_debug("%s: no hdmi-transmitter@39 ?\n", __func__);
578 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
579 &hdmi, GPIOD_IS_OUT)) {
580 pr_debug("%s: could not find reset-gpios\n",
585 node = ofnode_path("/soc/i2c@40012000/cs42l51@4a");
586 if (!ofnode_valid(node)) {
587 pr_debug("%s: no cs42l51@4a ?\n", __func__);
591 if (gpio_request_by_name_nodev(node, "reset-gpios", 0,
592 &audio, GPIOD_IS_OUT)) {
593 pr_debug("%s: could not find reset-gpios\n",
598 /* before power up, insure that HDMI and AUDIO IC is under reset */
599 ret = dm_gpio_set_value(&hdmi, 1);
601 pr_err("%s: can't set_value for hdmi_nrst gpio", __func__);
604 ret = dm_gpio_set_value(&audio, 1);
606 pr_err("%s: can't set_value for audio_nrst gpio", __func__);
610 /* power-up audio IC */
611 regulator_autoset_by_name("v1v8_audio", NULL);
613 /* power-up HDMI IC */
614 regulator_autoset_by_name("v1v2_hdmi", NULL);
615 regulator_autoset_by_name("v3v3_hdmi", NULL);
621 static bool board_is_dk2(void)
623 if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
624 of_machine_is_compatible("st,stm32mp157c-dk2"))
631 static bool board_is_ev1(void)
633 if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
634 (of_machine_is_compatible("st,stm32mp157a-ev1") ||
635 of_machine_is_compatible("st,stm32mp157c-ev1") ||
636 of_machine_is_compatible("st,stm32mp157d-ev1") ||
637 of_machine_is_compatible("st,stm32mp157f-ev1")))
643 /* touchscreen driver: only used for pincontrol configuration */
644 static const struct udevice_id goodix_ids[] = {
645 { .compatible = "goodix,gt9147", },
649 U_BOOT_DRIVER(goodix) = {
652 .of_match = goodix_ids,
655 static void board_ev1_init(void)
659 /* configure IRQ line on EV1 for touchscreen before LCD reset */
660 uclass_get_device_by_driver(UCLASS_NOP, DM_GET_DRIVER(goodix), &dev);
663 /* board dependent setup after realloc */
668 /* address of boot parameters */
669 gd->bd->bi_boot_params = STM32_DDR_BASE + 0x100;
671 /* probe all PINCTRL for hog */
672 for (uclass_first_device(UCLASS_PINCTRL, &dev);
674 uclass_next_device(&dev)) {
675 pr_debug("probe pincontrol = %s\n", dev->name);
683 #ifdef CONFIG_DM_REGULATOR
687 regulators_enable_boot_on(_DEBUG);
692 if (CONFIG_IS_ENABLED(LED))
700 int board_late_init(void)
702 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
703 const void *fdt_compat;
710 fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
712 if (fdt_compat && fdt_compat_len) {
713 if (strncmp(fdt_compat, "st,", 3) != 0) {
714 env_set("board_name", fdt_compat);
717 int buf_len = sizeof(dtb_name);
719 env_set("board_name", fdt_compat + 3);
721 strncpy(dtb_name, fdt_compat + 3, buf_len);
722 buf_len -= strlen(fdt_compat + 3);
723 strncat(dtb_name, ".dtb", buf_len);
724 env_set("fdtfile", dtb_name);
727 ret = uclass_get_device_by_driver(UCLASS_MISC,
728 DM_GET_DRIVER(stm32mp_bsec),
732 ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
735 snprintf(buf, sizeof(buf), "0x%04x", otp >> 16);
736 env_set("board_id", buf);
738 snprintf(buf, sizeof(buf), "0x%04x",
739 ((otp >> 8) & 0xF) - 1 + 0xA);
740 env_set("board_rev", buf);
745 /* for DK1/DK2 boards */
746 board_check_usb_power();
747 #endif /* CONFIG_ADC */
752 void board_quiesce_devices(void)
754 setup_led(LEDST_OFF);
757 /* eth init function : weak called in eqos driver */
758 int board_interface_eth_init(struct udevice *dev,
759 phy_interface_t interface_type)
763 bool eth_clk_sel_reg = false;
764 bool eth_ref_clk_sel_reg = false;
766 /* Gigabit Ethernet 125MHz clock selection. */
767 eth_clk_sel_reg = dev_read_bool(dev, "st,eth_clk_sel");
769 /* Ethernet 50Mhz RMII clock selection */
770 eth_ref_clk_sel_reg =
771 dev_read_bool(dev, "st,eth_ref_clk_sel");
773 syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
778 switch (interface_type) {
779 case PHY_INTERFACE_MODE_MII:
780 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
781 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
782 debug("%s: PHY_INTERFACE_MODE_MII\n", __func__);
784 case PHY_INTERFACE_MODE_GMII:
786 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
787 SYSCFG_PMCSETR_ETH_CLK_SEL;
789 value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII;
790 debug("%s: PHY_INTERFACE_MODE_GMII\n", __func__);
792 case PHY_INTERFACE_MODE_RMII:
793 if (eth_ref_clk_sel_reg)
794 value = SYSCFG_PMCSETR_ETH_SEL_RMII |
795 SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
797 value = SYSCFG_PMCSETR_ETH_SEL_RMII;
798 debug("%s: PHY_INTERFACE_MODE_RMII\n", __func__);
800 case PHY_INTERFACE_MODE_RGMII:
801 case PHY_INTERFACE_MODE_RGMII_ID:
802 case PHY_INTERFACE_MODE_RGMII_RXID:
803 case PHY_INTERFACE_MODE_RGMII_TXID:
805 value = SYSCFG_PMCSETR_ETH_SEL_RGMII |
806 SYSCFG_PMCSETR_ETH_CLK_SEL;
808 value = SYSCFG_PMCSETR_ETH_SEL_RGMII;
809 debug("%s: PHY_INTERFACE_MODE_RGMII\n", __func__);
812 debug("%s: Do not manage %d interface\n",
813 __func__, interface_type);
814 /* Do not manage others interfaces */
818 /* clear and set ETH configuration bits */
819 writel(SYSCFG_PMCSETR_ETH_SEL_MASK | SYSCFG_PMCSETR_ETH_SELMII |
820 SYSCFG_PMCSETR_ETH_REF_CLK_SEL | SYSCFG_PMCSETR_ETH_CLK_SEL,
821 syscfg + SYSCFG_PMCCLRR);
822 writel(value, syscfg + SYSCFG_PMCSETR);
827 enum env_location env_get_location(enum env_operation op, int prio)
829 u32 bootmode = get_bootmode();
834 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
835 #ifdef CONFIG_ENV_IS_IN_EXT4
837 case BOOT_FLASH_EMMC:
840 #ifdef CONFIG_ENV_IS_IN_UBI
841 case BOOT_FLASH_NAND:
842 case BOOT_FLASH_SPINAND:
845 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
847 return ENVL_SPI_FLASH;
854 #if defined(CONFIG_ENV_IS_IN_EXT4)
855 const char *env_ext4_get_intf(void)
857 u32 bootmode = get_bootmode();
859 switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
861 case BOOT_FLASH_EMMC:
868 const char *env_ext4_get_dev_part(void)
870 static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
871 u32 bootmode = get_bootmode();
873 return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
877 #if defined(CONFIG_OF_BOARD_SETUP)
878 int ft_board_setup(void *blob, bd_t *bd)
880 #ifdef CONFIG_FDT_FIXUP_PARTITIONS
881 struct node_info nodes[] = {
882 { "st,stm32f469-qspi", MTD_DEV_TYPE_NOR, },
883 { "st,stm32f469-qspi", MTD_DEV_TYPE_SPINAND},
884 { "st,stm32mp15-fmc2", MTD_DEV_TYPE_NAND, },
886 fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
893 static void board_copro_image_process(ulong fw_image, size_t fw_size)
895 int ret, id = 0; /* Copro id fixed to 0 as only one coproc on mp1 */
897 if (!rproc_is_initialized())
899 printf("Remote Processor %d initialization failed\n",
904 ret = rproc_load(id, fw_image, fw_size);
905 printf("Load Remote Processor %d with data@addr=0x%08lx %u bytes:%s\n",
906 id, fw_image, fw_size, ret ? " Failed!" : " Success!");
912 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);