Skip to contentSkip to conversation

spi_s3c24xx must initialize num_chipselect

PATCH In review David Brownell 2 participants 3 messages Apr 15, 2008 2 messages not in the archive

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

PATCH 1/3 spi_s3c24xx must initialize num_chipselect

From: Ben Dooks <[email protected]>

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.

---
 drivers/spi/spi_s3c24xx.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/spi/spi_s3c24xx.c +3 -0
@@ -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;

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

A message that is not in the archive (sent off-list or not yet received): 200804151056.43830.david-b-yBeKhBN/[email protected]

#2 lore raw

The title is "spi_s3c24xx must initialize num_chipselect"

Quoted 17 lines · On Tue, 15 Apr 2008 10:56:43 -0700 David Brownell…

From: Ben Dooks <[email protected]>

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.

---
 drivers/spi/spi_s3c24xx.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/spi/spi_s3c24xx.c +0 -0
@@ -192,8 +192,11 @@ static int s3c24xx_spi_txrx(struct spi_d
 	hw->len = t->len;

drivers/spi/spi_s3c24xx.c static int s3c24xx_spi_txrx(struct spi_d · line 202

Quoted 10 lines
drivers/spi/spi_s3c24xx.c +3 -0
 	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;

But you (re)sent a copy of "spi_s3c24xx driver must init completion"

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

A message that is not in the archive (sent off-list or not yet received): 20080415123006.b8e229d6.akpm-de/[email protected]

#4 lore raw

From: Ben Dooks <[email protected]>

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.

---
Matching $TITLE this time...

 drivers/spi/spi_s3c24xx.c          |    4 ++++
 include/asm-arm/arch-s3c2410/spi.h |    1 +
 2 files changed, 5 insertions(+)
drivers/spi/spi_s3c24xx.c +4 -0
@@ -263,6 +263,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;
include/asm-arm/arch-s3c2410/spi.h +1 -0
@@ -15,6 +15,7 @@
 
 struct s3c2410_spi_info {
 	unsigned long		 pin_cs;	/* simple gpio cs */
+	unsigned int		 num_cs;	/* total chipselects */
 
 	void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
 };

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