Skip to contentSkip to conversation

spi: Setup the master controller driver before setting the chipselect

PATCH In review Franklin S Cooper Jr 4 participants 8 messages Oct 16, 2015 – Oct 28, 2015 SPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spi: Setup the master controller driver before setting the chipselect

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

---
Keystone 2 devices currently fail to boot in linux-next after the below commit was applied:

spi: bitbang: switch to the generic implementation of transfer_one_message
commit: 0037686596832572bbca05ab168d9884d7d704c1

This patch allows Keystone 2 devices to boot again in linux-next.

Tested this patch on K2E evm and am437 starterkit which both have SPI devices to insure regressions aren't seen.

V2 Changes:
Update commit message.

 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi.c +2 -2
index 4c638f3..9d5525a 100644
@@ -2059,11 +2059,11 @@ int spi_setup(struct spi_device *spi)
 	if (!spi->max_speed_hz)
 		spi->max_speed_hz = spi->master->max_speed_hz;
 
-	spi_set_cs(spi, false);
-
 	if (spi->master->setup)
 		status = spi->master->setup(spi);
 
+	spi_set_cs(spi, false);
+
 	dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
 			(int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
 			(spi->mode & SPI_CS_HIGH) ? "cs_high, " : "",
Signature · 6 lines
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 9 lines · Franklin S Cooper Jr

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

Does it mean I have to test it again?

Quoted 39 lines

---
Keystone 2 devices currently fail to boot in linux-next after the below commit was applied:

spi: bitbang: switch to the generic implementation of transfer_one_message
commit: 0037686596832572bbca05ab168d9884d7d704c1

This patch allows Keystone 2 devices to boot again in linux-next.

Tested this patch on K2E evm and am437 starterkit which both have SPI devices to insure regressions aren't seen.

V2 Changes:
Update commit message.

 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi.c +2 -3
index 4c638f3..9d5525a 100644
@@ -2059,11 +2059,11 @@ int spi_setup(struct spi_device *spi)
        if (!spi->max_speed_hz)
                spi->max_speed_hz = spi->master->max_speed_hz;
 
-       spi_set_cs(spi, false);
-
        if (spi->master->setup)
                status = spi->master->setup(spi);
 
+       spi_set_cs(spi, false);
+
        dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
                        (int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
                        (spi->mode & SPI_CS_HIGH) ? "cs_high, " : "",
--

2.6.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Franklin S Cooper Jr

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

Does it mean I have to test it again?

Oops sorry. No the patch hasn't changed. I can shoot a v3 with your tested by included.

Quoted 32 lines
Quoted 32 lines

---
Keystone 2 devices currently fail to boot in linux-next after the below commit was applied:

spi: bitbang: switch to the generic implementation of transfer_one_message
commit: 0037686596832572bbca05ab168d9884d7d704c1

This patch allows Keystone 2 devices to boot again in linux-next.

Tested this patch on K2E evm and am437 starterkit which both have SPI devices to insure regressions aren't seen.

V2 Changes:
Update commit message.

 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi.c +0 -2
index 4c638f3..9d5525a 100644
@@ -2059,11 +2059,11 @@ int spi_setup(struct spi_device *spi)
        if (!spi->max_speed_hz)
                spi->max_speed_hz = spi->master->max_speed_hz;
 
-       spi_set_cs(spi, false);
-
        if (spi->master->setup)
                status = spi->master->setup(spi);
 
Quoted 10 lines
Quoted 8 lines
drivers/spi/spi.c +2 -1
+       spi_set_cs(spi, false);
+
        dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
                        (int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
                        (spi->mode & SPI_CS_HIGH) ? "cs_high, " : "",
--

2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 9 lines · Franklin S Cooper Jr.
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Franklin S Cooper Jr

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

Does it mean I have to test it again?

Oops sorry. No the patch hasn't changed. I can shoot a v3 with your tested by included.

Whatever Mark prefers.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Franklin S Cooper Jr.
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Franklin S Cooper Jr

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

Does it mean I have to test it again?

Oops sorry. No the patch hasn't changed. I can shoot a v3 with your tested by included.

Whatever Mark prefers.

Hi Mark,
I don't see that you pulled this patch into your topic/core branch just yet. Would you prefer for me to shoot a v3 with Andy's tested by or will you just add it when your ready to pull it in?

Without this patch several of our boards don't boot in linux-next so if there is anything you need for me to do please let me know.

Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Tested-by Tested-by Ivan Khoronzhuk
#5 lore raw
Quoted 18 lines · Franklin S Cooper Jr.
Quoted 15 lines · Andy Shevchenko
Quoted 14 lines · Franklin S Cooper Jr.
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Franklin S Cooper Jr

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

Does it mean I have to test it again?

Oops sorry. No the patch hasn't changed. I can shoot a v3 with your tested by included.

Quoted 11 lines
Quoted 1 line

Whatever Mark prefers.

Hi Mark,
I don't see that you pulled this patch into your topic/core branch just yet. Would you prefer for me to shoot a v3 with Andy's tested by or will you just add it when your ready to pull it in?

Without this patch several of our boards don't boot in linux-next so if there is anything you need for me to do please let me know.

Quoted 2 lines

Boot tested on K2HK:

Signature · 6 lines
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tested-by Ivan Khoronzhuk
#6 lore raw
Quoted 37 lines · Grygorii Strashko
Quoted 29 lines · Franklin S Cooper Jr.
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Franklin S Cooper Jr.
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Franklin S Cooper Jr

SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion.

Does it mean I have to test it again?

Oops sorry. No the patch hasn't changed. I can shoot a v3 with your tested by included.

Whatever Mark prefers.

Hi Mark,
I don't see that you pulled this patch into your topic/core branch just yet. Would you prefer
for me to shoot a v3 with Andy's tested by or will you just add it when your ready to
pull it in?

Quoted 6 lines

Without this patch several of our boards don't boot in linux-next so if there is anything you
need for me to do please let me know.

Quoted 2 lines
Quoted 5 lines

Boot tested on K2HK:

Sry, Fix Ivan's e-mail

Signature · 6 lines
regards,
-grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#7 lore raw
In reply to Franklin S Cooper Jr.
Quoted 3 lines · Franklin S Cooper Jr.

I don't see that you pulled this patch into your topic/core branch just yet. Would you prefer for me to shoot a v3 with Andy's tested by or will you just add it when your ready to pull it in?

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.

Please don't send content free pings. If your patch has been lost then you will need to resend it, if your patch is waiting to be handled then at best your message is likely to be threaded in with the original thread and therefore not seen. Either way a content free ping just adds to mail volume rather than helping.