sync hh.org
[hh.org.git] / drivers / net / wireless / acx / hx4700_acx.c
blobd782d7eb6d7e4654132c13555f780dad966998c0
1 /*
2 * WLAN (TI TNETW1100B) support in the hx470x.
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>
17 #include <linux/leds.h>
19 #include <asm/hardware.h>
21 #include <asm/arch/pxa-regs.h>
22 #include <asm/arch/hx4700-gpio.h>
23 #include <asm/arch/hx4700-core.h>
24 #include <asm/io.h>
26 #include "acx_hw.h"
28 #define WLAN_OFFSET 0x1000000
29 #define WLAN_BASE (PXA_CS5_PHYS+WLAN_OFFSET)
32 static int
33 hx4700_wlan_start( void )
35 SET_HX4700_GPIO( WLAN_RESET_N, 0 );
36 mdelay(5);
37 hx4700_egpio_enable( EGPIO0_VCC_3V3_EN );
38 mdelay(100);
39 hx4700_egpio_enable( EGPIO7_VCC_3V3_WL_EN );
40 mdelay(150);
41 hx4700_egpio_enable( EGPIO1_WL_VREG_EN | EGPIO2_VCC_2V1_WL_EN |
42 EGPIO6_WL1V8_EN );
43 mdelay(10);
44 SET_HX4700_GPIO( WLAN_RESET_N, 1 );
45 mdelay(50);
46 led_trigger_event_shared(hx4700_radio_trig, LED_FULL);
47 return 0;
50 static int
51 hx4700_wlan_stop( void )
53 hx4700_egpio_disable( EGPIO0_VCC_3V3_EN | EGPIO1_WL_VREG_EN |
54 EGPIO7_VCC_3V3_WL_EN | EGPIO2_VCC_2V1_WL_EN |
55 EGPIO6_WL1V8_EN );
56 SET_HX4700_GPIO( WLAN_RESET_N, 0 );
57 led_trigger_event_shared(hx4700_radio_trig, LED_OFF);
58 return 0;
61 static struct resource acx_resources[] = {
62 [0] = {
63 .start = WLAN_BASE,
64 .end = WLAN_BASE + 0x20,
65 .flags = IORESOURCE_MEM,
67 [1] = {
68 .start = HX4700_IRQ(WLAN_IRQ_N),
69 .end = HX4700_IRQ(WLAN_IRQ_N),
70 .flags = IORESOURCE_IRQ,
74 static struct acx_hardware_data acx_data = {
75 .start_hw = hx4700_wlan_start,
76 .stop_hw = hx4700_wlan_stop,
79 static struct platform_device acx_device = {
80 .name = "acx-mem",
81 .dev = {
82 .platform_data = &acx_data,
84 .num_resources = ARRAY_SIZE( acx_resources ),
85 .resource = acx_resources,
88 static int __init
89 hx4700_wlan_init( void )
91 printk( "hx4700_wlan_init: acx-mem platform_device_register\n" );
92 return platform_device_register( &acx_device );
96 static void __exit
97 hx4700_wlan_exit( void )
99 platform_device_unregister( &acx_device );
102 module_init( hx4700_wlan_init );
103 module_exit( hx4700_wlan_exit );
105 MODULE_AUTHOR( "Todd Blumer <todd@sdgsystems.com>" );
106 MODULE_DESCRIPTION( "WLAN driver for iPAQ hx4700" );
107 MODULE_LICENSE( "GPL" );