【发布时间】:2022-10-20 14:08:15
【问题描述】:
我正在尝试使用 MTD 设备在 Licheepi 零上进行存储。我已经能够成功地添加和使用 i2c 和 spidev,但是我无法在内核启动期间执行 jedec、spi-nor。
我的 dts 是(我已经尝试了很多变体):
&spi0 {
pinctrl-0 = <&spi0_pins>; // tried without these two lines
pinctrl-names = "default";
status = "okay";
/* tried with and without this */
/*cs-gpios = <&pio 2 2 GPIO_ACTIVE_LOW>, <&pio 1 0 GPIO_ACTIVE_LOW>;*/
flash@0 {
compatible = "winbond,w25q64", "jedec,spi-nor"; // I tried deleting winbond,w25q64
status = "okay"; // I added this line on desperation
spi-max-frequency = <50000000>; // I tried lowering this to 10MHz
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;
};
};
当我使用这个 dts 启动内核时,我看不到 jedec,spi-nor 试图探测 NOR-FLASH,就像“jedec,spi-nor”根本没有执行一样。我知道我的更改正在起作用,因为如果我用spidev@0{compatible = "spidev";..} 替换flash@0{compatible="jedec,spi-nor";..},我会得到一个spidev 设备(它是功能性的)并且也可以在dmesg 上看到它。
其他一些输出:
cat /proc/mtd
dev: size: erasesize name
ls /sys/class/mtd 为空
# cat /sys/class/spi_master/spi0/spi0.0/uevent
OF_NAME=flash
OF_FULLNAME=/soc/spi@1c68000/flash@0
OF_COMPATIBLE_0=winbond,w25q64
OF_COMPATIBLE_1=jedec,spi-nor
OF_COMPATIBLE_N=2
MODALIAS=spi:w25q64
MTD_SPI_NOR 在 menuconfig 中启用。我还将它添加为一个模块并尝试运行modprobe -v jedec_probe.ko 和modprobe -v spi-nor.ko,但我认为绝对没有冗长。 mtdinfo 用户空间计数 0 个 MTD 设备。
我使用的 linux 内核是 5.3.5。我正在用 buildroot 编译它。我检查了 jdec,spi-nor (linux-5.3.5/drivers/mtd/spi-nor/spi-nor.c) 支持 w25q64
【问题讨论】:
标签: linux-kernel linux-device-driver kernel-module device-tree