mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-21 13:00:44 +09:00
upload the packed driver of rtl8188cu.(V3.10)
This commit is contained in:
@@ -57,7 +57,7 @@ choice
|
||||
(4) Murata SP-8HEP-P
|
||||
|
||||
source "drivers/net/wireless/bcm4319/Kconfig"
|
||||
|
||||
source "drivers/net/wireless/rtl8192c/Kconfig"
|
||||
endchoice
|
||||
|
||||
#source "drivers/net/wireless/bcm4329/Kconfig"
|
||||
|
||||
@@ -5,4 +5,5 @@ obj-y += wifi_sys/rkwifi_sys_iface.o
|
||||
obj-$(CONFIG_BCM4329) += bcm4329/
|
||||
obj-$(CONFIG_MV8686) += mv8686/
|
||||
obj-$(CONFIG_BCM4319) += bcm4319/
|
||||
obj-$(CONFIG_RTL8192CU) += rtl8192c/
|
||||
#obj-m += wlan/
|
||||
|
||||
8
drivers/net/wireless/rtl8192c/Kconfig
Executable file
8
drivers/net/wireless/rtl8192c/Kconfig
Executable file
@@ -0,0 +1,8 @@
|
||||
config RTL8192CU
|
||||
tristate "Realtek 8192C USB WiFi"
|
||||
depends on WLAN_80211 && USB
|
||||
select WIRELESS_EXT
|
||||
select IEEE80211
|
||||
---help---
|
||||
Help message of RTL8192CU
|
||||
|
||||
21
drivers/net/wireless/rtl8192c/Makefile
Normal file
21
drivers/net/wireless/rtl8192c/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
#EXTRA_CFLAGS += -I$(src)/rkcfg/include
|
||||
|
||||
rk_cfg := \
|
||||
wifi_power.o \
|
||||
wifi_power_usb.o \
|
||||
wifi_power_ops.o
|
||||
|
||||
rkcfg-y += $(rk_cfg)
|
||||
|
||||
obj-$(CONFIG_RTL8192CU) += rtl8192c.o rkcfg.o
|
||||
|
||||
$(obj)/rtl8192c.o: $(obj)/rtl8192c.uu
|
||||
@echo "UUDE rtl8192c.uu"
|
||||
@uudecode $(obj)/rtl8192c.uu -o $(obj)/rtl8192c.o
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
find . -name '*.o*' -exec rm -f {} \;
|
||||
11415
drivers/net/wireless/rtl8192c/rtl8192c.uu
Normal file
11415
drivers/net/wireless/rtl8192c/rtl8192c.uu
Normal file
File diff suppressed because it is too large
Load Diff
112
drivers/net/wireless/rtl8192c/wifi_power.c
Normal file
112
drivers/net/wireless/rtl8192c/wifi_power.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* wifi_power.c
|
||||
*
|
||||
* Power control for WIFI module.
|
||||
*
|
||||
* Yongle Lai @ Rockchip
|
||||
*
|
||||
* There are Power supply and Power Up/Down controls for WIFI typically.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include "wifi_power.h"
|
||||
|
||||
/*
|
||||
* rtw_channel_plan : The initialization parameter of wifi channel,
|
||||
* Allow number is "0" "2" and "5".
|
||||
* 0 => 11 ( channel 1 ~ 11 is SCAN_ACTIVE )
|
||||
* 2 => 13 ( channel 1 ~ 13 is SCAN_ACTIVE )
|
||||
* 5 => 14 ( channel 1 ~ 14 is SCAN_ACTIVE )
|
||||
* default number is "2".
|
||||
*/
|
||||
char init_channel_plan = 2;
|
||||
|
||||
#if (WIFI_GPIO_POWER_CONTROL == 1)
|
||||
|
||||
/*
|
||||
* GPIO to control LDO/DCDC.
|
||||
*
|
||||
* 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。
|
||||
*
|
||||
* 如果是扩展IO,请参考下面的例子:
|
||||
* POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH
|
||||
*/
|
||||
struct wifi_power power_gpio =
|
||||
{
|
||||
//POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0
|
||||
|
||||
// RBOX
|
||||
//POWER_USE_GPIO, POWER_GPIO_IOMUX,
|
||||
//GPIO5D6_SDMMC1PWREN_NAME, GPIO5H_GPIO5D6, RK29_PIN5_PD6, GPIO_HIGH
|
||||
|
||||
/*// YIFANG M803
|
||||
POWER_USE_GPIO, 0,
|
||||
0, 0, GPIO_WIFI_POWER, GPIO_HIGH
|
||||
*/
|
||||
//SDK
|
||||
POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* GPIO to control WIFI PowerDOWN/RESET.
|
||||
*
|
||||
* 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。
|
||||
*/
|
||||
struct wifi_power power_save_gpio =
|
||||
{
|
||||
POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* GPIO to reset WIFI. Keep this as NULL normally.
|
||||
*
|
||||
* 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。
|
||||
*/
|
||||
struct wifi_power power_reset_gpio =
|
||||
{
|
||||
POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* 在WIFI被上电前,会调用这个函数。
|
||||
*/
|
||||
void wifi_turn_on_callback(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* 在WIFI被下电后,会调用这个函数。
|
||||
*/
|
||||
void wifi_turn_off_callback(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* If external GPIO chip such as PCA9554 is being used, please
|
||||
* implement the following 2 function.
|
||||
*
|
||||
* id: is GPIO identifier, such as GPIOPortF_Pin0, or external
|
||||
* name defined in struct wifi_power.
|
||||
* sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW.
|
||||
*
|
||||
* 如果有用扩展GPIO来控制WIFI,请实现下面的函数:
|
||||
* 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。
|
||||
* id : 是IO的标识号,以整数的形式标识。
|
||||
* sens: 是要求的IO状态,为高或低。
|
||||
*/
|
||||
void wifi_extgpio_operation(u8 id, u8 sens)
|
||||
{
|
||||
//pca955x_gpio_direction_output(id, sens);
|
||||
}
|
||||
|
||||
/*
|
||||
* 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口:
|
||||
* void rockchip_wifi_shutdown(void);
|
||||
* 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。
|
||||
*/
|
||||
|
||||
#endif /* WIFI_GPIO_POWER_CONTROL */
|
||||
|
||||
87
drivers/net/wireless/rtl8192c/wifi_power.h
Normal file
87
drivers/net/wireless/rtl8192c/wifi_power.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* wifi_power.h
|
||||
*
|
||||
* WIFI power control.
|
||||
*
|
||||
* Yongle Lai
|
||||
*/
|
||||
|
||||
#ifndef WIFI_POWER_H
|
||||
#define WIFI_POWER_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#define DONT_SWITCH_USB 0 /* Don't switch USB automaticately. */
|
||||
#define WIFI_USE_OTG 1 /* WiFi will be connected to USB OTG. */
|
||||
#define WIFI_USE_HOST11 2 /* WiFi will be connected to USB HOST 1.1. */
|
||||
|
||||
#define WIFI_USE_IFACE WIFI_USE_HOST11 /* Select USB Controler */
|
||||
#define WIFI_GPIO_POWER_CONTROL 1 /* Enable GPIO Control Power */
|
||||
|
||||
#if (WIFI_GPIO_POWER_CONTROL == 1)
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/iomux.h>
|
||||
#else
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/iomux.h>
|
||||
#endif
|
||||
|
||||
#define WIFI_CHIP_MV8686 0
|
||||
#define WIFI_CHIP_AR6002 1
|
||||
#define WIFI_CHIP_BCM4319 2
|
||||
#define WIFI_CHIP_NRX700 3
|
||||
#define WIFI_CHIP_RT3070 4
|
||||
#define WIFI_CHIP_RTL8192C 5
|
||||
|
||||
#define POWER_NOT_USE_GPIO 0
|
||||
#define POWER_USE_GPIO 1
|
||||
#define POWER_USE_EXT_GPIO 2 /* External GPIO chip is used, such as PCA9554. */
|
||||
|
||||
#define POWER_GPIO_NOT_IOMUX 0
|
||||
#define POWER_GPIO_IOMUX 1
|
||||
|
||||
#define GPIO_SWITCH_OFF 0
|
||||
#define GPIO_SWITCH_ON 1
|
||||
|
||||
struct wifi_power
|
||||
{
|
||||
u8 use_gpio; /* If uses GPIO to control wifi power supply. 0 - no, 1 - yes. */
|
||||
u8 gpio_iomux; /* If the GPIO is iomux. 0 - no, 1 - yes. */
|
||||
char *iomux_name; /* IOMUX name */
|
||||
u8 iomux_value; /* IOMUX value - which function is choosen. */
|
||||
u8 gpio_id; /* GPIO number */
|
||||
u8 sensi_level; /* GPIO sensitive level. */
|
||||
};
|
||||
|
||||
int wifi_turn_on_card(int module);
|
||||
int wifi_turn_off_card(void);
|
||||
int wifi_reset_card(void);
|
||||
void wifi_extgpio_operation(u8 id, u8 sens);
|
||||
|
||||
void rockchip_wifi_shutdown(void);
|
||||
|
||||
#endif /* WIFI_GPIO_POWER_CONTROL */
|
||||
|
||||
#define WIFI_NETWORK_BUSY 0
|
||||
#define WIFI_NETWORK_IDLE 1
|
||||
|
||||
int wifi_power_save_init(void);
|
||||
int wifi_power_save_exit(void);
|
||||
int wifi_power_save_stop(void);
|
||||
int wifi_power_save_state(void);
|
||||
void wifi_power_save_suspend(void);
|
||||
void wifi_power_save_resume(void);
|
||||
int wifi_power_save_register_callback(int (*callback)(int status));
|
||||
|
||||
void wifi_turn_on_callback(void);
|
||||
void wifi_turn_off_callback(void);
|
||||
|
||||
/* usb wifi */
|
||||
int wifi_activate_usb(void);
|
||||
int wifi_deactivate_usb(void);
|
||||
void wifi_usb_init(void);
|
||||
|
||||
#endif /* WIFI_POWER_H */
|
||||
|
||||
112
drivers/net/wireless/rtl8192c/wifi_power_ops.c
Normal file
112
drivers/net/wireless/rtl8192c/wifi_power_ops.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* wifi_power.c
|
||||
*
|
||||
* Yongle Lai @ Rockchip Fuzhou @ 20100303.
|
||||
*
|
||||
* Power control for WIFI module.
|
||||
*
|
||||
* There are Power supply and Power Up/Down controls for WIFI typically.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include "wifi_power.h"
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/iomux.h>
|
||||
#else
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/iomux.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if (WIFI_GPIO_POWER_CONTROL == 1)
|
||||
|
||||
extern struct wifi_power power_gpio;
|
||||
extern struct wifi_power power_save_gpio;
|
||||
extern struct wifi_power power_reset_gpio;
|
||||
|
||||
#define OS_IOMUX(name, value) rk29_mux_api_set((name), (value));
|
||||
|
||||
int wifi_gpio_operate(struct wifi_power *gpio, int flag)
|
||||
{
|
||||
int sensitive;
|
||||
|
||||
if (gpio->use_gpio == POWER_NOT_USE_GPIO)
|
||||
return 0;
|
||||
|
||||
if (gpio->gpio_iomux == POWER_GPIO_IOMUX)
|
||||
{
|
||||
OS_IOMUX(gpio->iomux_name, gpio->iomux_value);
|
||||
}
|
||||
|
||||
if (flag == GPIO_SWITCH_ON)
|
||||
sensitive = gpio->sensi_level;
|
||||
else
|
||||
sensitive = 1 - gpio->sensi_level;
|
||||
|
||||
if (gpio->use_gpio == POWER_USE_EXT_GPIO)
|
||||
{
|
||||
wifi_extgpio_operation(gpio->gpio_id, sensitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(gpio->gpio_id, NULL);
|
||||
if (ret != 0)
|
||||
printk("Request GPIO for WIFI POWER error!\n");
|
||||
|
||||
gpio_direction_output(gpio->gpio_id, sensitive);
|
||||
gpio_set_value(gpio->gpio_id, sensitive);
|
||||
|
||||
gpio_free(gpio->gpio_id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* WiFi power up sequence
|
||||
*/
|
||||
int wifi_turn_on_rtl8192c_card(void)
|
||||
{
|
||||
wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON);
|
||||
if (power_gpio.use_gpio != POWER_NOT_USE_GPIO)
|
||||
msleep(1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wifi_turn_on_card(int module)
|
||||
{
|
||||
wifi_turn_on_callback();
|
||||
|
||||
wifi_turn_on_rtl8192c_card();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wifi_turn_off_card(void)
|
||||
{
|
||||
wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF);
|
||||
msleep(5);
|
||||
|
||||
wifi_turn_off_callback();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rockchip_wifi_shutdown(void)
|
||||
{
|
||||
printk("rockchip_wifi_shutdown....\n");
|
||||
|
||||
wifi_turn_off_card();
|
||||
}
|
||||
EXPORT_SYMBOL(rockchip_wifi_shutdown);
|
||||
|
||||
#endif /* WIFI_GPIO_POWER_CONTROL */
|
||||
|
||||
118
drivers/net/wireless/rtl8192c/wifi_power_usb.c
Normal file
118
drivers/net/wireless/rtl8192c/wifi_power_usb.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* wifi_power.c
|
||||
*
|
||||
* Power control for WIFI module.
|
||||
*
|
||||
* There are Power supply and Power Up/Down controls for WIFI typically.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include "wifi_power.h"
|
||||
|
||||
#if (WIFI_GPIO_POWER_CONTROL == 1)
|
||||
|
||||
int wifi_change_usb_mode = 0;
|
||||
int usb_wifi_status = 0;
|
||||
|
||||
void wifi_usb_init(void)
|
||||
{
|
||||
wifi_change_usb_mode = 0;
|
||||
usb_wifi_status = 0;
|
||||
}
|
||||
|
||||
#if (WIFI_USE_IFACE == WIFI_USE_OTG)
|
||||
|
||||
#define USB_NORMAL 0
|
||||
#define USB_FORCE_HOST 1
|
||||
#define USB_FORCE_DEVICE 2
|
||||
|
||||
extern int usb_force_usb_for_wifi(int mode);
|
||||
|
||||
/*
|
||||
* Change USB mode to HOST.
|
||||
*/
|
||||
int wifi_activate_usb(void)
|
||||
{
|
||||
wifi_turn_on_card(WIFI_CHIP_RTL8192C);
|
||||
|
||||
wifi_change_usb_mode = usb_force_usb_for_wifi(USB_FORCE_HOST);
|
||||
msleep(1000);
|
||||
|
||||
usb_wifi_status = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Change USB mode to be original.
|
||||
*/
|
||||
int wifi_deactivate_usb(void)
|
||||
{
|
||||
if (wifi_change_usb_mode == 1)
|
||||
{
|
||||
usb_force_usb_for_wifi(USB_FORCE_DEVICE);
|
||||
msleep(1000);
|
||||
usb_force_usb_for_wifi(USB_NORMAL);
|
||||
msleep(1000);
|
||||
}
|
||||
wifi_turn_off_card();
|
||||
|
||||
usb_wifi_status = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif (WIFI_USE_IFACE == WIFI_USE_HOST11)
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
|
||||
extern int usb_switch_usb_host11_for_wifi(int enabled);
|
||||
#endif
|
||||
|
||||
int wifi_deactivate_usb(void)
|
||||
{
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
|
||||
usb_switch_usb_host11_for_wifi(0);
|
||||
msleep(1000);
|
||||
#endif
|
||||
|
||||
wifi_turn_off_card();
|
||||
msleep(100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wifi_activate_usb(void)
|
||||
{
|
||||
wifi_turn_on_card(WIFI_CHIP_RTL8192C);
|
||||
msleep(100);
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
|
||||
usb_switch_usb_host11_for_wifi(1);
|
||||
msleep(1000);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int wifi_deactivate_usb(void)
|
||||
{
|
||||
wifi_turn_off_card();
|
||||
msleep(1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wifi_activate_usb(void)
|
||||
{
|
||||
wifi_turn_on_card(WIFI_CHIP_RTL8192C);
|
||||
msleep(1000);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WIFI_GPIO_POWER_CONTROL */
|
||||
|
||||
13
drivers/net/wireless/rtl8192c/wifi_version.h
Executable file
13
drivers/net/wireless/rtl8192c/wifi_version.h
Executable file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Yongle Lai @ Rockchip
|
||||
*/
|
||||
#ifndef WIFI_BCM4319_VERSION_H
|
||||
#define WIFI_BCM4319_VERSION_H
|
||||
|
||||
/*
|
||||
* Broadcom BCM4319 driver version.
|
||||
*/
|
||||
#define RTL8192_DRV_VERSION "3.10"
|
||||
|
||||
#endif /* WIFI_BCM4319_VERSION_H */
|
||||
|
||||
Reference in New Issue
Block a user