aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/Kconfig4
-rw-r--r--drivers/mmc/host/mmci.c109
-rw-r--r--drivers/mmc/host/mmci.h3
-rw-r--r--drivers/mmc/host/pxamci.c104
-rw-r--r--drivers/net/irda/pxaficp_ir.c47
-rw-r--r--drivers/pcmcia/Makefile1
-rw-r--r--drivers/pcmcia/pxa2xx_base.c18
-rw-r--r--drivers/pcmcia/pxa2xx_palmtc.c230
-rw-r--r--drivers/rtc/rtc-pxa.c27
-rw-r--r--drivers/rtc/rtc-sa1100.c23
-rw-r--r--drivers/serial/pxa.c20
-rw-r--r--drivers/spi/amba-pl022.c8
-rw-r--r--drivers/spi/pxa2xx_spi.c30
-rw-r--r--drivers/usb/host/ohci-pxa27x.c30
-rw-r--r--drivers/video/backlight/da903x_bl.c20
-rw-r--r--drivers/video/pxafb.c32
16 files changed, 578 insertions, 128 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 6bedd2fcfc15..737335ff2b21 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -477,8 +477,8 @@ config I2C_PNX
477 will be called i2c-pnx. 477 will be called i2c-pnx.
478 478
479config I2C_PXA 479config I2C_PXA
480 tristate "Intel PXA2XX I2C adapter (EXPERIMENTAL)" 480 tristate "Intel PXA2XX I2C adapter"
481 depends on EXPERIMENTAL && ARCH_PXA 481 depends on ARCH_PXA || ARCH_MMP
482 help 482 help
483 If you have devices in the PXA I2C bus, say yes to this option. 483 If you have devices in the PXA I2C bus, say yes to this option.
484 This driver can also be built as a module. If so, the module 484 This driver can also be built as a module. If so, the module
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 8741d0f5146a..3d1e5329da12 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -22,12 +22,13 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/amba/mmci.h>
26#include <linux/regulator/consumer.h>
25 27
26#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
27#include <asm/div64.h> 29#include <asm/div64.h>
28#include <asm/io.h> 30#include <asm/io.h>
29#include <asm/sizes.h> 31#include <asm/sizes.h>
30#include <asm/mach/mmc.h>
31 32
32#include "mmci.h" 33#include "mmci.h"
33 34
@@ -38,6 +39,36 @@
38 39
39static unsigned int fmax = 515633; 40static unsigned int fmax = 515633;
40 41
42/*
43 * This must be called with host->lock held
44 */
45static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired)
46{
47 u32 clk = 0;
48
49 if (desired) {
50 if (desired >= host->mclk) {
51 clk = MCI_CLK_BYPASS;
52 host->cclk = host->mclk;
53 } else {
54 clk = host->mclk / (2 * desired) - 1;
55 if (clk >= 256)
56 clk = 255;
57 host->cclk = host->mclk / (2 * (clk + 1));
58 }
59 if (host->hw_designer == 0x80)
60 clk |= MCI_FCEN; /* Bug fix in ST IP block */
61 clk |= MCI_CLK_ENABLE;
62 /* This hasn't proven to be worthwhile */
63 /* clk |= MCI_CLK_PWRSAVE; */
64 }
65
66 if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4)
67 clk |= MCI_WIDE_BUS;
68
69 writel(clk, host->base + MMCICLOCK);
70}
71
41static void 72static void
42mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) 73mmci_request_end(struct mmci_host *host, struct mmc_request *mrq)
43{ 74{
@@ -419,30 +450,31 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
419static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 450static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
420{ 451{
421 struct mmci_host *host = mmc_priv(mmc); 452 struct mmci_host *host = mmc_priv(mmc);
422 u32 clk = 0, pwr = 0; 453 u32 pwr = 0;
423 454 unsigned long flags;
424 if (ios->clock) {
425 if (ios->clock >= host->mclk) {
426 clk = MCI_CLK_BYPASS;
427 host->cclk = host->mclk;
428 } else {
429 clk = host->mclk / (2 * ios->clock) - 1;
430 if (clk >= 256)
431 clk = 255;
432 host->cclk = host->mclk / (2 * (clk + 1));
433 }
434 if (host->hw_designer == AMBA_VENDOR_ST)
435 clk |= MCI_FCEN; /* Bug fix in ST IP block */
436 clk |= MCI_CLK_ENABLE;
437 }
438
439 if (host->plat->translate_vdd)
440 pwr |= host->plat->translate_vdd(mmc_dev(mmc), ios->vdd);
441 455
442 switch (ios->power_mode) { 456 switch (ios->power_mode) {
443 case MMC_POWER_OFF: 457 case MMC_POWER_OFF:
458 if(host->vcc &&
459 regulator_is_enabled(host->vcc))
460 regulator_disable(host->vcc);
444 break; 461 break;
445 case MMC_POWER_UP: 462 case MMC_POWER_UP:
463#ifdef CONFIG_REGULATOR
464 if (host->vcc)
465 /* This implicitly enables the regulator */
466 mmc_regulator_set_ocr(host->vcc, ios->vdd);
467#endif
468 /*
469 * The translate_vdd function is not used if you have
470 * an external regulator, or your design is really weird.
471 * Using it would mean sending in power control BOTH using
472 * a regulator AND the 4 MMCIPWR bits. If we don't have
473 * a regulator, we might have some other platform specific
474 * power control behind this translate function.
475 */
476 if (!host->vcc && host->plat->translate_vdd)
477 pwr |= host->plat->translate_vdd(mmc_dev(mmc), ios->vdd);
446 /* The ST version does not have this, fall through to POWER_ON */ 478 /* The ST version does not have this, fall through to POWER_ON */
447 if (host->hw_designer != AMBA_VENDOR_ST) { 479 if (host->hw_designer != AMBA_VENDOR_ST) {
448 pwr |= MCI_PWR_UP; 480 pwr |= MCI_PWR_UP;
@@ -465,12 +497,16 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
465 } 497 }
466 } 498 }
467 499
468 writel(clk, host->base + MMCICLOCK); 500 spin_lock_irqsave(&host->lock, flags);
501
502 mmci_set_clkreg(host, ios->clock);
469 503
470 if (host->pwr != pwr) { 504 if (host->pwr != pwr) {
471 host->pwr = pwr; 505 host->pwr = pwr;
472 writel(pwr, host->base + MMCIPOWER); 506 writel(pwr, host->base + MMCIPOWER);
473 } 507 }
508
509 spin_unlock_irqrestore(&host->lock, flags);
474} 510}
475 511
476static int mmci_get_ro(struct mmc_host *mmc) 512static int mmci_get_ro(struct mmc_host *mmc)
@@ -517,7 +553,7 @@ static void mmci_check_status(unsigned long data)
517 553
518static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) 554static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
519{ 555{
520 struct mmc_platform_data *plat = dev->dev.platform_data; 556 struct mmci_platform_data *plat = dev->dev.platform_data;
521 struct mmci_host *host; 557 struct mmci_host *host;
522 struct mmc_host *mmc; 558 struct mmc_host *mmc;
523 int ret; 559 int ret;
@@ -583,7 +619,30 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
583 mmc->ops = &mmci_ops; 619 mmc->ops = &mmci_ops;
584 mmc->f_min = (host->mclk + 511) / 512; 620 mmc->f_min = (host->mclk + 511) / 512;
585 mmc->f_max = min(host->mclk, fmax); 621 mmc->f_max = min(host->mclk, fmax);
586 mmc->ocr_avail = plat->ocr_mask; 622#ifdef CONFIG_REGULATOR
623 /* If we're using the regulator framework, try to fetch a regulator */
624 host->vcc = regulator_get(&dev->dev, "vmmc");
625 if (IS_ERR(host->vcc))
626 host->vcc = NULL;
627 else {
628 int mask = mmc_regulator_get_ocrmask(host->vcc);
629
630 if (mask < 0)
631 dev_err(&dev->dev, "error getting OCR mask (%d)\n",
632 mask);
633 else {
634 host->mmc->ocr_avail = (u32) mask;
635 if (plat->ocr_mask)
636 dev_warn(&dev->dev,
637 "Provided ocr_mask/setpower will not be used "
638 "(using regulator instead)\n");
639 }
640 }
641#endif
642 /* Fall back to platform data if no regulator is found */
643 if (host->vcc == NULL)
644 mmc->ocr_avail = plat->ocr_mask;
645 mmc->caps = plat->capabilities;
587 646
588 /* 647 /*
589 * We can do SGIO 648 * We can do SGIO
@@ -720,6 +779,10 @@ static int __devexit mmci_remove(struct amba_device *dev)
720 clk_disable(host->clk); 779 clk_disable(host->clk);
721 clk_put(host->clk); 780 clk_put(host->clk);
722 781
782 if (regulator_is_enabled(host->vcc))
783 regulator_disable(host->vcc);
784 regulator_put(host->vcc);
785
723 mmc_free_host(mmc); 786 mmc_free_host(mmc);
724 787
725 amba_release_regions(dev); 788 amba_release_regions(dev);
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index 839f264c9725..1ceb9a90f59b 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -161,7 +161,7 @@ struct mmci_host {
161 unsigned int mclk; 161 unsigned int mclk;
162 unsigned int cclk; 162 unsigned int cclk;
163 u32 pwr; 163 u32 pwr;
164 struct mmc_platform_data *plat; 164 struct mmci_platform_data *plat;
165 165
166 u8 hw_designer; 166 u8 hw_designer;
167 u8 hw_revision:4; 167 u8 hw_revision:4;
@@ -175,6 +175,7 @@ struct mmci_host {
175 struct scatterlist *sg_ptr; 175 struct scatterlist *sg_ptr;
176 unsigned int sg_off; 176 unsigned int sg_off;
177 unsigned int size; 177 unsigned int size;
178 struct regulator *vcc;
178}; 179};
179 180
180static inline void mmci_init_sg(struct mmci_host *host, struct mmc_data *data) 181static inline void mmci_init_sg(struct mmci_host *host, struct mmc_data *data)
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index e55ac792d68c..5e0b1529964d 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -28,6 +28,7 @@
28#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/regulator/consumer.h> 30#include <linux/regulator/consumer.h>
31#include <linux/gpio.h>
31 32
32#include <asm/sizes.h> 33#include <asm/sizes.h>
33 34
@@ -96,10 +97,18 @@ static inline void pxamci_init_ocr(struct pxamci_host *host)
96 97
97static inline void pxamci_set_power(struct pxamci_host *host, unsigned int vdd) 98static inline void pxamci_set_power(struct pxamci_host *host, unsigned int vdd)
98{ 99{
100 int on;
101
99#ifdef CONFIG_REGULATOR 102#ifdef CONFIG_REGULATOR
100 if (host->vcc) 103 if (host->vcc)
101 mmc_regulator_set_ocr(host->vcc, vdd); 104 mmc_regulator_set_ocr(host->vcc, vdd);
102#endif 105#endif
106 if (!host->vcc && host->pdata &&
107 gpio_is_valid(host->pdata->gpio_power)) {
108 on = ((1 << vdd) & host->pdata->ocr_mask);
109 gpio_set_value(host->pdata->gpio_power,
110 !!on ^ host->pdata->gpio_power_invert);
111 }
103 if (!host->vcc && host->pdata && host->pdata->setpower) 112 if (!host->vcc && host->pdata && host->pdata->setpower)
104 host->pdata->setpower(mmc_dev(host->mmc), vdd); 113 host->pdata->setpower(mmc_dev(host->mmc), vdd);
105} 114}
@@ -421,6 +430,12 @@ static int pxamci_get_ro(struct mmc_host *mmc)
421{ 430{
422 struct pxamci_host *host = mmc_priv(mmc); 431 struct pxamci_host *host = mmc_priv(mmc);
423 432
433 if (host->pdata && gpio_is_valid(host->pdata->gpio_card_ro)) {
434 if (host->pdata->gpio_card_ro_invert)
435 return !gpio_get_value(host->pdata->gpio_card_ro);
436 else
437 return gpio_get_value(host->pdata->gpio_card_ro);
438 }
424 if (host->pdata && host->pdata->get_ro) 439 if (host->pdata && host->pdata->get_ro)
425 return !!host->pdata->get_ro(mmc_dev(mmc)); 440 return !!host->pdata->get_ro(mmc_dev(mmc));
426 /* 441 /*
@@ -534,7 +549,7 @@ static int pxamci_probe(struct platform_device *pdev)
534 struct mmc_host *mmc; 549 struct mmc_host *mmc;
535 struct pxamci_host *host = NULL; 550 struct pxamci_host *host = NULL;
536 struct resource *r, *dmarx, *dmatx; 551 struct resource *r, *dmarx, *dmatx;
537 int ret, irq; 552 int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
538 553
539 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 554 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
540 irq = platform_get_irq(pdev, 0); 555 irq = platform_get_irq(pdev, 0);
@@ -661,13 +676,63 @@ static int pxamci_probe(struct platform_device *pdev)
661 } 676 }
662 host->dma_drcmrtx = dmatx->start; 677 host->dma_drcmrtx = dmatx->start;
663 678
679 if (host->pdata) {
680 gpio_cd = host->pdata->gpio_card_detect;
681 gpio_ro = host->pdata->gpio_card_ro;
682 gpio_power = host->pdata->gpio_power;
683 }
684 if (gpio_is_valid(gpio_power)) {
685 ret = gpio_request(gpio_power, "mmc card power");
686 if (ret) {
687 dev_err(&pdev->dev, "Failed requesting gpio_power %d\n", gpio_power);
688 goto out;
689 }
690 gpio_direction_output(gpio_power,
691 host->pdata->gpio_power_invert);
692 }
693 if (gpio_is_valid(gpio_ro)) {
694 ret = gpio_request(gpio_ro, "mmc card read only");
695 if (ret) {
696 dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_power);
697 goto err_gpio_ro;
698 }
699 gpio_direction_input(gpio_ro);
700 }
701 if (gpio_is_valid(gpio_cd)) {
702 ret = gpio_request(gpio_cd, "mmc card detect");
703 if (ret) {
704 dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_power);
705 goto err_gpio_cd;
706 }
707 gpio_direction_input(gpio_cd);
708
709 ret = request_irq(gpio_to_irq(gpio_cd), pxamci_detect_irq,
710 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
711 "mmc card detect", mmc);
712 if (ret) {
713 dev_err(&pdev->dev, "failed to request card detect IRQ\n");
714 goto err_request_irq;
715 }
716 }
717
664 if (host->pdata && host->pdata->init) 718 if (host->pdata && host->pdata->init)
665 host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); 719 host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc);
666 720
721 if (gpio_is_valid(gpio_power) && host->pdata->setpower)
722 dev_warn(&pdev->dev, "gpio_power and setpower() both defined\n");
723 if (gpio_is_valid(gpio_ro) && host->pdata->get_ro)
724 dev_warn(&pdev->dev, "gpio_ro and get_ro() both defined\n");
725
667 mmc_add_host(mmc); 726 mmc_add_host(mmc);
668 727
669 return 0; 728 return 0;
670 729
730err_request_irq:
731 gpio_free(gpio_cd);
732err_gpio_cd:
733 gpio_free(gpio_ro);
734err_gpio_ro:
735 gpio_free(gpio_power);
671 out: 736 out:
672 if (host) { 737 if (host) {
673 if (host->dma >= 0) 738 if (host->dma >= 0)
@@ -688,12 +753,26 @@ static int pxamci_probe(struct platform_device *pdev)
688static int pxamci_remove(struct platform_device *pdev) 753static int pxamci_remove(struct platform_device *pdev)
689{ 754{
690 struct mmc_host *mmc = platform_get_drvdata(pdev); 755 struct mmc_host *mmc = platform_get_drvdata(pdev);
756 int gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
691 757
692 platform_set_drvdata(pdev, NULL); 758 platform_set_drvdata(pdev, NULL);
693 759
694 if (mmc) { 760 if (mmc) {
695 struct pxamci_host *host = mmc_priv(mmc); 761 struct pxamci_host *host = mmc_priv(mmc);
696 762
763 if (host->pdata) {
764 gpio_cd = host->pdata->gpio_card_detect;
765 gpio_ro = host->pdata->gpio_card_ro;
766 gpio_power = host->pdata->gpio_power;
767 }
768 if (gpio_is_valid(gpio_cd)) {
769 free_irq(gpio_to_irq(gpio_cd), mmc);
770 gpio_free(gpio_cd);
771 }
772 if (gpio_is_valid(gpio_ro))
773 gpio_free(gpio_ro);
774 if (gpio_is_valid(gpio_power))
775 gpio_free(gpio_power);
697 if (host->vcc) 776 if (host->vcc)
698 regulator_put(host->vcc); 777 regulator_put(host->vcc);
699 778
@@ -725,20 +804,20 @@ static int pxamci_remove(struct platform_device *pdev)
725} 804}
726 805
727#ifdef CONFIG_PM 806#ifdef CONFIG_PM
728static int pxamci_suspend(struct platform_device *dev, pm_message_t state) 807static int pxamci_suspend(struct device *dev)
729{ 808{
730 struct mmc_host *mmc = platform_get_drvdata(dev); 809 struct mmc_host *mmc = dev_get_drvdata(dev);
731 int ret = 0; 810 int ret = 0;
732 811
733 if (mmc) 812 if (mmc)
734 ret = mmc_suspend_host(mmc, state); 813 ret = mmc_suspend_host(mmc, PMSG_SUSPEND);
735 814
736 return ret; 815 return ret;
737} 816}
738 817
739static int pxamci_resume(struct platform_device *dev) 818static int pxamci_resume(struct device *dev)
740{ 819{
741 struct mmc_host *mmc = platform_get_drvdata(dev); 820 struct mmc_host *mmc = dev_get_drvdata(dev);
742 int ret = 0; 821 int ret = 0;
743 822
744 if (mmc) 823 if (mmc)
@@ -746,19 +825,22 @@ static int pxamci_resume(struct platform_device *dev)
746 825
747 return ret; 826 return ret;
748} 827}
749#else 828
750#define pxamci_suspend NULL 829static struct dev_pm_ops pxamci_pm_ops = {
751#define pxamci_resume NULL 830 .suspend = pxamci_suspend,
831 .resume = pxamci_resume,
832};
752#endif 833#endif
753 834
754static struct platform_driver pxamci_driver = { 835static struct platform_driver pxamci_driver = {
755 .probe = pxamci_probe, 836 .probe = pxamci_probe,
756 .remove = pxamci_remove, 837 .remove = pxamci_remove,
757 .suspend = pxamci_suspend,
758 .resume = pxamci_resume,
759 .driver = { 838 .driver = {
760 .name = DRIVER_NAME, 839 .name = DRIVER_NAME,
761 .owner = THIS_MODULE, 840 .owner = THIS_MODULE,
841#ifdef CONFIG_PM
842 .pm = &pxamci_pm_ops,
843#endif
762 }, 844 },
763}; 845};
764 846
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 1445e5865196..84db145d2b59 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -17,6 +17,7 @@
17#include <linux/etherdevice.h> 17#include <linux/etherdevice.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/gpio.h>
20 21
21#include <net/irda/irda.h> 22#include <net/irda/irda.h>
22#include <net/irda/irmod.h> 23#include <net/irda/irmod.h>
@@ -163,6 +164,22 @@ inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si)
163} 164}
164 165
165/* 166/*
167 * Set the IrDA communications mode.
168 */
169static void pxa_irda_set_mode(struct pxa_irda *si, int mode)
170{
171 if (si->pdata->transceiver_mode)
172 si->pdata->transceiver_mode(si->dev, mode);
173 else {
174 if (gpio_is_valid(si->pdata->gpio_pwdown))
175 gpio_set_value(si->pdata->gpio_pwdown,
176 !(mode & IR_OFF) ^
177 !si->pdata->gpio_pwdown_inverted);
178 pxa2xx_transceiver_mode(si->dev, mode);
179 }
180}
181
182/*
166 * Set the IrDA communications speed. 183 * Set the IrDA communications speed.
167 */ 184 */
168static int pxa_irda_set_speed(struct pxa_irda *si, int speed) 185static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
@@ -188,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
188 pxa_irda_disable_clk(si); 205 pxa_irda_disable_clk(si);
189 206
190 /* set board transceiver to SIR mode */ 207 /* set board transceiver to SIR mode */
191 si->pdata->transceiver_mode(si->dev, IR_SIRMODE); 208 pxa_irda_set_mode(si, IR_SIRMODE);
192 209
193 /* enable the STUART clock */ 210 /* enable the STUART clock */
194 pxa_irda_enable_sirclk(si); 211 pxa_irda_enable_sirclk(si);
@@ -222,7 +239,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
222 ICCR0 = 0; 239 ICCR0 = 0;
223 240
224 /* set board transceiver to FIR mode */ 241 /* set board transceiver to FIR mode */
225 si->pdata->transceiver_mode(si->dev, IR_FIRMODE); 242 pxa_irda_set_mode(si, IR_FIRMODE);
226 243
227 /* enable the FICP clock */ 244 /* enable the FICP clock */
228 pxa_irda_enable_firclk(si); 245 pxa_irda_enable_firclk(si);
@@ -641,7 +658,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
641 local_irq_restore(flags); 658 local_irq_restore(flags);
642 659
643 /* power off board transceiver */ 660 /* power off board transceiver */
644 si->pdata->transceiver_mode(si->dev, IR_OFF); 661 pxa_irda_set_mode(si, IR_OFF);
645 662
646 printk(KERN_DEBUG "pxa_ir: irda shutdown\n"); 663 printk(KERN_DEBUG "pxa_ir: irda shutdown\n");
647} 664}
@@ -849,10 +866,26 @@ static int pxa_irda_probe(struct platform_device *pdev)
849 if (err) 866 if (err)
850 goto err_mem_5; 867 goto err_mem_5;
851 868
852 if (si->pdata->startup) 869 if (gpio_is_valid(si->pdata->gpio_pwdown)) {
870 err = gpio_request(si->pdata->gpio_pwdown, "IrDA switch");
871 if (err)
872 goto err_startup;
873 err = gpio_direction_output(si->pdata->gpio_pwdown,
874 !si->pdata->gpio_pwdown_inverted);
875 if (err) {
876 gpio_free(si->pdata->gpio_pwdown);
877 goto err_startup;
878 }
879 }
880
881 if (si->pdata->startup) {
853 err = si->pdata->startup(si->dev); 882 err = si->pdata->startup(si->dev);
854 if (err) 883 if (err)
855 goto err_startup; 884 goto err_startup;
885 }
886
887 if (gpio_is_valid(si->pdata->gpio_pwdown) && si->pdata->startup)
888 dev_warn(si->dev, "gpio_pwdown and startup() both defined!\n");
856 889
857 dev->netdev_ops = &pxa_irda_netdev_ops; 890 dev->netdev_ops = &pxa_irda_netdev_ops;
858 891
@@ -903,6 +936,8 @@ static int pxa_irda_remove(struct platform_device *_dev)
903 if (dev) { 936 if (dev) {
904 struct pxa_irda *si = netdev_priv(dev); 937 struct pxa_irda *si = netdev_priv(dev);
905 unregister_netdev(dev); 938 unregister_netdev(dev);
939 if (gpio_is_valid(si->pdata->gpio_pwdown))
940 gpio_free(si->pdata->gpio_pwdown);
906 if (si->pdata->shutdown) 941 if (si->pdata->shutdown)
907 si->pdata->shutdown(si->dev); 942 si->pdata->shutdown(si->dev);
908 kfree(si->tx_buff.head); 943 kfree(si->tx_buff.head);
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index 047394d98ac2..3247828aa203 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -71,6 +71,7 @@ pxa2xx-obj-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx_cs.o
71pxa2xx-obj-$(CONFIG_ARCH_VIPER) += pxa2xx_viper.o 71pxa2xx-obj-$(CONFIG_ARCH_VIPER) += pxa2xx_viper.o
72pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o 72pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o
73pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o 73pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o
74pxa2xx-obj-$(CONFIG_MACH_PALMTC) += pxa2xx_palmtc.o
74pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o 75pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o
75pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o 76pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o
76pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o 77pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index c49a7269f6d1..87e22ef8eb02 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -300,25 +300,29 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
300 return soc_common_drv_pcmcia_remove(&dev->dev); 300 return soc_common_drv_pcmcia_remove(&dev->dev);
301} 301}
302 302
303static int pxa2xx_drv_pcmcia_suspend(struct platform_device *dev, pm_message_t state) 303static int pxa2xx_drv_pcmcia_suspend(struct device *dev)
304{ 304{
305 return pcmcia_socket_dev_suspend(&dev->dev, state); 305 return pcmcia_socket_dev_suspend(dev, PMSG_SUSPEND);
306} 306}
307 307
308static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev) 308static int pxa2xx_drv_pcmcia_resume(struct device *dev)
309{ 309{
310 pxa2xx_configure_sockets(&dev->dev); 310 pxa2xx_configure_sockets(dev);
311 return pcmcia_socket_dev_resume(&dev->dev); 311 return pcmcia_socket_dev_resume(dev);
312} 312}
313 313
314static struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = {
315 .suspend = pxa2xx_drv_pcmcia_suspend,
316 .resume = pxa2xx_drv_pcmcia_resume,
317};
318
314static struct platform_driver pxa2xx_pcmcia_driver = { 319static struct platform_driver pxa2xx_pcmcia_driver = {
315 .probe = pxa2xx_drv_pcmcia_probe, 320 .probe = pxa2xx_drv_pcmcia_probe,
316 .remove = pxa2xx_drv_pcmcia_remove, 321 .remove = pxa2xx_drv_pcmcia_remove,
317 .suspend = pxa2xx_drv_pcmcia_suspend,
318 .resume = pxa2xx_drv_pcmcia_resume,
319 .driver = { 322 .driver = {
320 .name = "pxa2xx-pcmcia", 323 .name = "pxa2xx-pcmcia",
321 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
325 .pm = &pxa2xx_drv_pcmcia_pm_ops,
322 }, 326 },
323}; 327};
324 328
diff --git a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c
new file mode 100644
index 000000000000..3a8993ed5621
--- /dev/null
+++ b/drivers/pcmcia/pxa2xx_palmtc.c
@@ -0,0 +1,230 @@
1/*
2 * linux/drivers/pcmcia/pxa2xx_palmtc.c
3 *
4 * Driver for Palm Tungsten|C PCMCIA
5 *
6 * Copyright (C) 2008 Alex Osborne <ato@meshy.org>
7 * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <linux/gpio.h>
18#include <linux/delay.h>
19
20#include <asm/mach-types.h>
21#include <mach/palmtc.h>
22#include "soc_common.h"
23
24static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
25{
26 int ret;
27
28 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1");
29 if (ret)
30 goto err1;
31 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0);
32 if (ret)
33 goto err2;
34
35 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2");
36 if (ret)
37 goto err2;
38 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0);
39 if (ret)
40 goto err3;
41
42 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3");
43 if (ret)
44 goto err3;
45 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0);
46 if (ret)
47 goto err4;
48
49 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST");
50 if (ret)
51 goto err4;
52 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1);
53 if (ret)
54 goto err5;
55
56 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY");
57 if (ret)
58 goto err5;
59 ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY);
60 if (ret)
61 goto err6;
62
63 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY");
64 if (ret)
65 goto err6;
66 ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
67 if (ret)
68 goto err7;
69
70 skt->irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY);
71 return 0;
72
73err7:
74 gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
75err6:
76 gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);
77err5:
78 gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);
79err4:
80 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);
81err3:
82 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);
83err2:
84 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);
85err1:
86 return ret;
87}
88
89static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
90{
91 gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
92 gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);
93 gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);
94 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);
95 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);
96 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);
97}
98
99static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
100 struct pcmcia_state *state)
101{
102 state->detect = 1; /* always inserted */
103 state->ready = !!gpio_get_value(GPIO_NR_PALMTC_PCMCIA_READY);
104 state->bvd1 = 1;
105 state->bvd2 = 1;
106 state->wrprot = 0;
107 state->vs_3v = 1;
108 state->vs_Xv = 0;
109}
110
111static int palmtc_wifi_powerdown(void)
112{
113 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_RESET, 1);
114 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER2, 0);
115 mdelay(40);
116 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER1, 0);
117 return 0;
118}
119
120static int palmtc_wifi_powerup(void)
121{
122 int timeout = 50;
123
124 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER3, 1);
125 mdelay(50);
126
127 /* Power up the card, 1.8V first, after a while 3.3V */
128 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER1, 1);
129 mdelay(100);
130 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER2, 1);
131
132 /* Wait till the card is ready */
133 while (!gpio_get_value(GPIO_NR_PALMTC_PCMCIA_PWRREADY) &&
134 timeout) {
135 mdelay(1);
136 timeout--;
137 }
138
139 /* Power down the WiFi in case of error */
140 if (!timeout) {
141 palmtc_wifi_powerdown();
142 return 1;
143 }
144
145 /* Reset the card */
146 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_RESET, 1);
147 mdelay(20);
148 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_RESET, 0);
149 mdelay(25);
150
151 gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER3, 0);
152
153 return 0;
154}
155
156static int palmtc_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
157 const socket_state_t *state)
158{
159 int ret = 1;
160
161 if (state->Vcc == 0)
162 ret = palmtc_wifi_powerdown();
163 else if (state->Vcc == 33)
164 ret = palmtc_wifi_powerup();
165
166 return ret;
167}
168
169static void palmtc_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
170{
171}
172
173static void palmtc_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
174{
175}
176
177static struct pcmcia_low_level palmtc_pcmcia_ops = {
178 .owner = THIS_MODULE,
179
180 .first = 0,
181 .nr = 1,
182
183 .hw_init = palmtc_pcmcia_hw_init,
184 .hw_shutdown = palmtc_pcmcia_hw_shutdown,
185
186 .socket_state = palmtc_pcmcia_socket_state,
187 .configure_socket = palmtc_pcmcia_configure_socket,
188
189 .socket_init = palmtc_pcmcia_socket_init,
190 .socket_suspend = palmtc_pcmcia_socket_suspend,
191};
192
193static struct platform_device *palmtc_pcmcia_device;
194
195static int __init palmtc_pcmcia_init(void)
196{
197 int ret;
198
199 if (!machine_is_palmtc())
200 return -ENODEV;
201
202 palmtc_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
203 if (!palmtc_pcmcia_device)
204 return -ENOMEM;
205
206 ret = platform_device_add_data(palmtc_pcmcia_device, &palmtc_pcmcia_ops,
207 sizeof(palmtc_pcmcia_ops));
208
209 if (!ret)
210 ret = platform_device_add(palmtc_pcmcia_device);
211
212 if (ret)
213 platform_device_put(palmtc_pcmcia_device);
214
215 return ret;
216}
217
218static void __exit palmtc_pcmcia_exit(void)
219{
220 platform_device_unregister(palmtc_pcmcia_device);
221}
222
223module_init(palmtc_pcmcia_init);
224module_exit(palmtc_pcmcia_exit);
225
226MODULE_AUTHOR("Alex Osborne <ato@meshy.org>,"
227 " Marek Vasut <marek.vasut@gmail.com>");
228MODULE_DESCRIPTION("PCMCIA support for Palm Tungsten|C");
229MODULE_ALIAS("platform:pxa2xx-pcmcia");
230MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index bb8cc05605ac..747ca194fad4 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -438,34 +438,37 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev)
438} 438}
439 439
440#ifdef CONFIG_PM 440#ifdef CONFIG_PM
441static int pxa_rtc_suspend(struct platform_device *pdev, pm_message_t state) 441static int pxa_rtc_suspend(struct device *dev)
442{ 442{
443 struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); 443 struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev);
444 444
445 if (device_may_wakeup(&pdev->dev)) 445 if (device_may_wakeup(dev))
446 enable_irq_wake(pxa_rtc->irq_Alrm); 446 enable_irq_wake(pxa_rtc->irq_Alrm);
447 return 0; 447 return 0;
448} 448}
449 449
450static int pxa_rtc_resume(struct platform_device *pdev) 450static int pxa_rtc_resume(struct device *dev)
451{ 451{
452 struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); 452 struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev);
453 453
454 if (device_may_wakeup(&pdev->dev)) 454 if (device_may_wakeup(dev))
455 disable_irq_wake(pxa_rtc->irq_Alrm); 455 disable_irq_wake(pxa_rtc->irq_Alrm);
456 return 0; 456 return 0;
457} 457}
458#else 458
459#define pxa_rtc_suspend NULL 459static struct dev_pm_ops pxa_rtc_pm_ops = {
460#define pxa_rtc_resume NULL 460 .suspend = pxa_rtc_suspend,
461 .resume = pxa_rtc_resume,
462};
461#endif 463#endif
462 464
463static struct platform_driver pxa_rtc_driver = { 465static struct platform_driver pxa_rtc_driver = {
464 .remove = __exit_p(pxa_rtc_remove), 466 .remove = __exit_p(pxa_rtc_remove),
465 .suspend = pxa_rtc_suspend,
466 .resume = pxa_rtc_resume,
467 .driver = { 467 .driver = {
468 .name = "pxa-rtc", 468 .name = "pxa-rtc",
469#ifdef CONFIG_PM
470 .pm = &pxa_rtc_pm_ops,
471#endif
469 }, 472 },
470}; 473};
471 474
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 021b2928f0b9..29f98a70586e 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -393,31 +393,34 @@ static int sa1100_rtc_remove(struct platform_device *pdev)
393} 393}
394 394
395#ifdef CONFIG_PM 395#ifdef CONFIG_PM
396static int sa1100_rtc_suspend(struct platform_device *pdev, pm_message_t state) 396static int sa1100_rtc_suspend(struct device *dev)
397{ 397{
398 if (device_may_wakeup(&pdev->dev)) 398 if (device_may_wakeup(dev))
399 enable_irq_wake(IRQ_RTCAlrm); 399 enable_irq_wake(IRQ_RTCAlrm);
400 return 0; 400 return 0;
401} 401}
402 402
403static int sa1100_rtc_resume(struct platform_device *pdev) 403static int sa1100_rtc_resume(struct device *dev)
404{ 404{
405 if (device_may_wakeup(&pdev->dev)) 405 if (device_may_wakeup(dev))
406 disable_irq_wake(IRQ_RTCAlrm); 406 disable_irq_wake(IRQ_RTCAlrm);
407 return 0; 407 return 0;
408} 408}
409#else 409
410#define sa1100_rtc_suspend NULL 410static struct dev_pm_ops sa1100_rtc_pm_ops = {
411#define sa1100_rtc_resume NULL 411 .suspend = sa1100_rtc_suspend,
412 .resume = sa1100_rtc_resume,
413};
412#endif 414#endif
413 415
414static struct platform_driver sa1100_rtc_driver = { 416static struct platform_driver sa1100_rtc_driver = {
415 .probe = sa1100_rtc_probe, 417 .probe = sa1100_rtc_probe,
416 .remove = sa1100_rtc_remove, 418 .remove = sa1100_rtc_remove,
417 .suspend = sa1100_rtc_suspend,
418 .resume = sa1100_rtc_resume,
419 .driver = { 419 .driver = {
420 .name = "sa1100-rtc", 420 .name = "sa1100-rtc",
421#ifdef CONFIG_PM
422 .pm = &sa1100_rtc_pm_ops,
423#endif
421 }, 424 },
422}; 425};
423 426
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 6443b7ff274a..b8629d74f6a2 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -726,9 +726,10 @@ static struct uart_driver serial_pxa_reg = {
726 .cons = PXA_CONSOLE, 726 .cons = PXA_CONSOLE,
727}; 727};
728 728
729static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) 729#ifdef CONFIG_PM
730static int serial_pxa_suspend(struct device *dev)
730{ 731{
731 struct uart_pxa_port *sport = platform_get_drvdata(dev); 732 struct uart_pxa_port *sport = dev_get_drvdata(dev);
732 733
733 if (sport) 734 if (sport)
734 uart_suspend_port(&serial_pxa_reg, &sport->port); 735 uart_suspend_port(&serial_pxa_reg, &sport->port);
@@ -736,9 +737,9 @@ static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
736 return 0; 737 return 0;
737} 738}
738 739
739static int serial_pxa_resume(struct platform_device *dev) 740static int serial_pxa_resume(struct device *dev)
740{ 741{
741 struct uart_pxa_port *sport = platform_get_drvdata(dev); 742 struct uart_pxa_port *sport = dev_get_drvdata(dev);
742 743
743 if (sport) 744 if (sport)
744 uart_resume_port(&serial_pxa_reg, &sport->port); 745 uart_resume_port(&serial_pxa_reg, &sport->port);
@@ -746,6 +747,12 @@ static int serial_pxa_resume(struct platform_device *dev)
746 return 0; 747 return 0;
747} 748}
748 749
750static struct dev_pm_ops serial_pxa_pm_ops = {
751 .suspend = serial_pxa_suspend,
752 .resume = serial_pxa_resume,
753};
754#endif
755
749static int serial_pxa_probe(struct platform_device *dev) 756static int serial_pxa_probe(struct platform_device *dev)
750{ 757{
751 struct uart_pxa_port *sport; 758 struct uart_pxa_port *sport;
@@ -825,11 +832,12 @@ static struct platform_driver serial_pxa_driver = {
825 .probe = serial_pxa_probe, 832 .probe = serial_pxa_probe,
826 .remove = serial_pxa_remove, 833 .remove = serial_pxa_remove,
827 834
828 .suspend = serial_pxa_suspend,
829 .resume = serial_pxa_resume,
830 .driver = { 835 .driver = {
831 .name = "pxa2xx-uart", 836 .name = "pxa2xx-uart",
832 .owner = THIS_MODULE, 837 .owner = THIS_MODULE,
838#ifdef CONFIG_PM
839 .pm = &serial_pxa_pm_ops,
840#endif
833 }, 841 },
834}; 842};
835 843
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index c0f950a7cbec..958a3ffc8987 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -532,7 +532,7 @@ static void restore_state(struct pl022 *pl022)
532 GEN_MASK_BITS(SSP_DATA_BITS_12, SSP_CR0_MASK_DSS, 0) | \ 532 GEN_MASK_BITS(SSP_DATA_BITS_12, SSP_CR0_MASK_DSS, 0) | \
533 GEN_MASK_BITS(SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, SSP_CR0_MASK_HALFDUP, 5) | \ 533 GEN_MASK_BITS(SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, SSP_CR0_MASK_HALFDUP, 5) | \
534 GEN_MASK_BITS(SSP_CLK_POL_IDLE_LOW, SSP_CR0_MASK_SPO, 6) | \ 534 GEN_MASK_BITS(SSP_CLK_POL_IDLE_LOW, SSP_CR0_MASK_SPO, 6) | \
535 GEN_MASK_BITS(SSP_CLK_FALLING_EDGE, SSP_CR0_MASK_SPH, 7) | \ 535 GEN_MASK_BITS(SSP_CLK_SECOND_EDGE, SSP_CR0_MASK_SPH, 7) | \
536 GEN_MASK_BITS(NMDK_SSP_DEFAULT_CLKRATE, SSP_CR0_MASK_SCR, 8) | \ 536 GEN_MASK_BITS(NMDK_SSP_DEFAULT_CLKRATE, SSP_CR0_MASK_SCR, 8) | \
537 GEN_MASK_BITS(SSP_BITS_8, SSP_CR0_MASK_CSS, 16) | \ 537 GEN_MASK_BITS(SSP_BITS_8, SSP_CR0_MASK_CSS, 16) | \
538 GEN_MASK_BITS(SSP_INTERFACE_MOTOROLA_SPI, SSP_CR0_MASK_FRF, 21) \ 538 GEN_MASK_BITS(SSP_INTERFACE_MOTOROLA_SPI, SSP_CR0_MASK_FRF, 21) \
@@ -1247,8 +1247,8 @@ static int verify_controller_parameters(struct pl022 *pl022,
1247 return -EINVAL; 1247 return -EINVAL;
1248 } 1248 }
1249 if (chip_info->iface == SSP_INTERFACE_MOTOROLA_SPI) { 1249 if (chip_info->iface == SSP_INTERFACE_MOTOROLA_SPI) {
1250 if ((chip_info->clk_phase != SSP_CLK_RISING_EDGE) 1250 if ((chip_info->clk_phase != SSP_CLK_FIRST_EDGE)
1251 && (chip_info->clk_phase != SSP_CLK_FALLING_EDGE)) { 1251 && (chip_info->clk_phase != SSP_CLK_SECOND_EDGE)) {
1252 dev_err(chip_info->dev, 1252 dev_err(chip_info->dev,
1253 "Clock Phase is configured incorrectly\n"); 1253 "Clock Phase is configured incorrectly\n");
1254 return -EINVAL; 1254 return -EINVAL;
@@ -1485,7 +1485,7 @@ static int pl022_setup(struct spi_device *spi)
1485 chip_info->data_size = SSP_DATA_BITS_12; 1485 chip_info->data_size = SSP_DATA_BITS_12;
1486 chip_info->rx_lev_trig = SSP_RX_1_OR_MORE_ELEM; 1486 chip_info->rx_lev_trig = SSP_RX_1_OR_MORE_ELEM;
1487 chip_info->tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC; 1487 chip_info->tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC;
1488 chip_info->clk_phase = SSP_CLK_FALLING_EDGE; 1488 chip_info->clk_phase = SSP_CLK_SECOND_EDGE;
1489 chip_info->clk_pol = SSP_CLK_POL_IDLE_LOW; 1489 chip_info->clk_pol = SSP_CLK_POL_IDLE_LOW;
1490 chip_info->ctrl_len = SSP_BITS_8; 1490 chip_info->ctrl_len = SSP_BITS_8;
1491 chip_info->wait_state = SSP_MWIRE_WAIT_ZERO; 1491 chip_info->wait_state = SSP_MWIRE_WAIT_ZERO;
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 31dd56f0dae9..c8c2b693ffac 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1668,10 +1668,9 @@ static void pxa2xx_spi_shutdown(struct platform_device *pdev)
1668} 1668}
1669 1669
1670#ifdef CONFIG_PM 1670#ifdef CONFIG_PM
1671 1671static int pxa2xx_spi_suspend(struct device *dev)
1672static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
1673{ 1672{
1674 struct driver_data *drv_data = platform_get_drvdata(pdev); 1673 struct driver_data *drv_data = dev_get_drvdata(dev);
1675 struct ssp_device *ssp = drv_data->ssp; 1674 struct ssp_device *ssp = drv_data->ssp;
1676 int status = 0; 1675 int status = 0;
1677 1676
@@ -1684,9 +1683,9 @@ static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
1684 return 0; 1683 return 0;
1685} 1684}
1686 1685
1687static int pxa2xx_spi_resume(struct platform_device *pdev) 1686static int pxa2xx_spi_resume(struct device *dev)
1688{ 1687{
1689 struct driver_data *drv_data = platform_get_drvdata(pdev); 1688 struct driver_data *drv_data = dev_get_drvdata(dev);
1690 struct ssp_device *ssp = drv_data->ssp; 1689 struct ssp_device *ssp = drv_data->ssp;
1691 int status = 0; 1690 int status = 0;
1692 1691
@@ -1703,26 +1702,29 @@ static int pxa2xx_spi_resume(struct platform_device *pdev)
1703 /* Start the queue running */ 1702 /* Start the queue running */
1704 status = start_queue(drv_data); 1703 status = start_queue(drv_data);
1705 if (status != 0) { 1704 if (status != 0) {
1706 dev_err(&pdev->dev, "problem starting queue (%d)\n", status); 1705 dev_err(dev, "problem starting queue (%d)\n", status);
1707 return status; 1706 return status;
1708 } 1707 }
1709 1708
1710 return 0; 1709 return 0;
1711} 1710}
1712#else 1711
1713#define pxa2xx_spi_suspend NULL 1712static struct dev_pm_ops pxa2xx_spi_pm_ops = {
1714#define pxa2xx_spi_resume NULL 1713 .suspend = pxa2xx_spi_suspend,
1715#endif /* CONFIG_PM */ 1714 .resume = pxa2xx_spi_resume,
1715};
1716#endif
1716 1717
1717static struct platform_driver driver = { 1718static struct platform_driver driver = {
1718 .driver = { 1719 .driver = {
1719 .name = "pxa2xx-spi", 1720 .name = "pxa2xx-spi",
1720 .owner = THIS_MODULE, 1721 .owner = THIS_MODULE,
1722#ifdef CONFIG_PM
1723 .pm = &pxa2xx_spi_pm_ops,
1724#endif
1721 }, 1725 },
1722 .remove = pxa2xx_spi_remove, 1726 .remove = pxa2xx_spi_remove,
1723 .shutdown = pxa2xx_spi_shutdown, 1727 .shutdown = pxa2xx_spi_shutdown,
1724 .suspend = pxa2xx_spi_suspend,
1725 .resume = pxa2xx_spi_resume,
1726}; 1728};
1727 1729
1728static int __init pxa2xx_spi_init(void) 1730static int __init pxa2xx_spi_init(void)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index b5294a9344de..f1c06202fdf2 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -481,38 +481,47 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
481 return 0; 481 return 0;
482} 482}
483 483
484#ifdef CONFIG_PM 484#ifdef CONFIG_PM
485static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) 485static int ohci_hcd_pxa27x_drv_suspend(struct device *dev)
486{ 486{
487 struct usb_hcd *hcd = platform_get_drvdata(pdev); 487 struct usb_hcd *hcd = dev_get_drvdata(dev);
488 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); 488 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
489 489
490 if (time_before(jiffies, ohci->ohci.next_statechange)) 490 if (time_before(jiffies, ohci->ohci.next_statechange))
491 msleep(5); 491 msleep(5);
492 ohci->ohci.next_statechange = jiffies; 492 ohci->ohci.next_statechange = jiffies;
493 493
494 pxa27x_stop_hc(ohci, &pdev->dev); 494 pxa27x_stop_hc(ohci, dev);
495 hcd->state = HC_STATE_SUSPENDED; 495 hcd->state = HC_STATE_SUSPENDED;
496 496
497 return 0; 497 return 0;
498} 498}
499 499
500static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) 500static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
501{ 501{
502 struct usb_hcd *hcd = platform_get_drvdata(pdev); 502 struct usb_hcd *hcd = dev_get_drvdata(dev);
503 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); 503 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
504 struct pxaohci_platform_data *inf = dev->platform_data;
504 int status; 505 int status;
505 506
506 if (time_before(jiffies, ohci->ohci.next_statechange)) 507 if (time_before(jiffies, ohci->ohci.next_statechange))
507 msleep(5); 508 msleep(5);
508 ohci->ohci.next_statechange = jiffies; 509 ohci->ohci.next_statechange = jiffies;
509 510
510 if ((status = pxa27x_start_hc(ohci, &pdev->dev)) < 0) 511 if ((status = pxa27x_start_hc(ohci, dev)) < 0)
511 return status; 512 return status;
512 513
514 /* Select Power Management Mode */
515 pxa27x_ohci_select_pmm(ohci, inf->port_mode);
516
513 ohci_finish_controller_resume(hcd); 517 ohci_finish_controller_resume(hcd);
514 return 0; 518 return 0;
515} 519}
520
521static struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = {
522 .suspend = ohci_hcd_pxa27x_drv_suspend,
523 .resume = ohci_hcd_pxa27x_drv_resume,
524};
516#endif 525#endif
517 526
518/* work with hotplug and coldplug */ 527/* work with hotplug and coldplug */
@@ -522,13 +531,12 @@ static struct platform_driver ohci_hcd_pxa27x_driver = {
522 .probe = ohci_hcd_pxa27x_drv_probe, 531 .probe = ohci_hcd_pxa27x_drv_probe,
523 .remove = ohci_hcd_pxa27x_drv_remove, 532 .remove = ohci_hcd_pxa27x_drv_remove,
524 .shutdown = usb_hcd_platform_shutdown, 533 .shutdown = usb_hcd_platform_shutdown,
525#ifdef CONFIG_PM
526 .suspend = ohci_hcd_pxa27x_drv_suspend,
527 .resume = ohci_hcd_pxa27x_drv_resume,
528#endif
529 .driver = { 534 .driver = {
530 .name = "pxa27x-ohci", 535 .name = "pxa27x-ohci",
531 .owner = THIS_MODULE, 536 .owner = THIS_MODULE,
537#ifdef CONFIG_PM
538 .pm = &ohci_hcd_pxa27x_pm_ops,
539#endif
532 }, 540 },
533}; 541};
534 542
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c
index 93bb4340cc64..701a1081e199 100644
--- a/drivers/video/backlight/da903x_bl.c
+++ b/drivers/video/backlight/da903x_bl.c
@@ -154,34 +154,38 @@ static int da903x_backlight_remove(struct platform_device *pdev)
154} 154}
155 155
156#ifdef CONFIG_PM 156#ifdef CONFIG_PM
157static int da903x_backlight_suspend(struct platform_device *pdev, 157static int da903x_backlight_suspend(struct device *dev)
158 pm_message_t state)
159{ 158{
159 struct platform_device *pdev = to_platform_device(dev);
160 struct backlight_device *bl = platform_get_drvdata(pdev); 160 struct backlight_device *bl = platform_get_drvdata(pdev);
161 return da903x_backlight_set(bl, 0); 161 return da903x_backlight_set(bl, 0);
162} 162}
163 163
164static int da903x_backlight_resume(struct platform_device *pdev) 164static int da903x_backlight_resume(struct device *dev)
165{ 165{
166 struct platform_device *pdev = to_platform_device(dev);
166 struct backlight_device *bl = platform_get_drvdata(pdev); 167 struct backlight_device *bl = platform_get_drvdata(pdev);
167 168
168 backlight_update_status(bl); 169 backlight_update_status(bl);
169 return 0; 170 return 0;
170} 171}
171#else 172
172#define da903x_backlight_suspend NULL 173static struct dev_pm_ops da903x_backlight_pm_ops = {
173#define da903x_backlight_resume NULL 174 .suspend = da903x_backlight_suspend,
175 .resume = da903x_backlight_resume,
176};
174#endif 177#endif
175 178
176static struct platform_driver da903x_backlight_driver = { 179static struct platform_driver da903x_backlight_driver = {
177 .driver = { 180 .driver = {
178 .name = "da903x-backlight", 181 .name = "da903x-backlight",
179 .owner = THIS_MODULE, 182 .owner = THIS_MODULE,
183#ifdef CONFIG_PM
184 .pm = &da903x_backlight_pm_ops,
185#endif
180 }, 186 },
181 .probe = da903x_backlight_probe, 187 .probe = da903x_backlight_probe,
182 .remove = da903x_backlight_remove, 188 .remove = da903x_backlight_remove,
183 .suspend = da903x_backlight_suspend,
184 .resume = da903x_backlight_resume,
185}; 189};
186 190
187static int __init da903x_backlight_init(void) 191static int __init da903x_backlight_init(void)
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 6506117c134b..1820c4a24434 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1638,24 +1638,26 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
1638 * Power management hooks. Note that we won't be called from IRQ context, 1638 * Power management hooks. Note that we won't be called from IRQ context,
1639 * unlike the blank functions above, so we may sleep. 1639 * unlike the blank functions above, so we may sleep.
1640 */ 1640 */
1641static int pxafb_suspend(struct platform_device *dev, pm_message_t state) 1641static int pxafb_suspend(struct device *dev)
1642{ 1642{
1643 struct pxafb_info *fbi = platform_get_drvdata(dev); 1643 struct pxafb_info *fbi = dev_get_drvdata(dev);
1644 1644
1645 set_ctrlr_state(fbi, C_DISABLE_PM); 1645 set_ctrlr_state(fbi, C_DISABLE_PM);
1646 return 0; 1646 return 0;
1647} 1647}
1648 1648
1649static int pxafb_resume(struct platform_device *dev) 1649static int pxafb_resume(struct device *dev)
1650{ 1650{
1651 struct pxafb_info *fbi = platform_get_drvdata(dev); 1651 struct pxafb_info *fbi = dev_get_drvdata(dev);
1652 1652
1653 set_ctrlr_state(fbi, C_ENABLE_PM); 1653 set_ctrlr_state(fbi, C_ENABLE_PM);
1654 return 0; 1654 return 0;
1655} 1655}
1656#else 1656
1657#define pxafb_suspend NULL 1657static struct dev_pm_ops pxafb_pm_ops = {
1658#define pxafb_resume NULL 1658 .suspend = pxafb_suspend,
1659 .resume = pxafb_resume,
1660};
1659#endif 1661#endif
1660 1662
1661static int __devinit pxafb_init_video_memory(struct pxafb_info *fbi) 1663static int __devinit pxafb_init_video_memory(struct pxafb_info *fbi)
@@ -2081,6 +2083,9 @@ static int __devinit pxafb_probe(struct platform_device *dev)
2081 goto failed; 2083 goto failed;
2082 } 2084 }
2083 2085
2086 if (cpu_is_pxa3xx() && inf->acceleration_enabled)
2087 fbi->fb.fix.accel = FB_ACCEL_PXA3XX;
2088
2084 fbi->backlight_power = inf->pxafb_backlight_power; 2089 fbi->backlight_power = inf->pxafb_backlight_power;
2085 fbi->lcd_power = inf->pxafb_lcd_power; 2090 fbi->lcd_power = inf->pxafb_lcd_power;
2086 2091
@@ -2091,14 +2096,14 @@ static int __devinit pxafb_probe(struct platform_device *dev)
2091 goto failed_fbi; 2096 goto failed_fbi;
2092 } 2097 }
2093 2098
2094 r = request_mem_region(r->start, r->end - r->start + 1, dev->name); 2099 r = request_mem_region(r->start, resource_size(r), dev->name);
2095 if (r == NULL) { 2100 if (r == NULL) {
2096 dev_err(&dev->dev, "failed to request I/O memory\n"); 2101 dev_err(&dev->dev, "failed to request I/O memory\n");
2097 ret = -EBUSY; 2102 ret = -EBUSY;
2098 goto failed_fbi; 2103 goto failed_fbi;
2099 } 2104 }
2100 2105
2101 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); 2106 fbi->mmio_base = ioremap(r->start, resource_size(r));
2102 if (fbi->mmio_base == NULL) { 2107 if (fbi->mmio_base == NULL) {
2103 dev_err(&dev->dev, "failed to map I/O memory\n"); 2108 dev_err(&dev->dev, "failed to map I/O memory\n");
2104 ret = -EBUSY; 2109 ret = -EBUSY;
@@ -2197,7 +2202,7 @@ failed_free_dma:
2197failed_free_io: 2202failed_free_io:
2198 iounmap(fbi->mmio_base); 2203 iounmap(fbi->mmio_base);
2199failed_free_res: 2204failed_free_res:
2200 release_mem_region(r->start, r->end - r->start + 1); 2205 release_mem_region(r->start, resource_size(r));
2201failed_fbi: 2206failed_fbi:
2202 clk_put(fbi->clk); 2207 clk_put(fbi->clk);
2203 platform_set_drvdata(dev, NULL); 2208 platform_set_drvdata(dev, NULL);
@@ -2237,7 +2242,7 @@ static int __devexit pxafb_remove(struct platform_device *dev)
2237 iounmap(fbi->mmio_base); 2242 iounmap(fbi->mmio_base);
2238 2243
2239 r = platform_get_resource(dev, IORESOURCE_MEM, 0); 2244 r = platform_get_resource(dev, IORESOURCE_MEM, 0);
2240 release_mem_region(r->start, r->end - r->start + 1); 2245 release_mem_region(r->start, resource_size(r));
2241 2246
2242 clk_put(fbi->clk); 2247 clk_put(fbi->clk);
2243 kfree(fbi); 2248 kfree(fbi);
@@ -2248,11 +2253,12 @@ static int __devexit pxafb_remove(struct platform_device *dev)
2248static struct platform_driver pxafb_driver = { 2253static struct platform_driver pxafb_driver = {
2249 .probe = pxafb_probe, 2254 .probe = pxafb_probe,
2250 .remove = __devexit_p(pxafb_remove), 2255 .remove = __devexit_p(pxafb_remove),
2251 .suspend = pxafb_suspend,
2252 .resume = pxafb_resume,
2253 .driver = { 2256 .driver = {
2254 .owner = THIS_MODULE, 2257 .owner = THIS_MODULE,
2255 .name = "pxa2xx-fb", 2258 .name = "pxa2xx-fb",
2259#ifdef CONFIG_PM
2260 .pm = &pxafb_pm_ops,
2261#endif
2256 }, 2262 },
2257}; 2263};
2258 2264