Skip to contentSkip to conversation

mx6: mx6qsabrelite/nitrogen6x: Remove incorrect setting of gpio CS signal

PATCH New Andrew Gabbasov 4 participants 4 messages May 30, 2013 – Jun 3, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx6: mx6qsabrelite/nitrogen6x: Remove incorrect setting of gpio CS signal

The number of gpio signal is packed inside CONFIG_SF_DEFAULT_CS macro (shifted and or'ed with chip select), so it's incorrect to pass that macro directly as an argument to gpio_direction_output() call.

Also, SPI driver sets the direction and initial value of a gpio, used as a chip select signal, before any actual activity happens on the bus.

So, it is safe to just remove the gpio_direction_output call, that works incorrectly, thus making no effect, anyway.

---
 board/boundary/nitrogen6x/nitrogen6x.c        |    1 -
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |    1 -
 2 files changed, 2 deletions(-)
board/boundary/nitrogen6x/nitrogen6x.c +0 -1
index cc071d6..735fd76 100644
@@ -342,7 +342,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
 
 void setup_spi(void)
 {
-	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
 	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
 					 ARRAY_SIZE(ecspi1_pads));
 }
board/freescale/mx6qsabrelite/mx6qsabrelite.c +0 -1
index 9f9cac8..29815d7 100644
@@ -312,7 +312,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
 
 void setup_spi(void)
 {
-	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
 	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
 					 ARRAY_SIZE(ecspi1_pads));
 }
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 mx6: mx6qsabrelite/nitrogen6x: Remove incorrect setting of gpio CS signal

On Thu, May 30, 2013 at 7:47 AM, Andrew Gabbasov <[email protected]

Quoted 48 lines

wrote:

The number of gpio signal is packed inside CONFIG_SF_DEFAULT_CS macro (shifted and or'ed with chip select), so it's incorrect to pass that macro directly as an argument to gpio_direction_output() call.

Also, SPI driver sets the direction and initial value of a gpio, used as a chip select signal, before any actual activity happens on the bus.

So, it is safe to just remove the gpio_direction_output call, that works incorrectly, thus making no effect, anyway.

---
 board/boundary/nitrogen6x/nitrogen6x.c        |    1 -
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |    1 -
 2 files changed, 2 deletions(-)
board/boundary/nitrogen6x/nitrogen6x.c +0 -1
index cc071d6..735fd76 100644
@@ -342,7 +342,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
 
 void setup_spi(void)
 {
-       gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
        imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
                                         ARRAY_SIZE(ecspi1_pads));
 }
board/freescale/mx6qsabrelite/mx6qsabrelite.c +0 -2
index 9f9cac8..29815d7 100644
@@ -312,7 +312,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
 
 void setup_spi(void)
 {
-       gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
        imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
                                         ARRAY_SIZE(ecspi1_pads));
 }
--

1.7.10.4

Quoted 1 line

Works for me for all Tegra builds, so:

Tested on the Sabre Lite.

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH 1/1 mx6: mx6qsabrelite/nitrogen6x: Remove incorrect setting of gpio CS signal

In reply to Andrew Gabbasov
Quoted 35 lines · Andrew Gabbasov

The number of gpio signal is packed inside CONFIG_SF_DEFAULT_CS macro (shifted and or'ed with chip select), so it's incorrect to pass that macro directly as an argument to gpio_direction_output() call.

Also, SPI driver sets the direction and initial value of a gpio, used as a chip select signal, before any actual activity happens on the bus.

So, it is safe to just remove the gpio_direction_output call, that works incorrectly, thus making no effect, anyway.

---
  board/boundary/nitrogen6x/nitrogen6x.c        |    1 -
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |    1 -
  2 files changed, 2 deletions(-)
board/boundary/nitrogen6x/nitrogen6x.c +0 -1
index cc071d6..735fd76 100644
@@ -342,7 +342,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
 
  void setup_spi(void)
  {
-	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
  	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
  					 ARRAY_SIZE(ecspi1_pads));
  }
board/freescale/mx6qsabrelite/mx6qsabrelite.c +0 -0
index 9f9cac8..29815d7 100644

board/freescale/mx6qsabrelite/mx6qsabrelite.c iomux_v3_cfg_t const ecspi1_pads[] = { · line 317

Quoted 7 lines
board/freescale/mx6qsabrelite/mx6qsabrelite.c +0 -1
@@ -312,7 +312,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
 
  void setup_spi(void)
  {
-	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
  	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,
  					 ARRAY_SIZE(ecspi1_pads));
  }

Thanks

Dirk

#3 lore raw

PATCH 1/1 mx6: mx6qsabrelite/nitrogen6x: Remove incorrect setting of gpio CS signal

In reply to Andrew Gabbasov
Quoted 8 lines · Andrew Gabbasov

The number of gpio signal is packed inside CONFIG_SF_DEFAULT_CS macro (shifted and or'ed with chip select), so it's incorrect to pass that macro directly as an argument to gpio_direction_output() call.

Also, SPI driver sets the direction and initial value of a gpio, used as a chip select signal, before any actual activity happens on the bus.

Quoted 5 lines

So, it is safe to just remove the gpio_direction_output call, that works incorrectly, thus making no effect, anyway.

---

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
=====================================================================