各位大牛好:
目前本人正在调试AM3352板子,用的SDK为Ti_Am335x_SDK_02.00.02.11;
SPI下面挂了2个spi,spi0为spiflash spi1为spi通讯;
问题是:
在linux启动后,/dev目录下没有生成类似spidev的设备文件,也不清楚spiflash和spi有无被正常识别;
设备树配置为:
spi_flash_pins_default: spi_flash_pins_default {
pinctrl-single,pins = <
0x150 ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (A17) spi0_sclk.spi0_sclk */
0x154 ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (B17) spi0_d0.spi0_d0 */
0x158 ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (B16) spi0_d1.spi0_d1 */
0x15c ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (A16) spi0_cs0.spi0_cs0 */
>;
};
sm_module_pins_default: sm_module_pins_default {
pinctrl-single,pins = <
0x190 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (A13) mcasp0_aclkx.spi1_sclk */
0x194 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (B13) mcasp0_fsx.spi1_d0 */
0x198 ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (D12) mcasp0_axr0.spi1_d1 */
0x19c ( PIN_INPUT_PULLUP | MUX_MODE3 ) /* (C12) mcasp0_ahclkr.spi1_cs0 */
>;
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi_flash_pins_default>;
status = "okay";
spidev0: spi@0 {
compatible = "spiflash";
reg = <0>;
spi-max-frequency = <16000000>;
};
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&sm_module_pins_default>;
status = "okay";
spidev1: spi@1 {
compatible = "smmodule";
reg = <1>;
spi-max-frequency = <15000000>;/*15M*/
};
};
内核配置:
| +————————————————————————————————————————————————–+ |
| | — SPI support | |
| | [ ] Debug support for SPI drivers | |
| | *** SPI Master Controller Drivers *** | |
| | < > Altera SPI Controller | |
| | < > Utilities for Bitbanging SPI masters | |
| | < > Cadence SPI controller | |
| | < > GPIO-based bitbanging SPI Master | |
| | < > Freescale SPI controller and Aeroflex Gaisler GRLIB SPI controller | |
| | < > OpenCores tiny SPI | |
| | <*> McSPI driver for OMAP | |
| | <*> DRA7xxx QSPI controller support | |
| | < > PXA2xx SSP SPI master | |
| | < > Rockchip SPI controller driver | |
| | < > NXP SC18IS602/602B/603 I2C to SPI bridge | |
| | < > Analog Devices AD-FMCOMMS1-EBZ SPI-I2C-bridge driver | |
| | < > Xilinx SPI controller common module | |
| | < > DesignWare SPI controller core support | |
| | *** SPI Protocol Masters *** | |
| | < > User mode SPI device driver support | |
| | < > Infineon TLE62X0 (for power switching) | |
| |
在/sys目录下有spi的有:
root@am335x-evm:/dev# find /sys -name '*spi*'
/sys/bus/spi
/sys/bus/spi/devices/spi1.0
/sys/bus/spi/devices/spi2.1
/sys/bus/platform/devices/48030000.spi
/sys/bus/platform/devices/480ca000.spinlock
/sys/bus/platform/devices/481a0000.spi
/sys/bus/platform/drivers/ti-qspi
/sys/bus/platform/drivers/omap_hwspinlock
/sys/bus/platform/drivers/omap_hwspinlock/480ca000.spinlock
/sys/bus/platform/drivers/omap2_mcspi
/sys/bus/platform/drivers/omap2_mcspi/48030000.spi
/sys/bus/platform/drivers/omap2_mcspi/481a0000.spi
/sys/devices/platform/ocp/48030000.spi
/sys/devices/platform/ocp/48030000.spi/spi_master
/sys/devices/platform/ocp/48030000.spi/spi_master/spi1
/sys/devices/platform/ocp/48030000.spi/spi_master/spi1/spi1.0
/sys/devices/platform/ocp/480ca000.spinlock
/sys/devices/platform/ocp/481a0000.spi
/sys/devices/platform/ocp/481a0000.spi/spi_master
/sys/devices/platform/ocp/481a0000.spi/spi_master/spi2
/sys/devices/platform/ocp/481a0000.spi/spi_master/spi2/spi2.1
/sys/class/spi_master
/sys/class/spi_master/spi1
/sys/class/spi_master/spi2
/sys/firmware/devicetree/base/ocp/l4_wkup@44c00000/scm@210000/pinmux@800/spi_flash_pins_default
/sys/firmware/devicetree/base/ocp/spi@48030000
/sys/firmware/devicetree/base/ocp/spi@48030000/spi@0
/sys/firmware/devicetree/base/ocp/spi@48030000/spi@0/spi-max-frequency
/sys/firmware/devicetree/base/ocp/spi@48030000/ti,spi-num-cs
/sys/firmware/devicetree/base/ocp/spi@481a0000
/sys/firmware/devicetree/base/ocp/spi@481a0000/spi@1
/sys/firmware/devicetree/base/ocp/spi@481a0000/spi@1/spi-max-frequency
/sys/firmware/devicetree/base/ocp/spi@481a0000/ti,spi-num-cs
/sys/firmware/devicetree/base/ocp/spinlock@480ca000
请各位帮忙看看,是不是我哪里配置不对?
Steven Liu1:
如果没生成,估计是你没有成功使能他们。
因为你使用的是自己的板子,板子上面多半是没有EEPROM的,所以首先要处理processor sdk中关于EEPROM的这部分处理。如果可以的话,建议使用GPEVM的配置作为最初的参考。因为这个板子上是有SPI flash之类的。
然后就是查device tree的配置。特别提一点,GPEVM板上有profile设置的概念,有些设置是有SPI设备的,有些是没有的,所以一定要仔细看一下初始化代码来确认逻辑的处理正确。