diff options
author | Jochen Friedrich <jochen@scram.de> | 2011-08-18 16:50:31 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-10-17 04:12:42 -0400 |
commit | de0bc0d1b008d1240c03a0bac4f5534f995ab802 (patch) | |
tree | 3f3b230d3ff6d3d1f27ceb5525867228668f44c2 /drivers/pcmcia | |
parent | f24dec9fdafadca53bf9db460da2cbbbfccdb584 (diff) |
ARM: 7024/1: simpad: Cleanup CS3 accessors.
- prepend CS3 accessors by simpad_ to indicate they
are specific to simpad devices.
- use spinlock to protect shadow register.
- implement 8 read-only pins.
- use readl/writel macros so barriers are used where
necessary.
- register CS3 as GPIO controller with 24 pins
(16 output only and 8 input only).
- fix PCMCIA driver to access the read-only pins
rather than the shadow register for status bits.
Signed-off-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/sa1100_simpad.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c index c998f7aaadbc..0fac9658b020 100644 --- a/drivers/pcmcia/sa1100_simpad.c +++ b/drivers/pcmcia/sa1100_simpad.c | |||
@@ -15,10 +15,6 @@ | |||
15 | #include <mach/simpad.h> | 15 | #include <mach/simpad.h> |
16 | #include "sa1100_generic.h" | 16 | #include "sa1100_generic.h" |
17 | 17 | ||
18 | extern long get_cs3_shadow(void); | ||
19 | extern void set_cs3_bit(int value); | ||
20 | extern void clear_cs3_bit(int value); | ||
21 | |||
22 | static struct pcmcia_irqs irqs[] = { | 18 | static struct pcmcia_irqs irqs[] = { |
23 | { 1, IRQ_GPIO_CF_CD, "CF_CD" }, | 19 | { 1, IRQ_GPIO_CF_CD, "CF_CD" }, |
24 | }; | 20 | }; |
@@ -26,7 +22,7 @@ static struct pcmcia_irqs irqs[] = { | |||
26 | static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 22 | static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
27 | { | 23 | { |
28 | 24 | ||
29 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); | 25 | simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); |
30 | 26 | ||
31 | skt->socket.pci_irq = IRQ_GPIO_CF_IRQ; | 27 | skt->socket.pci_irq = IRQ_GPIO_CF_IRQ; |
32 | 28 | ||
@@ -38,8 +34,8 @@ static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | |||
38 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 34 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
39 | 35 | ||
40 | /* Disable CF bus: */ | 36 | /* Disable CF bus: */ |
41 | //set_cs3_bit(PCMCIA_BUFF_DIS); | 37 | /*simpad_set_cs3_bit(PCMCIA_BUFF_DIS);*/ |
42 | clear_cs3_bit(PCMCIA_RESET); | 38 | simpad_clear_cs3_bit(PCMCIA_RESET); |
43 | } | 39 | } |
44 | 40 | ||
45 | static void | 41 | static void |
@@ -47,15 +43,16 @@ simpad_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | |||
47 | struct pcmcia_state *state) | 43 | struct pcmcia_state *state) |
48 | { | 44 | { |
49 | unsigned long levels = GPLR; | 45 | unsigned long levels = GPLR; |
50 | long cs3reg = get_cs3_shadow(); | 46 | long cs3reg = simpad_get_cs3_ro(); |
51 | 47 | ||
52 | state->detect=((levels & GPIO_CF_CD)==0)?1:0; | 48 | state->detect=((levels & GPIO_CF_CD)==0)?1:0; |
53 | state->ready=(levels & GPIO_CF_IRQ)?1:0; | 49 | state->ready=(levels & GPIO_CF_IRQ)?1:0; |
54 | state->bvd1=1; /* Not available on Simpad. */ | 50 | state->bvd1 = 1; /* Might be cs3reg & PCMCIA_BVD1 */ |
55 | state->bvd2=1; /* Not available on Simpad. */ | 51 | state->bvd2 = 1; /* Might be cs3reg & PCMCIA_BVD2 */ |
56 | state->wrprot=0; /* Not available on Simpad. */ | 52 | state->wrprot=0; /* Not available on Simpad. */ |
57 | 53 | ||
58 | if((cs3reg & 0x0c) == 0x0c) { | 54 | if ((cs3reg & (PCMCIA_VS1|PCMCIA_VS2)) == |
55 | (PCMCIA_VS1|PCMCIA_VS2)) { | ||
59 | state->vs_3v=0; | 56 | state->vs_3v=0; |
60 | state->vs_Xv=0; | 57 | state->vs_Xv=0; |
61 | } else { | 58 | } else { |
@@ -75,23 +72,23 @@ simpad_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
75 | /* Murphy: see table of MIC2562a-1 */ | 72 | /* Murphy: see table of MIC2562a-1 */ |
76 | switch (state->Vcc) { | 73 | switch (state->Vcc) { |
77 | case 0: | 74 | case 0: |
78 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); | 75 | simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); |
79 | break; | 76 | break; |
80 | 77 | ||
81 | case 33: | 78 | case 33: |
82 | clear_cs3_bit(VCC_3V_EN|EN1); | 79 | simpad_clear_cs3_bit(VCC_3V_EN|EN1); |
83 | set_cs3_bit(VCC_5V_EN|EN0); | 80 | simpad_set_cs3_bit(VCC_5V_EN|EN0); |
84 | break; | 81 | break; |
85 | 82 | ||
86 | case 50: | 83 | case 50: |
87 | clear_cs3_bit(VCC_5V_EN|EN1); | 84 | simpad_clear_cs3_bit(VCC_5V_EN|EN1); |
88 | set_cs3_bit(VCC_3V_EN|EN0); | 85 | simpad_set_cs3_bit(VCC_3V_EN|EN0); |
89 | break; | 86 | break; |
90 | 87 | ||
91 | default: | 88 | default: |
92 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | 89 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", |
93 | __func__, state->Vcc); | 90 | __func__, state->Vcc); |
94 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); | 91 | simpad_clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); |
95 | local_irq_restore(flags); | 92 | local_irq_restore(flags); |
96 | return -1; | 93 | return -1; |
97 | } | 94 | } |
@@ -110,7 +107,7 @@ static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | |||
110 | static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | 107 | static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) |
111 | { | 108 | { |
112 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 109 | soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
113 | set_cs3_bit(PCMCIA_RESET); | 110 | simpad_set_cs3_bit(PCMCIA_RESET); |
114 | } | 111 | } |
115 | 112 | ||
116 | static struct pcmcia_low_level simpad_pcmcia_ops = { | 113 | static struct pcmcia_low_level simpad_pcmcia_ops = { |