Skip to contentSkip to conversation

omap3_spi: Undo CONFIG_AM33XX D0/D1 change

PATCH New Tom Rini 2 participants 8 messages Oct 16, 2012 – Oct 17, 2012

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/3 omap3_spi: Undo CONFIG_AM33XX D0/D1 change

At some point the am335x evm hardware was updated to previosly used in all other designs layout, so remove the now incorrect code.

---
 drivers/spi/omap3_spi.c |   10 ----------
 1 file changed, 10 deletions(-)
drivers/spi/omap3_spi.c +0 -10
index e40a632..47f9e56 100644
@@ -173,18 +173,8 @@ int spi_claim_bus(struct spi_slave *slave)
 	/* standard 4-wire master mode:	SCK, MOSI/out, MISO/in, nCS
 	 * REVISIT: this controller could support SPI_3WIRE mode.
 	 */
-#ifdef CONFIG_AM33XX
-	/*
-	 * The reference design on AM33xx has D0 and D1 wired up opposite
-	 * of how it has been done on previous platforms.  We assume that
-	 * custom hardware will also follow this convention.
-	 */
-	conf &= OMAP3_MCSPI_CHCONF_DPE0;
-	conf |= ~(OMAP3_MCSPI_CHCONF_IS|OMAP3_MCSPI_CHCONF_DPE1);
-#else
 	conf &= ~(OMAP3_MCSPI_CHCONF_IS|OMAP3_MCSPI_CHCONF_DPE1);
 	conf |= OMAP3_MCSPI_CHCONF_DPE0;
-#endif
 
 	/* wordlength */
 	conf &= ~OMAP3_MCSPI_CHCONF_WL_MASK;
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/3 omapimage: Add support for byteswapped SPI images

Add MLO.byteswap as a target to spl/Makefile and un-guard the first MLO rule so we don't have to duplicate it.

---
 spl/Makefile      |    9 ++----
 tools/omapimage.c |   83 +++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 68 insertions(+), 24 deletions(-)
