Hello Igor,
I included that TJA1145 driver into my kernel (there are multiple patches that need to be put together), but it doesn't seem to work. Within the probe function is a call to check the device ID by reading the identification register over SPI. Based on the TJA1145 documentation it should either return 0x70 or 0x74. When I try to read this register it returns 0x00. In fact it seems all reads return 0x00. The TJA1145 chip is definitely powered, so I think there is something wrong with the SPI configuration in my device tree.
The board I am using has the TJA1145 connected to SPI1. The following is my device tree configuration for SPI1 and the TJA1145:
lpspi1: lpspi@5a010000 {
compatible = "fsl,imx7ulp-spi";
reg = <0x0 0x5a010000 0x0 0x10000>;
interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&gic>;
clocks = <&clk IMX8QXP_SPI1_CLK>,
<&clk IMX8QXP_SPI1_IPG_CLK>;
clock-names = "per", "ipg";
assigned-clocks = <&clk IMX8QXP_SPI1_CLK>;
assigned-clock-rates = <20000000>;
power-domains = <&pd_dma_lpspi1>;
status = "disabled";
};
pinctrl_lpspi1: lpspi1grp {
fsl,pins = <
SC_P_SAI0_TXD_ADMA_SPI1_SDO 0x00000041
SC_P_SAI0_RXD_ADMA_SPI1_CS0 0x02000061
SC_P_SAI0_TXC_ADMA_SPI1_SDI 0x00000041
SC_P_SAI0_TXFS_ADMA_SPI1_SCK 0x00000061
>;
};
&lpspi1 {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi1>;
status = "okay";
tja1145: tja1145@0 {
compatible = "nxp,tja1145";
reg = <0>;
spi-max-frequency = <1000000>;
spi-cpha;
};
};
The TJA1145 has an internal pull up resistor on the chip select line and an internal pull down resistor on the clock line. The minimum clock frequency for SPI in the TJA1145 data sheet is 4 MHz. The SPI timing diagram in the TJA1145 data sheet shows that CPOL=0 and CPHA=1 with chip select active low. Is there something wrong with my device tree settings?
Edit: I tried using the configuration 0x0600004c for all of the pins since I saw another node in a sample device tree do this, but it also did not work. I have also changed the spi-max-frequency field to 1 MHz since I misinterpreted the data sheet. A clock rate of 4 MHz is the maximum, not the minimum. However, I still can't read anything.