aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-09-16 15:08:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-09-16 15:08:13 -0400
commitcac4662a88702fc9e405ef19c429de375822d77a (patch)
tree8de362ab63366e281843351a37daf162f10cb888
parent22f6b4d34fcf039c63a94e7670e0da24f8575a5a (diff)
parent1a57c286d8ced1e4144c6201a19bbb70827edee6 (diff)
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: "Most of this update are fixes primarily discovered from testing on the older StrongARM 1110 and PXA systems, as a result of recent interest from several people in these platforms: - Locomo interrupt handling incorrectly stores the handler data in the chip's private data slot: when Locomo is combined with an interrupt controller who's chip uses the chip private data, this leads to an oops. - SA1111 was missing a call to clk_disable() to clean up after a failed probe. - SA1111 and PCMCIA suspend/resume was broken: The PCMCIA "ds" layer was using the legacy bus suspend/resume methods, which the core PM code is no longer calling as a result of device_pm_check_callbacks() introduced in commit aa8e54b559479 ("PM / sleep: Go direct_complete if driver has no callbacks"). SA1111 was broken due to changes to PCMCIA which makes PCMCIA suspend itself later than the SA1111 code expects, and resume before the SA1111 code has initialised access to the pcmcia sub-device. - the default SA1111 interrupt mask polarity got messed up when it was converted to use a dynamic interrupt base number for its interrupts. - fix platform_get_irq() error code propagation, which was causing problems on platforms where the interrupt may not be available at probe time in DT setups. - fix the lack of clock to PCMCIA code on PXA platforms, which was omitted in conversions of PXA to CCF. - fix an oops in the PXA PCMCIA code caused by a previous commit not realising that Lubbock is different from the rest of the PXA PCMCIA drivers. - ensure that SA1111 low-level PCMCIA drivers propagate their error codes to the main probe function, rather than the driver silently accepting a failure. - fix the sa11xx debugfs reporting of timing information, which always indicated zero due to the clock being a factor of 1000 out. - fix the polarity of the status change signal reported from the sockets. Lastly, one ARM specific commit from Stefan Agner fixing the LPAE cache attributes" * 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: pxa/lubbock: add pcmcia clock ARM: locomo: fix locomo irq handling ARM: 8612/1: LPAE: initialize cache policy correctly ARM: sa1111: fix missing clk_disable() ARM: sa1111: fix pcmcia suspend/resume ARM: sa1111: fix pcmcia interrupt mask polarity ARM: sa1111: fix error code propagation in sa1111_probe() pcmcia: lubbock: fix sockets configuration pcmcia: sa1111: fix propagation of lowlevel board init return code pcmcia: soc_common: fix SS_STSCHG polarity pcmcia: sa11xx_base: add units to the timing information pcmcia: sa11xx_base: fix reporting of timing information pcmcia: ds: fix suspend/resume
-rw-r--r--arch/arm/common/locomo.c5
-rw-r--r--arch/arm/common/sa1111.c32
-rw-r--r--arch/arm/include/asm/pgtable-2level-hwdef.h1
-rw-r--r--arch/arm/include/asm/pgtable-3level-hwdef.h1
-rw-r--r--arch/arm/mach-pxa/lubbock.c14
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--drivers/pcmcia/ds.c12
-rw-r--r--drivers/pcmcia/pxa2xx_base.c9
-rw-r--r--drivers/pcmcia/pxa2xx_base.h2
-rw-r--r--drivers/pcmcia/sa1111_badge4.c22
-rw-r--r--drivers/pcmcia/sa1111_generic.c22
-rw-r--r--drivers/pcmcia/sa1111_jornada720.c25
-rw-r--r--drivers/pcmcia/sa1111_lubbock.c32
-rw-r--r--drivers/pcmcia/sa1111_neponset.c26
-rw-r--r--drivers/pcmcia/sa11xx_base.c8
-rw-r--r--drivers/pcmcia/soc_common.c2
16 files changed, 114 insertions, 101 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 0e97b4b871f9..6c7b06854fce 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -140,7 +140,7 @@ static struct locomo_dev_info locomo_devices[] = {
140 140
141static void locomo_handler(struct irq_desc *desc) 141static void locomo_handler(struct irq_desc *desc)
142{ 142{
143 struct locomo *lchip = irq_desc_get_chip_data(desc); 143 struct locomo *lchip = irq_desc_get_handler_data(desc);
144 int req, i; 144 int req, i;
145 145
146 /* Acknowledge the parent IRQ */ 146 /* Acknowledge the parent IRQ */
@@ -200,8 +200,7 @@ static void locomo_setup_irq(struct locomo *lchip)
200 * Install handler for IRQ_LOCOMO_HW. 200 * Install handler for IRQ_LOCOMO_HW.
201 */ 201 */
202 irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); 202 irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);
203 irq_set_chip_data(lchip->irq, lchip); 203 irq_set_chained_handler_and_data(lchip->irq, locomo_handler, lchip);
204 irq_set_chained_handler(lchip->irq, locomo_handler);
205 204
206 /* Install handlers for IRQ_LOCOMO_* */ 205 /* Install handlers for IRQ_LOCOMO_* */
207 for ( ; irq <= lchip->irq_base + 3; irq++) { 206 for ( ; irq <= lchip->irq_base + 3; irq++) {
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
872static int sa1111_suspend(struct platform_device *dev, pm_message_t state) 874static 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 */
937static int sa1111_resume(struct platform_device *dev) 939static 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
1010static int sa1111_probe(struct platform_device *pdev) 1012static 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
1043static 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)
1050static struct platform_driver sa1111_device_driver = { 1057static 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
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h
index d0131ee6f6af..3f82e9da7cec 100644
--- a/arch/arm/include/asm/pgtable-2level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-2level-hwdef.h
@@ -47,6 +47,7 @@
47#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) 47#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
48#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) 48#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
49#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) 49#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
50#define PMD_SECT_CACHE_MASK (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
50#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) 51#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
51 52
52/* 53/*
diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h
index f8f1cff62065..4cd664abfcd3 100644
--- a/arch/arm/include/asm/pgtable-3level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-3level-hwdef.h
@@ -62,6 +62,7 @@
62#define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ 62#define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */
63#define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ 63#define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */
64#define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ 64#define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */
65#define PMD_SECT_CACHE_MASK (_AT(pmdval_t, 7) << 2)
65 66
66/* 67/*
67 * + Level 3 descriptor (PTE) 68 * + Level 3 descriptor (PTE)
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 7245f3359564..d6159f8ef0c2 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -137,6 +137,18 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
137 // no D+ pullup; lubbock can't connect/disconnect in software 137 // no D+ pullup; lubbock can't connect/disconnect in software
138}; 138};
139 139
140static void lubbock_init_pcmcia(void)
141{
142 struct clk *clk;
143
144 /* Add an alias for the SA1111 PCMCIA clock */
145 clk = clk_get_sys("pxa2xx-pcmcia", NULL);
146 if (!IS_ERR(clk)) {
147 clkdev_create(clk, NULL, "1800");
148 clk_put(clk);
149 }
150}
151
140static struct resource sa1111_resources[] = { 152static struct resource sa1111_resources[] = {
141 [0] = { 153 [0] = {
142 .start = 0x10000000, 154 .start = 0x10000000,
@@ -467,6 +479,8 @@ static void __init lubbock_init(void)
467 pxa_set_btuart_info(NULL); 479 pxa_set_btuart_info(NULL);
468 pxa_set_stuart_info(NULL); 480 pxa_set_stuart_info(NULL);
469 481
482 lubbock_init_pcmcia();
483
470 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); 484 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
471 pxa_set_udc_info(&udc_info); 485 pxa_set_udc_info(&udc_info);
472 pxa_set_fb_info(NULL, &sharp_lm8v31); 486 pxa_set_fb_info(NULL, &sharp_lm8v31);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 6344913f0804..30fe03f95c85 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -137,7 +137,7 @@ void __init init_default_cache_policy(unsigned long pmd)
137 137
138 initial_pmd_value = pmd; 138 initial_pmd_value = pmd;
139 139
140 pmd &= PMD_SECT_TEX(1) | PMD_SECT_BUFFERABLE | PMD_SECT_CACHEABLE; 140 pmd &= PMD_SECT_CACHE_MASK;
141 141
142 for (i = 0; i < ARRAY_SIZE(cache_policies); i++) 142 for (i = 0; i < ARRAY_SIZE(cache_policies); i++)
143 if (cache_policies[i].pmd == pmd) { 143 if (cache_policies[i].pmd == pmd) {
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 489ea1098c96..69b5e811ea2b 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -977,7 +977,7 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
977 977
978/************************ runtime PM support ***************************/ 978/************************ runtime PM support ***************************/
979 979
980static int pcmcia_dev_suspend(struct device *dev, pm_message_t state); 980static int pcmcia_dev_suspend(struct device *dev);
981static int pcmcia_dev_resume(struct device *dev); 981static int pcmcia_dev_resume(struct device *dev);
982 982
983static int runtime_suspend(struct device *dev) 983static int runtime_suspend(struct device *dev)
@@ -985,7 +985,7 @@ static int runtime_suspend(struct device *dev)
985 int rc; 985 int rc;
986 986
987 device_lock(dev); 987 device_lock(dev);
988 rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); 988 rc = pcmcia_dev_suspend(dev);
989 device_unlock(dev); 989 device_unlock(dev);
990 return rc; 990 return rc;
991} 991}
@@ -1135,7 +1135,7 @@ ATTRIBUTE_GROUPS(pcmcia_dev);
1135 1135
1136/* PM support, also needed for reset */ 1136/* PM support, also needed for reset */
1137 1137
1138static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) 1138static int pcmcia_dev_suspend(struct device *dev)
1139{ 1139{
1140 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1140 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1141 struct pcmcia_driver *p_drv = NULL; 1141 struct pcmcia_driver *p_drv = NULL;
@@ -1410,6 +1410,9 @@ static struct class_interface pcmcia_bus_interface __refdata = {
1410 .remove_dev = &pcmcia_bus_remove_socket, 1410 .remove_dev = &pcmcia_bus_remove_socket,
1411}; 1411};
1412 1412
1413static const struct dev_pm_ops pcmcia_bus_pm_ops = {
1414 SET_SYSTEM_SLEEP_PM_OPS(pcmcia_dev_suspend, pcmcia_dev_resume)
1415};
1413 1416
1414struct bus_type pcmcia_bus_type = { 1417struct bus_type pcmcia_bus_type = {
1415 .name = "pcmcia", 1418 .name = "pcmcia",
@@ -1418,8 +1421,7 @@ struct bus_type pcmcia_bus_type = {
1418 .dev_groups = pcmcia_dev_groups, 1421 .dev_groups = pcmcia_dev_groups,
1419 .probe = pcmcia_device_probe, 1422 .probe = pcmcia_device_probe,
1420 .remove = pcmcia_device_remove, 1423 .remove = pcmcia_device_remove,
1421 .suspend = pcmcia_dev_suspend, 1424 .pm = &pcmcia_bus_pm_ops,
1422 .resume = pcmcia_dev_resume,
1423}; 1425};
1424 1426
1425 1427
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 483f919e0d2e..91b5f5724cba 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -214,9 +214,8 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
214} 214}
215#endif 215#endif
216 216
217void pxa2xx_configure_sockets(struct device *dev) 217void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops)
218{ 218{
219 struct pcmcia_low_level *ops = dev->platform_data;
220 /* 219 /*
221 * We have at least one socket, so set MECR:CIT 220 * We have at least one socket, so set MECR:CIT
222 * (Card Is There) 221 * (Card Is There)
@@ -322,7 +321,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
322 goto err1; 321 goto err1;
323 } 322 }
324 323
325 pxa2xx_configure_sockets(&dev->dev); 324 pxa2xx_configure_sockets(&dev->dev, ops);
326 dev_set_drvdata(&dev->dev, sinfo); 325 dev_set_drvdata(&dev->dev, sinfo);
327 326
328 return 0; 327 return 0;
@@ -348,7 +347,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
348 347
349static int pxa2xx_drv_pcmcia_resume(struct device *dev) 348static int pxa2xx_drv_pcmcia_resume(struct device *dev)
350{ 349{
351 pxa2xx_configure_sockets(dev); 350 struct pcmcia_low_level *ops = (struct pcmcia_low_level *)dev->platform_data;
351
352 pxa2xx_configure_sockets(dev, ops);
352 return 0; 353 return 0;
353} 354}
354 355
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h
index b609b45469ed..e58c7a415418 100644
--- a/drivers/pcmcia/pxa2xx_base.h
+++ b/drivers/pcmcia/pxa2xx_base.h
@@ -1,4 +1,4 @@
1int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); 1int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt);
2void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); 2void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops);
3void pxa2xx_configure_sockets(struct device *dev); 3void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops);
4 4
diff --git a/drivers/pcmcia/sa1111_badge4.c b/drivers/pcmcia/sa1111_badge4.c
index 12f0dd091477..2f490930430d 100644
--- a/drivers/pcmcia/sa1111_badge4.c
+++ b/drivers/pcmcia/sa1111_badge4.c
@@ -134,20 +134,14 @@ static struct pcmcia_low_level badge4_pcmcia_ops = {
134 134
135int pcmcia_badge4_init(struct sa1111_dev *dev) 135int pcmcia_badge4_init(struct sa1111_dev *dev)
136{ 136{
137 int ret = -ENODEV; 137 printk(KERN_INFO
138 138 "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n",
139 if (machine_is_badge4()) { 139 __func__,
140 printk(KERN_INFO 140 badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc);
141 "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", 141
142 __func__, 142 sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops);
143 badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); 143 return sa1111_pcmcia_add(dev, &badge4_pcmcia_ops,
144 144 sa11xx_drv_pcmcia_add_one);
145 sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops);
146 ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops,
147 sa11xx_drv_pcmcia_add_one);
148 }
149
150 return ret;
151} 145}
152 146
153static int __init pcmv_setup(char *s) 147static int __init pcmv_setup(char *s)
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index a1531feb8460..3d95dffcff7a 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -18,6 +18,7 @@
18 18
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <asm/hardware/sa1111.h> 20#include <asm/hardware/sa1111.h>
21#include <asm/mach-types.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
22 23
23#include "sa1111_generic.h" 24#include "sa1111_generic.h"
@@ -203,19 +204,30 @@ static int pcmcia_probe(struct sa1111_dev *dev)
203 sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); 204 sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR);
204 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); 205 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR);
205 206
207 ret = -ENODEV;
206#ifdef CONFIG_SA1100_BADGE4 208#ifdef CONFIG_SA1100_BADGE4
207 pcmcia_badge4_init(dev); 209 if (machine_is_badge4())
210 ret = pcmcia_badge4_init(dev);
208#endif 211#endif
209#ifdef CONFIG_SA1100_JORNADA720 212#ifdef CONFIG_SA1100_JORNADA720
210 pcmcia_jornada720_init(dev); 213 if (machine_is_jornada720())
214 ret = pcmcia_jornada720_init(dev);
211#endif 215#endif
212#ifdef CONFIG_ARCH_LUBBOCK 216#ifdef CONFIG_ARCH_LUBBOCK
213 pcmcia_lubbock_init(dev); 217 if (machine_is_lubbock())
218 ret = pcmcia_lubbock_init(dev);
214#endif 219#endif
215#ifdef CONFIG_ASSABET_NEPONSET 220#ifdef CONFIG_ASSABET_NEPONSET
216 pcmcia_neponset_init(dev); 221 if (machine_is_assabet())
222 ret = pcmcia_neponset_init(dev);
217#endif 223#endif
218 return 0; 224
225 if (ret) {
226 release_mem_region(dev->res.start, 512);
227 sa1111_disable_device(dev);
228 }
229
230 return ret;
219} 231}
220 232
221static int pcmcia_remove(struct sa1111_dev *dev) 233static int pcmcia_remove(struct sa1111_dev *dev)
diff --git a/drivers/pcmcia/sa1111_jornada720.c b/drivers/pcmcia/sa1111_jornada720.c
index c2c30580c83f..480a3ede27c8 100644
--- a/drivers/pcmcia/sa1111_jornada720.c
+++ b/drivers/pcmcia/sa1111_jornada720.c
@@ -94,22 +94,17 @@ static struct pcmcia_low_level jornada720_pcmcia_ops = {
94 94
95int pcmcia_jornada720_init(struct sa1111_dev *sadev) 95int pcmcia_jornada720_init(struct sa1111_dev *sadev)
96{ 96{
97 int ret = -ENODEV; 97 unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3;
98 98
99 if (machine_is_jornada720()) { 99 /* Fixme: why messing around with SA11x0's GPIO1? */
100 unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; 100 GRER |= 0x00000002;
101 101
102 GRER |= 0x00000002; 102 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */
103 sa1111_set_io_dir(sadev, pin, 0, 0);
104 sa1111_set_io(sadev, pin, 0);
105 sa1111_set_sleep_io(sadev, pin, 0);
103 106
104 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ 107 sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops);
105 sa1111_set_io_dir(sadev, pin, 0, 0); 108 return sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops,
106 sa1111_set_io(sadev, pin, 0); 109 sa11xx_drv_pcmcia_add_one);
107 sa1111_set_sleep_io(sadev, pin, 0);
108
109 sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops);
110 ret = sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops,
111 sa11xx_drv_pcmcia_add_one);
112 }
113
114 return ret;
115} 110}
diff --git a/drivers/pcmcia/sa1111_lubbock.c b/drivers/pcmcia/sa1111_lubbock.c
index c5caf5790451..e741f499c875 100644
--- a/drivers/pcmcia/sa1111_lubbock.c
+++ b/drivers/pcmcia/sa1111_lubbock.c
@@ -210,27 +210,21 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = {
210 210
211int pcmcia_lubbock_init(struct sa1111_dev *sadev) 211int pcmcia_lubbock_init(struct sa1111_dev *sadev)
212{ 212{
213 int ret = -ENODEV; 213 /*
214 214 * Set GPIO_A<3:0> to be outputs for the MAX1600,
215 if (machine_is_lubbock()) { 215 * and switch to standby mode.
216 /* 216 */
217 * Set GPIO_A<3:0> to be outputs for the MAX1600, 217 sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0);
218 * and switch to standby mode. 218 sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
219 */ 219 sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
220 sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0);
221 sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
222 sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
223
224 /* Set CF Socket 1 power to standby mode. */
225 lubbock_set_misc_wr((1 << 15) | (1 << 14), 0);
226 220
227 pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); 221 /* Set CF Socket 1 power to standby mode. */
228 pxa2xx_configure_sockets(&sadev->dev); 222 lubbock_set_misc_wr((1 << 15) | (1 << 14), 0);
229 ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops,
230 pxa2xx_drv_pcmcia_add_one);
231 }
232 223
233 return ret; 224 pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops);
225 pxa2xx_configure_sockets(&sadev->dev, &lubbock_pcmcia_ops);
226 return sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops,
227 pxa2xx_drv_pcmcia_add_one);
234} 228}
235 229
236MODULE_LICENSE("GPL"); 230MODULE_LICENSE("GPL");
diff --git a/drivers/pcmcia/sa1111_neponset.c b/drivers/pcmcia/sa1111_neponset.c
index 1d78739c4c07..019c395eb4bf 100644
--- a/drivers/pcmcia/sa1111_neponset.c
+++ b/drivers/pcmcia/sa1111_neponset.c
@@ -110,20 +110,14 @@ static struct pcmcia_low_level neponset_pcmcia_ops = {
110 110
111int pcmcia_neponset_init(struct sa1111_dev *sadev) 111int pcmcia_neponset_init(struct sa1111_dev *sadev)
112{ 112{
113 int ret = -ENODEV; 113 /*
114 114 * Set GPIO_A<3:0> to be outputs for the MAX1600,
115 if (machine_is_assabet()) { 115 * and switch to standby mode.
116 /* 116 */
117 * Set GPIO_A<3:0> to be outputs for the MAX1600, 117 sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0);
118 * and switch to standby mode. 118 sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
119 */ 119 sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
120 sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 120 sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops);
121 sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 121 return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops,
122 sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 122 sa11xx_drv_pcmcia_add_one);
123 sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops);
124 ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops,
125 sa11xx_drv_pcmcia_add_one);
126 }
127
128 return ret;
129} 123}
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index 9f6ec87b9f9e..48140ac73ed6 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -144,19 +144,19 @@ static int
144sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) 144sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
145{ 145{
146 struct soc_pcmcia_timing timing; 146 struct soc_pcmcia_timing timing;
147 unsigned int clock = clk_get_rate(skt->clk); 147 unsigned int clock = clk_get_rate(skt->clk) / 1000;
148 unsigned long mecr = MECR; 148 unsigned long mecr = MECR;
149 char *p = buf; 149 char *p = buf;
150 150
151 soc_common_pcmcia_get_timing(skt, &timing); 151 soc_common_pcmcia_get_timing(skt, &timing);
152 152
153 p+=sprintf(p, "I/O : %u (%u)\n", timing.io, 153 p+=sprintf(p, "I/O : %uns (%uns)\n", timing.io,
154 sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); 154 sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr)));
155 155
156 p+=sprintf(p, "attribute: %u (%u)\n", timing.attr, 156 p+=sprintf(p, "attribute: %uns (%uns)\n", timing.attr,
157 sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); 157 sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr)));
158 158
159 p+=sprintf(p, "common : %u (%u)\n", timing.mem, 159 p+=sprintf(p, "common : %uns (%uns)\n", timing.mem,
160 sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); 160 sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr)));
161 161
162 return p - buf; 162 return p - buf;
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index eed5e9c05353..d5ca760c4eb2 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -235,7 +235,7 @@ static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt)
235 stat |= skt->cs_state.Vcc ? SS_POWERON : 0; 235 stat |= skt->cs_state.Vcc ? SS_POWERON : 0;
236 236
237 if (skt->cs_state.flags & SS_IOCARD) 237 if (skt->cs_state.flags & SS_IOCARD)
238 stat |= state.bvd1 ? SS_STSCHG : 0; 238 stat |= state.bvd1 ? 0 : SS_STSCHG;
239 else { 239 else {
240 if (state.bvd1 == 0) 240 if (state.bvd1 == 0)
241 stat |= SS_BATDEAD; 241 stat |= SS_BATDEAD;