spl/Makefile +3 -6
index e9d0ec4..000cafa 100644
@@ -110,16 +110,13 @@ LDPPFLAGS += \
 	$(shell $(LD) --version | \
 	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
 
-ifdef CONFIG_OMAP
 $(OBJTREE)/MLO:	$(obj)u-boot-spl.bin
 	$(OBJTREE)/tools/mkimage -T omapimage \
 		-a $(CONFIG_SPL_TEXT_BASE) -d $< $@
-endif
-ifdef CONFIG_AM33XX
-$(OBJTREE)/MLO:	$(obj)u-boot-spl.bin
-	$(OBJTREE)/tools/mkimage -T omapimage \
+
+$(OBJTREE)/MLO.byteswap: $(obj)u-boot-spl.bin
+	$(OBJTREE)/tools/mkimage -T omapimage -n byteswap \
 		-a $(CONFIG_SPL_TEXT_BASE) -d $< $@
-endif
 
 ALL-y	+= $(obj)u-boot-spl.bin
 
tools/omapimage.c +65 -18

132 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 3/3 am33xx: Add SPI SPL as an option

In reply to Tom Rini

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

---
 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(+)
arch/arm/cpu/armv7/am33xx/config.mk +1 -0
index 5750bbd..babf0eb 100644
@@ -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
arch/arm/include/asm/arch-am33xx/spl.h +1 -0
index 63ed10b..644ff35 100644
@@ -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
include/configs/am335x_evm.h +7 -0
index 9d80739..58d62d0 100644
@@ -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"
 
 /*
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 am33xx: Add SPI SPL as an option

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tom" == Tom Rini <[email protected]> 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 <[email protected]>
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.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/3 omap3_spi: Undo CONFIG_AM33XX D0/D1 change

In reply to Tom Rini
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tom" == Tom Rini <[email protected]> writes:

Tom> At some point the am335x evm hardware was updated to previosly Tom> used in all other designs layout, so remove the now incorrect Tom> code.

Could we please just put it under a different symbol,
E.G. CONFIG_OMAP3_SPI_SWAPPED? The board I'm working on uses the same wiring as the old evm (E.G. transmit on D0 and receive on D1).

Tom> Signed-off-by: Tom Rini <[email protected]>
Tom> ---

 Tom>  drivers/spi/omap3_spi.c |   10 ----------

Tom> 1 file changed, 10 deletions(-)

Tom> diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c Tom> index e40a632..47f9e56 100644
Tom> --- a/drivers/spi/omap3_spi.c
Tom> +++ b/drivers/spi/omap3_spi.c
Tom> @@ -173,18 +173,8 @@ int spi_claim_bus(struct spi_slave *slave)

 Tom>  	/* standard 4-wire master mode:	SCK, MOSI/out, MISO/in, nCS
 Tom>  	 * REVISIT: this controller could support SPI_3WIRE mode.
 Tom>  	 */

Tom> -#ifdef CONFIG_AM33XX
Tom> - /*
Tom> - * The reference design on AM33xx has D0 and D1 wired up opposite
Tom> - * of how it has been done on previous platforms. We assume that
Tom> - * custom hardware will also follow this convention.
Tom> - */
Tom> - conf &= OMAP3_MCSPI_CHCONF_DPE0;
Tom> - conf |= ~(OMAP3_MCSPI_CHCONF_IS|OMAP3_MCSPI_CHCONF_DPE1);

The inversion seems wrong. DPE0 should be cleared and IS|DPE1 set.

Tom> -#else
Tom> conf &= ~(OMAP3_MCSPI_CHCONF_IS|OMAP3_MCSPI_CHCONF_DPE1);
Tom> conf |= OMAP3_MCSPI_CHCONF_DPE0;
Tom> -#endif

Tom> /* wordlength */
Tom> conf &= ~OMAP3_MCSPI_CHCONF_WL_MASK;
Tom> --
Tom> 1.7.9.5

Signature · 1 line
Bye, Peter Korsgaard
author
#6 lore raw

PATCH 1/3 omap3_spi: Undo CONFIG_AM33XX D0/D1 change

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 31 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tom" == Tom Rini <[email protected]> writes:

Tom> At some point the am335x evm hardware was updated to previosly Tom> used in all other designs layout, so remove the now incorrect Tom> code.

Could we please just put it under a different symbol, E.G. CONFIG_OMAP3_SPI_SWAPPED? The board I'm working on uses the same wiring as the old evm (E.G. transmit on D0 and receive on D1).

Tom> Signed-off-by: Tom Rini <[email protected]> Tom> --- Tom>
drivers/spi/omap3_spi.c | 10 ---------- Tom> 1 file changed, 10
deletions(-)

Tom> diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c Tom> index e40a632..47f9e56 100644 Tom> --- a/drivers/spi/omap3_spi.c Tom> +++ b/drivers/spi/omap3_spi.c Tom> @@ -173,18 +173,8 @@ int spi_claim_bus(struct spi_slave
*slave) Tom> /* standard 4-wire master mode: SCK, MOSI/out,
MISO/in, nCS Tom> * REVISIT: this controller could support
SPI_3WIRE mode. Tom> */ Tom> -#ifdef CONFIG_AM33XX Tom> - /*
Tom> - * The reference design on AM33xx has D0 and D1 wired up
opposite Tom> - * of how it has been done on previous platforms. We
assume that Tom> - * custom hardware will also follow this
convention. Tom> - */ Tom> - conf &= OMAP3_MCSPI_CHCONF_DPE0; Tom>

drivers/spi/omap3_spi.c +0 -1
-	conf |= ~(OMAP3_MCSPI_CHCONF_IS|OMAP3_MCSPI_CHCONF_DPE1);

The inversion seems wrong. DPE0 should be cleared and IS|DPE1 set.

Quoted 6 lines

Tom> -#else Tom> conf &=
~(OMAP3_MCSPI_CHCONF_IS|OMAP3_MCSPI_CHCONF_DPE1); Tom> conf |=
OMAP3_MCSPI_CHCONF_DPE0; Tom> -#endif

Tom> /* wordlength */ Tom> conf &=
~OMAP3_MCSPI_CHCONF_WL_MASK;

Alright, can you post a patch that works for you? Thanks!

- --
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQfsG7AAoJENk4IS6UOR1WbskP/1EPbY/pFTsOCRHC8ee6Q/Sj Vlm2vUOV9SbzmKn+AO8vZr90bB5Orf2nLSGXmGMF/VO0j3WLZh4lzIVXCesWJfu5 FgofsfmPZRxeX7y/Y1edudy68jRbf2080WglbZP5JJK6EEMuM1juKlgufj0Km7C6 uyDurQ9ew0obNf8qQVkGJghxIVrQheoMTg9rEWD8HTBxT4YdKarJ1CtL8Tu88YL1 7L1FStrqQ1A/aRNxw8wyEf7aKhquoj5nQsk/zNXMj43lyR4e8Rcm8+z/ujeflfgk 62ZYvfEGlC8K3fp9e4IGN36h+WfxteMCTXR/PEmzSyZiipZzD7hRtwQ0TafxcztV ADE66Rpt26MPQNnxTWVi2Dswa5ICctwdmcxDsib8RbGFh4BcaMlBz7vRkFgTX33j 7KfKWZ9uiHouzz/4IfIG1pbdbCAjokHaMRFMKlF4R+btY1y/C2ZIofLWRprnBlXA ss+wh1nfUooVGL/rG81zdZBLM1qKF+tax7bzPWxEWGTc7KsugR52FvTo+1uTnLxR LIEY8V0Kp5EFIPBzEKTy760BrvRF6W62+qLtczBso7p8RKQ0p/ubGNEXxleQZsFa KE7tCpT1huO5Rg5ls6dOkouAiGvXxaweK/HJlSf7pqgPj0sQec261OkmGCLhAApm Ir4Xb101MuKipeoh9mBJ
=+RCa
-----END PGP SIGNATURE-----

author
#4 lore raw

PATCH 3/3 am33xx: Add SPI SPL as an option

In reply to Peter Korsgaard
Quoted 32 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tom" == Tom Rini <[email protected]> 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 <[email protected]>
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 */
Quoted 3 lines

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!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121017/e0cf4106/attachment.pgp>
#7 lore raw

PATCH 1/3 omap3_spi: Undo CONFIG_AM33XX D0/D1 change

In reply to Tom Rini
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tom" == Tom Rini <[email protected]> writes:

Hi,

Tom> Alright, can you post a patch that works for you? Thanks!

Sure, will do so now.

Signature · 1 line
Bye, Peter Korsgaard