diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-10-03 14:11:36 -0400 |
---|---|---|
committer | Samuel Ortiz <samuel@sortiz.org> | 2008-10-19 16:54:10 -0400 |
commit | 51a55623565c6ca864f7cf19e87c2d4bde1c0c5e (patch) | |
tree | 1151f856655c95b60b045d60732b23ab75403fef /drivers/mfd | |
parent | 504f97f884bafcd14d28ab52533e7b92996c8b98 (diff) |
mfd: add OHCI cell to tc6393xb
Add information regarding OHCI cell of the tc6393xb
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Ian Molton <spyro@f2s.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/tc6393xb.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index c3c64aeeb12a..6197db7d4859 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -113,6 +113,7 @@ struct tc6393xb { | |||
113 | enum { | 113 | enum { |
114 | TC6393XB_CELL_NAND, | 114 | TC6393XB_CELL_NAND, |
115 | TC6393XB_CELL_MMC, | 115 | TC6393XB_CELL_MMC, |
116 | TC6393XB_CELL_OHCI, | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | /*--------------------------------------------------------------------------*/ | 119 | /*--------------------------------------------------------------------------*/ |
@@ -170,6 +171,78 @@ static struct resource __devinitdata tc6393xb_mmc_resources[] = { | |||
170 | }, | 171 | }, |
171 | }; | 172 | }; |
172 | 173 | ||
174 | const static struct resource tc6393xb_ohci_resources[] = { | ||
175 | { | ||
176 | .start = 0x3000, | ||
177 | .end = 0x31ff, | ||
178 | .flags = IORESOURCE_MEM, | ||
179 | }, | ||
180 | { | ||
181 | .start = 0x0300, | ||
182 | .end = 0x03ff, | ||
183 | .flags = IORESOURCE_MEM, | ||
184 | }, | ||
185 | { | ||
186 | .start = 0x010000, | ||
187 | .end = 0x017fff, | ||
188 | .flags = IORESOURCE_MEM, | ||
189 | }, | ||
190 | { | ||
191 | .start = 0x018000, | ||
192 | .end = 0x01ffff, | ||
193 | .flags = IORESOURCE_MEM, | ||
194 | }, | ||
195 | { | ||
196 | .start = IRQ_TC6393_OHCI, | ||
197 | .end = IRQ_TC6393_OHCI, | ||
198 | .flags = IORESOURCE_IRQ, | ||
199 | }, | ||
200 | }; | ||
201 | |||
202 | static int tc6393xb_ohci_enable(struct platform_device *dev) | ||
203 | { | ||
204 | struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); | ||
205 | unsigned long flags; | ||
206 | u16 ccr; | ||
207 | u8 fer; | ||
208 | |||
209 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
210 | |||
211 | ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); | ||
212 | ccr |= SCR_CCR_USBCK; | ||
213 | tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); | ||
214 | |||
215 | fer = tmio_ioread8(tc6393xb->scr + SCR_FER); | ||
216 | fer |= SCR_FER_USBEN; | ||
217 | tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); | ||
218 | |||
219 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static int tc6393xb_ohci_disable(struct platform_device *dev) | ||
225 | { | ||
226 | struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); | ||
227 | unsigned long flags; | ||
228 | u16 ccr; | ||
229 | u8 fer; | ||
230 | |||
231 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
232 | |||
233 | fer = tmio_ioread8(tc6393xb->scr + SCR_FER); | ||
234 | fer &= ~SCR_FER_USBEN; | ||
235 | tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); | ||
236 | |||
237 | ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); | ||
238 | ccr &= ~SCR_CCR_USBCK; | ||
239 | tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); | ||
240 | |||
241 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
242 | |||
243 | return 0; | ||
244 | } | ||
245 | |||
173 | static struct mfd_cell __devinitdata tc6393xb_cells[] = { | 246 | static struct mfd_cell __devinitdata tc6393xb_cells[] = { |
174 | [TC6393XB_CELL_NAND] = { | 247 | [TC6393XB_CELL_NAND] = { |
175 | .name = "tmio-nand", | 248 | .name = "tmio-nand", |
@@ -182,6 +255,15 @@ static struct mfd_cell __devinitdata tc6393xb_cells[] = { | |||
182 | .num_resources = ARRAY_SIZE(tc6393xb_mmc_resources), | 255 | .num_resources = ARRAY_SIZE(tc6393xb_mmc_resources), |
183 | .resources = tc6393xb_mmc_resources, | 256 | .resources = tc6393xb_mmc_resources, |
184 | }, | 257 | }, |
258 | [TC6393XB_CELL_OHCI] = { | ||
259 | .name = "tmio-ohci", | ||
260 | .num_resources = ARRAY_SIZE(tc6393xb_ohci_resources), | ||
261 | .resources = tc6393xb_ohci_resources, | ||
262 | .enable = tc6393xb_ohci_enable, | ||
263 | .suspend = tc6393xb_ohci_disable, | ||
264 | .resume = tc6393xb_ohci_enable, | ||
265 | .disable = tc6393xb_ohci_disable, | ||
266 | }, | ||
185 | }; | 267 | }; |
186 | 268 | ||
187 | /*--------------------------------------------------------------------------*/ | 269 | /*--------------------------------------------------------------------------*/ |
@@ -470,6 +552,11 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
470 | tc6393xb_cells[TC6393XB_CELL_MMC].data_size = | 552 | tc6393xb_cells[TC6393XB_CELL_MMC].data_size = |
471 | sizeof(tc6393xb_cells[TC6393XB_CELL_MMC]); | 553 | sizeof(tc6393xb_cells[TC6393XB_CELL_MMC]); |
472 | 554 | ||
555 | tc6393xb_cells[TC6393XB_CELL_OHCI].platform_data = | ||
556 | &tc6393xb_cells[TC6393XB_CELL_OHCI]; | ||
557 | tc6393xb_cells[TC6393XB_CELL_OHCI].data_size = | ||
558 | sizeof(tc6393xb_cells[TC6393XB_CELL_OHCI]); | ||
559 | |||
473 | 560 | ||
474 | ret = mfd_add_devices(&dev->dev, dev->id, | 561 | ret = mfd_add_devices(&dev->dev, dev->id, |
475 | tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), | 562 | tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), |