ath79 spi报错:ath79-spi 1f000000.spi: cs1 >= max 1
发布日期:2021-05-07 15:56:23 浏览次数:27 分类:精选文章

本文共 2356 字,大约阅读时间需要 7 分钟。

一、问题及其解决方法

ath79 在dts 中配置spi 时,固件启动后出现以下错误日志:

[ 0.374839] ath79-spi 1f000000.spi: cs1 >= max 1[ 0.379668] spi_master spi0: spi_device register error /ahb/spi@1f000000/flash@1[ 0.387309] spi_master spi0: Failed to create SPI device for /ahb/spi@1f000000/flash@1[ 0.406176] m25p80 spi0.0: w25q128 (16384 Kbytes)[ 0.411104] 6 fixed-partitions partitions found on MTD device spi0.0[ 0.417658] Creating 6 MTD partitions on "spi0.0"[ 0.422632] 0x000000000000-0x000000040000 : "u-boot"[ 0.428493] 0x000000040000-0x000000050000 : "u-boot-env"[ 0.434607] 0x000000050000-0x000000060000 : "art"[ 0.440165] 0x000000060000-0x000001000000 : "nor_firmware"[ 0.446436] 0x000000060000-0x000000460000 : "kernel"[ 0.452231] 0x000000460000-0x000001000000 : "nor_reserved"[ 0.459194] libphy: Fixed MDIO Bus: probed[ 1.138441] libphy: ag71xx_mdio: probed[ 1.145395] switch0: Atheros AR8337 rev. 2 switch registered on mdio-bus.0[ 1.799559] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:00 [uid=004dd036, driver=Atheros AR8216/AR8236/AR8316][ 1.811180] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: mii[ 1.819260] NET: Registered protocol family 10[ 1.827674] Segment Routing with IPv6[ 1.831590] NET: Registered protocol family 17[ 1.836223] 8021q: 802.1Q VLAN Support v1.8[ 1.844012] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6[ 1.851786] Please append a correct "root=" boot option; here are the available partitions:[ 1.860429] 1f00 256 mtdblock0[ 1.860433] (driver?)[ 1.867184] 1f01 64 mtdblock1[ 1.867187] (driver?)[ 1.873951] 1f02 64 mtdblock2[ 1.873954] (driver?)[ 1.880724] 1f03 16000 mtdblock3[ 1.880728] (driver?)[ 1.887478] 1f04 4096 mtdblock4[ 1.887481] (driver?)[ 1.894245] 1f05 11904 mtdblock5[ 1.894248] (driver?)[ 1.901017] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)[ 1.910175] Rebooting in 1 seconds..

原因:spi slave 不识别

解决方法:修改 dts 中的 spi 配置

在 dts 文件中,spi 芯片的配置通常如下:

&spi {    status = "okay";    num-cs = <2>;  // 根据硬件情况调整    cs-gpios = <0>, <0>;  // 使用 cs0 和 cs1,低电平有效    // ... 其他配置};

注:cs-gpios 的具体值需要根据硬件和设计需求调整。例如,cs-gpios = <0>, <0> 表示使用系统默认的 cs0 和 cs1,低电平有效;如果需要使用 cs2,则可以配置为 cs-gpios = <0>, <0>, <&gpio1 18 GPIO_ACTIVE_LOW>,表示 cs2 绑定到gpio18,低电平有效。

二、SPI 知识拓展

CS 信号是 SPI 从设备是否被选中的控制信号。只有当 CS 信号为预先规定的有效状态(如低电平)时,SPI 从设备的操作才会有效。

通常,SPI 从设备的 CS 信号由一个固定的 SPI 主机控制,常见的模式是低电平选中设备,高电平释放设备。

上一篇:openwrt支持wpa3加密
下一篇:openwrt使用tayga/totd实现NAT64/DNS64

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2025年03月22日 22时25分54秒