diff mbox

[U-Boot,5/5] arm: mvebu: db-88f6820-gp: Add SDIO/MMC SPL boot support

Message ID 1437384040-16244-5-git-send-email-sr@denx.de
State Accepted
Delegated to: Stefan Roese
Headers show

Commit Message

Stefan Roese July 20, 2015, 9:20 a.m. UTC
This patch adds the configuration options to boot via SDIO/MMC on the
Marvell DB-88F6820-GP Armada A38x board. The default boot device
is still SPI NOR flash.

To enable MMC booting on this board 2 things need to be changes:
a) Change kwbimage.cfg
   BOOT_FROM   sdio
b) In the config header select
   #define CONFIG_SPL_BOOT_DEVICE	SPL_BOOT_SDIO_MMC_CARD

The generated image needs to be copied to the first bootable MMC
partition:

dd if=u-boot-spl.kwb of=/dev/sdX1

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Cc: Dirk Eibach <eibach@gdsys.de>
---
 include/configs/db-88f6820-gp.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Luka Perkov July 20, 2015, 9:34 p.m. UTC | #1
Hi Stefan,

On Mon, Jul 20, 2015 at 11:20:40AM +0200, Stefan Roese wrote:
> This patch adds the configuration options to boot via SDIO/MMC on the
> Marvell DB-88F6820-GP Armada A38x board. The default boot device
> is still SPI NOR flash.
> 
> To enable MMC booting on this board 2 things need to be changes:
> a) Change kwbimage.cfg
>    BOOT_FROM   sdio
> b) In the config header select
>    #define CONFIG_SPL_BOOT_DEVICE	SPL_BOOT_SDIO_MMC_CARD
> 
> The generated image needs to be copied to the first bootable MMC
> partition:

Can you please define "bootable" here? Does the partition really need to
have bootable flag configured?

Thanks,
Luka

> dd if=u-boot-spl.kwb of=/dev/sdX1
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Luka Perkov <luka.perkov@sartura.hr>
> Cc: Dirk Eibach <eibach@gdsys.de>
> ---
>  include/configs/db-88f6820-gp.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h
> index 73b3236..739c2bf 100644
> --- a/include/configs/db-88f6820-gp.h
> +++ b/include/configs/db-88f6820-gp.h
> @@ -110,6 +110,17 @@
>  	"initrd_high=0x10000000\0"
>  
>  /* SPL */
> +/*
> + * Select the boot device here
> + *
> + * Currently supported are:
> + * SPL_BOOT_SPI_NOR_FLASH	- Booting via SPI NOR flash
> + * SPL_BOOT_SDIO_MMC_CARD	- Booting via SDIO/MMC card (partition 1)
> + */
> +#define SPL_BOOT_SPI_NOR_FLASH		1
> +#define SPL_BOOT_SDIO_MMC_CARD		2
> +#define CONFIG_SPL_BOOT_DEVICE		SPL_BOOT_SPI_NOR_FLASH
> +
>  /* Defines for SPL */
>  #define CONFIG_SPL_FRAMEWORK
>  #define CONFIG_SPL_SIZE			(140 << 10)
> @@ -131,6 +142,7 @@
>  #define CONFIG_SPL_SERIAL_SUPPORT
>  #define CONFIG_SPL_I2C_SUPPORT
>  
> +#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH
>  /* SPL related SPI defines */
>  #define CONFIG_SPL_SPI_SUPPORT
>  #define CONFIG_SPL_SPI_FLASH_SUPPORT
> @@ -138,6 +150,22 @@
>  #define CONFIG_SPL_SPI_BUS		0
>  #define CONFIG_SPL_SPI_CS		0
>  #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
> +#define CONFIG_SYS_U_BOOT_OFFS		CONFIG_SYS_SPI_U_BOOT_OFFS
> +#endif
> +
> +#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD
> +/* SPL related MMC defines */
> +#define CONFIG_SPL_MMC_SUPPORT
> +#define CONFIG_SPL_LIBDISK_SUPPORT
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 1
> +#define CONFIG_SYS_MMC_U_BOOT_OFFS		(160 << 10)
> +#define CONFIG_SYS_U_BOOT_OFFS			CONFIG_SYS_MMC_U_BOOT_OFFS
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	(CONFIG_SYS_U_BOOT_OFFS / 512)
> +#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	((512 << 10) / 512) /* 512KiB */
> +#ifdef CONFIG_SPL_BUILD
> +#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER	0x00180000	/* in SDRAM */
> +#endif
> +#endif
>  
>  /* Enable DDR support in SPL (DDR3 training from Marvell bin_hdr) */
>  #define CONFIG_SYS_MVEBU_DDR_A38X
> -- 
> 2.4.6
>
Stefan Roese July 21, 2015, 4:24 a.m. UTC | #2
Hi Luka,

