diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-06-27 05:37:57 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-07 08:22:08 -0400 |
commit | f024ff10b1ab13da4d626366019fd05c49721af7 (patch) | |
tree | 9f2c1431856716d7d22d53315945301ebe2b33e8 /drivers/mfd/tc6393xb.c | |
parent | aa613de676986f136fa6f48a4d709b5d264f4f38 (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>
Diffstat (limited to 'drivers/mfd/tc6393xb.c')
-rw-r--r-- | drivers/mfd/tc6393xb.c | 63 |
1 files changed, 63 insertions, 0 deletions
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 | ||
113 | enum { | ||
114 | TC6393XB_CELL_NAND, | ||
115 | }; | ||
116 | |||
117 | /*--------------------------------------------------------------------------*/ | ||
118 | |||
119 | static 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 | |||
136 | static 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 | |||
157 | static 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 | ||
113 | static int tc6393xb_gpio_get(struct gpio_chip *chip, | 168 | static 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 | ||