I wrote:
> Yes, I checked the power and reset GPIOs and everything there looks
> good. When you run stable-tracking, does WLAN work, i.e., does it
> show up in "iwconfig" ?

Found it :-) It was the missing reset pulse.

I've attached two patches to choose from:

- fix-wlan-must-reset.patch is minimally invasive

- fix-wlan-share-bringup.patch does only the pin configuration in
  gta02_wlan_probe and shares the code of gta02_wlan_write for the
  rest. This introduces potential brief glitches on CHIP_PWD and
  WLAN_nRESET, but they shouldn't really matter.

- Werner
fix-wlan-must-reset.patch

introduce-gta02-pm-wlan.patch turned the WLAN module off by default and
performed the power-up sequence only on demand, which would have required
the WLAN driver to be built as a module.

fix-set-wlan-power-mgt-to-default-on.patch reverted to powering the WLAN
module on by default, but didn't do the power-up sequence and thus missed
the reset, causing the module to fail to communicate if it had been
brought out of reset before booting the current kernel.

This patch puts the reset pulse back in.

Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>

---

diff --git a/arch/arm/plat-s3c24xx/gta02_pm_wlan.c b/arch/arm/plat-s3c24xx/gta02_pm_wlan.c
index 7c6154d..0b86a55 100644
--- a/arch/arm/plat-s3c24xx/gta02_pm_wlan.c
+++ b/arch/arm/plat-s3c24xx/gta02_pm_wlan.c
@@ -104,8 +104,11 @@ static int __init gta02_wlan_probe(struct platform_device *pdev)
 	s3c2410_gpio_setpin(GTA02_CHIP_PWD, !default_state);
 	s3c2410_gpio_cfgpin(GTA02_CHIP_PWD, S3C2410_GPIO_OUTPUT);
 	/* reset is asserted */
-	s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, default_state);
+	s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 0);
 	s3c2410_gpio_cfgpin(GTA02_GPIO_nWLAN_RESET, S3C2410_GPIO_OUTPUT);
+	if (default_state)
+		msleep(100);
+	s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, default_state);
 
 	return sysfs_create_group(&pdev->dev.kobj, &gta02_wlan_attr_group);
 }
fix-wlan-share-bringup.patch

Use the same code for bringup during initialization and when switching
the module on/off through sysfs.

This also solves the problem of not resetting the WLAN module, which
was caused by fix-set-wlan-power-mgt-to-default-on.patch only partially
reverting the power-off default introduced with
introduce-gta02-pm-wlan.patch.

Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>

---

diff --git a/arch/arm/plat-s3c24xx/gta02_pm_wlan.c b/arch/arm/plat-s3c24xx/gta02_pm_wlan.c
index 7c6154d..b55ba24 100644
--- a/arch/arm/plat-s3c24xx/gta02_pm_wlan.c
+++ b/arch/arm/plat-s3c24xx/gta02_pm_wlan.c
@@ -26,25 +26,13 @@
 
 #include <linux/delay.h>
 
-static ssize_t gta02_wlan_read(struct device *dev,
-				       struct device_attribute *attr, char *buf)
-{
-	if (s3c2410_gpio_getpin(GTA02_CHIP_PWD))
-		return strlcpy(buf, "0\n", 3);
-
-	return strlcpy(buf, "1\n", 3);
-}
 
-static ssize_t gta02_wlan_write(struct device *dev,
-		   struct device_attribute *attr, const char *buf, size_t count)
+static void gta02_wlan_power(int on)
 {
-	unsigned long on = simple_strtoul(buf, NULL, 10) & 1;
-
 	if (!on) {
 		s3c2410_gpio_setpin(GTA02_CHIP_PWD, 1);
 		s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 0);
-
-		return count;
+		return;
 	}
 
 	/* power up sequencing */
@@ -56,6 +44,23 @@ static ssize_t gta02_wlan_write(struct device *dev,
 	msleep(100);
 	s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 1);
 
+}
+
+static ssize_t gta02_wlan_read(struct device *dev,
+				       struct device_attribute *attr, char *buf)
+{
+	if (s3c2410_gpio_getpin(GTA02_CHIP_PWD))
+		return strlcpy(buf, "0\n", 3);
+
+	return strlcpy(buf, "1\n", 3);
+}
+
+static ssize_t gta02_wlan_write(struct device *dev,
+		   struct device_attribute *attr, const char *buf, size_t count)
+{
+	unsigned long on = simple_strtoul(buf, NULL, 10) & 1;
+
+	gta02_wlan_power(on);
 	return count;
 }
 
@@ -100,12 +105,9 @@ static int __init gta02_wlan_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "starting\n");
 
-	/* Power is down */
-	s3c2410_gpio_setpin(GTA02_CHIP_PWD, !default_state);
 	s3c2410_gpio_cfgpin(GTA02_CHIP_PWD, S3C2410_GPIO_OUTPUT);
-	/* reset is asserted */
-	s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, default_state);
 	s3c2410_gpio_cfgpin(GTA02_GPIO_nWLAN_RESET, S3C2410_GPIO_OUTPUT);
+	gta02_wlan_power(default_state);
 
 	return sysfs_create_group(&pdev->dev.kobj, &gta02_wlan_attr_group);
 }

Reply via email to