spl: spl_mmc: provide one weak function spl_boot_partition
Subsystems (3)
PATCH 1/4 spl: spl_mmc: provide one weak function spl_boot_partition
The spl_boot_partition function has been added in order to have the possibility to boot on a same binary from different mmc devices with different partitions.
By default keep the current behavior, SPL use the partition defined by CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.
---
common/spl/spl_mmc.c | 15 +++++++++++++-- include/spl.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +13 -2
@@ -292,6 +292,14 @@ u32 __weak spl_boot_mode(const u32 boot_device)#endif } +#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION +__weak +int spl_boot_partition (const u32 boot_device) +{ +return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION ; +} +#endif +int spl_mmc_load_image (struct spl_image_info *spl_image,struct spl_boot_device *bootdev) {
@@ -347,8 +355,11 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,return err; }#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION - err =mmc_load_image_raw_partition (spl_image, mmc, -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION ); + err =spl_boot_partition (bootdev->boot_device); +if (!err) +return err; + + err =mmc_load_image_raw_partition (spl_image, mmc, err);if (!err)return err;#endif
include/spl.h +1 -0
@@ -82,6 +82,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,void preloader_console_init (void );u32 spl_boot_device (void );u32 spl_boot_mode (const u32 boot_device); +int spl_boot_partition (const u32 boot_device);void spl_set_bd (void );/**
Signature · 1 line
2.7.4
PATCH 2/4 stm32mp1: add eMMC support for ED1
Add command GPT support
Add EMMC boot support
Add the 2 other SDMMC instances for ED1:
- SDMMC2 = mmc 1, eMMC on the ED1 board
- SDMMC3 = extension connector, deactivated by default
---
arch/arm/dts/stm32mp157.dtsi | 28 +++++++++++ arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 21 ++++++++ arch/arm/dts/stm32mp157c-ed1.dts | 37 ++++++++++++++ board/st/stm32mp1/README | 83 +++++++++++++++++++++++--------- configs/stm32mp15_basic_defconfig | 1 + include/configs/stm32mp1.h | 1 + 6 files changed, 147 insertions(+), 24 deletions(-)
arch/arm/dts/stm32mp157.dtsi +28 -0
@@ -86,6 +86,20 @@ status = "disabled"; }; + sdmmc3: sdmmc at 48004000 { + compatible = "st,stm32-sdmmc2"; + reg = <0x48004000 0x400>, <0x48005000 0x400>; + reg-names = "sdmmc", "delay"; + interrupts = <GIC_SPI 137 IRQ_TYPE_NONE>; + clocks = <&rcc_clk SDMMC3_K>; + resets = <&rcc_rst SDMMC3_R>; + st,idma = <1>; + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <120000000>; + status = "disabled"; + }; + rcc: rcc at 50000000 { compatible = "syscon", "simple-mfd";
@@ -288,6 +302,20 @@ status = "disabled"; }; + sdmmc2: sdmmc at 58007000 { + compatible = "st,stm32-sdmmc2"; + reg = <0x58007000 0x1000>, <0x58008000 0x1000>; + reg-names = "sdmmc", "delay"; + interrupts = <GIC_SPI 124 IRQ_TYPE_NONE>; + clocks = <&rcc_clk SDMMC2_K>; + resets = <&rcc_rst SDMMC2_R>; + st,idma = <1>; + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <120000000>; + status = "disabled"; + }; + i2c4: i2c at 5c002000 { compatible = "st,stm32f7-i2c"; reg = <0x5c002000 0x400>;
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +21 -0
@@ -11,6 +11,7 @@ / { aliases { mmc0 = &sdmmc1; + mmc1 = &sdmmc2; i2c3 = &i2c4; }; };
@@ -77,6 +78,7 @@ CLK_SDMMC12_PLL3R CLK_I2C46_PCLK5 CLK_I2C12_PCLK1 + CLK_SDMMC3_PLL3R CLK_I2C35_PCLK1 CLK_UART1_PCLK5 CLK_UART24_PCLK1
@@ -131,3 +133,22 @@ &sdmmc1 { u-boot,dm-spl; }; + +/* MMC2 boot */ +&sdmmc2_b4_pins_a { + u-boot,dm-spl; + pins { + u-boot,dm-spl; + }; +}; + +&sdmmc2_d47_pins_a { + u-boot,dm-spl; + pins { + u-boot,dm-spl; + }; +}; + +&sdmmc2 { + u-boot,dm-spl; +};
arch/arm/dts/stm32mp157c-ed1.dts +37 -0
@@ -112,6 +112,31 @@ bias-pull-up; }; }; + sdmmc2_b4_pins_a: sdmmc2-b4 at 0 { + pins { + pinmux = <STM32_PINMUX('B', 14, AF9)>, /* SDMMC2_D0 */ + <STM32_PINMUX('B', 15, AF9)>, /* SDMMC2_D1 */ + <STM32_PINMUX('B', 3, AF9)>, /* SDMMC2_D2 */ + <STM32_PINMUX('B', 4, AF9)>, /* SDMMC2_D3 */ + <STM32_PINMUX('E', 3, AF9)>, /* SDMMC2_CK */ + <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */ + slew-rate = <3>; + drive-push-pull; + bias-pull-up; + }; + }; + + sdmmc2_d47_pins_a: sdmmc2-d47 at 0 { + pins { + pinmux = <STM32_PINMUX('A', 8, AF9)>, /* SDMMC2_D4 */ + <STM32_PINMUX('A', 9, AF10)>, /* SDMMC2_D5 */ + <STM32_PINMUX('E', 5, AF9)>, /* SDMMC2_D6 */ + <STM32_PINMUX('D', 3, AF9)>; /* SDMMC2_D7 */ + slew-rate = <3>; + drive-push-pull; + bias-pull-up; + }; + }; }; &pinctrl_z {
@@ -160,6 +185,18 @@ status = "okay"; }; +&sdmmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>; + non-removable; + no-sd; + no-sdio; + st,dirpol; + st,negedge; + bus-width = <8>; + status = "okay"; +}; + &uart4 { pinctrl-names = "default"; pinctrl-0 = <&uart4_pins_a>;
board/st/stm32mp1/README +59 -24
108 lines not on this page · raw message
configs/stm32mp15_basic_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_SYS_PROMPT="STM32MP> " # CONFIG_CMD_IMPORTENV is not set CONFIG_CMD_MEMINFO=y CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_PMIC=y
include/configs/stm32mp1.h +1 -0
@@ -71,6 +71,7 @@/*MMC SD*/ #define CONFIG_SYS_MMC_MAX_DEVICE 3 +#define CONFIG_SUPPORT_EMMC_BOOT #if !defined(CONFIG_SPL ) || !defined(CONFIG_SPL_BUILD )
Signature · 1 line
2.7.4
PATCH 2/4 stm32mp1: add eMMC support for ED1
Quoted 7 lines · Patrick Delaunay
Add command GPT support
Add EMMC boot support
Add the 2 other SDMMC instances for ED1:
- SDMMC2 = mmc 1, eMMC on the ED1 board
- SDMMC3 = extension connector, deactivated by defaultSigned-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/8aaac919/attachment.sig>
PATCH 3/4 stm32mp1: get boot mode from BootRom
In reply to Patrick DelaunaySPL copy BootRom boot mode information
in TAMP register 21.
This TAMP register information is used
after relocation to set 2 env variables
- boot_device
- boot_instance
---
arch/arm/Kconfig | 1 + arch/arm/mach-stm32mp/cpu.c | 92 ++++++++++++++++++++++++++++++ arch/arm/mach-stm32mp/include/mach/stm32.h | 53 +++++++++++++++++ 3 files changed, 146 insertions(+)
arch/arm/Kconfig +1 -0
@@ -1150,6 +1150,7 @@ config ARCH_STI config ARCH_STM32MP bool "Support STMicroelectronics STM32MP Socs with cortex A" + select ARCH_MISC_INIT select BOARD_LATE_INIT select CLK select DM
arch/arm/mach-stm32mp/cpu.c +92 -0
122 lines not on this page · raw message
arch/arm/mach-stm32mp/include/mach/stm32.h +53 -0
57 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/4 stm32mp1: get boot mode from BootRom
Quoted 9 lines · Patrick Delaunay
SPL copy BootRom boot mode information
in TAMP register 21.This TAMP register information is used
after relocation to set 2 env variables
-boot_device
-boot_instanceSigned-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/dc216cf9/attachment.sig>
PATCH 4/4 stm32mp1: select boot device and partition
In reply to Patrick DelaunayBootrom loads SPL from SDCARD or eMMC
according BootPin selection.
Then SPL loads U-Boot on the same mmc device
with the following predefined GPT partitioning:
on SDCARD: gpt partitioning
1: SPL
2: SPL#2
3: U-Boot
4: bootable partition
on eMMC:
The 2 boot partitions are used for SPL (2 copy)
boot1: SPL
boot2: SPL#2 The user partition use gpt partitioning
1: U-Boot
2: bootable partition
This patch select the correct SPL partition
(3 for SDCARD on mmc0 and 1 for eMMC on mmc1) according the BootRom information saved in TAMP register and based on configuration flasg:
- CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
=> for BOOT_DEVICE_MMC1 or mmc 0 in U-Boot
- CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2 (new) => for BOOT_DEVICE_MMC2 or mmc 1 in U-Boot
And the correct boot_targets is selected according the environment variables boot_device and boot_instance, with preboot command, to search the bootable partition with kernel on this device (generic distro support).
---
arch/arm/mach-stm32mp/Kconfig | 8 ++++++++ arch/arm/mach-stm32mp/spl.c | 30 ++++++++++++++++++++++++++++++ include/configs/stm32mp1.h | 7 +++++++ 3 files changed, 45 insertions(+)
arch/arm/mach-stm32mp/Kconfig +8 -0
@@ -38,6 +38,14 @@ config SYS_TEXT_BASE when DDR driver is used: DDR + 1MB (0xC0100000) +config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2 + hex "Partition on MMC2 to use to load U-Boot from" + depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION + default 1 + help + Partition on the second MMC to load U-Boot from when the MMC is being + used in raw mode + source "board/st/stm32mp1/Kconfig" endif
arch/arm/mach-stm32mp/spl.c +30 -0
@@ -7,9 +7,27 @@#include <common.h> #include <dm.h> #include <spl.h> +#include <asm/io.h> u32 spl_boot_device (void ) { +u32 boot_mode; + + boot_mode = (readl (TAMP_BOOT_CONTEXT ) &TAMP_BOOT_MODE_MASK ) >> +TAMP_BOOT_MODE_SHIFT ; +clrsetbits_le32 (TAMP_BOOT_CONTEXT , +TAMP_BOOT_MODE_MASK , + boot_mode <<TAMP_BOOT_MODE_SHIFT ); + +switch (boot_mode) { +case BOOT_FLASH_SD_1 : +case BOOT_FLASH_EMMC_1 : +return BOOT_DEVICE_MMC1 ; +case BOOT_FLASH_SD_2 : +case BOOT_FLASH_EMMC_2 : +return BOOT_DEVICE_MMC2 ; + } +return BOOT_DEVICE_MMC1 ; }
@@ -18,6 +36,18 @@ u32 spl_boot_mode(const u32 boot_device)return MMCSD_MODE_RAW ; } +int spl_boot_partition (const u32 boot_device) +{ +switch (boot_device) { +case BOOT_DEVICE_MMC1 : +return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION ; +case BOOT_DEVICE_MMC2 : +return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2 ; +default : +return -EINVAL ; + } +} +void board_init_f (ulong dummy) {struct udevice *dev;
include/configs/stm32mp1.h +7 -0
@@ -82,6 +82,12 @@#include <config_distro_bootcmd.h> +#define STM32MP_PREBOOT \ + "echo \"Boot over ${boot_device}${boot_instance}!\"; " \ + "if test \"${boot_device}\" = \"mmc\"; then " \ + "env set boot_targets \"mmc${boot_instance}\"; "\ + "fi;" +#define CONFIG_EXTRA_ENV_SETTINGS \ "scriptaddr=0xC0000000\0" \ "pxefile_addr_r=0xC0000000\0" \
@@ -90,6 +96,7 @@"ramdisk_addr_r=0xC4100000\0" \"fdt_high=0xffffffff\0" \"initrd_high=0xffffffff\0" \ +"preboot=" STM32MP_PREBOOT "\0" \ BOOTENV#endif /* ifndef CONFIG_SPL_BUILD */
Signature · 1 line
2.7.4
PATCH 4/4 stm32mp1: select boot device and partition
Quoted 29 lines · Patrick Delaunay
Bootrom loads SPL from SDCARD or eMMC
according BootPin selection.Then SPL loads U-Boot on the same mmc device
with the following predefined GPT partitioning:on SDCARD: gpt partitioning
1: SPL
2: SPL#2
3: U-Boot
4: bootable partitionon eMMC:
The 2 boot partitions are used for SPL (2 copy)boot1: SPL boot2: SPL#2The user partition use gpt partitioning
1: U-Boot
2: bootable partitionThis patch select the correct SPL partition
(3 for SDCARD on mmc0 and 1 for eMMC on mmc1) according the BootRom information saved in TAMP register and based on configuration flasg:
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
=> forBOOT_DEVICE_MMC1or mmc 0 in U-Boot
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2(new) => forBOOT_DEVICE_MMC2or mmc 1 in U-Boot
Quoted 6 lines
And the correct
boot_targetsis selected according the environment variablesboot_deviceandboot_instance, with preboot command, to search the bootable partition with kernel on this device (generic distro support).Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/eeef2b2c/attachment.sig>
PATCH 1/4 spl: spl_mmc: provide one weak function spl_boot_partition
In reply to Patrick DelaunayQuoted 9 lines · Patrick Delaunay
The
spl_boot_partitionfunction has been added in order to have the possibility to boot on a same binary from different mmc devices with different partitions.By default keep the current behavior, SPL use the partition defined by
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.Signed-off-by Patrick Delaunay <[email protected]>Signed-off-by Christophe KERELLO <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180320/dc651270/attachment.sig>
PATCH 1/4 spl: spl_mmc: provide one weak function spl_boot_partition
In reply to Patrick DelaunayQuoted 53 lines · On Tue, 20 Mar 2018 10:54:51 +0100 Patrick Delaunay <[email protected]>…
The
spl_boot_partitionfunction has been added in order to have the possibility to boot on a same binary from different mmc devices with different partitions.By default keep the current behavior, SPL use the partition defined by
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.Signed-off-by Patrick Delaunay <[email protected]>Signed-off-by Christophe KERELLO <[email protected]>---
common/spl/spl_mmc.c | 15 +++++++++++++-- include/spl.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-)common/spl/spl_mmc.c +13
-2@@ -292,6 +292,14 @@ u32 __weak spl_boot_mode(const u32 boot_device)#endif } +#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION +__weak +int spl_boot_partition (const u32 boot_device) +{ +return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION ; +} +#endif +int spl_mmc_load_image (struct spl_image_info *spl_image,struct spl_boot_device *bootdev) {@@ -347,8 +355,11 @@ int spl_mmc_load_image(struct spl_image_info *spl_image, return err; }#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION - err =mmc_load_image_raw_partition (spl_image, mmc, -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION ); + err =spl_boot_partition (bootdev->boot_device); +if (!err) +return err; + + err =mmc_load_image_raw_partition (spl_image, mmc, err);if (!err)return err;#endif include/spl.h +0
-0
include/spl.h int spl_load_simple_fit(struct spl_image_info · line 88
Quoted 7 lines
include/spl.h +1
-0@@ -82,6 +82,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, void preloader_console_init(void);u32 spl_boot_device (void );u32 spl_boot_mode (const u32 boot_device); +int spl_boot_partition (const u32 boot_device);void spl_set_bd (void );/**
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180320/1204962e/attachment.sig>
PATCH 1/4 spl: spl_mmc: provide one weak function spl_boot_partition
In reply to Patrick DelaunayQuoted 11 lines · Patrick Delaunay
The
spl_boot_partitionfunction has been added in order to have the possibility to boot on a same binary from different mmc devices with different partitions.By default keep the current behavior, SPL use the partition defined by
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION.Signed-off-by Patrick Delaunay <[email protected]>Signed-off-by Christophe KERELLO <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180407/3c9057b6/attachment.sig>