linux版本3.2.0,使用BL88W8801无线网卡芯片(MMC2、SDIO)
做了如下初始化操作:
//初始化管脚
static struct pinmux_config mmc2_wifi_pin_mux[] = {
{"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_ad12.mmc2_dat0", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_ad13.mmc2_dat1", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_ad14.mmc2_dat2", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_ad15.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
{"mcasp0_ahclkr.gpio3_17",OMAP_MUX_MODE7| AM33XX_PIN_INPUT},//芯片使能
{NULL, 0},
};
//初始化MMC2(MMC1已经用作SD卡)
static void mmc2_wifi_init(int evm_id, int profile)
{
setup_pin_mux(mmc2_wifi_pin_mux);
am335x_mmc[1].mmc = 3;
am335x_mmc[1].name = "libertas_sdio";
am335x_mmc[1].caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD;
am335x_mmc[1].nonremovable = true;
am335x_mmc[1].pm_caps = MMC_PM_KEEP_POWER; am335x_mmc[1].gpio_cd = -EINVAL;
am335x_mmc[1].gpio_wp = -EINVAL;
am335x_mmc[1].ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34; /* 3V3 */
/* mmc will be initialized when mmc0_init is called */
printk("!!!!!!!!!!!mmc2_wifi_init!!!!!!!!!!!!\n");
return;
}
//开启使能及供电
static void wl12xx_init(int evm_id, int profile)
{
struct device *dev;
struct omap_mmc_platform_data *pdata;
int ret;
printk("wl12xx_init begin ———————1111111\n");
am335xevm_wlan_data.wlan_enable_gpio = GPIO_TO_PIN(3, 17);
if(wl12xx_set_platform_data(&am335xevm_wlan_data))
pr_err("error setting wl12xx data\n");
dev = am335x_mmc[1].dev;
if (!dev) {
pr_err("wl12xx mmc device initialization failed\n");
goto out;
}
pdata = dev->platform_data;
if (!pdata) {
pr_err("Platfrom data of wl12xx device not set\n");
goto out;
}
ret = gpio_request_one(am335xevm_wlan_data.wlan_enable_gpio,
GPIOF_OUT_INIT_LOW, "wlan_en");
if (ret) {
pr_err("Error requesting wlan enable gpio: %d\n", ret);
goto out;
}
pdata->slots[0].set_power = wl12xx_set_power;
printk("wl12xx_init end ———————1111111111\n");
out:
return;
}
//其中wl12xx_set_power函数如下
static int wl12xx_set_power(struct device *dev, int slot, int on, int vdd)
{
printk("set_power ———————on = %d\n",on);
if (on) {
gpio_direction_output(am335xevm_wlan_data.wlan_enable_gpio, 1);
mdelay(70);
} else {
gpio_direction_output(am335xevm_wlan_data.wlan_enable_gpio, 0);
}
return 0;
}
//am335xevm_wlan_data结构体如下
#define AM335XEVM_WLAN_IRQ_GPIO GPIO_TO_PIN(3, 17)
struct wl12xx_platform_data am335xevm_wlan_data = {
.irq = OMAP_GPIO_IRQ(AM335XEVM_WLAN_IRQ_GPIO),
.board_ref_clock = WL12XX_REFCLOCK_38_XTAL, /* 38.4Mhz */
.wlan_enable_gpio = GPIO_TO_PIN(3, 17),
};
//加入init
{mmc2_wifi_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_ALL},
{wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL},
内核加载信息:
————————————————–
!!!!!!!!!!!mmc2_wifi_init!!!!!!!!!!!!
omap_hsmmc.0: alias fck already exists
omap_hsmmc.2: alias fck already exists
wl12xx_init begin ———————1111111
wl12xx_init end ———————1111111111
mmc1: mmc_rescan_try_freq: trying to init card at 400000 Hz
set_power ———————on = 1
mmc1: new high speed SDIO card at address 0001
mmc1: mmc_power_save_host: powering down
set_power ———————on = 0
mmc1: mmc_power_restore_host: powering up
set_power ———————on = 1
INIT: version 2.88 booif_sdio_probe begin……………model = -1070182908
[test:]ting11111func->card->info[0] = Marvell,model = -1070182908
[test:]func->card->info[1] = 802.11 SDIO ID: 48,model = 72
libertas_sdio: unknown card model 0x48
mmc1: mmc_power_save_host: powering down
set_power ———————on = 0
————————————————–
手动加载驱动:
输出信息:
root@HTD-WICM521:~# insmod sd8xxx.kowlan: Loading MWLAN driver
mmc1: mmc_power_restore_host: powering up
set_power ———————on = 1
vendor=0x02DF device=0x9139 class="0" function=1
rx_work=0 cpu_num=1
Wlan: FW download over, firmwarelen=255536 downloaded 255536
WLAN FW is active
fw_cap_info=0xba3, dev_cap_mask=0xffffffff
wlan: Driver loaded successfully
root@HTD-WICM521:~# cmd53 read error=-110
sched: RT throttling activated
fun0: reg 0x05=0x02 ret=0
fun0: reg 0x04=0x02 ret=0
fun1: reg 0x03=0x02 ret=0
fun1: reg 0x04=0x02 ret=0
fun1: reg 0x05=0x02 ret=0
fun1: reg 0x60=0x02 ret=0
fun1: reg 0x61=0x02 ret=0
moal_read_data_sync: read registers failed
cmd53 read error=-110
fun0: reg 0x05=0x02 ret=0
fun0: reg 0x04=0x02 ret=0
fun1: reg 0x03=0x02 ret=0
fun1: reg 0x04=0x02 ret=0
fun1: reg 0x05=0x02 ret=0
fun1: reg 0x60=0x02 ret=0
fun1: reg 0x61=0x02 ret=0
moal_read_data_sync: read registers failed
cmd53 read error=-110
fun0: reg 0x05=0x02 ret=0
fun0: reg 0x04=0x02 ret=0
fun1: reg 0x03=0x02 ret=0
fun1: reg 0x04=0x02 ret=0
fun1: reg 0x05=0x02 ret=0
fun1: reg 0x60=0x02 ret=0
fun1: reg 0x61=0x02 ret=0
moal_read_data_sync: read registers failed
cmd53 read error=-110
fun0: reg 0x05=0x02 ret=0
fun0: reg 0x04=0x02 ret=0
fun1: reg 0x03=0x02 ret=0
fun1: reg 0x04=0x02 ret=0
fun1: reg 0x05=0x02 ret=0
fun1: reg 0x60=0x02 ret=0
fun1: reg 0x61=0x02 ret=0
moal_read_data_sync: read registers failed
这个错误信息一直输出?
Peter Li:
{"mcasp0_ahclkr.gpio3_17",OMAP_MUX_MODE7| AM33XX_PIN_INPUT},//芯片使能
改为 {"mcasp0_ahclkr.gpio3_17",OMAP_MUX_MODE7| AM33XX_PIN_OUTPUT},//芯片使能
芯片使能控制引脚是输出模式的。
hank hank:
回复 Peter Li:
都尝试过了,一样的输出。