aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Opfer <dirk@opfer-online.de>2006-09-25 17:41:47 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-09-27 15:59:00 -0400
commita2025e7f73ae5eab0a25dad88c60aba67e3ae690 (patch)
tree95470b4d1fea82bf8ef9b92afaf4bf49b8c238f3
parent8d48427ecb0639593ccf14e807479b7873254ccb (diff)
[ARM] 3863/1: Add Locomo SPI Device
The Locomo chip has a SPI interface which is used for SD/MMC cards (only collie). This patch adds the definition for the SPI device inside the Locomo chip. Signed-off-by: Dirk Opfer <Dirk@Opfer-Online.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/common/locomo.c29
-rw-r--r--include/asm-arm/hardware/locomo.h24
2 files changed, 31 insertions, 22 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index c46dc65ec79a..181ef1ead5b8 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -121,6 +121,13 @@ static struct locomo_dev_info locomo_devices[] = {
121 .offset = 0, 121 .offset = 0,
122 .length = 0, 122 .length = 0,
123 }, 123 },
124 {
125 .devid = LOCOMO_DEVID_SPI,
126 .irq = {},
127 .name = "locomo-spi",
128 .offset = LOCOMO_SPI,
129 .length = 0x30,
130 },
124}; 131};
125 132
126 133
@@ -374,7 +381,7 @@ static void locomo_spi_handler(unsigned int irq, struct irqdesc *desc,
374 struct irqdesc *d; 381 struct irqdesc *d;
375 void __iomem *mapbase = get_irq_chipdata(irq); 382 void __iomem *mapbase = get_irq_chipdata(irq);
376 383
377 req = locomo_readl(mapbase + LOCOMO_SPIIR) & 0x000F; 384 req = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIR) & 0x000F;
378 if (req) { 385 if (req) {
379 irq = LOCOMO_IRQ_SPI_START; 386 irq = LOCOMO_IRQ_SPI_START;
380 d = irq_desc + irq; 387 d = irq_desc + irq;
@@ -391,35 +398,35 @@ static void locomo_spi_ack_irq(unsigned int irq)
391{ 398{
392 void __iomem *mapbase = get_irq_chipdata(irq); 399 void __iomem *mapbase = get_irq_chipdata(irq);
393 unsigned int r; 400 unsigned int r;
394 r = locomo_readl(mapbase + LOCOMO_SPIWE); 401 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
395 r |= (0x0001 << (irq - LOCOMO_IRQ_SPI_START)); 402 r |= (0x0001 << (irq - LOCOMO_IRQ_SPI_START));
396 locomo_writel(r, mapbase + LOCOMO_SPIWE); 403 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
397 404
398 r = locomo_readl(mapbase + LOCOMO_SPIIS); 405 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIS);
399 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START)); 406 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START));
400 locomo_writel(r, mapbase + LOCOMO_SPIIS); 407 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIIS);
401 408
402 r = locomo_readl(mapbase + LOCOMO_SPIWE); 409 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
403 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START)); 410 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START));
404 locomo_writel(r, mapbase + LOCOMO_SPIWE); 411 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIWE);
405} 412}
406 413
407static void locomo_spi_mask_irq(unsigned int irq) 414static void locomo_spi_mask_irq(unsigned int irq)
408{ 415{
409 void __iomem *mapbase = get_irq_chipdata(irq); 416 void __iomem *mapbase = get_irq_chipdata(irq);
410 unsigned int r; 417 unsigned int r;
411 r = locomo_readl(mapbase + LOCOMO_SPIIE); 418 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
412 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START)); 419 r &= ~(0x0001 << (irq - LOCOMO_IRQ_SPI_START));
413 locomo_writel(r, mapbase + LOCOMO_SPIIE); 420 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
414} 421}
415 422
416static void locomo_spi_unmask_irq(unsigned int irq) 423static void locomo_spi_unmask_irq(unsigned int irq)
417{ 424{
418 void __iomem *mapbase = get_irq_chipdata(irq); 425 void __iomem *mapbase = get_irq_chipdata(irq);
419 unsigned int r; 426 unsigned int r;
420 r = locomo_readl(mapbase + LOCOMO_SPIIE); 427 r = locomo_readl(mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
421 r |= (0x0001 << (irq - LOCOMO_IRQ_SPI_START)); 428 r |= (0x0001 << (irq - LOCOMO_IRQ_SPI_START));
422 locomo_writel(r, mapbase + LOCOMO_SPIIE); 429 locomo_writel(r, mapbase + LOCOMO_SPI + LOCOMO_SPIIE);
423} 430}
424 431
425static struct irq_chip locomo_spi_chip = { 432static struct irq_chip locomo_spi_chip = {
diff --git a/include/asm-arm/hardware/locomo.h b/include/asm-arm/hardware/locomo.h
index 2599a6bc70e4..adab77780ed3 100644
--- a/include/asm-arm/hardware/locomo.h
+++ b/include/asm-arm/hardware/locomo.h
@@ -54,17 +54,18 @@
54#define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */ 54#define LOCOMO_DAC_SDAOEB 0x01 /* SDA pin output data */
55 55
56/* SPI interface */ 56/* SPI interface */
57#define LOCOMO_SPIMD 0x60 /* SPI mode setting */ 57#define LOCOMO_SPI 0x60
58#define LOCOMO_SPICT 0x64 /* SPI mode control */ 58#define LOCOMO_SPIMD 0x00 /* SPI mode setting */
59#define LOCOMO_SPIST 0x68 /* SPI status */ 59#define LOCOMO_SPICT 0x04 /* SPI mode control */
60#define LOCOMO_SPIIS 0x70 /* SPI interrupt status */ 60#define LOCOMO_SPIST 0x08 /* SPI status */
61#define LOCOMO_SPIWE 0x74 /* SPI interrupt status write enable */ 61#define LOCOMO_SPIIS 0x10 /* SPI interrupt status */
62#define LOCOMO_SPIIE 0x78 /* SPI interrupt enable */ 62#define LOCOMO_SPIWE 0x14 /* SPI interrupt status write enable */
63#define LOCOMO_SPIIR 0x7c /* SPI interrupt request */ 63#define LOCOMO_SPIIE 0x18 /* SPI interrupt enable */
64#define LOCOMO_SPITD 0x80 /* SPI transfer data write */ 64#define LOCOMO_SPIIR 0x1c /* SPI interrupt request */
65#define LOCOMO_SPIRD 0x84 /* SPI receive data read */ 65#define LOCOMO_SPITD 0x20 /* SPI transfer data write */
66#define LOCOMO_SPITS 0x88 /* SPI transfer data shift */ 66#define LOCOMO_SPIRD 0x24 /* SPI receive data read */
67#define LOCOMO_SPIRS 0x8C /* SPI receive data shift */ 67#define LOCOMO_SPITS 0x28 /* SPI transfer data shift */
68#define LOCOMO_SPIRS 0x2C /* SPI receive data shift */
68#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */ 69#define LOCOMO_SPI_TEND (1 << 3) /* Transfer end bit */
69#define LOCOMO_SPI_OVRN (1 << 2) /* Over Run bit */ 70#define LOCOMO_SPI_OVRN (1 << 2) /* Over Run bit */
70#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */ 71#define LOCOMO_SPI_RFW (1 << 1) /* write buffer bit */
@@ -161,6 +162,7 @@ extern struct bus_type locomo_bus_type;
161#define LOCOMO_DEVID_AUDIO 3 162#define LOCOMO_DEVID_AUDIO 3
162#define LOCOMO_DEVID_LED 4 163#define LOCOMO_DEVID_LED 4
163#define LOCOMO_DEVID_UART 5 164#define LOCOMO_DEVID_UART 5
165#define LOCOMO_DEVID_SPI 6
164 166
165struct locomo_dev { 167struct locomo_dev {
166 struct device dev; 168 struct device dev;