public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: tegra: paz00: Add Wifi and second serial port support
@ 2011-07-15 10:24 Marc Dietrich
       [not found] ` <1310725464-2524-1-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Marc Dietrich @ 2011-07-15 10:24 UTC (permalink / raw)
  To: Collin Cross
  Cc: Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marc Dietrich

Colin,

the following three patches add the second serial port (some solder points
on the mainboard) and Wifi support (rfkill and LED) to PAZ00.
The second serial port is useful to be able to communicate with the booloader
and also to see early kernel messages.

They were intended for 3.1 but if it's too late, 3.2 is also ok.

Thanks

Marc

Marc Dietrich (3):
  ARM: tegra: paz00: add support serial port on JP1
  ARM: tegra: paz00: export the WIFI rfkill gpio
  ARM: tegra: paz00: enable wifi led

 arch/arm/mach-tegra/board-paz00-pinmux.c |    2 +
 arch/arm/mach-tegra/board-paz00.c        |   50 ++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/board-paz00.h        |    7 ++++
 3 files changed, 59 insertions(+), 0 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/3] ARM: tegra: paz00: add support serial port on JP1
       [not found] ` <1310725464-2524-1-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
@ 2011-07-15 10:24   ` Marc Dietrich
       [not found]     ` <1310725464-2524-2-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  2011-07-15 10:24   ` [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio Marc Dietrich
  2011-07-15 10:24   ` [PATCH 3/3] ARM: tegra: paz00: enable wifi led Marc Dietrich
  2 siblings, 1 reply; 13+ messages in thread
From: Marc Dietrich @ 2011-07-15 10:24 UTC (permalink / raw)
  To: Collin Cross
  Cc: Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marc Dietrich

