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.

AM5726: SPI UART expander issue

Part Number: AM5726


Hello,

I want to use a "NXP sc16is752" over mcSPI1 on AM5726.

The sc16is752 is connected to mcSPI1:

AM5726.SPI1_SCLK <-----> sc16.sclk

AM5726.SPI1_CS0 <-----> sc16.cs

AM5726.SPI1_D0 <-----> sc16.mosi

AM5726.SPI1_D1<-----> sc16.miso

AM5726.GPIO3_5 <-----> sc16.IRQ

My DTS-Configuration there are:

&dra7_pmx_core {    
    pinmux_spi1_pins: pinmux_spi1_pins {
        pinctrl-single,pins = <
            DRA7XX_CORE_IOPAD(0x37b0, PIN_INPUT_PULLUP | MUX_MODE0)    /* A24 spi1_cs0.spi1_cs0 */
            DRA7XX_CORE_IOPAD(0x37a4, PIN_INPUT | MUX_MODE0)    /* A25 spi1_sclk.spi1_sclk */
            DRA7XX_CORE_IOPAD(0x37ac, PIN_INPUT | MUX_MODE0)    /* B25 spi1_d0.spi1_d0 MOSI */
            DRA7XX_CORE_IOPAD(0x37a8, PIN_INPUT | MUX_MODE0)    /* F16 spi1.d1.spi1_d1 MISO */
        >;
    };
};



&mcspi1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinmux_spi1_pins>;

    status = "okay";

    sc16is752_0: sc16is752@0 {
        compatible = "nxp,sc16is752";

        reg = <0>;
        clocks = <&sc16is752_0_osc>;
        interrupt-parent = <&gpio3>;
        interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
        gpio-controller;
        spi-max-frequency = <4000000>;

        sc16is752_0_osc: sc16is752_0_osc {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <18432000>;
        };
    };
};

I have built the driver as Module:

CONFIG_SERIAL_SC16IS7XX_CORE=m
CONFIG_SERIAL_SC16IS7XX=m
# CONFIG_SERIAL_SC16IS7XX_I2C is not set
CONFIG_SERIAL_SC16IS7XX_SPI=y

With "insmod sc16is7xx.ko":

[   14.132331] gpiochip_find_base: found new base at 496
[   14.132732] gpio gpiochip9: (spi1.0): added GPIO chardev (254:9)
[   14.132916] gpiochip_setup_dev: registered GPIOs 496 to 503 on device: gpiochip9 (spi1.0)
[   14.133586] serial serial0: tty port ttySC0 registered
[   14.140619] serial serial1: tty port ttySC1 registered

I dont get an error but I have didn´t get a device in /dev/ttySCx

  • Hi Rekoe,

    rekoe said:
    &dra7_pmx_core {   
        pinmux_spi1_pins: pinmux_spi1_pins {
            pinctrl-single,pins = <
                DRA7XX_CORE_IOPAD(0x37b0, PIN_INPUT_PULLUP | MUX_MODE0)    /* A24 spi1_cs0.spi1_cs0 */
                DRA7XX_CORE_IOPAD(0x37a4, PIN_INPUT | MUX_MODE0)    /* A25 spi1_sclk.spi1_sclk */
                DRA7XX_CORE_IOPAD(0x37ac, PIN_INPUT | MUX_MODE0)    /* B25 spi1_d0.spi1_d0 MOSI */
                DRA7XX_CORE_IOPAD(0x37a8, PIN_INPUT | MUX_MODE0)    /* F16 spi1.d1.spi1_d1 MISO */
            >;
        };
    };

    AM57x pinmux should be done in SPL/MLO file u-boot/board/ti/am57xx/mux_data.h Refer to below e2e thread for details:

    https://e2e.ti.com/support/processors/f/791/t/661048

    rekoe said:
    &mcspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinmux_spi1_pins>;
        status = "okay";
        sc16is752_0: sc16is752@0 {
            compatible = "nxp,sc16is752";
            reg = <0>;
            clocks = <&sc16is752_0_osc>;
            interrupt-parent = <&gpio3>;
            interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
            gpio-controller;
            spi-max-frequency = <4000000>;
            sc16is752_0_osc: sc16is752_0_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <18432000>;
            };
        };
    };

    From AM572x McSPI module side, I can not see any problem. I suspect you have something wrong in  sc16is752 DTS part. Your issue seems to be specific for NXP sc16is752 DTS or driver. Have you tied to check this issue with NXP support team?

    Also, I have find in below link that the issue might be caused by sc16is752 clocks DTS entry wrong assignment:

    https://www.raspberrypi.org/forums/viewtopic.php?t=146908#p1009204

    Regards,
    Pavel