On 20.07.2015 23:34, Luka Perkov wrote:
> On Mon, Jul 20, 2015 at 11:20:40AM +0200, Stefan Roese wrote:
>> This patch adds the configuration options to boot via SDIO/MMC on the
>> Marvell DB-88F6820-GP Armada A38x board. The default boot device
>> is still SPI NOR flash.
>>
>> To enable MMC booting on this board 2 things need to be changes:
>> a) Change kwbimage.cfg
>>     BOOT_FROM   sdio
>> b) In the config header select
>>     #define CONFIG_SPL_BOOT_DEVICE	SPL_BOOT_SDIO_MMC_CARD
>>
>> The generated image needs to be copied to the first bootable MMC
>> partition:
>
> Can you please define "bootable" here? Does the partition really need to
> have bootable flag configured?

Correct. Thats how I understand it from the documentation. Trying to 
boot from a partition that did not have this "bootable" flag set did not 
work IIRC.

Thanks,
Stefan
diff mbox

Patch

diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h
index 73b3236..739c2bf 100644
--- a/include/configs/db-88f6820-gp.h
+++ b/include/configs/db-88f6820-gp.h
@@ -110,6 +110,17 @@ 
 	"initrd_high=0x10000000\0"
 
 /* SPL */
+/*
+ * Select the boot device here
+ *
+ * Currently supported are:
+ * SPL_BOOT_SPI_NOR_FLASH	- Booting via SPI NOR flash
+ * SPL_BOOT_SDIO_MMC_CARD	- Booting via SDIO/MMC card (partition 1)
+ */
+#define SPL_BOOT_SPI_NOR_FLASH		1
+#define SPL_BOOT_SDIO_MMC_CARD		2
+#define CONFIG_SPL_BOOT_DEVICE		SPL_BOOT_SPI_NOR_FLASH
+
 /* Defines for SPL */
 #define CONFIG_SPL_FRAMEWORK
 #define CONFIG_SPL_SIZE			(140 << 10)
@@ -131,6 +142,7 @@ 
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_I2C_SUPPORT
 
+#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH
 /* SPL related SPI defines */
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
@@ -138,6 +150,22 @@ 
 #define CONFIG_SPL_SPI_BUS		0
 #define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
+#define CONFIG_SYS_U_BOOT_OFFS		CONFIG_SYS_SPI_U_BOOT_OFFS
+#endif
+
+#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD
+/* SPL related MMC defines */
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 1
+#define CONFIG_SYS_MMC_U_BOOT_OFFS		(160 << 10)
+#define CONFIG_SYS_U_BOOT_OFFS			CONFIG_SYS_MMC_U_BOOT_OFFS
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	(CONFIG_SYS_U_BOOT_OFFS / 512)
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	((512 << 10) / 512) /* 512KiB */
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER	0x00180000	/* in SDRAM */
+#endif
+#endif
 
 /* Enable DDR support in SPL (DDR3 training from Marvell bin_hdr) */
 #define CONFIG_SYS_MVEBU_DDR_A38X