summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorhcg <hcg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-03-13 16:00:39 +0000
committerhcg <hcg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-03-13 16:00:39 +0000
commit02edb9eda7b8010adaaf0f6b910a1b008c870ba6 (patch)
treefe26fcd840ee8e1340736b499c599ec4b55997c6 /target
parentaa3defff60b9e1766574b78c0a8f8c09878fbdbd (diff)
at91: added new sim enable code as well as detection code to
differentiate between v1.0 and v1.5 hardware revisions git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10600 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/at91/patches-2.6.21/015-simenable.patch58
-rw-r--r--target/linux/at91/patches-2.6.21/016-v1-15-detect.patch204
2 files changed, 262 insertions, 0 deletions
diff --git a/target/linux/at91/patches-2.6.21/015-simenable.patch b/target/linux/at91/patches-2.6.21/015-simenable.patch
new file mode 100644
index 000000000..64ee4663f
--- /dev/null
+++ b/target/linux/at91/patches-2.6.21/015-simenable.patch
@@ -0,0 +1,58 @@
+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 2007-07-26 12:43:11.000000000 +0200
++++ linux-2.6.21.5/arch/arm/mach-at91/board-vlink.c 2007-08-20 16:56:56.000000000 +0200
+@@ -151,31 +151,37 @@
+ // at91_gpio_leds(vlink_leds, ARRAY_SIZE(vlink_leds));
+
+ /* Other LED's */
+- at91_set_gpio_output(AT91_PIN_PC7, 1); // LED FRONT AP1
+- at91_set_gpio_output(AT91_PIN_PC8, 1); // LED FRONT BP1
+- at91_set_gpio_output(AT91_PIN_PB14, 1); // LED BACK AP1
+- at91_set_gpio_output(AT91_PIN_PB15, 1); // LED BACK BP1
+- at91_set_gpio_output(AT91_PIN_PB16, 1); // LED BACK AP2
+- at91_set_gpio_output(AT91_PIN_PB17, 1); // LED BACK BP2
++ at91_set_gpio_output(AT91_PIN_PC7, 1); // LED FRONT AP1
++ at91_set_gpio_output(AT91_PIN_PC8, 1); // LED FRONT BP1
++ at91_set_gpio_output(AT91_PIN_PB14, 1); // LED BACK AP1
++ at91_set_gpio_output(AT91_PIN_PB15, 1); // LED BACK BP1
++ at91_set_gpio_output(AT91_PIN_PB16, 1); // LED BACK AP2
++ at91_set_gpio_output(AT91_PIN_PB17, 1); // LED BACK BP2
++
++/* Test jig presence detection */
++ at91_set_gpio_input(AT91_PIN_PB8, 1); // JIGPRESENT
+
+ /* SIM Cards */
+- at91_set_gpio_output(AT91_PIN_PB9, 1); // ENBSC3
+- at91_set_gpio_output(AT91_PIN_PB10, 1); // ENBSC2
+- at91_set_gpio_output(AT91_PIN_PB11, 1); // ENBSC1
++ if (at91_get_gpio_value(AT91_PIN_PB8)) {
++ at91_set_gpio_output(AT91_PIN_PB11, 0);
++ at91_set_gpio_output(AT91_PIN_PB9, 1);
++ } else {
++ at91_set_gpio_output(AT91_PIN_PB11, 1);
++ at91_set_gpio_output(AT91_PIN_PB9, 0);
++ }
++
++ at91_set_gpio_output(AT91_PIN_PB10, 1); // ENBSC2
+
+ /* GSM Module Control */
+- at91_set_gpio_output(AT91_PIN_PB12, 1); // GSMONOFF
+-
+-/* Test jig presence detection */
+- at91_set_gpio_input(AT91_PIN_PB8, 1); // JIGPRESENT
++ at91_set_gpio_output(AT91_PIN_PB12, 1); // GSMONOFF
+
+ /* Power indicator */
+- at91_set_gpio_input(AT91_PIN_PB22, 1); // PWR_IND
++ at91_set_gpio_input(AT91_PIN_PB22, 1); // PWR_IND
+
+ /* USB Device control */
+- 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
++ 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
+
+ }
+
diff --git a/target/linux/at91/patches-2.6.21/016-v1-15-detect.patch b/target/linux/at91/patches-2.6.21/016-v1-15-detect.patch
new file mode 100644
index 000000000..0778d6a02
--- /dev/null
+++ b/target/linux/at91/patches-2.6.21/016-v1-15-detect.patch
@@ -0,0 +1,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 = {