硬件:mangopi v3s
linux kernel: linux5.2.0
原理图:
设备树:使用的licheepi的
/*
* Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sun8i-v3s-licheepi-zero.dts"
#include <dt-bindings/input/input.h>
/ {
model = "Lichee Pi Zero with Dock";
compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
"allwinner,sun8i-v3s";
aliases {
ethernet0 = &emac;
};
leds {
/* The LEDs use PG0~2 pins, which conflict with MMC1 */
status = "disabled";
};
};
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC1", "Mic",
"Mic", "HBIAS";
status = "okay";
};
&emac {
phy-handle = <&int_mii_phy>;
phy-mode = "mii";
allwinner,leds-active-low;
status = "okay";
};
&mmc1 {
broken-cd;
bus-width = <4>;
vmmc-supply = <®_vcc3v3>;
status = "okay";
};
&lradc {
vref-supply = <®_vcc3v0>;
status = "okay";
button-200 {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
channel = <0>;
voltage = <200000>;
};
button-400 {
label = "Volume Down";
linux,code = <KEY_VOLUMEDOWN>;
channel = <0>;
voltage = <400000>;
};
button-600 {
label = "Select";
linux,code = <KEY_SELECT>;
channel = <0>;
voltage = <600000>;
};
button-800 {
label = "Start";
linux,code = <KEY_OK>;
channel = <0>;
voltage = <800000>;
};
};
&i2c0 {
status = "okay";
gt911: touchscreen@14 {
compatible = "goodix,gt911";
reg = <0x14>;
interrupt-parent = <&pio>;
interrupts = <1 1 IRQ_TYPE_EDGE_FALLING>; /* (PB1) */
pinctrl-names = "default";
irq-gpios = <&pio 1 1 GPIO_ACTIVE_HIGH>; /* (PB1) */
reset-gpios = <&pio 1 0 GPIO_ACTIVE_HIGH>; /* RST (PB0) */
/* touchscreen-swapped-x-y */
};
};
#include "sun8i-v3s.dtsi"
#include "sunxi-common-regulators.dtsi"
/ {
model = "Lichee Pi Zero";
compatible = "licheepi,licheepi-zero", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
leds {
compatible = "gpio-leds";
blue_led {
label = "licheepi:blue:usr";
gpios = <&pio 6 1 GPIO_ACTIVE_LOW>; /* PG1 */
};
green_led {
label = "licheepi:green:usr";
gpios = <&pio 6 0 GPIO_ACTIVE_LOW>; /* PG0 */
default-state = "on";
};
red_led {
label = "licheepi:red:usr";
gpios = <&pio 6 2 GPIO_ACTIVE_LOW>; /* PG2 */
};
};
};
&ehci0 {
status = "okay";
};
&mmc0 {
broken-cd;
bus-width = <4>;
vmmc-supply = <®_vcc3v3>;
status = "okay";
};
/*&i2c0 {
status = "okay";
ns2009: ns2009@48 {
compatible = "nsiway,ns2009";
reg = <0x48>;
};
};*/
&ohci0 {
status = "okay";
};
&uart0 {
pinctrl-0 = <&uart0_pb_pins>;
pinctrl-names = "default";
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&usbphy {
usb0_id_det-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
status = "okay";
};
加载esp8089.ko之后出现的问题:
# insmod esp8089.ko
[ 6037.164266]
[ 6037.164266] ***** EAGLE DRIVER VER:bdf5087c3deb*****
[ 6037.164266]
[ 6037.172352] debugfs: Directory 'esp_debug' with parent '/' already present!
[ 6037.179391] ESP8089 reset via GPIO 0
[ 6048.487708] esp_sdio_init ------ RETRY ------
[ 6048.492255] ESP8089 reset via GPIO 0
[ 6048.707737] ESP8089 reset via GPIO 0
[ 6060.007706] esp_sdio_init ------ RETRY ------
[ 6060.012250] ESP8089 reset via GPIO 0
[ 6060.227738] ESP8089 reset via GPIO 0
[ 6071.527710] esp_sdio_init ------ RETRY ------
[ 6071.532249] ESP8089 reset via GPIO 0
[ 6071.747749] ESP8089 reset via GPIO 0
[ 6083.047715] esp_sdio_init ------ RETRY ------
[ 6083.052250] ESP8089 reset via GPIO 0
[ 6083.267797] eagle sdio can not power up!
[ 6083.279314]
[ 6083.279314] ***** EAGLE DRIVER VER:bdf5087c3deb*****
[ 6083.279314]
[ 6083.287253] debugfs: Directory 'esp_debug' with parent '/' already present!
[ 6083.294340] ESP8089 reset via GPIO 0
[ 6094.567707] esp_sdio_init ------ RETRY ------
[ 6094.572245] ESP8089 reset via GPIO 0
[ 6094.787736] ESP8089 reset via GPIO 0
[ 6106.087714] esp_sdio_init ------ RETRY ------
[ 6106.092250] ESP8089 reset via GPIO 0
[ 6106.307733] ESP8089 reset via GPIO 0
[ 6117.607708] esp_sdio_init ------ RETRY ------
[ 6117.612243] ESP8089 reset via GPIO 0
[ 6117.827737] ESP8089 reset via GPIO 0
[ 6129.127704] esp_sdio_init ------ RETRY ------
[ 6129.132240] ESP8089 reset via GPIO 0
[ 6129.347722] eagle sdio can not power up!
insmod: can't insert 'esp8089.ko': No such device
离线
ESP8089 reset via GPIO 0
驱动可能需要传一个gpio进去。
您是说加载模块的时候吗?
这样吗?
insmod esp8089.ko reset via GPIO 0
离线
ESP8089 reset via GPIO 0
驱动可能需要传一个gpio进去。
# insmod esp8089.ko reset via GPIO 0
[ 8426.078282] esp8089: unknown parameter 'reset' ignored
[ 8426.083446] esp8089: unknown parameter 'via' ignored
[ 8426.088514] esp8089: unknown parameter 'GPIO' ignored
[ 8426.093563] esp8089: unknown parameter '0' ignored
[ 8426.098678]
[ 8426.098678] ***** EAGLE DRIVER VER:bdf5087c3deb*****
[ 8426.098678]
[ 8426.106608] debugfs: Directory 'esp_debug' with parent '/' already present!
[ 8426.113646] ESP8089 reset via GPIO 0
[ 8437.607699] esp_sdio_init ------ RETRY ------
[ 8437.612244] ESP8089 reset via GPIO 0
[ 8437.827788] ESP8089 reset via GPIO 0
[ 8449.127694] esp_sdio_init ------ RETRY ------
[ 8449.132234] ESP8089 reset via GPIO 0
[ 8449.347724] ESP8089 reset via GPIO 0
[ 8460.647704] esp_sdio_init ------ RETRY ------
[ 8460.652249] ESP8089 reset via GPIO 0
[ 8460.867733] ESP8089 reset via GPIO 0
[ 8472.167701] esp_sdio_init ------ RETRY ------
[ 8472.172240] ESP8089 reset via GPIO 0
[ 8472.387717] eagle sdio can not power up!
[ 8472.399061] esp8089: unknown parameter 'reset' ignored
[ 8472.404223] esp8089: unknown parameter 'via' ignored
[ 8472.409276] esp8089: unknown parameter 'GPIO' ignored
[ 8472.414327] esp8089: unknown parameter '0' ignored
[ 8472.419446]
[ 8472.419446] ***** EAGLE DRIVER VER:bdf5087c3deb*****
[ 8472.419446]
[ 8472.427372] debugfs: Directory 'esp_debug' with parent '/' already present!
[ 8472.434420] ESP8089 reset via GPIO 0
[ 8483.687696] esp_sdio_init ------ RETRY ------
[ 8483.692232] ESP8089 reset via GPIO 0
[ 8483.907724] ESP8089 reset via GPIO 0
[ 8495.207697] esp_sdio_init ------ RETRY ------
[ 8495.212233] ESP8089 reset via GPIO 0
[ 8495.427728] ESP8089 reset via GPIO 0
[ 8506.727701] esp_sdio_init ------ RETRY ------
[ 8506.732232] ESP8089 reset via GPIO 0
[ 8506.947728] ESP8089 reset via GPIO 0
[ 8518.247696] esp_sdio_init ------ RETRY ------
[ 8518.252238] ESP8089 reset via GPIO 0
[ 8518.467755] eagle sdio can not power up!
insmod: can't insert 'esp8089.ko': No such device
不行啊
离线
哇酷小二 说:ESP8089 reset via GPIO 0
驱动可能需要传一个gpio进去。
您是说加载模块的时候吗?
这样吗?insmod esp8089.ko reset via GPIO 0
不是, 要看下代码。
参考:
SDIO ESP8089开源Linux驱动现在可以直接编译通过了, 有没有朋友一起试一试
https://whycan.com/t_4326.html#p70252
离线
让板子重新上电其实就没有这个问题,可以正常加载模块的!
# insmod /lib/modules/esp8089.ko
[ 33.142620]
[ 33.142620] ***** EAGLE DRIVER VER:bdf5087c3deb*****
[ 33.142620]
[ 33.150803] ESP8089 reset via GPIO 0
[ 33.367996] esp_sdio_dummy_probe enter
[ 33.587670] esp_sdio_init power up OK
[ 34.039162] esp_host:bdf5087c3deb
[ 34.039162] esp_target: e826c2b3c9fd 57 18202
[ 34.039162]
[ 34.048460] esp_readwrite_file: file /system/lib/modules/test_results filp_open error
[ 34.056547] first normal exit
[ 34.059745] esp_sdio_remove enter
[ 34.064033] sif_disable_irq release irq failed
[ 34.187987] eagle_sdio: probe of mmc1:0001:1 failed with error -110
# [ 34.888079] mmc1: card 0001 removed
[ 34.942183] mmc1: queuing unknown CIS tuple 0x01 (3 bytes)
[ 34.954824] mmc1: queuing unknown CIS tuple 0x1a (5 bytes)
[ 34.963661] mmc1: queuing unknown CIS tuple 0x1b (8 bytes)
[ 34.971008] mmc1: queuing unknown CIS tuple 0x80 (1 bytes)
[ 34.976546] mmc1: queuing unknown CIS tuple 0x81 (1 bytes)
[ 34.982568] mmc1: queuing unknown CIS tuple 0x82 (1 bytes)
[ 34.988163] mmc1: new high speed SDIO card at address 0001
[ 35.352056] esp_host:bdf5087c3deb
[ 35.352056] esp_target: e826c2b3c9fd 57 18202
[ 35.352056]
#
#
# ifconfig wlan0 up
[ 49.594517] esp_op_add_interface STA
# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:64 errors:0 dropped:0 overruns:0 frame:0
TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4736 (4.6 KiB) TX bytes:4736 (4.6 KiB)
wlan0 Link encap:Ethernet HWaddr AC:D0:74:C8:E9:F8
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
#
离线
正好最近在调esp8089,研究了一下,用的这份代码 https://github.com/al177/esp8089, 指定复位引脚的的参数是esp_reset_gpio
insmod /lib/modules/esp8089.ko esp_reset_gpio=123
复位引脚接在esp8089的chip_en上,不过正确指定reset后就会出现楼主的现象,不指定还可以往下跑一段,加打印跟了一段,应该是加了reset之后,在给esp8089发第一条指令时超时无回复,导致出错。如果不加复位会在第二次probe时出现无响应,需要修改下esp_sdio_probe,添加卡在位状态重新检测。
// mmc_force_detect_change的实现
#ifndef MMC_HAS_FORCE_DETECT_CHANGE
void mmc_force_detect_change(struct mmc_host *host, unsigned long delay,
bool keep_power)
{
host->caps &= ~MMC_CAP_NONREMOVABLE;
host->caps |= MMC_CAP_NEEDS_POLL;
mmc_detect_change(host, delay);
}
#endif
static int esp_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
......
if(sif_sdio_state == ESP_SDIO_STATE_FIRST_INIT){
esp_dbg(ESP_DBG_ERROR, "first normal exit\n");
sif_sdio_state = ESP_SDIO_STATE_FIRST_NORMAL_EXIT;
mmc_force_detect_change(host, msecs_to_jiffies(100), true); //添加这行
up(&esp_powerup_sem);
}
......
}
参考的 https://github.com/Icenowy/esp8089 这份代码,这份可以正常生成wlan0,并连接wifi,安装需要指定晶振频率( insmod esp8089.ko config=crystal_26M_en=1)。但这份没有reset,一旦wifi不正常只能重新上电。
测试两份代码,在没有rmmod的情况下reboot,都会出现无法再次正常初始化的情况,只能断电重启。
另外rmmod crash的问题可以参考4楼的链接,帖子里有修复。
离线