aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-06-27 05:37:57 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-07 08:22:08 -0400
commitf024ff10b1ab13da4d626366019fd05c49721af7 (patch)
tree9f2c1431856716d7d22d53315945301ebe2b33e8
parentaa613de676986f136fa6f48a4d709b5d264f4f38 (diff)
[ARM] 5128/1: tc6393xb: tmio-nand support
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/mfd/Kconfig1
-rw-r--r--drivers/mfd/tc6393xb.c63
-rw-r--r--include/linux/mfd/tc6393xb.h2
-rw-r--r--include/linux/mfd/tmio.h17
4 files changed, 83 insertions, 0 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 8ebc0be10953..7dff105e8f83 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -45,6 +45,7 @@ config HTC_PASIC3
45config MFD_TC6393XB 45config MFD_TC6393XB
46 bool "Support Toshiba TC6393XB" 46 bool "Support Toshiba TC6393XB"
47 depends on HAVE_GPIO_LIB 47 depends on HAVE_GPIO_LIB
48 select MFD_CORE
48 help 49 help
49 Support for Toshiba Mobile IO Controller TC6393XB 50 Support for Toshiba Mobile IO Controller TC6393XB
50 51
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 4d7192edefe1..2d87501b6fd4 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -21,6 +21,8 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/fb.h> 22#include <linux/fb.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/mfd/core.h>
25#include <linux/mfd/tmio.h>
24#include <linux/mfd/tc6393xb.h> 26#include <linux/mfd/tc6393xb.h>
25#include <linux/gpio.h> 27#include <linux/gpio.h>
26 28
@@ -108,6 +110,59 @@ struct tc6393xb {
108 int irq_base; 110 int irq_base;
109}; 111};
110 112
113enum {
114 TC6393XB_CELL_NAND,
115};
116
117/*--------------------------------------------------------------------------*/
118
119static int tc6393xb_nand_enable(struct platform_device *nand)
120{
121 struct platform_device *dev = to_platform_device(nand->dev.parent);
122 struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
123 unsigned long flags;
124
125 spin_lock_irqsave(&tc6393xb->lock, flags);
126
127 /* SMD buffer on */
128 dev_dbg(&dev->dev, "SMD buffer on\n");
129 iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1));
130
131 spin_unlock_irqrestore(&tc6393xb->lock, flags);
132
133 return 0;
134}
135
136static struct resource __devinitdata tc6393xb_nand_resources[] = {
137 {
138 .name = TMIO_NAND_CONFIG,
139 .start = 0x0100,
140 .end = 0x01ff,
141 .flags = IORESOURCE_MEM,
142 },
143 {
144 .name = TMIO_NAND_CONTROL,
145 .start = 0x1000,
146 .end = 0x1007,
147 .flags = IORESOURCE_MEM,
148 },
149 {
150 .name = TMIO_NAND_IRQ,
151 .start = IRQ_TC6393_NAND,
152 .end = IRQ_TC6393_NAND,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157static struct mfd_cell __devinitdata tc6393xb_cells[] = {
158 [TC6393XB_CELL_NAND] = {
159 .name = "tmio-nand",
160 .enable = tc6393xb_nand_enable,
161 .num_resources = ARRAY_SIZE(tc6393xb_nand_resources),
162 .resources = tc6393xb_nand_resources,
163 },
164};
165
111/*--------------------------------------------------------------------------*/ 166/*--------------------------------------------------------------------------*/
112 167
113static int tc6393xb_gpio_get(struct gpio_chip *chip, 168static int tc6393xb_gpio_get(struct gpio_chip *chip,
@@ -410,6 +465,12 @@ static int __devinit tc6393xb_probe(struct platform_device *dev)
410 if (tc6393xb->irq) 465 if (tc6393xb->irq)
411 tc6393xb_attach_irq(dev); 466 tc6393xb_attach_irq(dev);
412 467
468 tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data;
469
470 retval = mfd_add_devices(dev,
471 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
472 iomem, tcpd->irq_base);
473
413 return 0; 474 return 0;
414 475
415 if (tc6393xb->irq) 476 if (tc6393xb->irq)
@@ -440,6 +501,8 @@ static int __devexit tc6393xb_remove(struct platform_device *dev)
440 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); 501 struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
441 int ret; 502 int ret;
442 503
504 mfd_remove_devices(dev);
505
443 if (tc6393xb->irq) 506 if (tc6393xb->irq)
444 tc6393xb_detach_irq(dev); 507 tc6393xb_detach_irq(dev);
445 508
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h
index 0e3dd4ca523b..7cc824a58f7c 100644
--- a/include/linux/mfd/tc6393xb.h
+++ b/include/linux/mfd/tc6393xb.h
@@ -31,6 +31,8 @@ struct tc6393xb_platform_data {
31 31
32 int irq_base; /* a base for cascaded irq */ 32 int irq_base; /* a base for cascaded irq */
33 int gpio_base; 33 int gpio_base;
34
35 struct tmio_nand_data *nand_data;
34}; 36};
35 37
36/* 38/*
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
new file mode 100644
index 000000000000..9438d8c9ac1c
--- /dev/null
+++ b/include/linux/mfd/tmio.h
@@ -0,0 +1,17 @@
1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H
3
4/*
5 * data for the NAND controller
6 */
7struct tmio_nand_data {
8 struct nand_bbt_descr *badblock_pattern;
9 struct mtd_partition *partition;
10 unsigned int num_partitions;
11};
12
13#define TMIO_NAND_CONFIG "tmio-nand-config"
14#define TMIO_NAND_CONTROL "tmio-nand-control"
15#define TMIO_NAND_IRQ "tmio-nand"
16
17#endif