UART-A is connected to JP1 and used by the bootloader for debugging
output while UART-D is connected to the mini-pcie expansion slot.

Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
---
 arch/arm/mach-tegra/board-paz00.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 1b076f6..931b06e 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -47,7 +47,17 @@
 #include "gpio-names.h"
 
 static struct plat_serial8250_port debug_uart_platform_data[] = {
+/* serial port on JP1 */
 	{
+		.membase	= IO_ADDRESS(TEGRA_UARTA_BASE),
+		.mapbase	= TEGRA_UARTA_BASE,
+		.irq		= INT_UARTA,
+		.flags		= UPF_BOOT_AUTOCONF,
+		.iotype		= UPIO_MEM,
+		.regshift	= 2,
+		.uartclk	= 216000000,
+	}, {
+/* serial port on mini-pcie */
 		.membase	= IO_ADDRESS(TEGRA_UARTD_BASE),
 		.mapbase	= TEGRA_UARTD_BASE,
 		.irq		= INT_UARTD,
@@ -137,6 +147,7 @@ static void __init tegra_paz00_fixup(struct machine_desc *desc,
 
 static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
 	/* name		parent		rate		enabled */
+	{ "uarta",	"pll_p",	216000000,	true },
 	{ "uartd",	"pll_p",	216000000,	true },
 	{ NULL,		NULL,		0,		0},
 };
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio
       [not found] ` <1310725464-2524-1-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  2011-07-15 10:24   ` [PATCH 1/3] ARM: tegra: paz00: add support serial port on JP1 Marc Dietrich
@ 2011-07-15 10:24   ` Marc Dietrich
       [not found]     ` <1310725464-2524-3-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  2011-07-15 10:24   ` [PATCH 3/3] ARM: tegra: paz00: enable wifi led Marc Dietrich
  2 siblings, 1 reply; 13+ messages in thread
From: Marc Dietrich @ 2011-07-15 10:24 UTC (permalink / raw)
  To: Collin Cross
  Cc: Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marc Dietrich

This makes the WIFI rfkill gpio available to userspace. On boot,
WIFI will be unblocked by default.

Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
---
 arch/arm/mach-tegra/board-paz00-pinmux.c |    1 +
 arch/arm/mach-tegra/board-paz00.c        |   16 ++++++++++++++++
 arch/arm/mach-tegra/board-paz00.h        |    6 ++++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index bdd2627..c02a48f 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -145,6 +145,7 @@ static struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_SD1_WP,	.enable = true },
 	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
 	{ .gpio = TEGRA_ULPI_RST,	.enable = true },
+	{ .gpio = TEGRA_WIFI_PWRN,	.enable = true },
 };
 
 void paz00_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 931b06e..0bc652b 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -25,6 +25,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/pda_power.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
 #include <linux/platform_data/tegra_usb.h>
@@ -165,6 +166,20 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 = {
 	.is_8bit	= 1,
 };
 
+static void __init paz00_wifi_init(void)
+{
+	int ret;
+
+	/* unlock hw rfkill */
+	ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH,
+		"wifi pwrn");
+	if (ret) {
+		pr_warning("WIFI: could not requestrfkill gpio\n");
+		return;
+	}
+	gpio_export(TEGRA_WIFI_PWRN, 0);
+};
+
 static void __init tegra_paz00_init(void)
 {
 	tegra_clk_init_from_table(paz00_clk_init_table);
@@ -178,6 +193,7 @@ static void __init tegra_paz00_init(void)
 
 	paz00_i2c_init();
 	paz00_usb_init();
+	paz00_wifi_init();
 }
 
 MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
index d4ff39d..5d2849e 100644
--- a/arch/arm/mach-tegra/board-paz00.h
+++ b/arch/arm/mach-tegra/board-paz00.h
@@ -17,11 +17,17 @@
 #ifndef _MACH_TEGRA_BOARD_PAZ00_H
 #define _MACH_TEGRA_BOARD_PAZ00_H
 
+/* SDCARD */
 #define TEGRA_GPIO_SD1_CD		TEGRA_GPIO_PV5
 #define TEGRA_GPIO_SD1_WP		TEGRA_GPIO_PH1
 #define TEGRA_GPIO_SD1_POWER		TEGRA_GPIO_PT3
+
+/* ULPI */
 #define TEGRA_ULPI_RST			TEGRA_GPIO_PV0
 
+/* WIFI */
+#define TEGRA_WIFI_PWRN			TEGRA_GPIO_PK5
+
 void paz00_pinmux_init(void);
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] ARM: tegra: paz00: enable wifi led
       [not found] ` <1310725464-2524-1-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  2011-07-15 10:24   ` [PATCH 1/3] ARM: tegra: paz00: add support serial port on JP1 Marc Dietrich
  2011-07-15 10:24   ` [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio Marc Dietrich
@ 2011-07-15 10:24   ` Marc Dietrich
       [not found]     ` <1310725464-2524-4-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Marc Dietrich @ 2011-07-15 10:24 UTC (permalink / raw)
  To: Collin Cross
  Cc: Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marc Dietrich

This adds support for the wifi led. It is automaticly triggered by
the rfkill0 event.

Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
---
 arch/arm/mach-tegra/board-paz00-pinmux.c |    1 +
 arch/arm/mach-tegra/board-paz00.c        |   23 +++++++++++++++++++++++
 arch/arm/mach-tegra/board-paz00.h        |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index c02a48f..41a6304 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -146,6 +146,7 @@ static struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
 	{ .gpio = TEGRA_ULPI_RST,	.enable = true },
 	{ .gpio = TEGRA_WIFI_PWRN,	.enable = true },
+	{ .gpio = TEGRA_WIFI_LED,	.enable = true },
 };
 
 void paz00_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 0bc652b..9c7531a 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -26,6 +26,7 @@
 #include <linux/pda_power.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/leds.h>
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
 #include <linux/platform_data/tegra_usb.h>
@@ -79,8 +80,30 @@ static struct platform_device debug_uart = {
 	},
 };
 
+static struct gpio_led gpio_leds[] = {
+	{
+		.name                   = "wifi-led",
+		.default_trigger        = "rfkill0",
+		.gpio                   = TEGRA_WIFI_LED,
+	},
+};
+
+static struct gpio_led_platform_data gpio_led_info = {
+	.leds           = gpio_leds,
+	.num_leds       = ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device leds_gpio = {
+	.name   = "leds-gpio",
+	.id     = -1,
+	.dev    = {
+		.platform_data  = &gpio_led_info,
+	},
+};
+
 static struct platform_device *paz00_devices[] __initdata = {
 	&debug_uart,
+	&leds_gpio,
 	&tegra_sdhci_device1,
 	&tegra_sdhci_device4,
 };
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
index 5d2849e..5d06053 100644
--- a/arch/arm/mach-tegra/board-paz00.h
+++ b/arch/arm/mach-tegra/board-paz00.h
@@ -27,6 +27,7 @@
 
 /* WIFI */
 #define TEGRA_WIFI_PWRN			TEGRA_GPIO_PK5
+#define TEGRA_WIFI_LED			TEGRA_GPIO_PD0
 
 void paz00_pinmux_init(void);
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio
       [not found]     ` <1310725464-2524-3-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
@ 2011-07-15 12:17       ` Vasily Khoruzhick
       [not found]         ` <201107151517.03176.anarsoul-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2011-07-15 16:53       ` Stephen Warren
  1 sibling, 1 reply; 13+ messages in thread
From: Vasily Khoruzhick @ 2011-07-15 12:17 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Marc Dietrich, Collin Cross, Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Friday 15 July 2011 13:24:22 Marc Dietrich wrote:
> This makes the WIFI rfkill gpio available to userspace. On boot,
> WIFI will be unblocked by default.

Take a look on rfkill-gpio driver.

Regards
Vasily

> Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
> ---
>  arch/arm/mach-tegra/board-paz00-pinmux.c |    1 +
>  arch/arm/mach-tegra/board-paz00.c        |   16 ++++++++++++++++
>  arch/arm/mach-tegra/board-paz00.h        |    6 ++++++
>  3 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c
> b/arch/arm/mach-tegra/board-paz00-pinmux.c index bdd2627..c02a48f 100644
> --- a/arch/arm/mach-tegra/board-paz00-pinmux.c
> +++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
> @@ -145,6 +145,7 @@ static struct tegra_gpio_table gpio_table[] = {
>  	{ .gpio = TEGRA_GPIO_SD1_WP,	.enable = true },
>  	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
>  	{ .gpio = TEGRA_ULPI_RST,	.enable = true },
> +	{ .gpio = TEGRA_WIFI_PWRN,	.enable = true },
>  };
> 
>  void paz00_pinmux_init(void)
> diff --git a/arch/arm/mach-tegra/board-paz00.c
> b/arch/arm/mach-tegra/board-paz00.c index 931b06e..0bc652b 100644
> --- a/arch/arm/mach-tegra/board-paz00.c
> +++ b/arch/arm/mach-tegra/board-paz00.c
> @@ -25,6 +25,7 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/pda_power.h>
>  #include <linux/io.h>
> +#include <linux/gpio.h>
>  #include <linux/i2c.h>
>  #include <linux/i2c-tegra.h>
>  #include <linux/platform_data/tegra_usb.h>
> @@ -165,6 +166,20 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 =
> { .is_8bit	= 1,
>  };
> 
> +static void __init paz00_wifi_init(void)
> +{
> +	int ret;
> +
> +	/* unlock hw rfkill */
> +	ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH,
> +		"wifi pwrn");
> +	if (ret) {
> +		pr_warning("WIFI: could not requestrfkill gpio\n");
> +		return;
> +	}
> +	gpio_export(TEGRA_WIFI_PWRN, 0);
> +};
> +
>  static void __init tegra_paz00_init(void)
>  {
>  	tegra_clk_init_from_table(paz00_clk_init_table);
> @@ -178,6 +193,7 @@ static void __init tegra_paz00_init(void)
> 
>  	paz00_i2c_init();
>  	paz00_usb_init();
> +	paz00_wifi_init();
>  }
> 
>  MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
> diff --git a/arch/arm/mach-tegra/board-paz00.h
> b/arch/arm/mach-tegra/board-paz00.h index d4ff39d..5d2849e 100644
> --- a/arch/arm/mach-tegra/board-paz00.h
> +++ b/arch/arm/mach-tegra/board-paz00.h
> @@ -17,11 +17,17 @@
>  #ifndef _MACH_TEGRA_BOARD_PAZ00_H
>  #define _MACH_TEGRA_BOARD_PAZ00_H
> 
> +/* SDCARD */
>  #define TEGRA_GPIO_SD1_CD		TEGRA_GPIO_PV5
>  #define TEGRA_GPIO_SD1_WP		TEGRA_GPIO_PH1
>  #define TEGRA_GPIO_SD1_POWER		TEGRA_GPIO_PT3
> +
> +/* ULPI */
>  #define TEGRA_ULPI_RST			TEGRA_GPIO_PV0
> 
> +/* WIFI */
> +#define TEGRA_WIFI_PWRN			TEGRA_GPIO_PK5
> +
>  void paz00_pinmux_init(void);
> 
>  #endif

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/3] ARM: tegra: paz00: add support serial port on JP1
       [not found]     ` <1310725464-2524-2-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
@ 2011-07-15 16:39       ` Stephen Warren
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C23-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Warren @ 2011-07-15 16:39 UTC (permalink / raw)
  To: Marc Dietrich, Collin Cross
  Cc: Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> UART-A is connected to JP1 and used by the bootloader for debugging
