sync hh.org
[hh.org.git] / drivers / net / wireless / acx / htcuniversal_acx.c
blob7195af73ec2c9e8223e0ca7f2c04acc60ed047d3
1 /*
2 * WLAN (TI TNETW1100B) support in the HTC Universal
4 * Copyright (c) 2006 SDG Systems, LLC
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
10 * 28-March-2006 Todd Blumer <todd@sdgsystems.com>
14 #include <linux/kernel.h>
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
18 #include <asm/hardware.h>
20 #include <asm/arch/pxa-regs.h>
21 #include <linux/soc/asic3_base.h>
22 #include <asm/arch/htcuniversal-gpio.h>
23 #include <asm/arch/htcuniversal-asic.h>
24 #include <asm/io.h>
26 #include "acx_hw.h"
28 #define WLAN_BASE PXA_CS2_PHYS
31 static int
32 htcuniversal_wlan_start( void )
34 htcuniversal_egpio_enable(EGPIO6_WIFI_ON);
35 asic3_set_gpio_out_c(&htcuniversal_asic3.dev, 1<<GPIOC_WIFI_PWR1_ON, 1<<GPIOC_WIFI_PWR1_ON);
36 asic3_set_gpio_out_d(&htcuniversal_asic3.dev, 1<<GPIOD_WIFI_PWR3_ON, 1<<GPIOD_WIFI_PWR3_ON);
37 asic3_set_gpio_out_d(&htcuniversal_asic3.dev, 1<<GPIOD_WIFI_PWR2_ON, 1<<GPIOD_WIFI_PWR2_ON);
38 mdelay(100);
40 asic3_set_gpio_out_c(&htcuniversal_asic3.dev, 1<<GPIOC_WIFI_RESET, 0);
41 mdelay(100);
42 asic3_set_gpio_out_c(&htcuniversal_asic3.dev, 1<<GPIOC_WIFI_RESET, 1<<GPIOC_WIFI_RESET);
43 mdelay(100);
44 return 0;
47 static int
48 htcuniversal_wlan_stop( void )
50 asic3_set_gpio_out_c(&htcuniversal_asic3.dev, 1<<GPIOC_WIFI_RESET, 0);
52 htcuniversal_egpio_disable(EGPIO6_WIFI_ON);
53 asic3_set_gpio_out_c(&htcuniversal_asic3.dev, 1<<GPIOC_WIFI_PWR1_ON, 0);
54 asic3_set_gpio_out_d(&htcuniversal_asic3.dev, 1<<GPIOD_WIFI_PWR2_ON, 0);
55 asic3_set_gpio_out_d(&htcuniversal_asic3.dev, 1<<GPIOD_WIFI_PWR3_ON, 0);
56 return 0;
59 static struct resource acx_resources[] = {
60 [0] = {
61 .start = WLAN_BASE,
62 .end = WLAN_BASE + 0x20,
63 .flags = IORESOURCE_MEM,
65 [1] = {
66 // .start = asic3_irq_base(&htcuniversal_asic3.dev) + ASIC3_GPIOC_IRQ_BASE+GPIOC_WIFI_IRQ_N,
67 // .end = asic3_irq_base(&htcuniversal_asic3.dev) + ASIC3_GPIOC_IRQ_BASE+GPIOC_WIFI_IRQ_N,
68 .flags = IORESOURCE_IRQ,
72 static struct acx_hardware_data acx_data = {
73 .start_hw = htcuniversal_wlan_start,
74 .stop_hw = htcuniversal_wlan_stop,
77 static struct platform_device acx_device = {
78 .name = "acx-mem",
79 .dev = {
80 .platform_data = &acx_data,
82 .num_resources = ARRAY_SIZE( acx_resources ),
83 .resource = acx_resources,
86 static int __init
87 htcuniversal_wlan_init( void )
89 printk( "htcuniversal_wlan_init: acx-mem platform_device_register\n" );
90 acx_device.resource[1].start = asic3_irq_base(&htcuniversal_asic3.dev) + ASIC3_GPIOC_IRQ_BASE+GPIOC_WIFI_IRQ_N;
91 acx_device.resource[1].end = asic3_irq_base(&htcuniversal_asic3.dev) + ASIC3_GPIOC_IRQ_BASE+GPIOC_WIFI_IRQ_N;
92 return platform_device_register( &acx_device );
96 static void __exit
97 htcuniversal_wlan_exit( void )
99 platform_device_unregister( &acx_device );
102 module_init( htcuniversal_wlan_init );
103 module_exit( htcuniversal_wlan_exit );
105 MODULE_AUTHOR( "Todd Blumer <todd@sdgsystems.com>" );
106 MODULE_DESCRIPTION( "WLAN driver for HTC Universal" );
107 MODULE_LICENSE( "GPL" );