We have added a chip that supports I2C expansion of GPIOs. By modifying the driver, we have registered it in the kernel. Now, the gpiod tool can be used to control the corresponding GPIO pins normally.
nvidia@thor:~/can$ gpioinfo /dev/gpiochip3
gpiochip3 - 16 lines:
line 0: "PPLA.00" unused input active-high
line 1: "PPLA.01" unused input active-high
line 2: "PPLA.02" unused input active-high
line 3: "PPLA.03" unused input active-high
line 4: "PPLA.04" unused input active-high
line 5: "PPLA.05" unused input active-high
line 6: "PPLA.06" unused input active-high
line 7: "PPLA.07" unused input active-high
line 8: "PPLB.00" unused input active-high
line 9: "PPLB.01" unused input active-high
line 10: "PPLB.02" unused input active-high
line 11: "PPLB.03" unused input active-high
line 12: "PPLB.04" unused input active-high
line 13: "PPLB.05" unused input active-high
line 14: "PPLB.06" unused input active-high
line 15: "PPLB.07" unused input active-high
Now, while using the default two CS pins, we want to use some of the GPIOs in the I2C extended GPIOs as CS pins.
However, I was unable to capture the CS signal at the corresponding GPIO pin.
i2c@810c680000 {
status = "okay";
pcf8575: pcf8575@20 {
status = "okay";
reg = <0x20>;
compatible = "nxp,pcf8575";
interrupt-parent = <&gpio_aon>;
interrupts = <TEGRA264_AON_GPIO(DD, 4) 0>;
gpio-controller;
interrupt-controller;
#gpio-cells = <12>;
#interrupt-cells = <4>;
};
};
spi@810c590000 { /* SPI1 */
status = "okay";
num-cs = <6>;
cs-gpios = <&pcf8575 TEGRA264_PLINK_GPIO(PLB, 0) GPIO_ACTIVE_LOW>,
<&pcf8575 TEGRA264_PLINK_GPIO(PLB, 1) GPIO_ACTIVE_LOW>,
<&pcf8575 TEGRA264_PLINK_GPIO(PLB, 2) GPIO_ACTIVE_LOW>,
<&pcf8575 TEGRA264_PLINK_GPIO(PLB, 3) GPIO_ACTIVE_LOW>;
spi@0 { /* cs0, ch9434 serial codec */
compatible = "wch,ch943x";
status = "disabled";
#address-cells = <1>;
#size-cell = <1>;
reg = <0x0>;
spi-max-frequency = <50000000>;
gpioint = <&gpio_aon TEGRA264_AON_GPIO(DD, 3) 0>; /* GPIO08: PDD.03; GPIO09: PDD.04 */
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
spi@1 {
compatible = "tegra-spidev";
reg = <0x1>;
spi-max-frequency = <10000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x10>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
spi@2 {
status = "okay";
compatible = "tegra-spidev";
reg = <0x3>;
spi-max-frequency = <10000000>
};
spi@3 {
status = "okay";
compatible = "tegra-spidev";
reg = <0x3>;
spi-max-frequency = <10000000>;
};
spi@4 {
status = "okay";
compatible = "tegra-spidev";
reg = <0x4>;
spi-max-frequency = <10000000>;
};
spi@5 {
status = "okay";
compatible = "tegra-spidev";
reg = <0x5>;
spi-max-frequency = <10000000>;
};
I referred to the following posts, but still have some unclear points regarding the operation. Could you please give me some good suggestions?
SPI CS doesn’t work - Jetson & Embedded Systems / Jetson Xavier NX - NVIDIA Developer Forums