diff options
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 2 | ||||
-rw-r--r-- | drivers/mfd/tc6393xb.c | 74 | ||||
-rw-r--r-- | include/linux/mfd/tc6393xb.h | 4 |
3 files changed, 40 insertions, 40 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index fac846b0d070..a6c4694359ca 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -746,6 +746,8 @@ static struct tc6393xb_platform_data tosa_tc6393xb_data = { | |||
746 | .resume = tosa_tc6393xb_resume, | 746 | .resume = tosa_tc6393xb_resume, |
747 | 747 | ||
748 | .nand_data = &tosa_tc6393xb_nand_config, | 748 | .nand_data = &tosa_tc6393xb_nand_config, |
749 | |||
750 | .resume_restore = 1, | ||
749 | }; | 751 | }; |
750 | 752 | ||
751 | 753 | ||
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 83dc703f3767..c3c64aeeb12a 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -369,41 +369,12 @@ static void tc6393xb_detach_irq(struct platform_device *dev) | |||
369 | 369 | ||
370 | /*--------------------------------------------------------------------------*/ | 370 | /*--------------------------------------------------------------------------*/ |
371 | 371 | ||
372 | static int tc6393xb_hw_init(struct platform_device *dev) | ||
373 | { | ||
374 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | ||
375 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
376 | int i; | ||
377 | |||
378 | iowrite8(tc6393xb->suspend_state.fer, tc6393xb->scr + SCR_FER); | ||
379 | iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); | ||
380 | iowrite16(tc6393xb->suspend_state.ccr, tc6393xb->scr + SCR_CCR); | ||
381 | iowrite16(SCR_MCR_RDY_OPENDRAIN | SCR_MCR_RDY_UNK | SCR_MCR_RDY_EN | | ||
382 | SCR_MCR_INT_OPENDRAIN | SCR_MCR_INT_UNK | SCR_MCR_INT_EN | | ||
383 | BIT(15), tc6393xb->scr + SCR_MCR); | ||
384 | iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); | ||
385 | iowrite8(0, tc6393xb->scr + SCR_IRR); | ||
386 | iowrite8(0xbf, tc6393xb->scr + SCR_IMR); | ||
387 | |||
388 | for (i = 0; i < 3; i++) { | ||
389 | iowrite8(tc6393xb->suspend_state.gpo_dsr[i], | ||
390 | tc6393xb->scr + SCR_GPO_DSR(i)); | ||
391 | iowrite8(tc6393xb->suspend_state.gpo_doecr[i], | ||
392 | tc6393xb->scr + SCR_GPO_DOECR(i)); | ||
393 | iowrite8(tc6393xb->suspend_state.gpi_bcr[i], | ||
394 | tc6393xb->scr + SCR_GPI_BCR(i)); | ||
395 | } | ||
396 | |||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | static int __devinit tc6393xb_probe(struct platform_device *dev) | 372 | static int __devinit tc6393xb_probe(struct platform_device *dev) |
401 | { | 373 | { |
402 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | 374 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; |
403 | struct tc6393xb *tc6393xb; | 375 | struct tc6393xb *tc6393xb; |
404 | struct resource *iomem, *rscr; | 376 | struct resource *iomem, *rscr; |
405 | int ret, temp; | 377 | int ret, temp; |
406 | int i; | ||
407 | 378 | ||
408 | iomem = platform_get_resource(dev, IORESOURCE_MEM, 0); | 379 | iomem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
409 | if (!iomem) | 380 | if (!iomem) |
@@ -458,14 +429,16 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
458 | if (ret) | 429 | if (ret) |
459 | goto err_enable; | 430 | goto err_enable; |
460 | 431 | ||
461 | tc6393xb->suspend_state.fer = 0; | 432 | iowrite8(0, tc6393xb->scr + SCR_FER); |
462 | 433 | iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); | |
463 | tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 | | 434 | iowrite16(SCR_CCR_UNK1 | SCR_CCR_HCLK_48, |
464 | SCR_CCR_HCLK_48; | 435 | tc6393xb->scr + SCR_CCR); |
465 | 436 | iowrite16(SCR_MCR_RDY_OPENDRAIN | SCR_MCR_RDY_UNK | SCR_MCR_RDY_EN | | |
466 | ret = tc6393xb_hw_init(dev); | 437 | SCR_MCR_INT_OPENDRAIN | SCR_MCR_INT_UNK | SCR_MCR_INT_EN | |
467 | if (ret) | 438 | BIT(15), tc6393xb->scr + SCR_MCR); |
468 | goto err_hw_init; | 439 | iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); |
440 | iowrite8(0, tc6393xb->scr + SCR_IRR); | ||
441 | iowrite8(0xbf, tc6393xb->scr + SCR_IMR); | ||
469 | 442 | ||
470 | printk(KERN_INFO "Toshiba tc6393xb revision %d at 0x%08lx, irq %d\n", | 443 | printk(KERN_INFO "Toshiba tc6393xb revision %d at 0x%08lx, irq %d\n", |
471 | tmio_ioread8(tc6393xb->scr + SCR_REVID), | 444 | tmio_ioread8(tc6393xb->scr + SCR_REVID), |
@@ -514,7 +487,6 @@ err_setup: | |||
514 | err_gpio_add: | 487 | err_gpio_add: |
515 | if (tc6393xb->gpio.base != -1) | 488 | if (tc6393xb->gpio.base != -1) |
516 | temp = gpiochip_remove(&tc6393xb->gpio); | 489 | temp = gpiochip_remove(&tc6393xb->gpio); |
517 | err_hw_init: | ||
518 | tcpd->disable(dev); | 490 | tcpd->disable(dev); |
519 | err_clk_enable: | 491 | err_clk_enable: |
520 | clk_disable(tc6393xb->clk); | 492 | clk_disable(tc6393xb->clk); |
@@ -592,15 +564,37 @@ static int tc6393xb_resume(struct platform_device *dev) | |||
592 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | 564 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; |
593 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | 565 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); |
594 | int ret; | 566 | int ret; |
567 | int i; | ||
595 | 568 | ||
596 | clk_enable(tc6393xb->clk); | 569 | clk_enable(tc6393xb->clk); |
597 | 570 | ||
598 | ret = tcpd->resume(dev); | 571 | ret = tcpd->resume(dev); |
599 | |||
600 | if (ret) | 572 | if (ret) |
601 | return ret; | 573 | return ret; |
602 | 574 | ||
603 | return tc6393xb_hw_init(dev); | 575 | if (!tcpd->resume_restore) |
576 | return 0; | ||
577 | |||
578 | iowrite8(tc6393xb->suspend_state.fer, tc6393xb->scr + SCR_FER); | ||
579 | iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); | ||
580 | iowrite16(tc6393xb->suspend_state.ccr, tc6393xb->scr + SCR_CCR); | ||
581 | iowrite16(SCR_MCR_RDY_OPENDRAIN | SCR_MCR_RDY_UNK | SCR_MCR_RDY_EN | | ||
582 | SCR_MCR_INT_OPENDRAIN | SCR_MCR_INT_UNK | SCR_MCR_INT_EN | | ||
583 | BIT(15), tc6393xb->scr + SCR_MCR); | ||
584 | iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); | ||
585 | iowrite8(0, tc6393xb->scr + SCR_IRR); | ||
586 | iowrite8(0xbf, tc6393xb->scr + SCR_IMR); | ||
587 | |||
588 | for (i = 0; i < 3; i++) { | ||
589 | iowrite8(tc6393xb->suspend_state.gpo_dsr[i], | ||
590 | tc6393xb->scr + SCR_GPO_DSR(i)); | ||
591 | iowrite8(tc6393xb->suspend_state.gpo_doecr[i], | ||
592 | tc6393xb->scr + SCR_GPO_DOECR(i)); | ||
593 | iowrite8(tc6393xb->suspend_state.gpi_bcr[i], | ||
594 | tc6393xb->scr + SCR_GPI_BCR(i)); | ||
595 | } | ||
596 | |||
597 | return 0; | ||
604 | } | 598 | } |
605 | #else | 599 | #else |
606 | #define tc6393xb_suspend NULL | 600 | #define tc6393xb_suspend NULL |
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h index 1fa820646d98..3ce10ae0f397 100644 --- a/include/linux/mfd/tc6393xb.h +++ b/include/linux/mfd/tc6393xb.h | |||
@@ -33,6 +33,10 @@ struct tc6393xb_platform_data { | |||
33 | void (*teardown)(struct platform_device *dev); | 33 | void (*teardown)(struct platform_device *dev); |
34 | 34 | ||
35 | struct tmio_nand_data *nand_data; | 35 | struct tmio_nand_data *nand_data; |
36 | |||
37 | unsigned resume_restore : 1; /* make special actions | ||
38 | to preserve the state | ||
39 | on suspend/resume */ | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | /* | 42 | /* |