All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Miguel Gonçalves" <jose.goncalves@inov.pt>
To: Russell King <linux@arm.linux.org.uk>, Ben Dooks <ben@simtec.co.uk>
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	Grant Likely <grant.likely@secretlab.ca>,
	Andrew Morton <akpm@linux-foundation.org>,
	Simtec Linux Team <linux@simtec.co.uk>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	spi-devel-general@lists.sourceforge.net
Subject: [PATCH] spi_s3c24xx: Fix for SPI on S3C2412
Date: Wed, 17 Feb 2010 18:09:35 +0000	[thread overview]
Message-ID: <4B7C30DF.90805@inov.pt> (raw)

[-- 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);
 	}

WARNING: multiple messages have this Message-ID (diff)
From: jose.goncalves@inov.pt (José Miguel Gonçalves)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi_s3c24xx: Fix for SPI on S3C2412
Date: Wed, 17 Feb 2010 18:09:35 +0000	[thread overview]
Message-ID: <4B7C30DF.90805@inov.pt> (raw)

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>

             reply	other threads:[~2010-02-17 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 18:09 José Miguel Gonçalves [this message]
2010-02-17 18:09 ` [PATCH] spi_s3c24xx: Fix for SPI on S3C2412 José Miguel Gonçalves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B7C30DF.90805@inov.pt \
    --to=jose.goncalves@inov.pt \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben@simtec.co.uk \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linux@simtec.co.uk \
    --cc=spi-devel-general@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.