diff mbox series

[U-Boot,v2019.04-aspeed-openbmc,2/3] arch: ARM: Aspeed: Add SPL eMMC partition boot support

Message ID 20200928202753.58351-3-eajames@linux.ibm.com
State New
Headers show
Series Aspeed: Support eMMC boot | expand

Commit Message

Eddie James Sept. 28, 2020, 8:27 p.m. UTC
Support loading U-Boot from a specific partition on the eMMC
device.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 arch/arm/mach-aspeed/Kconfig            | 7 +++++++
 arch/arm/mach-aspeed/ast2600/spl_boot.c | 9 ++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Joel Stanley Oct. 9, 2020, 3:41 a.m. UTC | #1
On Mon, 28 Sep 2020 at 20:28, Eddie James <eajames@linux.ibm.com> wrote:
>
> Support loading U-Boot from a specific partition on the eMMC
> device.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>  arch/arm/mach-aspeed/Kconfig            | 7 +++++++
>  arch/arm/mach-aspeed/ast2600/spl_boot.c | 9 ++++++++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig
> index 06f14f4f55..0e3bb841d0 100644
> --- a/arch/arm/mach-aspeed/Kconfig
> +++ b/arch/arm/mach-aspeed/Kconfig
> @@ -90,6 +90,13 @@ config ASPEED_UBOOT_MMC_BASE
>           The base block number of the U-Boot
>           image in the eMMC device
>
> +config ASPEED_UBOOT_MMC_PART
> +       int "U-Boot eMMC partition"
> +       default 0
> +       help
> +         The partition number of the U-Boot
> +         image in the eMMC device

To clarify, it's the partition number in the user area of the eMMC
device? (and not the eMMC partition).

Reviewed-by: Joel Stanley <joel@jms.id.au>

