Patchwork [U-Boot,3/3] am33xx: Add SPI SPL as an option

login
register
mail settings
Submitter Tom Rini
Date Oct. 16, 2012, 11:06 p.m.
Message ID <1350428767-15380-3-git-send-email-trini@ti.com>
Download mbox | patch
Permalink /patch/191911/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Tom Rini - Oct. 16, 2012, 11:06 p.m.
Add the required config.mk logic for this SoC as well as the BOOT_DEVICE
define.  Finally, enable the options on the am335x_evm.

Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/arm/cpu/armv7/am33xx/config.mk    |    1 +
 arch/arm/include/asm/arch-am33xx/spl.h |    1 +
 include/configs/am335x_evm.h           |    7 +++++++
 3 files changed, 9 insertions(+)
Peter Korsgaard - Oct. 17, 2012, 6:47 a.m.
>>>>> "Tom" == Tom Rini <trini@ti.com> writes:

 Tom> Add the required config.mk logic for this SoC as well as the BOOT_DEVICE
 Tom> define.  Finally, enable the options on the am335x_evm.

 Tom> Signed-off-by: Tom Rini <trini@ti.com>
 Tom> ---
 Tom>  arch/arm/cpu/armv7/am33xx/config.mk    |    1 +
 Tom>  arch/arm/include/asm/arch-am33xx/spl.h |    1 +
 Tom>  include/configs/am335x_evm.h           |    7 +++++++
 Tom>  3 files changed, 9 insertions(+)

 Tom> diff --git a/arch/arm/cpu/armv7/am33xx/config.mk b/arch/arm/cpu/armv7/am33xx/config.mk
 Tom> index 5750bbd..babf0eb 100644
 Tom> --- a/arch/arm/cpu/armv7/am33xx/config.mk
 Tom> +++ b/arch/arm/cpu/armv7/am33xx/config.mk
 Tom> @@ -13,6 +13,7 @@
 Tom>  #
 Tom>  ifdef CONFIG_SPL_BUILD
 Tom>  ALL-y	+= $(OBJTREE)/MLO
 Tom> +ALL-$(CONFIG_SPL_SPI_SUPPORT) += $(OBJTREE)/MLO.byteswap
 Tom>  else
 Tom>  ALL-y	+= $(obj)u-boot.img
 Tom>  endif
 Tom> diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h
 Tom> index 63ed10b..644ff35 100644
 Tom> --- a/arch/arm/include/asm/arch-am33xx/spl.h
 Tom> +++ b/arch/arm/include/asm/arch-am33xx/spl.h
 Tom> @@ -27,6 +27,7 @@
 Tom>  #define BOOT_DEVICE_NAND	5
 Tom>  #define BOOT_DEVICE_MMC1	8
 Tom>  #define BOOT_DEVICE_MMC2	9	/* eMMC or daughter card */
 Tom> +#define BOOT_DEVICE_SPI		11

11? According to the TRM (spuh73f, pg4295) spi is 21.
Tom Rini - Oct. 17, 2012, 3:18 p.m.
On Wed, Oct 17, 2012 at 08:47:57AM +0200, Peter Korsgaard wrote:
> >>>>> "Tom" == Tom Rini <trini@ti.com> writes:
> 
>  Tom> Add the required config.mk logic for this SoC as well as the BOOT_DEVICE
>  Tom> define.  Finally, enable the options on the am335x_evm.
> 
>  Tom> Signed-off-by: Tom Rini <trini@ti.com>
>  Tom> ---
>  Tom>  arch/arm/cpu/armv7/am33xx/config.mk    |    1 +
>  Tom>  arch/arm/include/asm/arch-am33xx/spl.h |    1 +
>  Tom>  include/configs/am335x_evm.h           |    7 +++++++
>  Tom>  3 files changed, 9 insertions(+)
> 
>  Tom> diff --git a/arch/arm/cpu/armv7/am33xx/config.mk b/arch/arm/cpu/armv7/am33xx/config.mk
>  Tom> index 5750bbd..babf0eb 100644
>  Tom> --- a/arch/arm/cpu/armv7/am33xx/config.mk
>  Tom> +++ b/arch/arm/cpu/armv7/am33xx/config.mk
>  Tom> @@ -13,6 +13,7 @@
>  Tom>  #
>  Tom>  ifdef CONFIG_SPL_BUILD
>  Tom>  ALL-y	+= $(OBJTREE)/MLO
>  Tom> +ALL-$(CONFIG_SPL_SPI_SUPPORT) += $(OBJTREE)/MLO.byteswap
>  Tom>  else
>  Tom>  ALL-y	+= $(obj)u-boot.img
>  Tom>  endif
>  Tom> diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h
>  Tom> index 63ed10b..644ff35 100644
>  Tom> --- a/arch/arm/include/asm/arch-am33xx/spl.h
>  Tom> +++ b/arch/arm/include/asm/arch-am33xx/spl.h
>  Tom> @@ -27,6 +27,7 @@
>  Tom>  #define BOOT_DEVICE_NAND	5
>  Tom>  #define BOOT_DEVICE_MMC1	8
>  Tom>  #define BOOT_DEVICE_MMC2	9	/* eMMC or daughter card */
>  Tom> +#define BOOT_DEVICE_SPI		11
> 
> 11? According to the TRM (spuh73f, pg4295) spi is 21.

Correct.  I hadn't seen the table before and all of those numbers come
from run-time testing.  I'm filing a bug against the TRM now, thanks!

Patch

diff --git a/arch/arm/cpu/armv7/am33xx/config.mk b/arch/arm/cpu/armv7/am33xx/config.mk
index 5750bbd..babf0eb 100644
--- a/arch/arm/cpu/armv7/am33xx/config.mk
+++ b/arch/arm/cpu/armv7/am33xx/config.mk
@@ -13,6 +13,7 @@ 
 #
 ifdef CONFIG_SPL_BUILD
 ALL-y	+= $(OBJTREE)/MLO
+ALL-$(CONFIG_SPL_SPI_SUPPORT) += $(OBJTREE)/MLO.byteswap
 else
 ALL-y	+= $(obj)u-boot.img
 endif
diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h
index 63ed10b..644ff35 100644
--- a/arch/arm/include/asm/arch-am33xx/spl.h
+++ b/arch/arm/include/asm/arch-am33xx/spl.h
@@ -27,6 +27,7 @@ 
 #define BOOT_DEVICE_NAND	5
 #define BOOT_DEVICE_MMC1	8
 #define BOOT_DEVICE_MMC2	9	/* eMMC or daughter card */
+#define BOOT_DEVICE_SPI		11
 #define BOOT_DEVICE_UART	65
 #define BOOT_DEVICE_CPGMAC	70
 #define BOOT_DEVICE_MMC2_2      0xFF
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 9d80739..58d62d0 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -218,6 +218,13 @@ 
 #define CONFIG_SPL_NET_SUPPORT
 #define CONFIG_SPL_NET_VCI_STRING	"AM335x U-Boot SPL"
 #define CONFIG_SPL_ETH_SUPPORT
+#define CONFIG_SPL_SPI_SUPPORT
+#define CONFIG_SPL_SPI_FLASH_SUPPORT
+#define CONFIG_SPL_SPI_LOAD
+#define CONFIG_SPL_SPI_BUS		0
+#define CONFIG_SPL_SPI_CS		0
+#define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
+#define CONFIG_SYS_SPI_U_BOOT_SIZE	0x40000
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds"
 
 /*