9

I use kernel 3.12.rc4 on an embedded linux device (olimex imx233 micro). My aim is to use /dev/spidev to be able to communicate with another spi device.

I edit arch/arm/boot/dts/imx23-olinuxino.dts as:

ssp1: ssp@80034000 {
  #address-cells = <1>;
  #size-cells = <0>;
  compatible = "fsl,imx23-spi";
  pinctrl-names = "default";
  pinctrl-0 = <&spi2_pins_a>;
  clock-frequency = <1000000>;
  status = "okay";

  spidev: spidev@0 {
    compatible = "spidev";
    spi-max-frequency = <1000000>;
    reg = <1>;
  };
};

arch/arm/boot/dts/imx23.dtsi: has this config

spi2_pins_a: spi2@0 {
  reg = <0>;
  fsl,pinmux-ids = <
    0x0182 /* MX23_PAD_GPMI_WRN__SSP2_SCK */
    0x0142 /* MX23_PAD_GPMI_RDY1__SSP2_CMD */
    0x0002 /* MX23_PAD_GPMI_D00__SSP2_DATA0 */
    0x0032 /* MX23_PAD_GPMI_D03__SSP2_DATA3 */
  >;
  fsl,drive-strength = <1>;
  fsl,voltage = <1>;
  fsl,pull-up = <1>;
};

Device binding looks correct. When I compile the kernel I get the /dev/spidev1.1. After that I use spidev_test.c and monitor the pins by an oscilloscope. The SCK and MOSI output signals correctly, however, the chipselect is set to the logic high even during the data transfer.

Is there any way to determine why spidev cannot set to logic low during the transmission? It seems like either additional things needs to be passed on kernel or there is an issue on spidev that cannot control the chip select . I wonder if I need to change anything on the spidev.h or spidev.c on the driver/spi directory of the kernel? or how can I solve it?

The reference manual for the processor

4

1 回答 1

6

我从未使用过设备树,但无论如何我都会尽力帮助你。

内核创建设备/dev/spidev1.1,因此 spidev 连接到SPI 总线 1片选 1。片选编号从 开始0,并且您没有与SPI 总线 1关联的任何其他设备。

据我所知reg = <1>,告诉 SPI 内核 spidev 连接到芯片选择 1,但也许您的设备连接到芯片选择 0。所以,reg = <0>

于 2013-10-23T18:51:45.400 回答