> +
>  config ASPEED_UBOOT_MMC_SIZE
>         hex "U-Boot eMMC size in blocks"
>         default 0x0
> diff --git a/arch/arm/mach-aspeed/ast2600/spl_boot.c b/arch/arm/mach-aspeed/ast2600/spl_boot.c
> index b08c49d204..58a22f646e 100644
> --- a/arch/arm/mach-aspeed/ast2600/spl_boot.c
> +++ b/arch/arm/mach-aspeed/ast2600/spl_boot.c
> @@ -46,8 +46,8 @@ static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
>                                       struct spl_boot_device *bootdev)
>  {
>         int err;
> +       int part = CONFIG_ASPEED_UBOOT_MMC_PART;
>         u32 count;
> -
>         struct mmc *mmc = NULL;
>         struct udevice *dev;
>         struct blk_desc *bd;
> @@ -78,6 +78,13 @@ static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
>
>         bd = mmc_get_blk_desc(mmc);
>
> +       if (part) {
> +               if (CONFIG_IS_ENABLED(MMC_TINY))
> +                       err = mmc_switch_part(mmc, part);
> +               else
> +                       err = blk_dselect_hwpart(bd, part);
> +       }
> +
>         count = blk_dread(bd, CONFIG_ASPEED_UBOOT_MMC_BASE, CONFIG_ASPEED_UBOOT_MMC_SIZE,
>                         (void *)CONFIG_ASPEED_UBOOT_DRAM_BASE);
>         if (count != CONFIG_ASPEED_UBOOT_MMC_SIZE) {
> --
> 2.26.2
>
Eddie James Oct. 12, 2020, 1:34 p.m. UTC | #2
On 10/8/20 10:41 PM, Joel Stanley wrote:
> On Mon, 28 Sep 2020 at 20:28, Eddie James <eajames@linux.ibm.com> wrote:
>> Support loading U-Boot from a specific partition on the eMMC
>> device.
>>
>> Signed-off-by: Eddie James <eajames@linux.ibm.com>
>> ---
>>   arch/arm/mach-aspeed/Kconfig            | 7 +++++++
>>   arch/arm/mach-aspeed/ast2600/spl_boot.c | 9 ++++++++-
>>   2 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig
>> index 06f14f4f55..0e3bb841d0 100644
>> --- a/arch/arm/mach-aspeed/Kconfig
>> +++ b/arch/arm/mach-aspeed/Kconfig
>> @@ -90,6 +90,13 @@ config ASPEED_UBOOT_MMC_BASE
>>            The base block number of the U-Boot
>>            image in the eMMC device
>>
>> +config ASPEED_UBOOT_MMC_PART
>> +       int "U-Boot eMMC partition"
>> +       default 0
>> +       help
>> +         The partition number of the U-Boot
>> +         image in the eMMC device
> To clarify, it's the partition number in the user area of the eMMC
> device? (and not the eMMC partition).


Ah, no it is the eMMC partition, where 0 is user data, 1 is boot 
partition 0, and 2 is boot partition 1.


Thanks,

Eddie


>
> Reviewed-by: Joel Stanley <joel@jms.id.au>
>
>> +
>>   config ASPEED_UBOOT_MMC_SIZE
>>          hex "U-Boot eMMC size in blocks"
>>          default 0x0
>> diff --git a/arch/arm/mach-aspeed/ast2600/spl_boot.c b/arch/arm/mach-aspeed/ast2600/spl_boot.c
>> index b08c49d204..58a22f646e 100644
>> --- a/arch/arm/mach-aspeed/ast2600/spl_boot.c
>> +++ b/arch/arm/mach-aspeed/ast2600/spl_boot.c
>> @@ -46,8 +46,8 @@ static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
>>                                        struct spl_boot_device *bootdev)
>>   {
>>          int err;
>> +       int part = CONFIG_ASPEED_UBOOT_MMC_PART;
>>          u32 count;
>> -
>>          struct mmc *mmc = NULL;
>>          struct udevice *dev;
>>          struct blk_desc *bd;
>> @@ -78,6 +78,13 @@ static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
>>
>>          bd = mmc_get_blk_desc(mmc);
>>
>> +       if (part) {
>> +               if (CONFIG_IS_ENABLED(MMC_TINY))
>> +                       err = mmc_switch_part(mmc, part);
>> +               else
>> +                       err = blk_dselect_hwpart(bd, part);
>> +       }
>> +
>>          count = blk_dread(bd, CONFIG_ASPEED_UBOOT_MMC_BASE, CONFIG_ASPEED_UBOOT_MMC_SIZE,
>>                          (void *)CONFIG_ASPEED_UBOOT_DRAM_BASE);
>>          if (count != CONFIG_ASPEED_UBOOT_MMC_SIZE) {
>> --
>> 2.26.2
>>
Joel Stanley Oct. 28, 2020, 4:28 a.m. UTC | #3
On Mon, 12 Oct 2020 at 13:34, Eddie James <eajames@linux.ibm.com> wrote:
>
>
> On 10/8/20 10:41 PM, Joel Stanley wrote:
> > On Mon, 28 Sep 2020 at 20:28, Eddie James <eajames@linux.ibm.com> wrote:
> >> Support loading U-Boot from a specific partition on the eMMC
> >> device.
> >>
> >> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> >> ---
> >>   arch/arm/mach-aspeed/Kconfig            | 7 +++++++
> >>   arch/arm/mach-aspeed/ast2600/spl_boot.c | 9 ++++++++-
> >>   2 files changed, 15 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig
> >> index 06f14f4f55..0e3bb841d0 100644
> >> --- a/arch/arm/mach-aspeed/Kconfig
> >> +++ b/arch/arm/mach-aspeed/Kconfig
> >> @@ -90,6 +90,13 @@ config ASPEED_UBOOT_MMC_BASE
> >>            The base block number of the U-Boot
> >>            image in the eMMC device
> >>
> >> +config ASPEED_UBOOT_MMC_PART
> >> +       int "U-Boot eMMC partition"
> >> +       default 0
> >> +       help
> >> +         The partition number of the U-Boot
> >> +         image in the eMMC device
> > To clarify, it's the partition number in the user area of the eMMC
> > device? (and not the eMMC partition).
>
>
> Ah, no it is the eMMC partition, where 0 is user data, 1 is boot
> partition 0, and 2 is boot partition 1.

Can you update your patch to make that clear?
diff mbox series

Patch

diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig
index 06f14f4f55..0e3bb841d0 100644
--- a/arch/arm/mach-aspeed/Kconfig
+++ b/arch/arm/mach-aspeed/Kconfig
@@ -90,6 +90,13 @@  config ASPEED_UBOOT_MMC_BASE
 	  The base block number of the U-Boot
 	  image in the eMMC device
 
+config ASPEED_UBOOT_MMC_PART
+	int "U-Boot eMMC partition"
+	default 0
+	help
+	  The partition number of the U-Boot
+	  image in the eMMC device
+
 config ASPEED_UBOOT_MMC_SIZE
 	hex "U-Boot eMMC size in blocks"
 	default 0x0
diff --git a/arch/arm/mach-aspeed/ast2600/spl_boot.c b/arch/arm/mach-aspeed/ast2600/spl_boot.c
index b08c49d204..58a22f646e 100644
--- a/arch/arm/mach-aspeed/ast2600/spl_boot.c
+++ b/arch/arm/mach-aspeed/ast2600/spl_boot.c
@@ -46,8 +46,8 @@  static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
 				      struct spl_boot_device *bootdev)
 {
 	int err;
+	int part = CONFIG_ASPEED_UBOOT_MMC_PART;
 	u32 count;
-
 	struct mmc *mmc = NULL;
 	struct udevice *dev;
 	struct blk_desc *bd;
@@ -78,6 +78,13 @@  static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
 
 	bd = mmc_get_blk_desc(mmc);
 
+	if (part) {
+		if (CONFIG_IS_ENABLED(MMC_TINY))
+			err = mmc_switch_part(mmc, part);
+		else
+			err = blk_dselect_hwpart(bd, part);
+	}
+
 	count = blk_dread(bd, CONFIG_ASPEED_UBOOT_MMC_BASE, CONFIG_ASPEED_UBOOT_MMC_SIZE,
 			(void *)CONFIG_ASPEED_UBOOT_DRAM_BASE);
 	if (count != CONFIG_ASPEED_UBOOT_MMC_SIZE) {