2 * Copyright (c) 2010 Broadcom Corporation
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/netdevice.h>
21 #include <dngl_stats.h>
27 #define WL_ERROR(fmt, args...) printk(fmt, ##args)
28 #define WL_TRACE(fmt, args...) no_printk(fmt, ##args)
31 extern void bcm_wlan_power_off(int);
32 extern void bcm_wlan_power_on(int);
33 #endif /* CUSTOMER_HW */
35 int wifi_set_carddetect(int on
);
36 int wifi_set_power(int on
, unsigned long msec
);
37 int wifi_get_irq_number(unsigned long *irq_flags_ptr
);
40 #if defined(OOB_INTR_ONLY)
42 #if defined(BCMLXSDMMC)
43 extern int sdioh_mmc_irq(int irq
);
44 #endif /* (BCMLXSDMMC) */
47 #include <mach/gpio.h>
50 /* Customer specific Host GPIO defintion */
51 static int dhd_oob_gpio_num
= -1; /* GG 19 */
53 module_param(dhd_oob_gpio_num
, int, 0644);
54 MODULE_PARM_DESC(dhd_oob_gpio_num
, "DHD oob gpio number");
56 int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr
)
61 host_oob_irq
= wifi_get_irq_number(irq_flags_ptr
);
63 #else /* for NOT CUSTOMER_HW2 */
64 #if defined(CUSTOM_OOB_GPIO_NUM)
65 if (dhd_oob_gpio_num
< 0)
66 dhd_oob_gpio_num
= CUSTOM_OOB_GPIO_NUM
;
69 if (dhd_oob_gpio_num
< 0) {
70 WL_ERROR("%s: ERROR customer specific Host GPIO is NOT defined\n",
72 return dhd_oob_gpio_num
;
75 WL_ERROR("%s: customer specific Host GPIO number is (%d)\n",
76 __func__
, dhd_oob_gpio_num
);
78 #if defined CUSTOMER_HW
79 host_oob_irq
= MSM_GPIO_TO_INT(dhd_oob_gpio_num
);
80 #elif defined CUSTOMER_HW3
81 gpio_request(dhd_oob_gpio_num
, "oob irq");
82 host_oob_irq
= gpio_to_irq(dhd_oob_gpio_num
);
83 gpio_direction_input(dhd_oob_gpio_num
);
84 #endif /* CUSTOMER_HW */
85 #endif /* CUSTOMER_HW2 */
89 #endif /* defined(OOB_INTR_ONLY) */
91 /* Customer function to control hw specific wlan gpios */
92 void dhd_customer_gpio_wlan_ctrl(int onoff
)
96 WL_TRACE("%s: call customer specific GPIO to insert WLAN RESET\n",
99 bcm_wlan_power_off(2);
100 #endif /* CUSTOMER_HW */
102 wifi_set_power(0, 0);
104 WL_ERROR("=========== WLAN placed in RESET ========\n");
108 WL_TRACE("%s: callc customer specific GPIO to remove WLAN RESET\n",
111 bcm_wlan_power_on(2);
112 #endif /* CUSTOMER_HW */
114 wifi_set_power(1, 0);
116 WL_ERROR("=========== WLAN going back to live ========\n");
120 WL_TRACE("%s: call customer specific GPIO to turn off WL_REG_ON\n",
123 bcm_wlan_power_off(1);
124 #endif /* CUSTOMER_HW */
128 WL_TRACE("%s: call customer specific GPIO to turn on WL_REG_ON\n",
131 bcm_wlan_power_on(1);
132 #endif /* CUSTOMER_HW */
133 /* Lets customer power to get stable */
139 #ifdef GET_CUSTOM_MAC_ENABLE
140 /* Function to get custom MAC address */
141 int dhd_custom_get_mac_address(unsigned char *buf
)
143 WL_TRACE("%s Enter\n", __func__
);
147 /* Customer access to MAC address stored outside of DHD driver */
149 #ifdef EXAMPLE_GET_MAC
152 struct ether_addr ea_example
= {
153 {0x00, 0x11, 0x22, 0x33, 0x44, 0xFF} };
154 bcopy((char *)&ea_example
, buf
, sizeof(struct ether_addr
));
156 #endif /* EXAMPLE_GET_MAC */
160 #endif /* GET_CUSTOM_MAC_ENABLE */