summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2012-09-18 13:23:08 -0500
committerJesse Gilles <jgilles@multitech.com>2012-09-18 13:36:56 -0500
commit37a410282653ad5c567d23861ebe6afcf7675c5c (patch)
tree7693139e720f53c91c5525d71f09777946f0b6c4
parent165908091aaa5b6f08a14f1bf67bf50e62e36ed4 (diff)
mts-io: mt100eocg-pcie-dk: remove unavailable pins from sysfs, add radio reset on startup if needed
-rw-r--r--multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/mts-io.init25
-rwxr-xr-xmultitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/radio-reset-h516
-rw-r--r--multitech/recipes/multitech/mts-io/mts-io-pcieh5.patch35
-rw-r--r--multitech/recipes/multitech/mts-io_0.5.1.bb2
4 files changed, 63 insertions, 15 deletions
diff --git a/multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/mts-io.init b/multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/mts-io.init
new file mode 100644
index 0000000..7c285ec
--- /dev/null
+++ b/multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/mts-io.init
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+case $1 in
+ start)
+ echo "Loading mts-io module"
+ modprobe mts_io
+ # reset module if MTPCIE-X was not detected
+ if ! lsusb | grep -q 'ID 1bc7:'; then
+ echo "Restarting radio"
+ radio-reset-h5
+ fi
+ ;;
+
+ stop)
+ echo "Unloading mts-io module"
+ modprobe -r mts_io
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 2
+ ;;
+esac
+
+
diff --git a/multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/radio-reset-h5 b/multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/radio-reset-h5
new file mode 100755
index 0000000..02e43d8
--- /dev/null
+++ b/multitech/recipes/multitech/mts-io/mt100eocg-pcie-dk/radio-reset-h5
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# This script works around an H5 radio quirk by disabling USB and
+# waiting for the radio to power up before re-enabling it. Note that
+# this will disable all USB devices connected to the USB host controller
+# until the reset is finished. USB device port is not affected.
+
+pin="gpo3"
+
+rmmod ohci_hcd
+# toggle onoff pin
+mts-io-sysfs store $pin 1
+usleep 200000
+mts-io-sysfs store $pin 0
+sleep 15
+modprobe ohci_hcd
diff --git a/multitech/recipes/multitech/mts-io/mts-io-pcieh5.patch b/multitech/recipes/multitech/mts-io/mts-io-pcieh5.patch
index a49f649..15a1e28 100644
--- a/multitech/recipes/multitech/mts-io/mts-io-pcieh5.patch
+++ b/multitech/recipes/multitech/mts-io/mts-io-pcieh5.patch
@@ -1,8 +1,8 @@
Index: io-module/mts_io.c
===================================================================
---- io-module.orig/mts_io.c 2011-10-03 12:47:24.000000000 -0500
-+++ io-module/mts_io.c 2012-09-12 17:06:42.476070820 -0500
-@@ -317,17 +317,19 @@
+--- io-module.orig/mts_io.c
++++ io-module/mts_io.c
+@@ -317,17 +317,19 @@ static struct gpio_pin gpio_pins_mt100eo
.output_value = 1,
.use_pullup = 0,
},
@@ -10,10 +10,10 @@ Index: io-module/mts_io.c
+ // (was TXD1 and DTR1) (PB17 and PB7 are tied together)
{
- .name = "TXD1",
-+ .name = "WLAN_EN",
- .pin = AT91_PIN_PB17,
-+ .pin = AT91_PIN_PB7,
- .direction = GPIO_DIR_INPUT,
++ .name = "WLAN_EN",
++ .pin = AT91_PIN_PB7,
+ .direction = GPIO_DIR_OUTPUT,
.output_value = 0,
.use_pullup = 0,
@@ -27,7 +27,7 @@ Index: io-module/mts_io.c
.output_value = 0,
.use_pullup = 0,
},
-@@ -338,6 +340,8 @@
+@@ -338,6 +340,8 @@ static struct gpio_pin gpio_pins_mt100eo
.output_value = 1,
.use_pullup = 0,
},
@@ -36,7 +36,7 @@ Index: io-module/mts_io.c
{
.name = "GPIO11",
.pin = AT91_PIN_PB19,
-@@ -345,6 +349,7 @@
+@@ -345,6 +349,7 @@ static struct gpio_pin gpio_pins_mt100eo
.output_value = 1,
.use_pullup = 1,
},
@@ -44,7 +44,7 @@ Index: io-module/mts_io.c
{
.name = "GPIO12",
.pin = AT91_PIN_PB20,
-@@ -400,6 +405,13 @@
+@@ -400,6 +405,13 @@ static int mts_id_eeprom_load(void)
mts_product_id = MTCDP_E1_DK_1_0;
}
@@ -58,7 +58,7 @@ Index: io-module/mts_io.c
log_info("sizeof: %lu", (unsigned long) sizeof(struct mts_id_eeprom_layout));
log_info("vendor-id: %.32s", id_eeprom.vendor_id);
log_info("product-id: %.32s", id_eeprom.product_id);
-@@ -1976,6 +1988,100 @@
+@@ -1976,6 +1988,100 @@ static ssize_t mts_attr_store_cd(struct
return count;
}
@@ -159,7 +159,7 @@ Index: io-module/mts_io.c
static struct device_attribute dev_attr_gpo1 = {
.attr = {
-@@ -2137,6 +2243,24 @@
+@@ -2137,6 +2243,24 @@ static struct device_attribute dev_attr_
.store = mts_attr_store_gpio12,
};
@@ -184,16 +184,23 @@ Index: io-module/mts_io.c
static struct device_attribute dev_attr_rsersrc = {
.attr = {
.name = "rsersrc",
-@@ -2164,6 +2288,8 @@
+@@ -2157,13 +2281,13 @@ static struct device_attribute dev_attr_
+
+
+ static struct attribute *mt100eocg_platform_attributes[] = {
+- &dev_attr_extserial_dtr.attr,
+ &dev_attr_extserial_cd.attr,
+ &dev_attr_rsersrc.attr,
+ &dev_attr_radio_reset.attr,
&dev_attr_eth0_enabled.attr,
- &dev_attr_gpio11.attr,
+- &dev_attr_gpio11.attr,
&dev_attr_gpio12.attr,
+ &dev_attr_bt_enabled.attr,
+ &dev_attr_wlan_enabled.attr,
&dev_attr_gpo1.attr,
&dev_attr_gpo2.attr,
-@@ -2323,7 +2449,7 @@
+@@ -2323,7 +2447,7 @@ static int __devinit mts_spi_dout_probe(
return tmp;
}
@@ -202,7 +209,7 @@ Index: io-module/mts_io.c
spi_writen(spi, &spi_dout_value, 1);
spi_dout_dev = spi;
-@@ -2521,11 +2647,14 @@
+@@ -2521,11 +2645,14 @@ static int __init mts_io_init(void)
if ( mts_product_id == MT100EOCG_0_0 ) {
//Set open drain for GPIO11 and GPIO12 using multi drive
diff --git a/multitech/recipes/multitech/mts-io_0.5.1.bb b/multitech/recipes/multitech/mts-io_0.5.1.bb
index 43ee4fe..2ddf14c 100644
--- a/multitech/recipes/multitech/mts-io_0.5.1.bb
+++ b/multitech/recipes/multitech/mts-io_0.5.1.bb
@@ -1,5 +1,5 @@
require mts-io.inc
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
SRC_URI_append_mt100eocg-pcie-dk = " file://mts-io-pcieh5.patch"