linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SPI fixes for S3C24XX SPI driver
@ 2008-04-11 14:55 Ben Dooks
  2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver needs to pass num_chipselect Ben Dooks
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ben Dooks @ 2008-04-11 14:55 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: patch-out-elnMNo+KYs3YtjvyW6yDsg

These are fixes for the spi_s3c24xx driver, which
could be possibly applied before the 2.6.25 release.

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] SPI: spi_s3c24xx driver needs to pass num_chipselect.
  2008-04-11 14:55 [PATCH] SPI fixes for S3C24XX SPI driver Ben Dooks
@ 2008-04-11 14:55 ` Ben Dooks
  2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver bus_num field Ben Dooks
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Dooks @ 2008-04-11 14:55 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: patch-out-elnMNo+KYs3YtjvyW6yDsg, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-spi-s3c24xx-fix-numcs.patch --]
[-- Type: text/plain, Size: 1942 bytes --]

The SPI core now expects num_chipselect to be set correctly as
due to added checks on the chip being selected before an
transfer is allowed. This patch adds a num_cs field to the
platform data which needs to be set correctly before adding
the SPI platform device.

Signed-off-by: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>

Index: linux-2.6.25-rc8-spi/drivers/spi/spi_s3c24xx.c
===================================================================
--- linux-2.6.25-rc8-spi.orig/drivers/spi/spi_s3c24xx.c	2008-04-11 15:25:28.000000000 +0100
+++ linux-2.6.25-rc8-spi/drivers/spi/spi_s3c24xx.c	2008-04-11 15:25:32.000000000 +0100
@@ -265,6 +265,10 @@ static int __init s3c24xx_spi_probe(stru
 	platform_set_drvdata(pdev, hw);
 	init_completion(&hw->done);
 
+	/* setup the master state. */
+
+	master->num_chipselect = hw->pdata->num_cs;
+
 	/* setup the state for the bitbang driver */
 
 	hw->bitbang.master         = hw->master;
Index: linux-2.6.25-rc8-spi/include/asm-arm/arch-s3c2410/spi.h
===================================================================
--- linux-2.6.25-rc8-spi.orig/include/asm-arm/arch-s3c2410/spi.h	2008-04-11 15:25:28.000000000 +0100
+++ linux-2.6.25-rc8-spi/include/asm-arm/arch-s3c2410/spi.h	2008-04-11 15:25:32.000000000 +0100
@@ -18,6 +18,7 @@ struct spi_board_info;
 
 struct s3c2410_spi_info {
 	unsigned long		 pin_cs;	/* simple gpio cs */
+	unsigned int		 num_cs;	/* total chipselects */
 
 	unsigned long		 board_size;
 	struct spi_board_info	*board_info;

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] SPI: spi_s3c24xx driver bus_num field.
  2008-04-11 14:55 [PATCH] SPI fixes for S3C24XX SPI driver Ben Dooks
  2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver needs to pass num_chipselect Ben Dooks
@ 2008-04-11 14:55 ` Ben Dooks
  2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver should initialise completion before using it Ben Dooks
       [not found] ` <20080411145500.130608954-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Dooks @ 2008-04-11 14:55 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: patch-out-elnMNo+KYs3YtjvyW6yDsg, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-spi-s3c24xx-busnum.patch --]
[-- Type: text/plain, Size: 2957 bytes --]

Pass the bus number we expect the S3C24XX SPI driver to attach
to via the platform data.

Signed-off-by: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>

Index: linux-2.6.25-rc8-spi/include/asm-arm/arch-s3c2410/spi.h
===================================================================
--- linux-2.6.25-rc8-spi.orig/include/asm-arm/arch-s3c2410/spi.h	2008-04-11 15:25:32.000000000 +0100
+++ linux-2.6.25-rc8-spi/include/asm-arm/arch-s3c2410/spi.h	2008-04-11 15:27:17.000000000 +0100
@@ -19,6 +19,7 @@ struct spi_board_info;
 struct s3c2410_spi_info {
 	unsigned long		 pin_cs;	/* simple gpio cs */
 	unsigned int		 num_cs;	/* total chipselects */
+	int			 bus_num;       /* bus number to use. */
 
 	unsigned long		 board_size;
 	struct spi_board_info	*board_info;
Index: linux-2.6.25-rc8-spi/drivers/spi/spi_s3c24xx.c
===================================================================
--- linux-2.6.25-rc8-spi.orig/drivers/spi/spi_s3c24xx.c	2008-04-11 15:25:32.000000000 +0100
+++ linux-2.6.25-rc8-spi/drivers/spi/spi_s3c24xx.c	2008-04-11 15:27:17.000000000 +0100
@@ -235,6 +235,7 @@ static irqreturn_t s3c24xx_spi_irq(int i
 
 static int __init s3c24xx_spi_probe(struct platform_device *pdev)
 {
+	struct s3c2410_spi_info *pdata;
 	struct s3c24xx_spi *hw;
 	struct spi_master *master;
 	struct spi_board_info *bi;
@@ -253,10 +254,10 @@ static int __init s3c24xx_spi_probe(stru
 	memset(hw, 0, sizeof(struct s3c24xx_spi));
 
 	hw->master = spi_master_get(master);
-	hw->pdata = pdev->dev.platform_data;
+	hw->pdata = pdata = pdev->dev.platform_data;
 	hw->dev = &pdev->dev;
 
-	if (hw->pdata == NULL) {
+	if (pdata == NULL) {
 		dev_err(&pdev->dev, "No platform data supplied\n");
 		err = -ENOENT;
 		goto err_no_pdata;
@@ -268,7 +269,8 @@ static int __init s3c24xx_spi_probe(stru
 	/* setup the master state. */
 
 	master->num_chipselect = hw->pdata->num_cs;
-
+	master->bus_num = pdata->bus_num;
+	
 	/* setup the state for the bitbang driver */
 
 	hw->bitbang.master         = hw->master;
@@ -336,13 +338,13 @@ static int __init s3c24xx_spi_probe(stru
 
 	/* setup any gpio we can */
 
-	if (!hw->pdata->set_cs) {
+	if (!pdata->set_cs) {
 		hw->set_cs = s3c24xx_spi_gpiocs;
 
-		s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
-		s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
+		s3c2410_gpio_setpin(pdata->pin_cs, 1);
+		s3c2410_gpio_cfgpin(pdata->pin_cs, S3C2410_GPIO_OUTPUT);
 	} else
-		hw->set_cs = hw->pdata->set_cs;
+		hw->set_cs = pdata->set_cs;
 
 	/* register our spi controller */
 

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] SPI: spi_s3c24xx driver should initialise completion before using it.
  2008-04-11 14:55 [PATCH] SPI fixes for S3C24XX SPI driver Ben Dooks
  2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver needs to pass num_chipselect Ben Dooks
  2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver bus_num field Ben Dooks
@ 2008-04-11 14:55 ` Ben Dooks
       [not found] ` <20080411145500.130608954-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Dooks @ 2008-04-11 14:55 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: patch-out-elnMNo+KYs3YtjvyW6yDsg, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-spi-s3c24xx-initcompletion.patch --]
[-- Type: text/plain, Size: 1226 bytes --]

The s3c24xx_spi_txrx() function should initialise the completion
each time before using it, otherwise we end up with the possibility
of returning success before the interrupt handler has processed
all the data.

Signed-off-by: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>

Index: linux-2.6.24-quilt16/drivers/spi/spi_s3c24xx.c
===================================================================
--- linux-2.6.24-quilt16.orig/drivers/spi/spi_s3c24xx.c
+++ linux-2.6.24-quilt16/drivers/spi/spi_s3c24xx.c
@@ -192,8 +192,11 @@ static int s3c24xx_spi_txrx(struct spi_d
 	hw->len = t->len;
 	hw->count = 0;
 
+	init_completion(&hw->done);
+
 	/* send the first byte */
 	writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
+
 	wait_for_completion(&hw->done);
 
 	return hw->count;

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] SPI fixes for S3C24XX SPI driver
       [not found] ` <20080411145500.130608954-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
@ 2008-04-15 18:01   ` David Brownell
  0 siblings, 0 replies; 5+ messages in thread
From: David Brownell @ 2008-04-15 18:01 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: patch-out-elnMNo+KYs3YtjvyW6yDsg, Ben Dooks

On Friday 11 April 2008, Ben Dooks wrote:
> These are fixes for the spi_s3c24xx driver, which
> could be possibly applied before the 2.6.25 release.

Most of them seem to need additional patches to the
board-specific init logic too ... so applying them
won't eliminate the need for any SPI patches with a
2.6.25-based release.

- Dave


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-15 18:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-11 14:55 [PATCH] SPI fixes for S3C24XX SPI driver Ben Dooks
2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver needs to pass num_chipselect Ben Dooks
2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver bus_num field Ben Dooks
2008-04-11 14:55 ` [PATCH] SPI: spi_s3c24xx driver should initialise completion before using it Ben Dooks
     [not found] ` <20080411145500.130608954-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-04-15 18:01   ` [PATCH] SPI fixes for S3C24XX SPI driver David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).