Skip to contentSkip to conversation

spi-atmel broken in next

PATCH Applied Joachim Eastwood 3 participants 5 messages Feb 17, 2013 – Mar 2, 2013 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

spi-atmel is now broken for all spi transfers in linux-next. This is caused by commit "spi: make sure all transfer has proper speed set". The reason is the following code in atmel_spi_transfer(...)

849 /* FIXME implement these protocol options!! */ 850 if (xfer->speed_hz) {
851 dev_dbg(&spi->dev, "no protocol options yet\n");
852 return -ENOPROTOOPT;
853 }

Now that xfer->speed_hz is always set all spi transfers will return with ENOPROTOOPT.

Not quite sure how to best fix it. Just removing the whole test makes it work again but I guess we should do something better with speed_hz here.

One little question; Is a per transfer speed setting really sensible? As far as I can see from grepping the kernel source it's not used by device drivers.

regards
Joachim Eastwood

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials, tech docs, whitepapers, evaluation guides, and opinion stories. Check out the most recent posts - join the conversation now. http://goparallel.sourceforge.net/

A message that is not in the archive (sent off-list or not yet received): CAGhQ9VwoehjY4niDqcnb88va9vNLw=jFmxOnq6k0QP6GZJ4gqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#2 lore raw
Quoted 12 lines · Joachim Eastwood

Hi,

spi-atmel is now broken for all spi transfers in linux-next. This is caused by commit "spi: make sure all transfer has proper speed set". The reason is the following code in atmel_spi_transfer(...)

849 /* FIXME implement these protocol options!! */ 850 if (xfer->speed_hz) {
851 dev_dbg(&spi->dev, "no protocol options yet\n");
852 return -ENOPROTOOPT;
853 }

Quoted 6 lines

Now that xfer->speed_hz is always set all spi transfers will return with ENOPROTOOPT.

Not quite sure how to best fix it. Just removing the whole test makes it work again but I guess we should do something better with speed_hz here.

Probably the best fix is to check instead if xfer->speed_hz is less than the bus speed. If it is then you can fail. If it is not, then continue.

g.

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials, tech docs, whitepapers, evaluation guides, and opinion stories. Check out the most recent posts - join the conversation now. http://goparallel.sourceforge.net/

A message that is not in the archive (sent off-list or not yet received): CACxGe6u0o0V3Jm9-iyizKH5KX=dPe-CL0bH-Kc7KM_k6gAk69A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

PATCH 1/1 spi/atmel: fix speed_hz check in atmel_spi_transfer()

atmel_spi_transfer() would check speed_hz and fail if the speed was changed in the transfer. After commit "spi: make sure all transfer has proper speed set" this would happen on all transfers.

Change speed_hz check to only fail if a lower speed than max is requested.

---
Hi Grant,

Fix for spi-atmel as per your suggestion; check if speed_hz is less than bus max speed.

regards
Joachim Eastwood

 drivers/spi/spi-atmel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-atmel.c +2 -2
index 656d137..80f5867 100644
@@ -847,8 +847,8 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
 		}
 
 		/* FIXME implement these protocol options!! */
-		if (xfer->speed_hz) {
-			dev_dbg(&spi->dev, "no protocol options yet\n");
+		if (xfer->speed_hz < spi->max_speed_hz) {
+			dev_dbg(&spi->dev, "can't change speed in transfer\n");
 			return -ENOPROTOOPT;
 		}
 
Signature · 8 lines
1.8.0


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

A message that is not in the archive (sent off-list or not yet received): 1361310297-28002-1-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by
#6 lore raw

Re: [PATCH] spi/atmel: fix speed_hz check in atmel_spi_transfer()

On 02/19/2013 10:44 PM, Joachim Eastwood :

Quoted 9 lines

atmel_spi_transfer() would check speed_hz and fail if the speed was changed in the transfer. After commit "spi: make sure all transfer has proper speed set" this would happen on all transfers.

Change speed_hz check to only fail if a lower speed than max is requested.

Thanks for spotting this Joachim.

Bye,

Quoted 28 lines

---
Hi Grant,

Fix for spi-atmel as per your suggestion; check if speed_hz is less than bus max speed.

regards
Joachim Eastwood

 drivers/spi/spi-atmel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-atmel.c +2 -2
index 656d137..80f5867 100644
@@ -847,8 +847,8 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
 		}
 
 		/* FIXME implement these protocol options!! */
-		if (xfer->speed_hz) {
-			dev_dbg(&spi->dev, "no protocol options yet\n");
+		if (xfer->speed_hz < spi->max_speed_hz) {
+			dev_dbg(&spi->dev, "can't change speed in transfer\n");
 			return -ENOPROTOOPT;
 		}
 
Signature · 7 lines
Nicolas Ferre

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

A message that is not in the archive (sent off-list or not yet received): [email protected]

Applied
#8 lore raw

Re: [PATCH] spi/atmel: fix speed_hz check in atmel_spi_transfer()

Quoted 6 lines · Nicolas Ferre

On 02/19/2013 10:44 PM, Joachim Eastwood :

Quoted 5 lines

atmel_spi_transfer() would check speed_hz and fail if the speed was changed in the transfer. After commit "spi: make sure all transfer has proper speed set" this would happen on all transfers.

Quoted 8 lines
Quoted 4 lines

Change speed_hz check to only fail if a lower speed than max is requested.

Thanks for spotting this Joachim.

Applied, thanks.

g.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb