This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] SK-AM62: How to configure spidev for MCU_SPI0 CS1 in AM625

Part Number: SK-AM62
Other Parts Discussed in Thread: AM625

Ref: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/09_00_00_03/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/SPI.html

 

The default SPI config in Processor SDK 9.x sets the number of chip select (CS) to 1. To enable additional CS, say CS1 instead of CS0, edit

k3-am62-mcu.dtsi and add ti,spi-num-cs = <2>;  

 

                mcu_spi0: spi@4b00000 {

                                compatible = "ti,am654-mcspi", "ti,omap4-mcspi";

                                reg = <0x00 0x04b00000 0x00 0x400>;

                                interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;

                                #address-cells = <1>;

                                #size-cells = <0>;

                                power-domains = <&k3_pds 147 TI_SCI_PD_EXCLUSIVE>;

                                clocks = <&k3_clks 147 0>;

                                ti,spi-num-cs = <2>;

                                status = "disabled";

                };

 

The following changes are needed in DTS file k3-am625-sk.dts to add MCU SPI0 with CS1

 

//Pinmux for MCU_SPI0 CS1 - SK EVM E3, which uses AM62x ALW package

                mcuspi0_pins_default: mcuspi0-pins-default { 

                                pinctrl-single,pins = <

                                                AM62X_MCU_IOPAD(0x0008, PIN_INPUT, 0) /* (A7) MCU_SPI0_CLK */

                                                AM62X_MCU_IOPAD(0x0004, PIN_INPUT, 0) /* (B8) MCU_SPI0_CS1 */

                                                AM62X_MCU_IOPAD(0x000c, PIN_INPUT, 0) /* (D9) MCU_SPI0_D0 */

                                                AM62X_MCU_IOPAD(0x0010, PIN_INPUT, 0) /* (C9) MCU_SPI0_D1 */

                                >;

                };

};

 

 

&mcu_spi0 {

                status = "okay";

                #address-cells = <1>;

                #size-cells = <0>;

                pinctrl-0 = <&mcuspi0_pins_default>;

                pinctrl-names = "default";

                spidev@1 {

                                compatible = "rohm,dh2228fv";

                                spi-max-frequency = <1000000>;

                                reg = <1>;

                };

};

 

Additionally, enable spidev in Linux by adding

CONFIG_SPI_SPIDEV=y

in the arch/arm64/configs/defconfig file of ti-linux-kernel

Rebuild Linux kernel and dts and boot the AM62x SK EVM.

In the target board /dev/spidev1.1 is created.

This changes were tested In the AM625 SK EVM. spidev_test.c was used to test the changes and the MCU SPI pins are available at J9 connector.