sync hh.org
[hh.org.git] / drivers / net / wireless / acx / htcsable_acx.c
blob67b4942ad36f06b362664a7ba62b5e5fac0cfbc4
1 /*
2 * WLAN (TI TNETW1100B) support in the HTC Sable
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/htcsable-gpio.h>
23 #include <asm/arch/htcsable-asic.h>
24 #include <asm/io.h>
26 #include "acx_hw.h"
28 #define WLAN_BASE PXA_CS2_PHYS
31 off: b15 c8 d3
32 on: d3 c8 b5 b5-
35 #define GPIO_NR_HTCSABLE_ACX111 111
37 static int
38 htcsable_wlan_stop( void );
40 static int
41 htcsable_wlan_start( void )
43 printk( "htcsable_wlan_start\n" );
45 /*asic3_set_gpio_out_c(&htcsable_asic3.dev, 1<<GPIOC_ACX_RESET, 0);*/
46 asic3_set_gpio_out_c(&htcsable_asic3.dev, 1<<GPIOC_ACX_PWR_3, 1<<GPIOC_ACX_PWR_3); /* related to acx */
47 SET_HTCSABLE_GPIO(ACX111, 1);
48 asic3_set_gpio_out_b(&htcsable_asic3.dev, 1<<GPIOB_ACX_PWR_1, 1<<GPIOB_ACX_PWR_1);
49 asic3_set_gpio_out_d(&htcsable_asic3.dev, 1<<GPIOD_ACX_PWR_2, 1<<GPIOD_ACX_PWR_2);
50 mdelay(260);
51 asic3_set_gpio_out_c(&htcsable_asic3.dev, 1<<GPIOC_ACX_RESET, 1<<GPIOC_ACX_RESET);
53 return 0;
56 static int
57 htcsable_wlan_stop( void )
59 printk( "htcsable_wlan_stop\n" );
60 asic3_set_gpio_out_b(&htcsable_asic3.dev, 1<<GPIOB_ACX_PWR_1, 0);
61 asic3_set_gpio_out_c(&htcsable_asic3.dev, 1<<GPIOC_ACX_RESET, 0);
62 asic3_set_gpio_out_d(&htcsable_asic3.dev, 1<<GPIOD_ACX_PWR_2, 0);
63 SET_HTCSABLE_GPIO(ACX111, 0); /* not necessary to power down this one? */
64 asic3_set_gpio_out_c(&htcsable_asic3.dev, 1<<GPIOC_ACX_PWR_3, 0); /* not necessary to power down this one? */
66 return 0;
69 static struct resource acx_resources[] = {
70 [0] = {
71 .start = WLAN_BASE,
72 .end = WLAN_BASE + 0x20,
73 .flags = IORESOURCE_MEM,
75 [1] = {
76 // .start = asic3_irq_base(&htcsable_asic3.dev) + ASIC3_GPIOC_IRQ_BASE+GPIOC_WIFI_IRQ_N,
77 // .end = asic3_irq_base(&htcsable_asic3.dev) + ASIC3_GPIOC_IRQ_BASE+GPIOC_WIFI_IRQ_N,
78 .flags = IORESOURCE_IRQ,
82 static struct acx_hardware_data acx_data = {
83 .start_hw = htcsable_wlan_start,
84 .stop_hw = htcsable_wlan_stop,
87 static struct platform_device acx_device = {
88 .name = "acx-mem",
89 .dev = {
90 .platform_data = &acx_data,
92 .num_resources = ARRAY_SIZE( acx_resources ),
93 .resource = acx_resources,
96 static int __init
97 htcsable_wlan_init( void )
99 printk( "htcsable_wlan_init: acx-mem platform_device_register\n" );
100 acx_device.resource[1].start = asic3_irq_base(&htcsable_asic3.dev) + ASIC3_GPIOB_IRQ_BASE+GPIOB_ACX_IRQ_N;
101 acx_device.resource[1].end = asic3_irq_base(&htcsable_asic3.dev) + ASIC3_GPIOB_IRQ_BASE+GPIOB_ACX_IRQ_N;
102 return platform_device_register( &acx_device );
106 static void __exit
107 htcsable_wlan_exit( void )
109 platform_device_unregister( &acx_device );
112 module_init( htcsable_wlan_init );
113 module_exit( htcsable_wlan_exit );
115 MODULE_AUTHOR( "Todd Blumer <todd@sdgsystems.com>" );
116 MODULE_DESCRIPTION( "WLAN driver for HTC Sable" );
117 MODULE_LICENSE( "GPL" );