summaryrefslogtreecommitdiffstats
path: root/target/linux/at91/patches-2.6.21/016-v1-15-detect.patch
blob: 0778d6a02f8789f779ce98388718f619c0713a62 (plain)
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
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
--- linux-2.6.21.5.old/arch/arm/mach-at91/at91rm9200_devices.c	2008-03-13 16:24:18.000000000 +0100
+++ linux-2.6.21.5/arch/arm/mach-at91/at91rm9200_devices.c	2008-03-13 16:34:43.000000000 +0100
@@ -840,9 +840,9 @@
 	at91_set_B_periph(AT91_PIN_PA6, 0);		/* RXD3 */
 	at91_set_B_periph(AT91_PIN_PB0, 0);   /* RTS3 */
 	at91_set_B_periph(AT91_PIN_PB1, 0);   /* CTS3 */
-	at91_set_gpio_output(AT91_PIN_PB29, 1); /* DTR0 */
-	at91_set_gpio_output(AT91_PIN_PB2, 1);  /* RI0 */
-	at91_set_gpio_input(AT91_PIN_PA24, 1);  /* DCD0 */
+	at91_set_gpio_output(AT91_PIN_PB29, 1); /* DTR3 */
+	at91_set_gpio_output(AT91_PIN_PB2, 1);  /* RI3 */
+	at91_set_gpio_input(AT91_PIN_PA24, 1);  /* DCD3 */
 	at91_set_deglitch(AT91_PIN_PA24, 1);
 }
 
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
--- linux-2.6.21.5.old/arch/arm/mach-at91/board-vlink.c	2008-03-13 16:24:18.000000000 +0100
+++ linux-2.6.21.5/arch/arm/mach-at91/board-vlink.c	2008-03-13 16:35:05.000000000 +0100
@@ -126,6 +126,7 @@
 
 static void __init vlink_board_init(void)
 {
+	int v100;
 	/* Serial */
 	at91_add_device_serial();
 	/* Ethernet */
@@ -147,6 +148,10 @@
 //	at91_set_gpio_output(AT91_PIN_PB22, 1);	/* this MMC card slot can optionally use SPI signaling (CS3). */
 	at91_add_device_mmc(0, &vlink_mmc_data);
 #endif
+// Set VLink version PIN as an input with pull up (V1.5 = GND)
+	at91_set_gpio_input(AT91_PIN_PC2, 1);  
+	v100 = at91_get_gpio_value(AT91_PIN_PC2);
+
 	/* LEDs */
 //	at91_gpio_leds(vlink_leds, ARRAY_SIZE(vlink_leds));
 
@@ -164,10 +169,16 @@
 /* SIM Cards */
 	if (at91_get_gpio_value(AT91_PIN_PB8)) {
 		at91_set_gpio_output(AT91_PIN_PB11, 0);
-		at91_set_gpio_output(AT91_PIN_PB9, 1);
+		if (v100)
+			at91_set_gpio_output(AT91_PIN_PB9, 1);
+		else
+			at91_set_gpio_output(AT91_PIN_PC13, 1);
 	} else {
 		at91_set_gpio_output(AT91_PIN_PB11, 1);
-		at91_set_gpio_output(AT91_PIN_PB9, 0);
+		if (v100)
+			at91_set_gpio_output(AT91_PIN_PB9, 0);
+		else
+			at91_set_gpio_output(AT91_PIN_PC13, 0);
 	}
 		
 	at91_set_gpio_output(AT91_PIN_PB10, 1); // ENBSC2
@@ -182,7 +193,18 @@
 	at91_set_gpio_input(AT91_PIN_PB27, 1);  // UDB_CNX
 	at91_set_gpio_output(AT91_PIN_PB28, 1); // UDB_PUP
 	at91_set_multi_drive(AT91_PIN_PB28, 1); // Set to multi-drive
-
+	
+	if (v100)
+	{	// V100
+		at91_set_gpio_input (AT91_PIN_PC12, 1);   // SD Card present
+	}
+	else
+	{	// DO special things for V1.5
+		at91_set_gpio_output(AT91_PIN_PB9 , 0);   // USB suspend
+		at91_set_gpio_input (AT91_PIN_PC10, 1);   // SD Card present
+		at91_set_gpio_output(AT91_PIN_PC11, 0);   // USB Vin CTRL for modules onboard 
+		at91_set_gpio_output(AT91_PIN_PC12, 0);   // SIM control 
+	}
 }
 
 MACHINE_START(VLINK, "FDL VersaLink")
diff -urN linux-2.6.21.5.old/drivers/char/vlink_giu.c linux-2.6.21.5/drivers/char/vlink_giu.c
--- linux-2.6.21.5.old/drivers/char/vlink_giu.c	2008-03-13 16:24:18.000000000 +0100
+++ linux-2.6.21.5/drivers/char/vlink_giu.c	2008-03-13 16:37:06.000000000 +0100
@@ -41,8 +41,7 @@
 module_param(major, int, 0);
 MODULE_PARM_DESC(major, "Major device number");
 
-#define VIO_NR_DEVS 96
-
+#define VIO_NR_DEVS   96
 struct vio_dev {
 	struct cdev cdev;
 };
