add support for the IXDPG425
[openwrt.git] / target / linux / at91 / patches-2.6.21 / 016-v1-15-detect.patch
1 diff -urN linux-2.6.21.5.old/arch/arm/mach-at91/at91rm9200_devices.c linux-2.6.21.5/arch/arm/mach-at91/at91rm9200_devices.c
2 --- linux-2.6.21.5.old/arch/arm/mach-at91/at91rm9200_devices.c 2008-03-13 16:24:18.000000000 +0100
3 +++ linux-2.6.21.5/arch/arm/mach-at91/at91rm9200_devices.c 2008-03-13 16:34:43.000000000 +0100
4 @@ -840,9 +840,9 @@
5 at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */
6 at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
7 at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */
8 - at91_set_gpio_output(AT91_PIN_PB29, 1); /* DTR0 */
9 - at91_set_gpio_output(AT91_PIN_PB2, 1); /* RI0 */
10 - at91_set_gpio_input(AT91_PIN_PA24, 1); /* DCD0 */
11 + at91_set_gpio_output(AT91_PIN_PB29, 1); /* DTR3 */
12 + at91_set_gpio_output(AT91_PIN_PB2, 1); /* RI3 */
13 + at91_set_gpio_input(AT91_PIN_PA24, 1); /* DCD3 */
14 at91_set_deglitch(AT91_PIN_PA24, 1);
15 }
16
17 diff -urN linux-2.6.21.5.old/arch/arm/mach-at91/board-vlink.c linux-2.6.21.5/arch/arm/mach-at91/board-vlink.c
18 --- linux-2.6.21.5.old/arch/arm/mach-at91/board-vlink.c 2008-03-13 16:24:18.000000000 +0100
19 +++ linux-2.6.21.5/arch/arm/mach-at91/board-vlink.c 2008-03-13 16:35:05.000000000 +0100
20 @@ -126,6 +126,7 @@
21
22 static void __init vlink_board_init(void)
23 {
24 + int v100;
25 /* Serial */
26 at91_add_device_serial();
27 /* Ethernet */
28 @@ -147,6 +148,10 @@
29 // at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
30 at91_add_device_mmc(0, &vlink_mmc_data);
31 #endif
32 +// Set VLink version PIN as an input with pull up (V1.5 = GND)
33 + at91_set_gpio_input(AT91_PIN_PC2, 1);
34 + v100 = at91_get_gpio_value(AT91_PIN_PC2);
35 +
36 /* LEDs */
37 // at91_gpio_leds(vlink_leds, ARRAY_SIZE(vlink_leds));
38
39 @@ -164,10 +169,16 @@
40 /* SIM Cards */
41 if (at91_get_gpio_value(AT91_PIN_PB8)) {
42 at91_set_gpio_output(AT91_PIN_PB11, 0);
43 - at91_set_gpio_output(AT91_PIN_PB9, 1);
44 + if (v100)
45 + at91_set_gpio_output(AT91_PIN_PB9, 1);
46 + else
47 + at91_set_gpio_output(AT91_PIN_PC13, 1);
48 } else {
49 at91_set_gpio_output(AT91_PIN_PB11, 1);
50 - at91_set_gpio_output(AT91_PIN_PB9, 0);
51 + if (v100)
52 + at91_set_gpio_output(AT91_PIN_PB9, 0);
53 + else
54 + at91_set_gpio_output(AT91_PIN_PC13, 0);
55 }
56
57 at91_set_gpio_output(AT91_PIN_PB10, 1); // ENBSC2
58 @@ -182,7 +193,18 @@
59 at91_set_gpio_input(AT91_PIN_PB27, 1); // UDB_CNX
60 at91_set_gpio_output(AT91_PIN_PB28, 1); // UDB_PUP
61 at91_set_multi_drive(AT91_PIN_PB28, 1); // Set to multi-drive
62 -
63 +
64 + if (v100)
65 + { // V100
66 + at91_set_gpio_input (AT91_PIN_PC12, 1); // SD Card present
67 + }
68 + else
69 + { // DO special things for V1.5
70 + at91_set_gpio_output(AT91_PIN_PB9 , 0); // USB suspend
71 + at91_set_gpio_input (AT91_PIN_PC10, 1); // SD Card present
72 + at91_set_gpio_output(AT91_PIN_PC11, 0); // USB Vin CTRL for modules onboard
73 + at91_set_gpio_output(AT91_PIN_PC12, 0); // SIM control
74 + }
75 }
76
77 MACHINE_START(VLINK, "FDL VersaLink")
78 diff -urN linux-2.6.21.5.old/drivers/char/vlink_giu.c linux-2.6.21.5/drivers/char/vlink_giu.c
79 --- linux-2.6.21.5.old/drivers/char/vlink_giu.c 2008-03-13 16:24:18.000000000 +0100
80 +++ linux-2.6.21.5/drivers/char/vlink_giu.c 2008-03-13 16:37:06.000000000 +0100
81 @@ -41,8 +41,7 @@
82 module_param(major, int, 0);
83 MODULE_PARM_DESC(major, "Major device number");
84
85 -#define VIO_NR_DEVS 96
86 -
87 +#define VIO_NR_DEVS 96
88 struct vio_dev {
89 struct cdev cdev;
90 };
91 @@ -50,6 +49,53 @@
92 struct vio_dev *vio_devices;
93 static struct class *vio_class;
94
95 +// KWJ + AJE
96 +#define MAX_VIO_NAMES 24
97 +typedef struct
98 +{
99 + char port;
100 + char pin;
101 + char name100[10];
102 + char name150[10];
103 +} VIO_NAMES;
104 +
105 +VIO_NAMES VioName[MAX_VIO_NAMES] = { //Port,PIN, V100 , V150
106 + {'A',19,"port1DTR" ,"port1DTR"},
107 + {'A',24,"port2DTR" ,"port2DTR"},
108 + {'B',8, "jigOn" ,"jigOn"} ,
109 + {'B',9, "enbSC3" ,"usbSUSPND"},
110 + {'B',10,"enbSC2" ,"enbSC2"},
111 + {'B',11,"enbSC1" ,"enbSC1"},
112 + {'B',12,"gsmONOFF" ,"gsmONOFF"},
113 + {'B',14,"ledBAP1" ,"ledBAP1"},
114 + {'B',15,"ledBBP1" ,"ledBBP1"},
115 + {'B',16,"ledBAP2" ,"ledBAP2"},
116 + {'B',17,"ledBBP2" ,"ledBBP2"},
117 + {'B',27,"udpCNX" ,"udpCNX"},
118 + {'B',28,"udpPUP" ,"udpPUP"},
119 + {'B',29,"port2DCD" ,"port2DCD"},
120 + {'C',2, "vlVer100" ,"vlVer150"},
121 + {'C',7, "ledFAP1" ,"ledFAP1"},
122 + {'C',8, "ledFBP1" ,"ledFBP1"},
123 + {'C',10,"vioC10" ,"sdCardON"},
124 + {'C',11,"vioC11" ,"vusbCTRL"},
125 + {'C',12,"sdCardON" ,"simCTRL"},
126 + {'C',13,"vioC13" ,"enbSC3"},
127 + {'C',14,"ledFBP2" ,"ledFBP2"},
128 + {'C',15,"ledFAP2" ,"ledFAP2"},
129 + {0,0,"",""}
130 + };
131 +/* {'B',18,"gsmRIO" ,"gsmRIO"},
132 + {'B',20,"gsmTX" ,"gsmTX"},
133 + {'B',21,"gsmRX" ,"gsmRX"},
134 + {'B',22,"gsmPIND" ,"gsmPIND"},
135 + {'B',23,"gsmDCD" ,"gsmDCD"},
136 + {'B',24,"gsmCTS" ,"gsmCTS"},
137 + {'B',25,"gsmDSR" ,"gsmDSR"},
138 + {'B',26,"gsmRTS" ,"gsmRTS"},*/
139 +static void lookupPINName(char version100, char *devName, char port, char pin);
140 +// EOF KWJ + AJE
141 +
142 static ssize_t gpio_read(struct file *file, char __user *buf, size_t len,
143 loff_t *ppos)
144 {
145 @@ -160,6 +206,8 @@
146 {
147 int retval, i, j;
148 dev_t vdev = 0;
149 + char devName[30];
150 + int vlinkV100;
151
152 if (major) {
153 vdev = MKDEV(major, 0);
154 @@ -185,6 +233,7 @@
155 vio_remove(dev);
156 return PTR_ERR(vio_class);
157 }
158 + vlinkV100 = at91_get_gpio_value(AT91_PIN_PC2); // Denotes V1.5 if ground
159
160 vio_devices = kmalloc(VIO_NR_DEVS * sizeof(struct vio_dev), GFP_KERNEL);
161 if (!vio_devices) {
162 @@ -198,8 +247,10 @@
163 int iodev = at91_is_pin_gpio(PIN_BASE + i*32 + j);
164 if (iodev) {
165 vio_setup_cdev(&vio_devices[i*32 + j], i*32 + j);
166 - class_device_create(vio_class, NULL, MKDEV(major, i*32 + j), NULL,
167 - "vio%c%d", i + 'A', j);
168 + // Lookup name of vio to create
169 + lookupPINName(vlinkV100, devName, i, j);
170 + class_device_create(vio_class, NULL, MKDEV(major, i*32 + j), NULL, devName);
171 +// "vio%c%d", i + 'A', j);
172 }
173 }
174
175 @@ -212,6 +263,29 @@
176 return retval;
177 }
178
179 +static void lookupPINName(char version100, char *devName, char port, char pin)
180 +{
181 + int i = -1;
182 + char found = 0;
183 + while (!found)
184 + {
185 + i++;
186 + if (i >= MAX_VIO_NAMES)
187 + break;
188 + if (VioName[i].port == port+'A' && VioName[i].pin == pin)
189 + {
190 + printk(KERN_ERR "vio++: %c%d=%s\n",VioName[i].port,VioName[i].pin,VioName[i].name150);
191 + if (version100)
192 + strcpy(devName, VioName[i].name100);
193 + else
194 + strcpy(devName, VioName[i].name150);
195 + found = 1;
196 + }
197 + }
198 + if (!found)
199 + sprintf(devName, "vio%c%d", port + 'A', pin);
200 +}
201 +
202 static struct platform_device *vio_platform_device;
203
204 static struct platform_driver vio_driver = {
This page took 0.051535 seconds and 5 git commands to generate.