diff options
-rw-r--r-- | arch/arm/common/sa1111.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index fb0a0a4dfea4..2e076c492005 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
@@ -472,8 +472,8 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base) | |||
472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. | 472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. |
473 | */ | 473 | */ |
474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); | 474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); |
475 | sa1111_writel(SA1111_IRQMASK_HI(IRQ_S0_READY_NINT) | | 475 | sa1111_writel(BIT(IRQ_S0_READY_NINT & 31) | |
476 | SA1111_IRQMASK_HI(IRQ_S1_READY_NINT), | 476 | BIT(IRQ_S1_READY_NINT & 31), |
477 | irqbase + SA1111_INTPOL1); | 477 | irqbase + SA1111_INTPOL1); |
478 | 478 | ||
479 | /* clear all IRQs */ | 479 | /* clear all IRQs */ |
@@ -754,7 +754,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
754 | if (sachip->irq != NO_IRQ) { | 754 | if (sachip->irq != NO_IRQ) { |
755 | ret = sa1111_setup_irq(sachip, pd->irq_base); | 755 | ret = sa1111_setup_irq(sachip, pd->irq_base); |
756 | if (ret) | 756 | if (ret) |
757 | goto err_unmap; | 757 | goto err_clk; |
758 | } | 758 | } |
759 | 759 | ||
760 | #ifdef CONFIG_ARCH_SA1100 | 760 | #ifdef CONFIG_ARCH_SA1100 |
@@ -799,6 +799,8 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
799 | 799 | ||
800 | return 0; | 800 | return 0; |
801 | 801 | ||
802 | err_clk: | ||
803 | clk_disable(sachip->clk); | ||
802 | err_unmap: | 804 | err_unmap: |
803 | iounmap(sachip->base); | 805 | iounmap(sachip->base); |
804 | err_clk_unprep: | 806 | err_clk_unprep: |
@@ -869,9 +871,9 @@ struct sa1111_save_data { | |||
869 | 871 | ||
870 | #ifdef CONFIG_PM | 872 | #ifdef CONFIG_PM |
871 | 873 | ||
872 | static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | 874 | static int sa1111_suspend_noirq(struct device *dev) |
873 | { | 875 | { |
874 | struct sa1111 *sachip = platform_get_drvdata(dev); | 876 | struct sa1111 *sachip = dev_get_drvdata(dev); |
875 | struct sa1111_save_data *save; | 877 | struct sa1111_save_data *save; |
876 | unsigned long flags; | 878 | unsigned long flags; |
877 | unsigned int val; | 879 | unsigned int val; |
@@ -934,9 +936,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | |||
934 | * restored by their respective drivers, and must be called | 936 | * restored by their respective drivers, and must be called |
935 | * via LDM after this function. | 937 | * via LDM after this function. |
936 | */ | 938 | */ |
937 | static int sa1111_resume(struct platform_device *dev) | 939 | static int sa1111_resume_noirq(struct device *dev) |
938 | { | 940 | { |
939 | struct sa1111 *sachip = platform_get_drvdata(dev); | 941 | struct sa1111 *sachip = dev_get_drvdata(dev); |
940 | struct sa1111_save_data *save; | 942 | struct sa1111_save_data *save; |
941 | unsigned long flags, id; | 943 | unsigned long flags, id; |
942 | void __iomem *base; | 944 | void __iomem *base; |
@@ -952,7 +954,7 @@ static int sa1111_resume(struct platform_device *dev) | |||
952 | id = sa1111_readl(sachip->base + SA1111_SKID); | 954 | id = sa1111_readl(sachip->base + SA1111_SKID); |
953 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { | 955 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { |
954 | __sa1111_remove(sachip); | 956 | __sa1111_remove(sachip); |
955 | platform_set_drvdata(dev, NULL); | 957 | dev_set_drvdata(dev, NULL); |
956 | kfree(save); | 958 | kfree(save); |
957 | return 0; | 959 | return 0; |
958 | } | 960 | } |
@@ -1003,8 +1005,8 @@ static int sa1111_resume(struct platform_device *dev) | |||
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | #else | 1007 | #else |
1006 | #define sa1111_suspend NULL | 1008 | #define sa1111_suspend_noirq NULL |
1007 | #define sa1111_resume NULL | 1009 | #define sa1111_resume_noirq NULL |
1008 | #endif | 1010 | #endif |
1009 | 1011 | ||
1010 | static int sa1111_probe(struct platform_device *pdev) | 1012 | static int sa1111_probe(struct platform_device *pdev) |
@@ -1017,7 +1019,7 @@ static int sa1111_probe(struct platform_device *pdev) | |||
1017 | return -EINVAL; | 1019 | return -EINVAL; |
1018 | irq = platform_get_irq(pdev, 0); | 1020 | irq = platform_get_irq(pdev, 0); |
1019 | if (irq < 0) | 1021 | if (irq < 0) |
1020 | return -ENXIO; | 1022 | return irq; |
1021 | 1023 | ||
1022 | return __sa1111_probe(&pdev->dev, mem, irq); | 1024 | return __sa1111_probe(&pdev->dev, mem, irq); |
1023 | } | 1025 | } |
@@ -1038,6 +1040,11 @@ static int sa1111_remove(struct platform_device *pdev) | |||
1038 | return 0; | 1040 | return 0; |
1039 | } | 1041 | } |
1040 | 1042 | ||
1043 | static struct dev_pm_ops sa1111_pm_ops = { | ||
1044 | .suspend_noirq = sa1111_suspend_noirq, | ||
1045 | .resume_noirq = sa1111_resume_noirq, | ||
1046 | }; | ||
1047 | |||
1041 | /* | 1048 | /* |
1042 | * Not sure if this should be on the system bus or not yet. | 1049 | * Not sure if this should be on the system bus or not yet. |
1043 | * We really want some way to register a system device at | 1050 | * We really want some way to register a system device at |
@@ -1050,10 +1057,9 @@ static int sa1111_remove(struct platform_device *pdev) | |||
1050 | static struct platform_driver sa1111_device_driver = { | 1057 | static struct platform_driver sa1111_device_driver = { |
1051 | .probe = sa1111_probe, | 1058 | .probe = sa1111_probe, |
1052 | .remove = sa1111_remove, | 1059 | .remove = sa1111_remove, |
1053 | .suspend = sa1111_suspend, | ||
1054 | .resume = sa1111_resume, | ||
1055 | .driver = { | 1060 | .driver = { |
1056 | .name = "sa1111", | 1061 | .name = "sa1111", |
1062 | .pm = &sa1111_pm_ops, | ||
1057 | }, | 1063 | }, |
1058 | }; | 1064 | }; |
1059 | 1065 | ||