All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi_s3c24xx: Fix for SPI on S3C2412
@ 2010-02-17 18:09 ` José Miguel Gonçalves
  0 siblings, 0 replies; 2+ messages in thread
From: José Miguel Gonçalves @ 2010-02-17 18:09 UTC (permalink / raw)
  To: Russell King, Ben Dooks
  Cc: David Brownell, Grant Likely, Andrew Morton, Simtec Linux Team,
	Alexey Dobriyan, linux-arm-kernel, linux-kernel,
	spi-devel-general

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

Hi,

Testing some SPI temperature sensors and ADCs with a S3C4212 host I have 
found that I could not read the correct data.  I've probed the SPI 
signals with a scope and everything seemed OK.
I dig into the driver sources and on the S3C2412 datasheet to find that 
this device can not use the same S3C2410 driver's code because of the 
added FIFOs, even if not used. The following patch is needed to make the 
driver to work on the S3C2412 chip (and probably on the S3C2413).

Regards,
José Miguel Gonçalves

[-- Attachment #2: linux-2.6.git-spi_s3c2412.patch --]
[-- Type: text/x-patch, Size: 2286 bytes --]

Signed-off-by: Jose Miguel Goncalves <jose.goncalves@inov.pt>

diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index bef39f7..c58330f 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -100,11 +100,9 @@ void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 	s3c_device_sdi.resource[1].end   = IRQ_S3C2412_SDI;
 
 	/* spi channel related changes, s3c2412/13 specific */
-	s3c_device_spi0.name = "s3c2412-spi";
-	s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24;
-	s3c_device_spi1.name = "s3c2412-spi";
+	s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x2F;
 	s3c_device_spi1.resource[0].start = S3C24XX_PA_SPI + S3C2412_SPI1;
-	s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x24;
+	s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x2F;
 
 }
 
diff --git a/arch/arm/plat-s3c24xx/include/plat/regs-spi.h b/arch/arm/plat-s3c24xx/include/plat/regs-spi.h
index 2b35479..57e799c 100644
--- a/arch/arm/plat-s3c24xx/include/plat/regs-spi.h
+++ b/arch/arm/plat-s3c24xx/include/plat/regs-spi.h
@@ -75,7 +75,8 @@
 #define S3C2410_SPRDAT	 (0x14)
 
 #define S3C2412_TXFIFO	 (0x18)
-#define S3C2412_RXFIFO	 (0x18)
+#define S3C2412_RXFIFO	 (0x1C)
+#define S3C2412_SPRDATB	 (0x20)
 #define S3C2412_SPFIC	 (0x24)
 
 
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index c010733..9c57715 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -440,6 +440,12 @@ static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
 	return hw->count;
 }
 
+#ifdef CONFIG_CPU_S3C2412
+#define SPRDAT S3C2412_SPRDATB
+#else
+#define SPRDAT S3C2410_SPRDAT
+#endif
+
 static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
 {
 	struct s3c24xx_spi *hw = dev;
@@ -462,7 +468,7 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
 		hw->count++;
 
 		if (hw->rx)
-			hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);
+			hw->rx[count] = readb(hw->regs + SPRDAT);
 
 		count++;
 
@@ -475,7 +481,7 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
 		hw->fiq_inuse = 0;
 
 		if (hw->rx)
-			hw->rx[hw->len-1] = readb(hw->regs + S3C2410_SPRDAT);
+			hw->rx[hw->len-1] = readb(hw->regs + SPRDAT);
 
 		complete(&hw->done);
 	}

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

* [PATCH] spi_s3c24xx: Fix for SPI on S3C2412
@ 2010-02-17 18:09 ` José Miguel Gonçalves
  0 siblings, 0 replies; 2+ messages in thread
From: José Miguel Gonçalves @ 2010-02-17 18:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Testing some SPI temperature sensors and ADCs with a S3C4212 host I have 
found that I could not read the correct data.  I've probed the SPI 
signals with a scope and everything seemed OK.
I dig into the driver sources and on the S3C2412 datasheet to find that 
this device can not use the same S3C2410 driver's code because of the 
added FIFOs, even if not used. The following patch is needed to make the 
driver to work on the S3C2412 chip (and probably on the S3C2413).

Regards,
Jos? Miguel Gon?alves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-2.6.git-spi_s3c2412.patch
Type: text/x-patch
Size: 2286 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100217/dd567841/attachment.bin>

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

end of thread, other threads:[~2010-02-17 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-17 18:09 [PATCH] spi_s3c24xx: Fix for SPI on S3C2412 José Miguel Gonçalves
2010-02-17 18:09 ` José Miguel Gonçalves

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.