Message ID | 1305806910-3903-7-git-send-email-marvin24@gmx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 14:08 Thu 19 May , Marc Dietrich wrote: > The Wifi card attached to one usb port needs to be unkilled. The > corresponding gpio and also the gpio for the LED are exported to be > controlled by userspace later on. > > Signed-off-by: Marc Dietrich <marvin24@gmx.de> [snip] > +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 request PWRN gpio!\n"); > + return; > + } > + gpio_export(TEGRA_WIFI_PWRN, 0); Although enabling wifi on boot may be OK for now, I think in long term it would be better and more proper to use rfkill infrastructure for this instead of just exporting gpio to userspace. There were some patches for gpio-based rfkill switch floating around lately. This is one the versions: https://lkml.org/lkml/2011/5/6/372 Not sure about their status and if they are directly suitable for PAZ00, but you may have a look. Btw, there's also another mostly generic gpio-rfkill driver in the tree I'm aware of - see arch/arm/mach-pxa/tosa-bt.c > + > + /* export wifi led */ > + ret = gpio_request_one(TEGRA_WIFI_LED, GPIOF_OUT_INIT_HIGH, > + "wifi_led"); > + if(ret) > + pr_warning("WIFI: could not request LED gpio!\n"); > + gpio_export(TEGRA_WIFI_LED, 0); For LED I think it's better to register gpio-leds platform device with something like 'rfkill.0' or 'wifi-rx' or whatever as a default trigger (not sure about exact names of triggers - you'll need to look up them). That way you will get a wide choice of led triggers for free, and still retain possibility of manual driving leds from userspace.
Hi Dmitry, > On 14:08 Thu 19 May , Marc Dietrich wrote: > > The Wifi card attached to one usb port needs to be unkilled. The > > corresponding gpio and also the gpio for the LED are exported to be > > controlled by userspace later on. > > > > Signed-off-by: Marc Dietrich <marvin24@gmx.de> > > [snip] > > > +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 request PWRN gpio!\n"); > > + return; > > + } > > + gpio_export(TEGRA_WIFI_PWRN, 0); > > Although enabling wifi on boot may be OK for now, I think in long term > it would be better and more proper to use rfkill infrastructure for this > instead of just exporting gpio to userspace. There were some patches for > gpio-based rfkill switch floating around lately. This is one the versions: > https://lkml.org/lkml/2011/5/6/372 > Not sure about their status and if they are directly suitable for PAZ00, > but you may have a look. Btw, there's also another mostly generic > gpio-rfkill driver in the tree I'm aware of - see > arch/arm/mach-pxa/tosa-bt.c yes, proper rfkill support is on my ToDo list. As it seems, the rt2x00 driver which we are using also has some initial support for gpio based rfkill. I guess I need some more time to sort this out. > > + > > + /* export wifi led */ > > + ret = gpio_request_one(TEGRA_WIFI_LED, GPIOF_OUT_INIT_HIGH, > > + "wifi_led"); > > + if(ret) > > + pr_warning("WIFI: could not request LED gpio!\n"); > > + gpio_export(TEGRA_WIFI_LED, 0); > > For LED I think it's better to register gpio-leds platform device with > something like 'rfkill.0' or 'wifi-rx' or whatever as a default trigger > (not sure about exact names of triggers - you'll need to look up them). > That way you will get a wide choice of led triggers for free, and still > retain possibility of manual driving leds from userspace. There are surely better ways to do this. Luckily, we got some more time to rework this because the tegra board changes were put to "hold" status. Expect some new version in a few weeks. Colin, first sorry that I misspelled your name serveral times. I swear it will not happen again. Second, please don't apply this patch to the for-next tree. I will resend a new version which better integrates into the kernel subsystem. Thanks for your comments! Marc
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c index bdd2627..41a6304 100644 --- a/arch/arm/mach-tegra/board-paz00-pinmux.c +++ b/arch/arm/mach-tegra/board-paz00-pinmux.c @@ -145,6 +145,8 @@ 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 }, + { .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 1b076f6..c78ef4c 100644 --- a/arch/arm/mach-tegra/board-paz00.c +++ b/arch/arm/mach-tegra/board-paz00.c @@ -135,6 +135,27 @@ static void __init tegra_paz00_fixup(struct machine_desc *desc, mi->bank[0].size = 448 * SZ_1M; } +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 request PWRN gpio!\n"); + return; + } + gpio_export(TEGRA_WIFI_PWRN, 0); + + /* export wifi led */ + ret = gpio_request_one(TEGRA_WIFI_LED, GPIOF_OUT_INIT_HIGH, + "wifi_led"); + if(ret) + pr_warning("WIFI: could not request LED gpio!\n"); + gpio_export(TEGRA_WIFI_LED, 0); +} + static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = { /* name parent rate enabled */ { "uartd", "pll_p", 216000000, true }, @@ -167,6 +188,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..a49543a 100644 --- a/arch/arm/mach-tegra/board-paz00.h +++ b/arch/arm/mach-tegra/board-paz00.h @@ -17,11 +17,18 @@ #ifndef _MACH_TEGRA_BOARD_PAZ00_H #define _MACH_TEGRA_BOARD_PAZ00_H +/* SDMMC */ #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_LED TEGRA_GPIO_PD0 +#define TEGRA_WIFI_PWRN TEGRA_GPIO_PK5 + void paz00_pinmux_init(void); #endif
The Wifi card attached to one usb port needs to be unkilled. The corresponding gpio and also the gpio for the LED are exported to be controlled by userspace later on. Signed-off-by: Marc Dietrich <marvin24@gmx.de> --- arch/arm/mach-tegra/board-paz00-pinmux.c | 2 ++ arch/arm/mach-tegra/board-paz00.c | 22 ++++++++++++++++++++++ arch/arm/mach-tegra/board-paz00.h | 7 +++++++ 3 files changed, 31 insertions(+), 0 deletions(-)