> output while UART-D is connected to the mini-pcie expansion slot.
> 
> Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
> ---
>  arch/arm/mach-tegra/board-paz00.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
> index 1b076f6..931b06e 100644
> --- a/arch/arm/mach-tegra/board-paz00.c
> +++ b/arch/arm/mach-tegra/board-paz00.c
> @@ -47,7 +47,17 @@
>  #include "gpio-names.h"
> 
>  static struct plat_serial8250_port debug_uart_platform_data[] = {
> +/* serial port on JP1 */
>  	{

Shouldn't the indentation of the comment be aligned to the brace?

I'm not sure if the order of entries in the array matters. It'd presumably
be safer to add the new UART entry to the end of the array so that any
existing index-based number isn't changed.

> +		.membase	= IO_ADDRESS(TEGRA_UARTA_BASE),
> +		.mapbase	= TEGRA_UARTA_BASE,
> +		.irq		= INT_UARTA,
> +		.flags		= UPF_BOOT_AUTOCONF,
> +		.iotype		= UPIO_MEM,
> +		.regshift	= 2,
> +		.uartclk	= 216000000,
> +	}, {
> +/* serial port on mini-pcie */
>  		.membase	= IO_ADDRESS(TEGRA_UARTD_BASE),
>  		.mapbase	= TEGRA_UARTD_BASE,
>  		.irq		= INT_UARTD,
> @@ -137,6 +147,7 @@ static void __init tegra_paz00_fixup(struct machine_desc *desc,
> 
>  static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
>  	/* name		parent		rate		enabled */
> +	{ "uarta",	"pll_p",	216000000,	true },
>  	{ "uartd",	"pll_p",	216000000,	true },
>  	{ NULL,		NULL,		0,		0},
>  };
> --
> 1.7.4.1

-- 
nvpublic

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio
       [not found]     ` <1310725464-2524-3-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
  2011-07-15 12:17       ` Vasily Khoruzhick
@ 2011-07-15 16:53       ` Stephen Warren
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C2F-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Stephen Warren @ 2011-07-15 16:53 UTC (permalink / raw)
  To: Marc Dietrich, Collin Cross
  Cc: Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> This makes the WIFI rfkill gpio available to userspace. On boot,
> WIFI will be unblocked by default.
...
> +static void __init paz00_wifi_init(void)
> +{
> +	int ret;
> +
> +	/* unlock hw rfkill */
> +	ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH,
> +		"wifi pwrn");
> +	if (ret) {
> +		pr_warning("WIFI: could not requestrfkill gpio\n");
> +		return;
> +	}
> +	gpio_export(TEGRA_WIFI_PWRN, 0);
> +};

Wouldn't you want to skip the gpio_export() call if the gpio_request()
call failed?

Of course, this is moot since Vasily mentioned the gpio-rfkill driver.
Luckily, that driver is already in Tegra's for-next, so it should be
pretty easy to adapt to.

-- 
nvpublic

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 3/3] ARM: tegra: paz00: enable wifi led
       [not found]     ` <1310725464-2524-4-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
@ 2011-07-15 17:10       ` Stephen Warren
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C43-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Warren @ 2011-07-15 17:10 UTC (permalink / raw)
  To: Marc Dietrich, Collin Cross
  Cc: Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> This adds support for the wifi led. It is automaticly triggered by
> the rfkill0 event.
...
> +static struct gpio_led gpio_leds[] = {
> +	{
> +		.name                   = "wifi-led",
> +		.default_trigger        = "rfkill0",
> +		.gpio                   = TEGRA_WIFI_LED,
> +	},
> +};

How does this work given that the previous patch simply exports the actual
GPIO to user-space, rather than registering it through an rfkill driver;
Does the WiFi driver itself register directly with the rfkill system? 

(what model of device is the AC100's WiFi? I assume it's on USB.)

-- 
nvpublic

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C2F-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
@ 2011-07-15 17:25           ` Sergei Shtylyov
       [not found]             ` <4E2077EC.1070902-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2011-07-15 17:25 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Marc Dietrich, Collin Cross, Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Hello.

Stephen Warren wrote:

>> This makes the WIFI rfkill gpio available to userspace. On boot,
>> WIFI will be unblocked by default.
> ...
>> +static void __init paz00_wifi_init(void)
>> +{
>> +	int ret;
>> +
>> +	/* unlock hw rfkill */
>> +	ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH,
>> +		"wifi pwrn");
>> +	if (ret) {
>> +		pr_warning("WIFI: could not requestrfkill gpio\n");
>> +		return;
>> +	}
>> +	gpio_export(TEGRA_WIFI_PWRN, 0);
>> +};
> 
> Wouldn't you want to skip the gpio_export() call if the gpio_request()
> call failed?

    I think that's what he does -- there's a *return* statement.

WBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio
       [not found]             ` <4E2077EC.1070902-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
@ 2011-07-15 17:30               ` Stephen Warren
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Warren @ 2011-07-15 17:30 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Marc Dietrich, Collin Cross, Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Sergei Shtylyov wrote at Friday, July 15, 2011 11:25 AM:
> Stephen Warren wrote:
> 
> >> This makes the WIFI rfkill gpio available to userspace. On boot,
> >> WIFI will be unblocked by default.
> > ...
> >> +static void __init paz00_wifi_init(void)
> >> +{
> >> +	int ret;
> >> +
> >> +	/* unlock hw rfkill */
> >> +	ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH,
> >> +		"wifi pwrn");
> >> +	if (ret) {
> >> +		pr_warning("WIFI: could not requestrfkill gpio\n");
> >> +		return;
> >> +	}
> >> +	gpio_export(TEGRA_WIFI_PWRN, 0);
> >> +};
> >
> > Wouldn't you want to skip the gpio_export() call if the gpio_request()
> > call failed?
> 
>     I think that's what he does -- there's a *return* statement.

D'oh. There is indeed. For some reason I only noticed the warning call.
I guess I suck at reviews:-(

-- 
nvpublic

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] ARM: tegra: paz00: add support serial port on JP1
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C23-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
@ 2011-07-16 15:59           ` Marc Dietrich
  0 siblings, 0 replies; 13+ messages in thread
From: Marc Dietrich @ 2011-07-16 15:59 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Collin Cross, Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Am Fri, 15 Jul 2011 09:39:36 -0700
schrieb Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>:

> Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> > UART-A is connected to JP1 and used by the bootloader for debugging
> > output while UART-D is connected to the mini-pcie expansion slot.
> > 
> > Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
> > ---
> >  arch/arm/mach-tegra/board-paz00.c |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/mach-tegra/board-paz00.c
> > b/arch/arm/mach-tegra/board-paz00.c index 1b076f6..931b06e 100644
> > --- a/arch/arm/mach-tegra/board-paz00.c
> > +++ b/arch/arm/mach-tegra/board-paz00.c
> > @@ -47,7 +47,17 @@
> >  #include "gpio-names.h"
> > 
> >  static struct plat_serial8250_port debug_uart_platform_data[] = {
> > +/* serial port on JP1 */
> >  	{
> 
> Shouldn't the indentation of the comment be aligned to the brace?

ok, seems to be the common kernel style. Will be fixed in V2.

> I'm not sure if the order of entries in the array matters. It'd
> presumably be safer to add the new UART entry to the end of the array
> so that any existing index-based number isn't changed.

yeah, it will change the numbering, but none I know of used the serial
interface of the mini-pcie and it makes some sense to have the
bootloader output on number 0.

> > +		.membase	= IO_ADDRESS(TEGRA_UARTA_BASE),
> > +		.mapbase	= TEGRA_UARTA_BASE,
> > +		.irq		= INT_UARTA,
> > +		.flags		= UPF_BOOT_AUTOCONF,
> > +		.iotype		= UPIO_MEM,
> > +		.regshift	= 2,
> > +		.uartclk	= 216000000,
> > +	}, {
> > +/* serial port on mini-pcie */
> >  		.membase	= IO_ADDRESS(TEGRA_UARTD_BASE),
> >  		.mapbase	= TEGRA_UARTD_BASE,
> >  		.irq		= INT_UARTD,
> > @@ -137,6 +147,7 @@ static void __init tegra_paz00_fixup(struct
> > machine_desc *desc,
> > 
> >  static __initdata struct tegra_clk_init_table
> > paz00_clk_init_table[] = { /* name
> > parent		rate		enabled */
> > +	{ "uarta",	"pll_p",	216000000,	true },
> >  	{ "uartd",	"pll_p",	216000000,	true },
> >  	{ NULL,		NULL,
> > 0,		0}, };
> > --
> > 1.7.4.1
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] ARM: tegra: paz00: enable wifi led
       [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C43-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
@ 2011-07-16 16:19           ` Marc Dietrich
  0 siblings, 0 replies; 13+ messages in thread
From: Marc Dietrich @ 2011-07-16 16:19 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Collin Cross, Olof Johansson,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Am Fri, 15 Jul 2011 10:10:28 -0700
schrieb Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>:

> Marc Dietrich wrote at Friday, July 15, 2011 4:24 AM:
> > This adds support for the wifi led. It is automaticly triggered by
> > the rfkill0 event.
> ...
> > +static struct gpio_led gpio_leds[] = {
> > +	{
> > +		.name                   = "wifi-led",
> > +		.default_trigger        = "rfkill0",
> > +		.gpio                   = TEGRA_WIFI_LED,
> > +	},
> > +};
> 
> How does this work given that the previous patch simply exports the
> actual GPIO to user-space, rather than registering it through an
> rfkill driver; Does the WiFi driver itself register directly with the
> rfkill system? 

I don't know the details but the driver seems to register some rfkill
poll routine which reports the hw status back to the mac layer. I guess
from there the rfkill events are distributed. At least the led works
fine here (and acts upon rfkill block). Problem is that the even binds
to the first device registered to if you plug in some other network
device which is registered first, then the led will act upon this one.
Don't know how to bind it to a specific device.

> (what model of device is the AC100's WiFi? I assume it's on USB.)

yes, it's a rt3070 (check the rt2x00 driver).

Marc

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio
       [not found]         ` <201107151517.03176.anarsoul-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2011-07-22 20:38           ` Marc Dietrich
  0 siblings, 0 replies; 13+ messages in thread
From: Marc Dietrich @ 2011-07-22 20:38 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Collin Cross,
	Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hi Vasily,

On Friday 15 July 2011 14:17:02 Vasily Khoruzhick wrote:
> On Friday 15 July 2011 13:24:22 Marc Dietrich wrote:
> > This makes the WIFI rfkill gpio available to userspace. On boot,
> > WIFI will be unblocked by default.
> 
> Take a look on rfkill-gpio driver.

mmh, seems I don't understand that driver. I made a simple patch which roughly 
goes like this: 

diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-
paz00.c
index e85711f..06b3089 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -27,6 +27,7 @@
 #include <linux/io.h>
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
+#include <linux/rfkill-gpio.h>
 #include <linux/platform_data/tegra_usb.h>
 
 #include <asm/mach-types.h>

...

+static struct rfkill_gpio_platform_data rfkill_gpio_data = {
+       .name           = "rfkill-gpio",
+       .reset_gpio     = TEGRA_WIFI_RST,
+       .shutdown_gpio  = TEGRA_WIFI_PWRN,
+       .type           = RFKILL_TYPE_WLAN,
+};
+
+static struct platform_device rfkill_gpio = {
+       .name   = "rfkill_gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &rfkill_gpio_data,
+       },
+};
+

@@ -327,6 +343,7 @@ static struct platform_device *paz00_devices[] __initdata = 
{
        &tegra_spi_device3,
        &tegra_spi_device4,
        &leds_gpio,
+       &rfkill_gpio,
        &tegra_gart_device,
        &tegra_i2s_device1,
        &tegra_das_device,

now I get two rfkill devices:

root@ac100:/sys/devices/platform/rfkill_gpio/rfkill/rfkill0# rfkill list; echo 0 
> state; sleep 5; rfkill list; echo 1 > state; sleep 5; rfkill list
0: rfkill-gpio: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
0: rfkill-gpio: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: yes
0: rfkill-gpio: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no

writing echo 1 > state is equal to rfkill block 0, while rfkill block 1 seems to 
be the softblock of phy0.

Is it possible that the gpios (rst and pwrn) are exchanged?
Why do I get two devices: rfkill-gpio from rfkill-gpio driver and phy0 from the 
wifi driver? I guess the latter shows the current state of the chip and the 
first? The state of the "switch"?

Thanks 

Marc


> Regards
> Vasily
> 
> > Signed-off-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
> > ---
> > 
> >  arch/arm/mach-tegra/board-paz00-pinmux.c |    1 +
> >  arch/arm/mach-tegra/board-paz00.c        |   16 ++++++++++++++++
> >  arch/arm/mach-tegra/board-paz00.h        |    6 ++++++
> >  3 files changed, 23 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c
> > b/arch/arm/mach-tegra/board-paz00-pinmux.c index bdd2627..c02a48f 100644
> > --- a/arch/arm/mach-tegra/board-paz00-pinmux.c
> > +++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
> > @@ -145,6 +145,7 @@ static struct tegra_gpio_table gpio_table[] = {
> > 
> >  	{ .gpio = TEGRA_GPIO_SD1_WP,	.enable = true },
> >  	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
> >  	{ .gpio = TEGRA_ULPI_RST,	.enable = true },
> > 
> > +	{ .gpio = TEGRA_WIFI_PWRN,	.enable = true },
> > 
> >  };
> >  
> >  void paz00_pinmux_init(void)
> > 
> > diff --git a/arch/arm/mach-tegra/board-paz00.c
> > b/arch/arm/mach-tegra/board-paz00.c index 931b06e..0bc652b 100644
> > --- a/arch/arm/mach-tegra/board-paz00.c
> > +++ b/arch/arm/mach-tegra/board-paz00.c
> > @@ -25,6 +25,7 @@
> > 
> >  #include <linux/dma-mapping.h>
> >  #include <linux/pda_power.h>
> >  #include <linux/io.h>
> > 
> > +#include <linux/gpio.h>
> > 
> >  #include <linux/i2c.h>
> >  #include <linux/i2c-tegra.h>
> >  #include <linux/platform_data/tegra_usb.h>
> > 
> > @@ -165,6 +166,20 @@ static struct tegra_sdhci_platform_data sdhci_pdata4
> > = { .is_8bit	= 1,
> > 
> >  };
> > 
> > +static void __init paz00_wifi_init(void)
> > +{
> > +	int ret;
> > +
> > +	/* unlock hw rfkill */
> > +	ret = gpio_request_one(TEGRA_WIFI_PWRN, GPIOF_OUT_INIT_HIGH,
> > +		"wifi pwrn");
> > +	if (ret) {
> > +		pr_warning("WIFI: could not requestrfkill gpio\n");
> > +		return;
> > +	}
> > +	gpio_export(TEGRA_WIFI_PWRN, 0);
> > +};
> > +
> > 
> >  static void __init tegra_paz00_init(void)
> >  {
> >  
> >  	tegra_clk_init_from_table(paz00_clk_init_table);
> > 
> > @@ -178,6 +193,7 @@ static void __init tegra_paz00_init(void)
> > 
> >  	paz00_i2c_init();
> >  	paz00_usb_init();
> > 
> > +	paz00_wifi_init();
> > 
> >  }
> >  
> >  MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
> > 
> > diff --git a/arch/arm/mach-tegra/board-paz00.h
> > b/arch/arm/mach-tegra/board-paz00.h index d4ff39d..5d2849e 100644
> > --- a/arch/arm/mach-tegra/board-paz00.h
> > +++ b/arch/arm/mach-tegra/board-paz00.h
> > @@ -17,11 +17,17 @@
> > 
> >  #ifndef _MACH_TEGRA_BOARD_PAZ00_H
> >  #define _MACH_TEGRA_BOARD_PAZ00_H
> > 
> > +/* SDCARD */
> > 
> >  #define TEGRA_GPIO_SD1_CD		TEGRA_GPIO_PV5
> >  #define TEGRA_GPIO_SD1_WP		TEGRA_GPIO_PH1
> >  #define TEGRA_GPIO_SD1_POWER		TEGRA_GPIO_PT3
> > 
> > +
> > +/* ULPI */
> > 
> >  #define TEGRA_ULPI_RST			TEGRA_GPIO_PV0
> > 
> > +/* WIFI */
> > +#define TEGRA_WIFI_PWRN			TEGRA_GPIO_PK5
> > +
> > 
> >  void paz00_pinmux_init(void);
> >  
> >  #endif

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-07-22 20:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 10:24 [PATCH 0/3] ARM: tegra: paz00: Add Wifi and second serial port support Marc Dietrich
     [not found] ` <1310725464-2524-1-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
2011-07-15 10:24   ` [PATCH 1/3] ARM: tegra: paz00: add support serial port on JP1 Marc Dietrich
     [not found]     ` <1310725464-2524-2-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
2011-07-15 16:39       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C23-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-07-16 15:59           ` Marc Dietrich
2011-07-15 10:24   ` [PATCH 2/3] ARM: tegra: paz00: export the WIFI rfkill gpio Marc Dietrich
     [not found]     ` <1310725464-2524-3-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
2011-07-15 12:17       ` Vasily Khoruzhick
     [not found]         ` <201107151517.03176.anarsoul-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-07-22 20:38           ` Marc Dietrich
2011-07-15 16:53       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C2F-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-07-15 17:25           ` Sergei Shtylyov
     [not found]             ` <4E2077EC.1070902-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-07-15 17:30               ` Stephen Warren
2011-07-15 10:24   ` [PATCH 3/3] ARM: tegra: paz00: enable wifi led Marc Dietrich
     [not found]     ` <1310725464-2524-4-git-send-email-marvin24-Mmb7MZpHnFY@public.gmane.org>
2011-07-15 17:10       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF049E834C43-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-07-16 16:19           ` Marc Dietrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox