Hello,
I am new to the device tree aspect of linux (4.5.0). We are using an imxrt1050 on a board similar to the IMXRT105X_NXPEVK and trying to add an external RTC via SPI. My Kinetis experience suggests that there are clock gating registers that need to be set, pin mux modes, chip select identification, etc. that needs to be done.
- What are the proper device tree entries that need to be added for this part to complete the device tree?
- What goes in the clock section to get the LPSPI_CLK_ROOT going? Or does the spi-fsl-lpspi driver take care of that?
- What goes in the SOC section (iomuxc? gpio? lpspi?)?
- What about pinctrl for the iomuxc? How are the chip selects handled versus the SDI, SDO and SCK pins?
- What else am I missing?
Here are snippets of the DT as I have it so far:
/ {
model = "NXP IMXRT1050 board";
compatible = "nxp,imxrt1050-evk", "nxp,imxrt105x";
(other stuff)
soc {
aips0: aips-bus@40000000 {
compatible = "fsl,aips-bus", "simple-bus";
#address-cells = <1>;
size-cells = <1>;
ranges;
(some gpiox stuff I don't fully understand)
(other stuff)
lpspi3: lpspi@4039c000 {
compatible = "fsl,imx7ulp-spi";
reg = <0x4039c000 0x4000>;
interrupts = <34>;
clocks = <&ipg_clk>;
clock-names = "ipg";
};
};
};
#define MXRT105X_PAD_CFG_SPI_CS 0xA0B0
#define MXRT105X_PAD_CFG_SPI 0xB0
&iomuxc {
(other stuff)
pinctrl_lpspi3_cs: lpspi3_cs_grp {
fsl,pins = <
MXRT105X_PAD_AD_B1_12_LPSPI3_PCS0 MXRT105X_PAD_CFG_SPI_CS
>;
};
pinctrl_lpspi3: lpspi3grp {
fsl,pins = <
MXRT105X_PAD_AD_B1_13_LPSPI3_SDI MXRT105X_PAD_CFG_SPI
MXRT105X_PAD_AD_B1_14_LPSPI3_SDO MXRT105X_PAD_CFG_SPI
MXRT105X_PAD_AD_B1_15_LPSPI3_SCK MXRT105X_PAD_CFG_SPI
>;
};
};
&lpspi3 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi3 &pinctrl_lpspi3_cs>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
mcp795: rtc@0 {
compatible = "maxim,mcp795";
spi-max-frequency = <500000>;
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
};
};
The SPI master is found and loaded. The RTC driver is also found and loaded but the RTC does not yet respond to the SPI requests. By faking the data returned by the RTC driver, from a system point of view, everything looks correct. /dev/rtc0 exists it just doesn't talk. I am in the process of trying to get scope probes on some of the lines to see if they are wiggling but I expect there is more to be done in the device tree than I presently understand. Any help would be appreciated and hopefully answers here will help many more people climbing the learning curve of the imxrt1050 and linux device trees.
Hi wre, hope you are doing well, did you solve your problem with DT and SPI interface?
I'm using imxrt1060 with Linux and I'm facing some problems trying to configure and use an SPI interface using a DT.
My DT SPI interface configuration is almost identical to the yours, with the diference that I'm trying to use the LPSPI4 intead of LPSPI3, but the registers and parameters are the same for imxrt1050 or 1060:
But in my case, I can't get even that the kernel recognize the SPI master controller, I always get the same error on startup: "fsl_lpspi: probe of 403a0000.lpspi failed with error -2"
Maybe you have found a solution for your proyect that could help me.
Many thanks.
@fangfang, thank you, I have seen that document. I can understand what needs to be set up from the processor point of view but what is not clear is how to properly accomplish those things through the device tree nodes.
Hello,
I'd recommend to the document(How to configure LPSPI clock) as the link. URL:
https://community.nxp.com/docs/DOC-342717.
Hope it help you.
Best regrads