Skip to contentSkip to conversation

ot1200: fix sf detection

PATCH New Christian Gmeiner 5 participants 6 messages Oct 22, 2014 – Nov 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ot1200: fix sf detection

Commit 155fa9af95ac5be857a7327e7a968a296e60d4c8 changed the way to define a GPIO line, which can be used to force CS high across multiple transactions. In order to fix sf detection change board code to make use of board_spi_cs_gpio(..).

---
 board/bachmann/ot1200/ot1200.c | 5 +++++
 include/configs/ot1200.h       | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
board/bachmann/ot1200/ot1200.c +5 -0
index 0d5ede5..2962e0c 100644
@@ -98,6 +98,11 @@ static void setup_iomux_spi(void)
 	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
 }
 
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+	return (bus == 2 && cs == 0) ? (IMX_GPIO_NR(1, 3)) : -1;
+}
+
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
include/configs/ot1200.h +1 -1
index 071880f..d7696bd 100644
@@ -47,7 +47,7 @@
 #define CONFIG_SPI_FLASH_SST
 #define CONFIG_MXC_SPI
 #define CONFIG_SF_DEFAULT_BUS  2
-#define CONFIG_SF_DEFAULT_CS   (0|(IMX_GPIO_NR(1, 3)<<8))
+#define CONFIG_SF_DEFAULT_CS   0
 #define CONFIG_SF_DEFAULT_SPEED 25000000
 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 ot1200: fix sf detection

Quoted 33 lines · Christian Gmeiner

Commit 155fa9af95ac5be857a7327e7a968a296e60d4c8 changed the way to define a GPIO line, which can be used to force CS high across multiple transactions. In order to fix sf detection change board code to make use of board_spi_cs_gpio(..).

---
 board/bachmann/ot1200/ot1200.c | 5 +++++
 include/configs/ot1200.h       | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
board/bachmann/ot1200/ot1200.c +5 -0
index 0d5ede5..2962e0c 100644
@@ -98,6 +98,11 @@ static void setup_iomux_spi(void)
 	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
 }
 
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+	return (bus == 2 && cs == 0) ? (IMX_GPIO_NR(1, 3)) : -1;
+}
+
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
include/configs/ot1200.h +0 -0
index 071880f..d7696bd 100644

include/configs/ot1200.h line 53

Quoted 8 lines
include/configs/ot1200.h +1 -1
@@ -47,7 +47,7 @@
 #define CONFIG_SPI_FLASH_SST
 #define CONFIG_MXC_SPI
 #define CONFIG_SF_DEFAULT_BUS  2
-#define CONFIG_SF_DEFAULT_CS   (0|(IMX_GPIO_NR(1, 3)<<8))
+#define CONFIG_SF_DEFAULT_CS   0
 #define CONFIG_SF_DEFAULT_SPEED 25000000
 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
 

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH 1/1 ot1200: fix sf detection

In reply to Christian Gmeiner

Hi all,

Quoted 10 lines · On Wed, 22 Oct 2014 11:29:51 +0200 Christian Gmeiner…

Commit 155fa9af95ac5be857a7327e7a968a296e60d4c8 changed the way to define a GPIO line, which can be used to force CS high across multiple transactions. In order to fix sf detection change board code to make use of board_spi_cs_gpio(..).

---
 board/bachmann/ot1200/ot1200.c | 5 +++++
 include/configs/ot1200.h       | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

There are another two board that might be affected:

$ grep --exclude=ot1200.h -r SF_DEFAULT_CS include/configs/ | grep IMX_GPIO_NR
include/configs/aristainetos.h:#define CONFIG_SF_DEFAULT_CS		(0|(IMX_GPIO_NR(3, 20)<<8))
include/configs/tqma6.h:#define CONFIG_SF_DEFAULT_CS	(0 | (IMX_GPIO_NR(3, 19) << 8))

So, I'm CC'ing board maintainers, please test/fix them too. Thanks!

Anatolij

#3 lore raw

PATCH 1/1 ot1200: fix sf detection

Hello Anatolij,

Am 22.10.2014 12:09, schrieb Anatolij Gustschin:

Quoted 17 lines

Hi all,

Quoted 10 lines · On Wed, 22 Oct 2014 11:29:51 +0200 Christian…

Commit 155fa9af95ac5be857a7327e7a968a296e60d4c8 changed the way to define a GPIO line, which can be used to force CS high across multiple transactions. In order to fix sf detection change board code to make use of board_spi_cs_gpio(..).

---
  board/bachmann/ot1200/ot1200.c | 5 +++++
  include/configs/ot1200.h       | 2 +-
  2 files changed, 6 insertions(+), 1 deletion(-)
Quoted 7 lines

There are another two board that might be affected:

$ grep --exclude=ot1200.h -r SF_DEFAULT_CS include/configs/ | grep IMX_GPIO_NR
include/configs/aristainetos.h:#define CONFIG_SF_DEFAULT_CS		(0|(IMX_GPIO_NR(3, 20)<<8))
include/configs/tqma6.h:#define CONFIG_SF_DEFAULT_CS	(0 | (IMX_GPIO_NR(3, 19)<<  8))

So, I'm CC'ing board maintainers, please test/fix them too. Thanks!

thanks for adding me to cc !

I fix this issue here:

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=2f6bb0a9419ec8016524142cb54fef81038b346e

already applied in the u-boot.imx tree ...

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH 1/1 ot1200: fix sf detection

In reply to Christian Gmeiner
Quoted 33 lines · Christian Gmeiner

Commit 155fa9af95ac5be857a7327e7a968a296e60d4c8 changed the way to define a GPIO line, which can be used to force CS high across multiple transactions. In order to fix sf detection change board code to make use of board_spi_cs_gpio(..).

---
  board/bachmann/ot1200/ot1200.c | 5 +++++
  include/configs/ot1200.h       | 2 +-
  2 files changed, 6 insertions(+), 1 deletion(-)
board/bachmann/ot1200/ot1200.c +5 -0
index 0d5ede5..2962e0c 100644
@@ -98,6 +98,11 @@ static void setup_iomux_spi(void)
  	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
  }
 
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+	return (bus == 2 && cs == 0) ? (IMX_GPIO_NR(1, 3)) : -1;
+}
+
  int board_early_init_f(void)
  {
  	setup_iomux_uart();
include/configs/ot1200.h +0 -0
index 071880f..d7696bd 100644

include/configs/ot1200.h line 53

Quoted 8 lines
include/configs/ot1200.h +1 -1
@@ -47,7 +47,7 @@
  #define CONFIG_SPI_FLASH_SST
  #define CONFIG_MXC_SPI
  #define CONFIG_SF_DEFAULT_BUS  2
-#define CONFIG_SF_DEFAULT_CS   (0|(IMX_GPIO_NR(1, 3)<<8))
+#define CONFIG_SF_DEFAULT_CS   0
  #define CONFIG_SF_DEFAULT_SPEED 25000000
  #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
 
Signature · 2 lines
Regards,
Nikita Kiryanov
#5 lore raw

PATCH 1/1 ot1200: fix sf detection

In reply to Christian Gmeiner

Hi Christian,

Quoted 7 lines · Christian Gmeiner

Commit 155fa9af95ac5be857a7327e7a968a296e60d4c8 changed the way to define a GPIO line, which can be used to force CS high across multiple transactions. In order to fix sf detection change board code to make use of board_spi_cs_gpio(..).

---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================