@@ -50,6 +49,53 @@
 struct vio_dev *vio_devices;
 static struct class *vio_class;
 
+// KWJ + AJE
+#define MAX_VIO_NAMES 24
+typedef struct
+{
+	char port;
+	char pin;
+	char name100[10];
+	char name150[10];
+} VIO_NAMES;
+
+VIO_NAMES VioName[MAX_VIO_NAMES] = {  //Port,PIN, V100     , V150
+										{'A',19,"port1DTR" ,"port1DTR"},
+										{'A',24,"port2DTR" ,"port2DTR"},
+										{'B',8, "jigOn"    ,"jigOn"} ,
+										{'B',9, "enbSC3"   ,"usbSUSPND"},
+										{'B',10,"enbSC2"   ,"enbSC2"},
+										{'B',11,"enbSC1"   ,"enbSC1"},
+										{'B',12,"gsmONOFF" ,"gsmONOFF"},
+										{'B',14,"ledBAP1"  ,"ledBAP1"},
+										{'B',15,"ledBBP1"  ,"ledBBP1"},
+										{'B',16,"ledBAP2"  ,"ledBAP2"},
+										{'B',17,"ledBBP2"  ,"ledBBP2"},
+										{'B',27,"udpCNX"   ,"udpCNX"},
+										{'B',28,"udpPUP"   ,"udpPUP"},
+										{'B',29,"port2DCD" ,"port2DCD"},
+										{'C',2, "vlVer100" ,"vlVer150"},
+										{'C',7, "ledFAP1"  ,"ledFAP1"},
+										{'C',8, "ledFBP1"  ,"ledFBP1"},
+										{'C',10,"vioC10"   ,"sdCardON"},
+										{'C',11,"vioC11"   ,"vusbCTRL"},
+										{'C',12,"sdCardON" ,"simCTRL"},
+										{'C',13,"vioC13"   ,"enbSC3"},
+										{'C',14,"ledFBP2"  ,"ledFBP2"},
+										{'C',15,"ledFAP2"  ,"ledFAP2"},
+										{0,0,"",""}
+								   };
+/*										{'B',18,"gsmRIO"  ,"gsmRIO"},
+										{'B',20,"gsmTX"   ,"gsmTX"},
+										{'B',21,"gsmRX"   ,"gsmRX"},
+										{'B',22,"gsmPIND" ,"gsmPIND"},
+										{'B',23,"gsmDCD"  ,"gsmDCD"},
+										{'B',24,"gsmCTS"  ,"gsmCTS"},
+										{'B',25,"gsmDSR"  ,"gsmDSR"},
+										{'B',26,"gsmRTS"  ,"gsmRTS"},*/
+static void lookupPINName(char version100, char *devName, char port, char pin);
+// EOF KWJ + AJE
+
 static ssize_t gpio_read(struct file *file, char __user *buf, size_t len,
                          loff_t *ppos)
 {
@@ -160,6 +206,8 @@
 {
 	int retval, i, j;
 	dev_t vdev = 0;
+	char devName[30];
+	int  vlinkV100;
 
 	if (major) {
 		vdev = MKDEV(major, 0);
@@ -185,6 +233,7 @@
 		vio_remove(dev);
 		return PTR_ERR(vio_class);
 	}
+    vlinkV100 = at91_get_gpio_value(AT91_PIN_PC2);		// Denotes V1.5 if ground
 
 	vio_devices = kmalloc(VIO_NR_DEVS * sizeof(struct vio_dev), GFP_KERNEL);
 	if (!vio_devices) {
@@ -198,8 +247,10 @@
 			int iodev = at91_is_pin_gpio(PIN_BASE + i*32 + j);
 			if (iodev) {
 				vio_setup_cdev(&vio_devices[i*32 + j], i*32 + j);
-				class_device_create(vio_class, NULL, MKDEV(major, i*32 + j), NULL,
-					"vio%c%d", i + 'A', j);
+				// Lookup name of vio to create
+				lookupPINName(vlinkV100, devName, i, j);
+				class_device_create(vio_class, NULL, MKDEV(major, i*32 + j), NULL, devName);
+//					"vio%c%d", i + 'A', j);
 			}
 		}
 
@@ -212,6 +263,29 @@
 	return retval;
 }
 
+static void lookupPINName(char version100, char *devName, char port, char pin)
+{
+	int i = -1;
+	char found = 0;
+	while (!found)
+	{
+		i++;
+		if (i >= MAX_VIO_NAMES)
+			break;
+		if (VioName[i].port == port+'A' && VioName[i].pin == pin)
+		{
+			printk(KERN_ERR "vio++: %c%d=%s\n",VioName[i].port,VioName[i].pin,VioName[i].name150);
+			if (version100)
+				strcpy(devName, VioName[i].name100);
+			else
+				strcpy(devName, VioName[i].name150);
+			found = 1;
+		}
+	}
+	if (!found)
+		sprintf(devName, "vio%c%d", port + 'A', pin);
+}
+
 static struct platform_device *vio_platform_device;
 
 static struct platform_driver vio_driver = {