[LIBERTAS] Hook up EC GPIO pin to reset Libertas when it goes AWOL

David Woodhouse dwmw2 at infradead.unroutableorg
Thu Nov 9 08:03:40 EST 2006


Commit:     cfb240271c6c81f927b499b9fec196c5b9e9ad80
Parent:     38ec230ba3bf896f4a20b47c7cf0927b6aa7ec99
commit cfb240271c6c81f927b499b9fec196c5b9e9ad80
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Thu Nov 9 21:08:05 2006 +0800
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Thu Nov 9 21:08:05 2006 +0800

    [LIBERTAS] Hook up EC GPIO pin to reset Libertas when it goes AWOL
    
    It seems that USB traffic on other ports will make the Libertas chip go
    gaga. We hooked up a GPIO pin from the EC on the OLPC CL1 B-test board
    so that we can get it back again.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/net/wireless/libertas/if_usb.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 4371c0a..fd1bc31 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -38,6 +38,7 @@ #include <linux/delay.h>
 #include <linux/firmware.h>
 #include <linux/netdevice.h>
 #include <linux/usb.h>
+#include <asm/io.h>
 
 #include "host.h"
 #include "sbi.h"
@@ -804,12 +805,39 @@ int libertas_sbi_get_cis_info(wlan_priva
 	return WLAN_STATUS_SUCCESS;
 }
 
+extern int machine_is_olpc;
+
 static int reset_device(wlan_private *priv)
 {
 	int ret;
 
 	ret = libertas_prepare_and_send_command(priv, HostCmd_CMD_802_11_RESET,
 			   	    HostCmd_ACT_HALT, 0, 0, NULL);
+#ifdef CONFIG_OLPC
+	if (machine_is_olpc) {
+		/* Frob the GPIO ED pin on the EC to reset the poxy thing too */
+
+		/* Set DATA low */
+		outb(0xfc, 0x381);
+		outb(0x25, 0x382);
+		outb(inb(0x383) & ~0x40, 0x383);
+
+		/* Enable output */
+		outb(0xfc, 0x381);
+		outb(0x15, 0x382);
+		outb(inb(0x383) | 0x40, 0x383); 
+		
+		printk(KERN_CRIT "Resetting OLPC wireless...\n");
+		msleep(500);
+
+		/* Disable output */
+		outb(0xfc, 0x381);
+		outb(0x15, 0x382);
+		outb(inb(0x383) & ~0x40, 0x383); 
+
+		msleep(5);
+	}
+#endif
 	msleep_interruptible(10);
 
 	return ret;


More information about the Commits-kernel mailing list