硬件平台
mdm9x07 + qca9377
现象
连wifi 测试跑大数据 出现wifi 连接不上, 重新卸载加载wifi驱动 报-110 错误, 只有重启设备wifi 才恢复正常
日志
打开MMC kernel 调试日志
CONFIG_MMC_DEBUG=y
关闭mmc1
& sdhc_2 {
*****
status = "disabled"
}
<3>[ 74.494041] mmc0: Timeout waiting for hardware interrupt.
<6>[ 74.494075] sdhci: =========== REGISTER DUMP (mmc0)===========
<6>[ 74.494094] sdhci: Sys addr: 0x00000000 | Version: 0x00002e02 BASE
<6>[ 74.494111] sdhci: Blk size: 0x00000100 | Blk cnt: 0x00000000
<6>[ 74.494129] sdhci: Argument: 0x9e549c06 | Trn mode: 0x00000023
<6>[ 74.494146] sdhci: Present: 0x03f80101 | Host ctl: 0x00000016
<6>[ 74.494163] sdhci: Power: 0x0000000d | Blk gap: 0x00000000
<6>[ 74.494180] sdhci: Wake-up: 0x00000000 | Clock: 0x00000007 实际始终400K
<6>[ 74.494197] sdhci: Timeout: 0x0000000d | Int stat: 0x00000000 超时时间0d
<6>[ 74.494214] sdhci: Int enab: 0x03bf810b | Sig enab: 0x03bf010b
<6>[ 74.494231] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
<6>[ 74.494248] sdhci: Caps: 0x262dc8b2 | Caps_1: 0x00008007
<6>[ 74.494265] sdhci: Cmd: 0x0000353a | Max curr: 0x00000000 CMD 53
<6>[ 74.494282] sdhci: Resp 1: 0x00000000 | Resp 0: 0x00001000
<6>[ 74.494300] sdhci: Resp 3: 0x00000000 | Resp 2: 0x00000000
<6>[ 74.494316] sdhci: Host ctl2: 0x0000400b
<6>[ 74.494332] sdhci: ADMA Err: 0x00000003 | ADMA Ptr: 0x8f848008
<6>[ 74.494349] ----------- VENDOR REGISTER DUMP -----------
<6>[ 74.494367] Data cnt: 0x00000000 | Fifo cnt: 0x00000200 | Int sts: 0x000c0000
<6>[ 74.494387] DLL cfg: 0x074d6400 | DLL sts: 0x000001a4 | SDCC ver: 0x1000002e
<6>[ 74.494408] Vndr func: 0x00018a1e | Vndr adma err : addr0: 0x008c8400 addr1: 0x00000000
<6>[ 74.494429] Vndr func2: 0xfa8018a8
<6>[ 74.494475] Test bus[0 to 3]: 0x0000c846 0x000020ce 0x00007018 0x01c002ff
<6>[ 74.494495] Test bus[4 to 7]: 0x00473fd8 0x0005c038 0x40000000 0xffa3ffff
<6>[ 74.494514] Test bus[8 to 11]: 0x4ffc3684 0x40800002 0x213be089 0x00001cc0
<6>[ 74.494534] Test bus[12 to 15]: 0x075f0508 0x843f11a0 0x0d001c48 0x00000a88
<6>[ 74.494554] Test bus[16 to 19]: 0x00022000 0x000f808c 0x00000000 0x00001c91
<6>[ 74.494573] Test bus[20 to 23]: 0x0241ff61 0x00054ea1 0x00000000 0x00000000
<6>[ 74.494592] Test bus[24 to 27]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494611] Test bus[28 to 31]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494630] Test bus[32 to 35]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494649] Test bus[36 to 39]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494668] Test bus[40 to 43]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494687] Test bus[44 to 47]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494706] Test bus[48 to 51]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494725] Test bus[52 to 55]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494745] Test bus[56 to 59]: 0x00000000 0x00000000 0x00000000 0x00000000
<6>[ 74.494766] mmc0: clk: 200000000 clk-gated: 0 claimer: AR6K Async pwr: 12 host->irq = 8192
<6>[ 74.494787] mmc0: rpmstatus[pltfm](runtime-suspend:usage_count:disable_depth)(0:1:0)
<6>[ 74.494807] sdhci: ===========================================
<6>[ 74.494827] mmc0: cf848000: DMA 0x8c928000, LEN 0x0600, Attr=0x23
<6>[ 74.494845] mmc0: bytes to transfer: 1536 transferred: 0
<7>[ 74.494966] mmc0: req done (CMD53): -84: 00000000 00000000 00000000 00000000
<7>[ 74.494976] mmc0: 0 bytes transferred: -110
<4>[ 74.495067] AR6000: SDIO bus operation failed! MMC stack returned : -84
<4>[ 74.495088] __HIFReadWrite, addr:0X012A4E, len:00001536, Write, Async
此处 为等待发送cmd 53 后,没有接收到中断,超时,延长等待中断时间
vim host/sdhci.c
void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
{
...
//add by svk@20230822
pr_debug("%s: salvikie cmd->opcode=%d timeout=%lu\n", mmc_hostname(host->mmc), cmd->opcode, (timeout - jiffies) / HZ);
if(cmd->opcode == 53)
{
timeout += 1000 * HZ;
pr_debug("%s: salvikie cmd->opcode=%d set timeout=%lu\n", mmc_hostname(host->mmc), cmd->opcode, (timeout - jiffies) / HZ);
}
//end by svk
mod_timer(&host->timer, timeout);
....
}
收到一个异常中断,然后卡在那里
<7>[ 116.624325] mmc0: starting CMD53 arg 9410d004 flags 000001b5
<7>[ 116.624344] mmc0: blksz 4 blocks 1 flags 00000100 tsac 1000 ms nsac 0
<7>[ 116.624369] mmc0: salvikie cmd->busy_timeout=0
<7>[ 116.624378] mmc0: salvikie cmd->opcode=53 timeout=10
<7>[ 116.624386] mmc0: salvikie cmd->opcode=53 set timeout=1010
<7>[ 116.624399] mmc0: salvikie data->timeout_clks=50000 host->clock=200000000
<7>[ 116.624409] mmc0: salvikie current_timeout=163 target_timeout=1000000
<7>[ 116.624418] mmc0: func[sdhci_set_timeout] salvikie count=0xd
<7>[ 116.624447] sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00028000
降低clock
void mmc_set_ios(struct mmc_host *host)
{
struct mmc_ios *ios = &host->ios;
pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u "
"width %u timing %u\n",
mmc_hostname(host), ios->clock, ios->bus_mode,
ios->power_mode, ios->chip_select, ios->vdd,
ios->bus_width, ios->timing);
//add by svk
if(ios->clock == 200000000)
{
//ios->clock = 400000;
//ios->clock = 20000000;
ios->clock = 100000000;
pr_debug("%s: salvikie change clock to %d/1001 K\n", mmc_hostname(host), ios->clock);
}
//end by svk
....
}
降到20M 稳定很多
后续,debugfs 设置最大时钟,卸载WiFi驱动 完全断电(mmc)