基于A31s的AP6210驱动调试

按照《A31s平台wifi移植说明》的相关步骤配置完成

在修改sys_config.fex的ap6xxx_clk_power     = "axp22_dldo4"后32.768K的时钟输出有了

修改Wifi_pm_ap6xxx.c (arch\arm\mach-sun6i\rf) 函数:

static int ap6xxx_gpio_ctrl(char* name, int level)
{
int i = 0;
int ret = 0;
int gpio = 0;
unsigned long flags = 0;
char * gpio_name[2] = {"ap6xxx_wl_regon", "ap6xxx_bt_regon"};


for (i = 0; i < 2; i++) {
if (strcmp(name, gpio_name[i]) == 0) {
switch (i)
{
case 0: /*ap6xxx_wl_regon*/
//gpio = ap6xxx_wl_regon;
gpio = GPIOM(0);
break;
case 1: /*ap6xxx_bt_regon*/
//gpio = ap6xxx_bt_regon;
break;
default:
ap6xxx_msg("no matched gpio.\n");
}
break;
}
}


if (1==level)
flags = GPIOF_OUT_INIT_HIGH;
else
flags = GPIOF_OUT_INIT_LOW;


ret = gpio_request_one(gpio, flags, NULL);
if (ret) {
ap6xxx_msg("failed to set gpio %s to %d !\n", name, level);
return -1;
} else {
gpio_free(gpio);
ap6xxx_msg("succeed to set gpio %s to %d !\n", name, level);
}


return 0;
}

void ap6xxx_power(int mode, int *updown)
{
    if (mode) {
        if (*updown) {
//ap6xxx_gpio_ctrl("ap6xxx_wl_regon", 1);
gpio_request_one(GPIOM(0),GPIOF_OUT_INIT_HIGH,NULL);
mdelay(200);
        } else {
//ap6xxx_gpio_ctrl("ap6xxx_wl_regon", 0);
gpio_request_one(GPIOM(0),GPIOF_OUT_INIT_LOW,NULL);
mdelay(100);
        }
        ap6xxx_msg("sdio wifi power state: %s\n", *updown ? "on" : "off");
    }
    return;
}

这时ap6xxx_wl_regon引脚可以拉高,内核的报错信息如下:

<4>[   98.780315] =========== WLAN going back to live  ========
<4>[   98.780328] sdio_reset_comm():
<4>[   98.780337] mmc_claim_host enter
<4>[   98.780351] mmc_claim_host leave
<4>[   98.780360] mmc_go_idle enter
<4>[   98.780377] [mmc]: sdc1 set ios: clk 150000Hz bm PP pm ON vdd 3.3V width 4 timing SD-HS(SDR25) dt B
<4>[   98.783244] [mmc]: sdc1 set ios: clk 150000Hz bm PP pm ON vdd 3.3V width 4 timing SD-HS(SDR25) dt B
<4>[   98.784299] mmc_go_idle leave
<4>[   98.784309] mmc_set_clock enter
<4>[   98.784322] [mmc]: sdc1 set ios: clk 150000Hz bm PP pm ON vdd 3.3V width 4 timing SD-HS(SDR25) dt B
<4>[   98.784375] mmc_set_clock leave
<4>[   98.784384] mmc_send_io_op_cond enter
<4>[   98.786106] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 5,  RTO !!
<4>[   98.787856] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 5,  RTO !!
<4>[   98.789606] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 5,  RTO !!
<4>[   98.791355] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 5,  RTO !!
<4>[   98.791390] mmc_wait_for_cmd return:-110
<4>[   98.791401] mmc_send_io_op_cond return:-110
<4>[   98.791413] mmc2: Error resetting SDIO communications (-110)
<4>[   98.791428] sdioh_start Failed, error = -110

 

你可能感兴趣的:(基于A31s的AP6210驱动调试)