aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorKristoffer Ericson <kristoffer.ericson@gmail.com>2009-09-21 20:03:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:42 -0400
commit02e87d1a934c70e3599eb7a29db783806d329e17 (patch)
tree74e469003183fb3cbea4ce8081e7b186c656179b /drivers/pcmcia
parente6be4a8c26d0a9bacd811084c468e25863e3d069 (diff)
pcmcia: cleanup/fixup patch for sa1100_jornada_pcmcia driver
Clean up the /drivers/pcmcia/sa1100_jornada.c file with respect to formatting. It also changes a build warning into a code comment (since its a pain to watch every build and havent seen any problems with driver in 3.5years). Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/sa1100_jornada720.c156
1 files changed, 85 insertions, 71 deletions
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c
index 57ca085473d5..7eedb42f800c 100644
--- a/drivers/pcmcia/sa1100_jornada720.c
+++ b/drivers/pcmcia/sa1100_jornada720.c
@@ -16,89 +16,103 @@
16 16
17#include "sa1111_generic.h" 17#include "sa1111_generic.h"
18 18
19#define SOCKET0_POWER GPIO_GPIO0 19/* Does SOCKET1_3V actually do anything? */
20#define SOCKET0_3V GPIO_GPIO2 20#define SOCKET0_POWER GPIO_GPIO0
21#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) 21#define SOCKET0_3V GPIO_GPIO2
22#warning *** Does SOCKET1_3V actually do anything? 22#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3)
23#define SOCKET1_3V GPIO_GPIO3 23#define SOCKET1_3V GPIO_GPIO3
24 24
25static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 25static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
26{ 26{
27 /* 27 unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3;
28 * What is all this crap for? 28
29 */ 29 /*
30 GRER |= 0x00000002; 30 * What is all this crap for?
31 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ 31 */
32 sa1111_set_io_dir(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 32 GRER |= 0x00000002;
33 sa1111_set_io(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 33 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */
34 sa1111_set_sleep_io(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 34 sa1111_set_io_dir(SA1111_DEV(skt->dev), pin, 0, 0);
35 35 sa1111_set_io(SA1111_DEV(skt->dev), pin, 0);
36 return sa1111_pcmcia_hw_init(skt); 36 sa1111_set_sleep_io(SA1111_DEV(skt->dev), pin, 0);
37
38 return sa1111_pcmcia_hw_init(skt);
37} 39}
38 40
39static int 41static int
40jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) 42jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
41{ 43{
42 unsigned int pa_dwr_mask, pa_dwr_set; 44 unsigned int pa_dwr_mask, pa_dwr_set;
43 int ret; 45 int ret;
44 46
45printk("%s(): config socket %d vcc %d vpp %d\n", __func__, 47 printk(KERN_INFO "%s(): config socket %d vcc %d vpp %d\n", __func__,
46 skt->nr, state->Vcc, state->Vpp); 48 skt->nr, state->Vcc, state->Vpp);
47 49
48 switch (skt->nr) { 50 switch (skt->nr) {
49 case 0: 51 case 0:
50 pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V; 52 pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V;
51 53
52 switch (state->Vcc) { 54 switch (state->Vcc) {
53 default: 55 default:
54 case 0: pa_dwr_set = 0; break; 56 case 0:
55 case 33: pa_dwr_set = SOCKET0_POWER | SOCKET0_3V; break; 57 pa_dwr_set = 0;
56 case 50: pa_dwr_set = SOCKET0_POWER; break; 58 break;
57 } 59 case 33:
58 break; 60 pa_dwr_set = SOCKET0_POWER | SOCKET0_3V;
59 61 break;
60 case 1: 62 case 50:
61 pa_dwr_mask = SOCKET1_POWER; 63 pa_dwr_set = SOCKET0_POWER;
62 64 break;
63 switch (state->Vcc) { 65 }
64 default: 66 break;
65 case 0: pa_dwr_set = 0; break; 67
66 case 33: pa_dwr_set = SOCKET1_POWER; break; 68 case 1:
67 case 50: pa_dwr_set = SOCKET1_POWER; break; 69 pa_dwr_mask = SOCKET1_POWER;
68 } 70
69 break; 71 switch (state->Vcc) {
70 72 default:
71 default: 73 case 0:
72 return -1; 74 pa_dwr_set = 0;
73 } 75 break;
74 76 case 33:
75 if (state->Vpp != state->Vcc && state->Vpp != 0) { 77 pa_dwr_set = SOCKET1_POWER;
76 printk(KERN_ERR "%s(): slot cannot support VPP %u\n", 78 break;
77 __func__, state->Vpp); 79 case 50:
78 return -1; 80 pa_dwr_set = SOCKET1_POWER;
79 } 81 break;
80 82 }
81 ret = sa1111_pcmcia_configure_socket(skt, state); 83 break;
82 if (ret == 0) { 84
83 unsigned long flags; 85 default:
84 86 return -1;
85 local_irq_save(flags); 87 }
86 sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); 88
87 local_irq_restore(flags); 89 if (state->Vpp != state->Vcc && state->Vpp != 0) {
88 } 90 printk(KERN_ERR "%s(): slot cannot support VPP %u\n",
89 91 __func__, state->Vpp);
90 return ret; 92 return -EPERM;
93 }
94
95 ret = sa1111_pcmcia_configure_socket(skt, state);
96 if (ret == 0) {
97 unsigned long flags;
98
99 local_irq_save(flags);
100 sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set);
101 local_irq_restore(flags);
102 }
103
104 return ret;
91} 105}
92 106
93static struct pcmcia_low_level jornada720_pcmcia_ops = { 107static struct pcmcia_low_level jornada720_pcmcia_ops = {
94 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
95 .hw_init = jornada720_pcmcia_hw_init, 109 .hw_init = jornada720_pcmcia_hw_init,
96 .hw_shutdown = sa1111_pcmcia_hw_shutdown, 110 .hw_shutdown = sa1111_pcmcia_hw_shutdown,
97 .socket_state = sa1111_pcmcia_socket_state, 111 .socket_state = sa1111_pcmcia_socket_state,
98 .configure_socket = jornada720_pcmcia_configure_socket, 112 .configure_socket = jornada720_pcmcia_configure_socket,
99 113
100 .socket_init = sa1111_pcmcia_socket_init, 114 .socket_init = sa1111_pcmcia_socket_init,
101 .socket_suspend = sa1111_pcmcia_socket_suspend, 115 .socket_suspend = sa1111_pcmcia_socket_suspend,
102}; 116};
103 117
104int __devinit pcmcia_jornada720_init(struct device *dev) 118int __devinit pcmcia_jornada720_init(struct device *dev)