4 #include <linux/rfkill-wlan.h>
6 #ifdef CONFIG_MACH_ODROID_4210
8 #include <mach/regs-gpio.h>
9 #include <plat/gpio-cfg.h>
10 #include <plat/sdhci.h>
11 #include <plat/devs.h>
12 #define sdmmc_channel s3c_device_hsmmc0
15 struct wifi_platform_data dhd_wlan_control = {0};
18 uint bcm_wlan_get_oob_irq(void)
20 uint host_oob_irq = 0;
22 host_oob_irq = rockchip_wifi_get_oob_irq();
24 printk("host_oob_irq: %d\n", host_oob_irq);
29 uint bcm_wlan_get_oob_irq_flags(void)
31 uint host_oob_irq_flags = 0;
33 host_oob_irq_flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE) & IRQF_TRIGGER_MASK;
34 printk("host_oob_irq_flags=0x%X\n", host_oob_irq_flags);
36 return host_oob_irq_flags;
40 int bcm_wlan_set_power(bool on)
45 printk("======== PULL WL_REG_ON HIGH! ========\n");
46 rockchip_wifi_power(1);
48 printk("======== PULL WL_REG_ON LOW! ========\n");
49 rockchip_wifi_power(0);
55 int bcm_wlan_set_carddetect(bool present)
60 printk("======== Card detection to detect SDIO card! ========\n");
61 rockchip_wifi_set_carddetect(1);
63 printk("======== Card detection to remove SDIO card! ========\n");
64 rockchip_wifi_set_carddetect(0);
70 int bcm_wlan_get_mac_address(unsigned char *buf)
74 printk("======== %s ========\n", __FUNCTION__);
75 #ifdef EXAMPLE_GET_MAC
78 struct ether_addr ea_example = {{0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}};
79 bcopy((char *)&ea_example, buf, sizeof(struct ether_addr));
81 #endif /* EXAMPLE_GET_MAC */
82 err = rockchip_wifi_mac_addr(buf);
87 #ifdef CONFIG_DHD_USE_STATIC_BUF
88 extern void *bcmdhd_mem_prealloc(int section, unsigned long size);
89 void* bcm_wlan_prealloc(int section, unsigned long size)
91 void *alloc_ptr = NULL;
92 alloc_ptr = bcmdhd_mem_prealloc(section, size);
94 printf("success alloc section %d, size %ld\n", section, size);
96 bzero(alloc_ptr, size);
99 printf("can't alloc section %d\n", section);
104 #if !defined(WL_WIRELESS_EXT)
105 struct cntry_locales_custom {
106 char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */
107 char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */
108 int32 custom_locale_rev; /* Custom local revisin default -1 */
112 static struct cntry_locales_custom brcm_wlan_translate_custom_table[] = {
113 /* Table should be filled out based on custom platform regulatory requirement */
114 {"", "XT", 49}, /* Universal if Country code is unknown or empty */
118 #ifdef CUSTOM_FORCE_NODFS_FLAG
119 struct cntry_locales_custom brcm_wlan_translate_nodfs_table[] = {
120 {"", "XT", 50}, /* Universal if Country code is unknown or empty */
125 static void *bcm_wlan_get_country_code(char *ccode
126 #ifdef CUSTOM_FORCE_NODFS_FLAG
131 struct cntry_locales_custom *locales;
138 #ifdef CUSTOM_FORCE_NODFS_FLAG
139 if (flags & WLAN_PLAT_NODFS_FLAG) {
140 locales = brcm_wlan_translate_nodfs_table;
141 size = ARRAY_SIZE(brcm_wlan_translate_nodfs_table);
144 locales = brcm_wlan_translate_custom_table;
145 size = ARRAY_SIZE(brcm_wlan_translate_custom_table);
146 #ifdef CUSTOM_FORCE_NODFS_FLAG
150 for (i = 0; i < size; i++)
151 if (strcmp(ccode, locales[i].iso_abbrev) == 0)
156 int bcm_wlan_set_plat_data(void) {
157 printf("======== %s ========\n", __FUNCTION__);
158 dhd_wlan_control.set_power = bcm_wlan_set_power;
159 dhd_wlan_control.set_carddetect = bcm_wlan_set_carddetect;
160 dhd_wlan_control.get_mac_addr = bcm_wlan_get_mac_address;
161 #ifdef CONFIG_DHD_USE_STATIC_BUF
162 dhd_wlan_control.mem_prealloc = bcm_wlan_prealloc;
164 dhd_wlan_control.get_country_code = bcm_wlan_get_country_code;