diff options
Diffstat (limited to 'drivers/mfd/asic3.c')
-rw-r--r-- | drivers/mfd/asic3.c | 190 |
1 files changed, 122 insertions, 68 deletions
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 7de708d15d72..c71ae09430c5 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -57,7 +57,7 @@ struct asic3_clk { | |||
57 | .rate = _rate, \ | 57 | .rate = _rate, \ |
58 | } | 58 | } |
59 | 59 | ||
60 | struct asic3_clk asic3_clk_init[] __initdata = { | 60 | static struct asic3_clk asic3_clk_init[] __initdata = { |
61 | INIT_CDEX(SPI, 0), | 61 | INIT_CDEX(SPI, 0), |
62 | INIT_CDEX(OWM, 5000000), | 62 | INIT_CDEX(OWM, 5000000), |
63 | INIT_CDEX(PWM0, 0), | 63 | INIT_CDEX(PWM0, 0), |
@@ -88,21 +88,21 @@ struct asic3 { | |||
88 | 88 | ||
89 | static int asic3_gpio_get(struct gpio_chip *chip, unsigned offset); | 89 | static int asic3_gpio_get(struct gpio_chip *chip, unsigned offset); |
90 | 90 | ||
91 | static inline void asic3_write_register(struct asic3 *asic, | 91 | void asic3_write_register(struct asic3 *asic, unsigned int reg, u32 value) |
92 | unsigned int reg, u32 value) | ||
93 | { | 92 | { |
94 | iowrite16(value, asic->mapping + | 93 | iowrite16(value, asic->mapping + |
95 | (reg >> asic->bus_shift)); | 94 | (reg >> asic->bus_shift)); |
96 | } | 95 | } |
96 | EXPORT_SYMBOL_GPL(asic3_write_register); | ||
97 | 97 | ||
98 | static inline u32 asic3_read_register(struct asic3 *asic, | 98 | u32 asic3_read_register(struct asic3 *asic, unsigned int reg) |
99 | unsigned int reg) | ||
100 | { | 99 | { |
101 | return ioread16(asic->mapping + | 100 | return ioread16(asic->mapping + |
102 | (reg >> asic->bus_shift)); | 101 | (reg >> asic->bus_shift)); |
103 | } | 102 | } |
103 | EXPORT_SYMBOL_GPL(asic3_read_register); | ||
104 | 104 | ||
105 | void asic3_set_register(struct asic3 *asic, u32 reg, u32 bits, bool set) | 105 | static void asic3_set_register(struct asic3 *asic, u32 reg, u32 bits, bool set) |
106 | { | 106 | { |
107 | unsigned long flags; | 107 | unsigned long flags; |
108 | u32 val; | 108 | u32 val; |
@@ -139,13 +139,12 @@ static void asic3_irq_flip_edge(struct asic3 *asic, | |||
139 | 139 | ||
140 | static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc) | 140 | static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc) |
141 | { | 141 | { |
142 | struct asic3 *asic = irq_desc_get_handler_data(desc); | ||
143 | struct irq_data *data = irq_desc_get_irq_data(desc); | ||
142 | int iter, i; | 144 | int iter, i; |
143 | unsigned long flags; | 145 | unsigned long flags; |
144 | struct asic3 *asic; | ||
145 | |||
146 | desc->chip->ack(irq); | ||
147 | 146 | ||
148 | asic = desc->handler_data; | 147 | data->chip->irq_ack(data); |
149 | 148 | ||
150 | for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) { | 149 | for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) { |
151 | u32 status; | 150 | u32 status; |
@@ -188,8 +187,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
188 | irqnr = asic->irq_base + | 187 | irqnr = asic->irq_base + |
189 | (ASIC3_GPIOS_PER_BANK * bank) | 188 | (ASIC3_GPIOS_PER_BANK * bank) |
190 | + i; | 189 | + i; |
191 | desc = irq_to_desc(irqnr); | 190 | generic_handle_irq(irqnr); |
192 | desc->handle_irq(irqnr, desc); | ||
193 | if (asic->irq_bothedge[bank] & bit) | 191 | if (asic->irq_bothedge[bank] & bit) |
194 | asic3_irq_flip_edge(asic, base, | 192 | asic3_irq_flip_edge(asic, base, |
195 | bit); | 193 | bit); |
@@ -200,11 +198,8 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
200 | /* Handle remaining IRQs in the status register */ | 198 | /* Handle remaining IRQs in the status register */ |
201 | for (i = ASIC3_NUM_GPIOS; i < ASIC3_NR_IRQS; i++) { | 199 | for (i = ASIC3_NUM_GPIOS; i < ASIC3_NR_IRQS; i++) { |
202 | /* They start at bit 4 and go up */ | 200 | /* They start at bit 4 and go up */ |
203 | if (status & (1 << (i - ASIC3_NUM_GPIOS + 4))) { | 201 | if (status & (1 << (i - ASIC3_NUM_GPIOS + 4))) |
204 | desc = irq_to_desc(asic->irq_base + i); | 202 | generic_handle_irq(asic->irq_base + i); |
205 | desc->handle_irq(asic->irq_base + i, | ||
206 | desc); | ||
207 | } | ||
208 | } | 203 | } |
209 | } | 204 | } |
210 | 205 | ||
@@ -226,14 +221,14 @@ static inline int asic3_irq_to_index(struct asic3 *asic, int irq) | |||
226 | return (irq - asic->irq_base) & 0xf; | 221 | return (irq - asic->irq_base) & 0xf; |
227 | } | 222 | } |
228 | 223 | ||
229 | static void asic3_mask_gpio_irq(unsigned int irq) | 224 | static void asic3_mask_gpio_irq(struct irq_data *data) |
230 | { | 225 | { |
231 | struct asic3 *asic = get_irq_chip_data(irq); | 226 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
232 | u32 val, bank, index; | 227 | u32 val, bank, index; |
233 | unsigned long flags; | 228 | unsigned long flags; |
234 | 229 | ||
235 | bank = asic3_irq_to_bank(asic, irq); | 230 | bank = asic3_irq_to_bank(asic, data->irq); |
236 | index = asic3_irq_to_index(asic, irq); | 231 | index = asic3_irq_to_index(asic, data->irq); |
237 | 232 | ||
238 | spin_lock_irqsave(&asic->lock, flags); | 233 | spin_lock_irqsave(&asic->lock, flags); |
239 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); | 234 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); |
@@ -242,9 +237,9 @@ static void asic3_mask_gpio_irq(unsigned int irq) | |||
242 | spin_unlock_irqrestore(&asic->lock, flags); | 237 | spin_unlock_irqrestore(&asic->lock, flags); |
243 | } | 238 | } |
244 | 239 | ||
245 | static void asic3_mask_irq(unsigned int irq) | 240 | static void asic3_mask_irq(struct irq_data *data) |
246 | { | 241 | { |
247 | struct asic3 *asic = get_irq_chip_data(irq); | 242 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
248 | int regval; | 243 | int regval; |
249 | unsigned long flags; | 244 | unsigned long flags; |
250 | 245 | ||
@@ -254,7 +249,7 @@ static void asic3_mask_irq(unsigned int irq) | |||
254 | ASIC3_INTR_INT_MASK); | 249 | ASIC3_INTR_INT_MASK); |
255 | 250 | ||
256 | regval &= ~(ASIC3_INTMASK_MASK0 << | 251 | regval &= ~(ASIC3_INTMASK_MASK0 << |
257 | (irq - (asic->irq_base + ASIC3_NUM_GPIOS))); | 252 | (data->irq - (asic->irq_base + ASIC3_NUM_GPIOS))); |
258 | 253 | ||
259 | asic3_write_register(asic, | 254 | asic3_write_register(asic, |
260 | ASIC3_INTR_BASE + | 255 | ASIC3_INTR_BASE + |
@@ -263,14 +258,14 @@ static void asic3_mask_irq(unsigned int irq) | |||
263 | spin_unlock_irqrestore(&asic->lock, flags); | 258 | spin_unlock_irqrestore(&asic->lock, flags); |
264 | } | 259 | } |
265 | 260 | ||
266 | static void asic3_unmask_gpio_irq(unsigned int irq) | 261 | static void asic3_unmask_gpio_irq(struct irq_data *data) |
267 | { | 262 | { |
268 | struct asic3 *asic = get_irq_chip_data(irq); | 263 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
269 | u32 val, bank, index; | 264 | u32 val, bank, index; |
270 | unsigned long flags; | 265 | unsigned long flags; |
271 | 266 | ||
272 | bank = asic3_irq_to_bank(asic, irq); | 267 | bank = asic3_irq_to_bank(asic, data->irq); |
273 | index = asic3_irq_to_index(asic, irq); | 268 | index = asic3_irq_to_index(asic, data->irq); |
274 | 269 | ||
275 | spin_lock_irqsave(&asic->lock, flags); | 270 | spin_lock_irqsave(&asic->lock, flags); |
276 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); | 271 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); |
@@ -279,9 +274,9 @@ static void asic3_unmask_gpio_irq(unsigned int irq) | |||
279 | spin_unlock_irqrestore(&asic->lock, flags); | 274 | spin_unlock_irqrestore(&asic->lock, flags); |
280 | } | 275 | } |
281 | 276 | ||
282 | static void asic3_unmask_irq(unsigned int irq) | 277 | static void asic3_unmask_irq(struct irq_data *data) |
283 | { | 278 | { |
284 | struct asic3 *asic = get_irq_chip_data(irq); | 279 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
285 | int regval; | 280 | int regval; |
286 | unsigned long flags; | 281 | unsigned long flags; |
287 | 282 | ||
@@ -291,7 +286,7 @@ static void asic3_unmask_irq(unsigned int irq) | |||
291 | ASIC3_INTR_INT_MASK); | 286 | ASIC3_INTR_INT_MASK); |
292 | 287 | ||
293 | regval |= (ASIC3_INTMASK_MASK0 << | 288 | regval |= (ASIC3_INTMASK_MASK0 << |
294 | (irq - (asic->irq_base + ASIC3_NUM_GPIOS))); | 289 | (data->irq - (asic->irq_base + ASIC3_NUM_GPIOS))); |
295 | 290 | ||
296 | asic3_write_register(asic, | 291 | asic3_write_register(asic, |
297 | ASIC3_INTR_BASE + | 292 | ASIC3_INTR_BASE + |
@@ -300,15 +295,15 @@ static void asic3_unmask_irq(unsigned int irq) | |||
300 | spin_unlock_irqrestore(&asic->lock, flags); | 295 | spin_unlock_irqrestore(&asic->lock, flags); |
301 | } | 296 | } |
302 | 297 | ||
303 | static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | 298 | static int asic3_gpio_irq_type(struct irq_data *data, unsigned int type) |
304 | { | 299 | { |
305 | struct asic3 *asic = get_irq_chip_data(irq); | 300 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
306 | u32 bank, index; | 301 | u32 bank, index; |
307 | u16 trigger, level, edge, bit; | 302 | u16 trigger, level, edge, bit; |
308 | unsigned long flags; | 303 | unsigned long flags; |
309 | 304 | ||
310 | bank = asic3_irq_to_bank(asic, irq); | 305 | bank = asic3_irq_to_bank(asic, data->irq); |
311 | index = asic3_irq_to_index(asic, irq); | 306 | index = asic3_irq_to_index(asic, data->irq); |
312 | bit = 1<<index; | 307 | bit = 1<<index; |
313 | 308 | ||
314 | spin_lock_irqsave(&asic->lock, flags); | 309 | spin_lock_irqsave(&asic->lock, flags); |
@@ -318,7 +313,7 @@ static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | |||
318 | bank + ASIC3_GPIO_EDGE_TRIGGER); | 313 | bank + ASIC3_GPIO_EDGE_TRIGGER); |
319 | trigger = asic3_read_register(asic, | 314 | trigger = asic3_read_register(asic, |
320 | bank + ASIC3_GPIO_TRIGGER_TYPE); | 315 | bank + ASIC3_GPIO_TRIGGER_TYPE); |
321 | asic->irq_bothedge[(irq - asic->irq_base) >> 4] &= ~bit; | 316 | asic->irq_bothedge[(data->irq - asic->irq_base) >> 4] &= ~bit; |
322 | 317 | ||
323 | if (type == IRQ_TYPE_EDGE_RISING) { | 318 | if (type == IRQ_TYPE_EDGE_RISING) { |
324 | trigger |= bit; | 319 | trigger |= bit; |
@@ -328,11 +323,11 @@ static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | |||
328 | edge &= ~bit; | 323 | edge &= ~bit; |
329 | } else if (type == IRQ_TYPE_EDGE_BOTH) { | 324 | } else if (type == IRQ_TYPE_EDGE_BOTH) { |
330 | trigger |= bit; | 325 | trigger |= bit; |
331 | if (asic3_gpio_get(&asic->gpio, irq - asic->irq_base)) | 326 | if (asic3_gpio_get(&asic->gpio, data->irq - asic->irq_base)) |
332 | edge &= ~bit; | 327 | edge &= ~bit; |
333 | else | 328 | else |
334 | edge |= bit; | 329 | edge |= bit; |
335 | asic->irq_bothedge[(irq - asic->irq_base) >> 4] |= bit; | 330 | asic->irq_bothedge[(data->irq - asic->irq_base) >> 4] |= bit; |
336 | } else if (type == IRQ_TYPE_LEVEL_LOW) { | 331 | } else if (type == IRQ_TYPE_LEVEL_LOW) { |
337 | trigger &= ~bit; | 332 | trigger &= ~bit; |
338 | level &= ~bit; | 333 | level &= ~bit; |
@@ -359,17 +354,17 @@ static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | |||
359 | 354 | ||
360 | static struct irq_chip asic3_gpio_irq_chip = { | 355 | static struct irq_chip asic3_gpio_irq_chip = { |
361 | .name = "ASIC3-GPIO", | 356 | .name = "ASIC3-GPIO", |
362 | .ack = asic3_mask_gpio_irq, | 357 | .irq_ack = asic3_mask_gpio_irq, |
363 | .mask = asic3_mask_gpio_irq, | 358 | .irq_mask = asic3_mask_gpio_irq, |
364 | .unmask = asic3_unmask_gpio_irq, | 359 | .irq_unmask = asic3_unmask_gpio_irq, |
365 | .set_type = asic3_gpio_irq_type, | 360 | .irq_set_type = asic3_gpio_irq_type, |
366 | }; | 361 | }; |
367 | 362 | ||
368 | static struct irq_chip asic3_irq_chip = { | 363 | static struct irq_chip asic3_irq_chip = { |
369 | .name = "ASIC3", | 364 | .name = "ASIC3", |
370 | .ack = asic3_mask_irq, | 365 | .irq_ack = asic3_mask_irq, |
371 | .mask = asic3_mask_irq, | 366 | .irq_mask = asic3_mask_irq, |
372 | .unmask = asic3_unmask_irq, | 367 | .irq_unmask = asic3_unmask_irq, |
373 | }; | 368 | }; |
374 | 369 | ||
375 | static int __init asic3_irq_probe(struct platform_device *pdev) | 370 | static int __init asic3_irq_probe(struct platform_device *pdev) |
@@ -393,21 +388,21 @@ static int __init asic3_irq_probe(struct platform_device *pdev) | |||
393 | 388 | ||
394 | for (irq = irq_base; irq < irq_base + ASIC3_NR_IRQS; irq++) { | 389 | for (irq = irq_base; irq < irq_base + ASIC3_NR_IRQS; irq++) { |
395 | if (irq < asic->irq_base + ASIC3_NUM_GPIOS) | 390 | if (irq < asic->irq_base + ASIC3_NUM_GPIOS) |
396 | set_irq_chip(irq, &asic3_gpio_irq_chip); | 391 | irq_set_chip(irq, &asic3_gpio_irq_chip); |
397 | else | 392 | else |
398 | set_irq_chip(irq, &asic3_irq_chip); | 393 | irq_set_chip(irq, &asic3_irq_chip); |
399 | 394 | ||
400 | set_irq_chip_data(irq, asic); | 395 | irq_set_chip_data(irq, asic); |
401 | set_irq_handler(irq, handle_level_irq); | 396 | irq_set_handler(irq, handle_level_irq); |
402 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | 397 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); |
403 | } | 398 | } |
404 | 399 | ||
405 | asic3_write_register(asic, ASIC3_OFFSET(INTR, INT_MASK), | 400 | asic3_write_register(asic, ASIC3_OFFSET(INTR, INT_MASK), |
406 | ASIC3_INTMASK_GINTMASK); | 401 | ASIC3_INTMASK_GINTMASK); |
407 | 402 | ||
408 | set_irq_chained_handler(asic->irq_nr, asic3_irq_demux); | 403 | irq_set_chained_handler(asic->irq_nr, asic3_irq_demux); |
409 | set_irq_type(asic->irq_nr, IRQ_TYPE_EDGE_RISING); | 404 | irq_set_irq_type(asic->irq_nr, IRQ_TYPE_EDGE_RISING); |
410 | set_irq_data(asic->irq_nr, asic); | 405 | irq_set_handler_data(asic->irq_nr, asic); |
411 | 406 | ||
412 | return 0; | 407 | return 0; |
413 | } | 408 | } |
@@ -421,11 +416,10 @@ static void asic3_irq_remove(struct platform_device *pdev) | |||
421 | 416 | ||
422 | for (irq = irq_base; irq < irq_base + ASIC3_NR_IRQS; irq++) { | 417 | for (irq = irq_base; irq < irq_base + ASIC3_NR_IRQS; irq++) { |
423 | set_irq_flags(irq, 0); | 418 | set_irq_flags(irq, 0); |
424 | set_irq_handler(irq, NULL); | 419 | irq_set_chip_and_handler(irq, NULL, NULL); |
425 | set_irq_chip(irq, NULL); | 420 | irq_set_chip_data(irq, NULL); |
426 | set_irq_chip_data(irq, NULL); | ||
427 | } | 421 | } |
428 | set_irq_chained_handler(asic->irq_nr, NULL); | 422 | irq_set_chained_handler(asic->irq_nr, NULL); |
429 | } | 423 | } |
430 | 424 | ||
431 | /* GPIOs */ | 425 | /* GPIOs */ |
@@ -625,6 +619,7 @@ static void asic3_clk_disable(struct asic3 *asic, struct asic3_clk *clk) | |||
625 | /* MFD cells (SPI, PWM, LED, DS1WM, MMC) */ | 619 | /* MFD cells (SPI, PWM, LED, DS1WM, MMC) */ |
626 | static struct ds1wm_driver_data ds1wm_pdata = { | 620 | static struct ds1wm_driver_data ds1wm_pdata = { |
627 | .active_high = 1, | 621 | .active_high = 1, |
622 | .reset_recover_delay = 1, | ||
628 | }; | 623 | }; |
629 | 624 | ||
630 | static struct resource ds1wm_resources[] = { | 625 | static struct resource ds1wm_resources[] = { |
@@ -635,7 +630,7 @@ static struct resource ds1wm_resources[] = { | |||
635 | }, | 630 | }, |
636 | { | 631 | { |
637 | .start = ASIC3_IRQ_OWM, | 632 | .start = ASIC3_IRQ_OWM, |
638 | .start = ASIC3_IRQ_OWM, | 633 | .end = ASIC3_IRQ_OWM, |
639 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | 634 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
640 | }, | 635 | }, |
641 | }; | 636 | }; |
@@ -682,7 +677,8 @@ static struct mfd_cell asic3_cell_ds1wm = { | |||
682 | .name = "ds1wm", | 677 | .name = "ds1wm", |
683 | .enable = ds1wm_enable, | 678 | .enable = ds1wm_enable, |
684 | .disable = ds1wm_disable, | 679 | .disable = ds1wm_disable, |
685 | .driver_data = &ds1wm_pdata, | 680 | .platform_data = &ds1wm_pdata, |
681 | .pdata_size = sizeof(ds1wm_pdata), | ||
686 | .num_resources = ARRAY_SIZE(ds1wm_resources), | 682 | .num_resources = ARRAY_SIZE(ds1wm_resources), |
687 | .resources = ds1wm_resources, | 683 | .resources = ds1wm_resources, |
688 | }; | 684 | }; |
@@ -783,12 +779,61 @@ static struct mfd_cell asic3_cell_mmc = { | |||
783 | .name = "tmio-mmc", | 779 | .name = "tmio-mmc", |
784 | .enable = asic3_mmc_enable, | 780 | .enable = asic3_mmc_enable, |
785 | .disable = asic3_mmc_disable, | 781 | .disable = asic3_mmc_disable, |
786 | .driver_data = &asic3_mmc_data, | 782 | .platform_data = &asic3_mmc_data, |
783 | .pdata_size = sizeof(asic3_mmc_data), | ||
787 | .num_resources = ARRAY_SIZE(asic3_mmc_resources), | 784 | .num_resources = ARRAY_SIZE(asic3_mmc_resources), |
788 | .resources = asic3_mmc_resources, | 785 | .resources = asic3_mmc_resources, |
789 | }; | 786 | }; |
790 | 787 | ||
788 | static const int clock_ledn[ASIC3_NUM_LEDS] = { | ||
789 | [0] = ASIC3_CLOCK_LED0, | ||
790 | [1] = ASIC3_CLOCK_LED1, | ||
791 | [2] = ASIC3_CLOCK_LED2, | ||
792 | }; | ||
793 | |||
794 | static int asic3_leds_enable(struct platform_device *pdev) | ||
795 | { | ||
796 | const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
797 | struct asic3 *asic = dev_get_drvdata(pdev->dev.parent); | ||
798 | |||
799 | asic3_clk_enable(asic, &asic->clocks[clock_ledn[cell->id]]); | ||
800 | |||
801 | return 0; | ||
802 | } | ||
803 | |||
804 | static int asic3_leds_disable(struct platform_device *pdev) | ||
805 | { | ||
806 | const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
807 | struct asic3 *asic = dev_get_drvdata(pdev->dev.parent); | ||
808 | |||
809 | asic3_clk_disable(asic, &asic->clocks[clock_ledn[cell->id]]); | ||
810 | |||
811 | return 0; | ||
812 | } | ||
813 | |||
814 | static struct mfd_cell asic3_cell_leds[ASIC3_NUM_LEDS] = { | ||
815 | [0] = { | ||
816 | .name = "leds-asic3", | ||
817 | .id = 0, | ||
818 | .enable = asic3_leds_enable, | ||
819 | .disable = asic3_leds_disable, | ||
820 | }, | ||
821 | [1] = { | ||
822 | .name = "leds-asic3", | ||
823 | .id = 1, | ||
824 | .enable = asic3_leds_enable, | ||
825 | .disable = asic3_leds_disable, | ||
826 | }, | ||
827 | [2] = { | ||
828 | .name = "leds-asic3", | ||
829 | .id = 2, | ||
830 | .enable = asic3_leds_enable, | ||
831 | .disable = asic3_leds_disable, | ||
832 | }, | ||
833 | }; | ||
834 | |||
791 | static int __init asic3_mfd_probe(struct platform_device *pdev, | 835 | static int __init asic3_mfd_probe(struct platform_device *pdev, |
836 | struct asic3_platform_data *pdata, | ||
792 | struct resource *mem) | 837 | struct resource *mem) |
793 | { | 838 | { |
794 | struct asic3 *asic = platform_get_drvdata(pdev); | 839 | struct asic3 *asic = platform_get_drvdata(pdev); |
@@ -810,12 +855,10 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, | |||
810 | ds1wm_resources[0].start >>= asic->bus_shift; | 855 | ds1wm_resources[0].start >>= asic->bus_shift; |
811 | ds1wm_resources[0].end >>= asic->bus_shift; | 856 | ds1wm_resources[0].end >>= asic->bus_shift; |
812 | 857 | ||
813 | asic3_cell_ds1wm.platform_data = &asic3_cell_ds1wm; | ||
814 | asic3_cell_ds1wm.data_size = sizeof(asic3_cell_ds1wm); | ||
815 | |||
816 | /* MMC */ | 858 | /* MMC */ |
817 | asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) + | 859 | asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) + |
818 | mem_sdio->start, 0x400 >> asic->bus_shift); | 860 | mem_sdio->start, |
861 | ASIC3_SD_CONFIG_SIZE >> asic->bus_shift); | ||
819 | if (!asic->tmio_cnf) { | 862 | if (!asic->tmio_cnf) { |
820 | ret = -ENOMEM; | 863 | ret = -ENOMEM; |
821 | dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n"); | 864 | dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n"); |
@@ -824,17 +867,28 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, | |||
824 | asic3_mmc_resources[0].start >>= asic->bus_shift; | 867 | asic3_mmc_resources[0].start >>= asic->bus_shift; |
825 | asic3_mmc_resources[0].end >>= asic->bus_shift; | 868 | asic3_mmc_resources[0].end >>= asic->bus_shift; |
826 | 869 | ||
827 | asic3_cell_mmc.platform_data = &asic3_cell_mmc; | ||
828 | asic3_cell_mmc.data_size = sizeof(asic3_cell_mmc); | ||
829 | |||
830 | ret = mfd_add_devices(&pdev->dev, pdev->id, | 870 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
831 | &asic3_cell_ds1wm, 1, mem, asic->irq_base); | 871 | &asic3_cell_ds1wm, 1, mem, asic->irq_base); |
832 | if (ret < 0) | 872 | if (ret < 0) |
833 | goto out; | 873 | goto out; |
834 | 874 | ||
835 | if (mem_sdio && (irq >= 0)) | 875 | if (mem_sdio && (irq >= 0)) { |
836 | ret = mfd_add_devices(&pdev->dev, pdev->id, | 876 | ret = mfd_add_devices(&pdev->dev, pdev->id, |
837 | &asic3_cell_mmc, 1, mem_sdio, irq); | 877 | &asic3_cell_mmc, 1, mem_sdio, irq); |
878 | if (ret < 0) | ||
879 | goto out; | ||
880 | } | ||
881 | |||
882 | if (pdata->leds) { | ||
883 | int i; | ||
884 | |||
885 | for (i = 0; i < ASIC3_NUM_LEDS; ++i) { | ||
886 | asic3_cell_leds[i].platform_data = &pdata->leds[i]; | ||
887 | asic3_cell_leds[i].pdata_size = sizeof(pdata->leds[i]); | ||
888 | } | ||
889 | ret = mfd_add_devices(&pdev->dev, 0, | ||
890 | asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0); | ||
891 | } | ||
838 | 892 | ||
839 | out: | 893 | out: |
840 | return ret; | 894 | return ret; |
@@ -915,7 +969,7 @@ static int __init asic3_probe(struct platform_device *pdev) | |||
915 | */ | 969 | */ |
916 | memcpy(asic->clocks, asic3_clk_init, sizeof(asic3_clk_init)); | 970 | memcpy(asic->clocks, asic3_clk_init, sizeof(asic3_clk_init)); |
917 | 971 | ||
918 | asic3_mfd_probe(pdev, mem); | 972 | asic3_mfd_probe(pdev, pdata, mem); |
919 | 973 | ||
920 | dev_info(asic->dev, "ASIC3 Core driver\n"); | 974 | dev_info(asic->dev, "ASIC3 Core driver\n"); |
921 | 975 | ||