1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
diff -Nur linux-2.6.24.vanilla/drivers/pcmcia/cs.c linux-2.6.24/drivers/pcmcia/cs.c
--- linux-2.6.24.vanilla/drivers/pcmcia/cs.c 2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/drivers/pcmcia/cs.c 2008-02-22 20:53:06.000000000 +0100
@@ -10,6 +10,8 @@
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* (C) 1999 David A. Hinds
+ *
+ * mrdata: -added suspend fix
*/
#include <linux/module.h>
@@ -59,6 +61,10 @@
INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */
INT_MODULE_PARM(unreset_check, 10); /* centiseconds */
INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
+// INT_MODULE_PARM(unreset_delay, 20); /* centiseconds */
+// INT_MODULE_PARM(unreset_check, 100); /* centiseconds */
+// INT_MODULE_PARM(unreset_limit, 300); /* unreset_check's */
+
/* Access speed for attribute memory windows */
INT_MODULE_PARM(cis_speed, 300); /* ns */
@@ -366,6 +372,7 @@
skt->ops->set_socket(skt, &skt->socket);
msleep(unreset_delay * 10);
+
for (i = 0; i < unreset_limit; i++) {
skt->ops->get_status(skt, &status);
@@ -434,7 +441,7 @@
msleep(initial_delay * 10);
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < 100; i++) {
skt->ops->get_status(skt, &status);
if (!(status & SS_DETECT))
return CS_NO_CARD;
diff -Nur linux-2.6.24.vanilla/drivers/pcmcia/sa1100_generic.c linux-2.6.24/drivers/pcmcia/sa1100_generic.c
--- linux-2.6.24.vanilla/drivers/pcmcia/sa1100_generic.c 2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/drivers/pcmcia/sa1100_generic.c 2008-02-22 20:53:06.000000000 +0100
@@ -28,6 +28,9 @@
the provisions above, a recipient may use your version of this
file under either the MPL or the GPL.
+ 2007 mrnice: added thesings changes from device_driver
+ to platform_driver - many thx to thesing
+
======================================================================*/
#include <linux/module.h>
@@ -81,13 +84,15 @@
return ret;
}
-static struct device_driver sa11x0_pcmcia_driver = {
- .probe = sa11x0_drv_pcmcia_probe,
- .remove = soc_common_drv_pcmcia_remove,
- .name = "sa11x0-pcmcia",
- .bus = &platform_bus_type,
- .suspend = pcmcia_socket_dev_suspend,
- .resume = pcmcia_socket_dev_resume,
+static struct platform_driver sa11x0_pcmcia_driver = {
+ .driver = {
+ .name = "sa11x0-pcmcia",
+ .probe = sa11x0_drv_pcmcia_probe,
+ .remove = soc_common_drv_pcmcia_remove,
+ .suspend= pcmcia_socket_dev_suspend,
+ .resume = pcmcia_socket_dev_resume,
+ //.bus = &platform_bus_type,
+ },
};
/* sa11x0_pcmcia_init()
@@ -100,7 +105,7 @@
*/
static int __init sa11x0_pcmcia_init(void)
{
- return driver_register(&sa11x0_pcmcia_driver);
+ return platform_driver_register(&sa11x0_pcmcia_driver);
}
/* sa11x0_pcmcia_exit()
@@ -110,7 +115,7 @@
*/
static void __exit sa11x0_pcmcia_exit(void)
{
- driver_unregister(&sa11x0_pcmcia_driver);
+ platform_driver_unregister(&sa11x0_pcmcia_driver);
}
MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
diff -Nur linux-2.6.24.vanilla/drivers/pcmcia/sa1100_simpad.c linux-2.6.24/drivers/pcmcia/sa1100_simpad.c
--- linux-2.6.24.vanilla/drivers/pcmcia/sa1100_simpad.c 2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/drivers/pcmcia/sa1100_simpad.c 2008-02-22 20:53:32.000000000 +0100
@@ -8,13 +8,15 @@
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/init.h>
+#include <linux/delay.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/arch/simpad.h>
#include "sa1100_generic.h"
-
+
+extern long get_cs3_ro(void);
extern long get_cs3_shadow(void);
extern void set_cs3_bit(int value);
extern void clear_cs3_bit(int value);
@@ -25,8 +27,15 @@
static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
-
- clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
+ clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1|PCMCIA_RESET);
+
+ set_cs3_bit(PCMCIA_BUFF_DIS);
+
+ msleep(10);
+
+ clear_cs3_bit(PCMCIA_BUFF_DIS);
+
+ msleep(5);
skt->irq = IRQ_GPIO_CF_IRQ;
@@ -38,7 +47,7 @@
soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
/* Disable CF bus: */
- //set_cs3_bit(PCMCIA_BUFF_DIS);
+ set_cs3_bit(PCMCIA_BUFF_DIS);
clear_cs3_bit(PCMCIA_RESET);
}
@@ -47,21 +56,17 @@
struct pcmcia_state *state)
{
unsigned long levels = GPLR;
- long cs3reg = get_cs3_shadow();
-
- state->detect=((levels & GPIO_CF_CD)==0)?1:0;
- state->ready=(levels & GPIO_CF_IRQ)?1:0;
- state->bvd1=1; /* Not available on Simpad. */
- state->bvd2=1; /* Not available on Simpad. */
- state->wrprot=0; /* Not available on Simpad. */
-
- if((cs3reg & 0x0c) == 0x0c) {
- state->vs_3v=0;
- state->vs_Xv=0;
- } else {
- state->vs_3v=1;
- state->vs_Xv=0;
- }
+
+ state->detect = ((levels & GPIO_CF_CD) == 0) ? 1 : 0 ;
+ state->ready = (levels & GPIO_CF_IRQ) ? 1 : 0 ;
+
+ long cs3_ro_reg = get_cs3_ro();
+
+ state->bvd1 = (cs3_ro_reg & PCMCIA_BVD1) ? 1 : 0 ; /* old: =1 Not available on Simpad. */
+ state->bvd2 = (cs3_ro_reg & PCMCIA_BVD2) ? 1 : 0 ; /* old: =1 Not available on Simpad. */
+ state->wrprot = 0 ; /* Not available on Simpad. */
+ state->vs_3v = (cs3_ro_reg & PCMCIA_VS1) ? 0 : 1 ;
+ state->vs_Xv = (cs3_ro_reg & PCMCIA_VS2) ? 0 : 1 ;
}
static int
@@ -95,7 +100,11 @@
local_irq_restore(flags);
return -1;
}
-
+
+ if (state->flags & SS_RESET)
+ set_cs3_bit(PCMCIA_RESET);
+ else
+ clear_cs3_bit(PCMCIA_RESET);
local_irq_restore(flags);
@@ -104,6 +113,7 @@
static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
+ clear_cs3_bit(PCMCIA_RESET);
soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
}
diff -Nur linux-2.6.24.vanilla/drivers/pcmcia/soc_common.c linux-2.6.24/drivers/pcmcia/soc_common.c
--- linux-2.6.24.vanilla/drivers/pcmcia/soc_common.c 2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/drivers/pcmcia/soc_common.c 2008-02-22 20:53:06.000000000 +0100
@@ -747,7 +747,9 @@
add_timer(&skt->poll_timer);
- device_create_file(&skt->socket.dev, &dev_attr_status);
+ ret = device_create_file(&skt->socket.dev, &dev_attr_status);
+ if (ret)
+ goto out_err_7;
}
dev_set_drvdata(dev, sinfo);
|