工具/软件:
大家好
我一直使用具有 OSPI 接口的平台、并控制256MB SPI-NOR 四通道器件。
我已使用 TI OSPI/QSPI 指南中概述的 spi-cadence-quadspi 驱动器成功地初始化器件:
我知道上面的链接适用于08.03.00.19版本、但仍然概述了内核中支持四路 SPI 所需的驱动程序。
我正在使用当前的10.01.10版本(6.6内核)
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/snapshot/ti-linux-kernel-10.01.10.tar.gz
启用 SPI 和踏频内核驱动程序:
CONFIG_SPI=y CONFIG_SPI_DEBUG=y CONFIG_SPI_MASTER=y CONFIG_SPI_MEM=y # # SPI Master Controller Drivers # CONFIG_SPI_BITBANG=y CONFIG_SPI_CADENCE_QUADSPI=y CONFIG_SPI_CADENCE_XSPI=y CONFIG_SPI_GPIO=y CONFIG_SPI_OMAP24XX=y # # SPI Protocol Masters # CONFIG_SPI_SPIDEV=m
和在用作 MTD 器件时正确识别闪存:
[ 1.188137] cadence-qspi fc40000.spi: couldn't determine phase-detect-selector [ 1.190538] spi-nor spi0.0: xxxx25nw (32768 Kbytes)
SPI-NOR 调试提供了有关器件的正确信息:
$ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities Supported read modes by the flashddir 1S-1S-1S opcode 0x13 mode cycles 0 dummy cycles 0 1S-4S-4S opcode 0xec mode cycles 2 dummy cycles 6 4S-4S-4S opcode 0xec mode cycles 2 dummy cycles 6 Supported page program modes by the flash 1S-1S-1S opcode 0x12 1S-4S-4S opcode 0x3e cat /sys/kernel/debug/spi-nor/spi0.0/params $ cat /sys/kernel/debug/spi-nor/spi0.0/params id xx xx xx 00 00 00 size 32.0 MiB write size 1 page size 256 address nbytes 4 flags 4B_OPCODES | HAS_4BAIT | HAS_16BIT_SR | SOFT_RESET opcodes read 0xec dummy cycles 8 erase 0xdc program 0x3e 8D extension invert protocols read 1S-4S-4S write 1S-4S-4S register 1S-1S-1S erase commands 21 (4.00 KiB) [1] ff (32.0 KiB) [2] dc (64.0 KiB) [3] c7 (32.0 MiB) sector map region (in hex) | erase mask | flags ------------------+------------+---------- 00000000-01ffffff | [ 123] |
使用 flashrom 可以正常转储设备。 在写入设备时出现一些问题、但会将其放在另一张票上、因为我认为它与我的 spidev 问题无关。
当我启用 ospi 接口并将闪存设备设置为与 spidev 兼容时、我会获得一个/dev/spidev0.0节点、但无法对该接口执行任何操作。
通过驱动程序层、它似乎在 spi_async 操作中中断、返回 ENOTSUPP 错误代码。
DTS 配置:
&ospi0 { bootph-all; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ospi0_pins_default>; reg = <0x00 0x0fc40000 0x00 0x100>, <0x05 0x00000000 0x01 0x2000000>; flash@0 { bootph-all; compatible = "micron,spi-authenta"; reg = <0x0>; spi-tx-bus-width = <1>; spi-rx-bus-width = <1>; spi-max-frequency = <20000000>; cdns,tshsl-ns = <60>; cdns,tsd2d-ns = <60>; cdns,tchsh-ns = <60>; cdns,tslch-ns = <60>; cdns,read-delay = <4>; }; };
我可以让 spidev 使用单线间隔、例如 main_spi0、1和2。
由于某种原因、无法让 spidev 使用 ospi 界面。
这是可能的吗?
我问,因为我们的设计需要使用 spidev 进行开发。
感谢您的帮助。
Marc