Other Parts Discussed in Thread: TPS65217
Tool/software: Linux
I am new to embedded linux. I am not using the sitara sdk, the linux build directory is from yocto build system.
I am trying to get the MCP23S18 working with the am3352. The MCP23S18 is an SPI gpio port expander.
I have the CONFIG_SPI_SPIDEV and CONFIG_GPIO_MCP23S08 enabled in .config. The relevant extracts from my device tree:
&am33xx_pinmux {
pinctrl-names = "default";
spi0_pins: pinmux_spi0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x150, PIN_OUTPUT | MUX_MODE0 ) // (A18) spi0_sclk.spi0_sclk
AM33XX_IOPAD(0x154, PIN_INPUT | MUX_MODE0 ) // (B18) spi0_d0.spi0_d0
AM33XX_IOPAD(0x158, PIN_OUTPUT | MUX_MODE0 ) // (B17) spi0_d1.spi0_d1
AM33XX_IOPAD(0x15c, PIN_OUTPUT_PULLUP | MUX_MODE0 ) // (A17) spi0_cs0.spi0_cs0
AM33XX_IOPAD(0x160, PIN_OUTPUT_PULLUP | MUX_MODE0 ) // (B16) spi0_cs1.spi0_cs1
>;
};
};
&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
};
&spi0 {
gpiom1: gpiom1@1 {
compatible = "microchip,mcp23s18";
reg = <1>;
gpio-controller;
#gpio-cells = <2>;
spi-present-mask = <0x01>;
spi-max-frequency = <1000000>;
};
nvram: nvram {
address-cells = <1>;
#size-cells = <1>;
compatible = "spansion,mr25h10"; //may need to change spansion.
reg = <0>;
spi-max-frequency = <40000000>;
m25p,fast-read;
};
};
Now I am unsure how the driver should be interfaced from the user space. Should there be file node in /dev or somewhere in /sys? On my target there is nothing new relating too the port expander, gpios etc
I can see some device relevant files extracted form the device tree but I don't think they can be used for control of the device:
root@am335x-evm:/sys/class/spi_master/spi1/spi1.1/of_node# ls
#gpio-cells gpio-controller reg spi-present-mask
compatible name spi-max-frequency
I can access the device through the spidev driver so i know the hardware is correct. To do this i have to include spidev in the device file.
compatible = "microchip,mcp23s18"; > compatible = "linux,spidev";
So does anyone know how this device should be accessed from user space and is my device tree/ configuration correct?
Thanks