This source file includes following definitions.
- complain_about_jumpering
- badge4_pcmcia_configure_socket
- pcmcia_badge4_init
- pcmv_setup
1
2
3
4
5
6
7
8
9
10
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/device.h>
14 #include <linux/errno.h>
15 #include <linux/init.h>
16
17 #include <mach/hardware.h>
18 #include <asm/mach-types.h>
19 #include <mach/badge4.h>
20 #include <asm/hardware/sa1111.h>
21
22 #include "sa1111_generic.h"
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 static int badge4_pcmvcc = 50;
56 static int badge4_pcmvpp = 50;
57 static int badge4_cfvcc = 33;
58
59 static void complain_about_jumpering(const char *whom,
60 const char *supply,
61 int given, int wanted)
62 {
63 printk(KERN_ERR
64 "%s: %s %d.%dV wanted but board is jumpered for %s %d.%dV operation"
65 "; re-jumper the board and/or use pcmv=xx,xx,xx\n",
66 whom, supply,
67 wanted / 10, wanted % 10,
68 supply,
69 given / 10, given % 10);
70 }
71
72 static int
73 badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
74 {
75 int ret;
76
77 switch (skt->nr) {
78 case 0:
79 if ((state->Vcc != 0) &&
80 (state->Vcc != badge4_pcmvcc)) {
81 complain_about_jumpering(__func__, "pcmvcc",
82 badge4_pcmvcc, state->Vcc);
83
84
85 }
86 if ((state->Vpp != 0) &&
87 (state->Vpp != badge4_pcmvpp)) {
88 complain_about_jumpering(__func__, "pcmvpp",
89 badge4_pcmvpp, state->Vpp);
90 return -1;
91 }
92 break;
93
94 case 1:
95 if ((state->Vcc != 0) &&
96 (state->Vcc != badge4_cfvcc)) {
97 complain_about_jumpering(__func__, "cfvcc",
98 badge4_cfvcc, state->Vcc);
99 return -1;
100 }
101 break;
102
103 default:
104 return -1;
105 }
106
107 ret = sa1111_pcmcia_configure_socket(skt, state);
108 if (ret == 0) {
109 unsigned long flags;
110 int need5V;
111
112 local_irq_save(flags);
113
114 need5V = ((state->Vcc == 50) || (state->Vpp == 50));
115
116 badge4_set_5V(BADGE4_5V_PCMCIA_SOCK(skt->nr), need5V);
117
118 local_irq_restore(flags);
119 }
120
121 return ret;
122 }
123
124 static struct pcmcia_low_level badge4_pcmcia_ops = {
125 .owner = THIS_MODULE,
126 .configure_socket = badge4_pcmcia_configure_socket,
127 .first = 0,
128 .nr = 2,
129 };
130
131 int pcmcia_badge4_init(struct sa1111_dev *dev)
132 {
133 printk(KERN_INFO
134 "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n",
135 __func__,
136 badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc);
137
138 sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops);
139 return sa1111_pcmcia_add(dev, &badge4_pcmcia_ops,
140 sa11xx_drv_pcmcia_add_one);
141 }
142
143 #ifndef MODULE
144 static int __init pcmv_setup(char *s)
145 {
146 int v[4];
147
148 s = get_options(s, ARRAY_SIZE(v), v);
149
150 if (v[0] >= 1) badge4_pcmvcc = v[1];
151 if (v[0] >= 2) badge4_pcmvpp = v[2];
152 if (v[0] >= 3) badge4_cfvcc = v[3];
153
154 return 1;
155 }
156
157 __setup("pcmv=", pcmv_setup);
158 #endif