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.

AM3352: AM3352 UART2 device tree config issue

Part Number: AM3352

Hi,

I have the following board layout on my custom board:

The pinmux tool comes up with the following config for pin K18 and L18:

myuart2_pins_default: myuart2_pins_default {
pinctrl-single,pins = <
AM33XX_IOPAD(0x92c, PIN_INPUT | MUX_MODE1) /* (K18) gmii1_txclk.uart2_rxd */
AM33XX_IOPAD(0x930, PIN_OUTPUT | MUX_MODE1) /* (L18) gmii1_rxclk.uart2_txd */
>;
};

When Use this for my Uart config:

&uart2 {
        pinctrl-names = "default";
        pinctrl-0 = <&myuart2_pins_default>;
        status = "okay";
};





I see the following error during boot:

[ 0.632451] OMAP GPIO hardware version 0.1
[ 0.736053] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 1.085993] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 1.094580] omap_uart 44e09000.serial: no wakeirq for uart0
[ 1.095479] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 29, base_baud = 3000000) is a OMAP UART0
[ 1.645500] printk: console [ttyO0] enabled
[ 1.651710] omap_uart 48022000.serial: no wakeirq for uart1
[ 1.658046] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 36, base_baud = 3000000) is a OMAP UART1
[ 1.670133] pinctrl-single 44e10800.pinmux: pin PIN75 already requested by 48022000.serial; cannot claim for 48024000.serial
[ 1.681965] pinctrl-single 44e10800.pinmux: pin-75 (48024000.serial) status -22
[ 1.689642] pinctrl-single 44e10800.pinmux: could not request pin 75 (PIN75) from group myuart2_pins_default on device pinctrl-single
[ 1.702277] omap_uart 48024000.serial: Error applying setting, reverse things back
[ 1.710343] omap_uart: probe of 48024000.serial failed with error -22

Running on kernel:

Linux cdx 5.4.51casenio #1 Mon Jul 13 14:08:14 CEST 2020 armv7l GNU/Linux

When I change the syntax from the pinmux tool to this:

myuart2_pins_default: myuart2_pins_default {
pinctrl-single,pins = <
0x92c (PIN_INPUT | MUX_MODE1) /* (K18) gmii1_txclk.uart2_rxd */
0x930 (PIN_OUTPUT | MUX_MODE1) /* (L18) gmii1_rxclk.uart2_txd */
>;
};

I get the following message:

[ 0.632609] OMAP GPIO hardware version 0.1
[ 0.736345] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 1.086233] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 1.094664] omap_uart 44e09000.serial: no wakeirq for uart0
[ 1.095572] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 29, base_baud = 3000000) is a OMAP UART0
[ 1.645602] printk: console [ttyO0] enabled
[ 1.651822] omap_uart 48022000.serial: no wakeirq for uart1
[ 1.658148] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 36, base_baud = 3000000) is a OMAP UART1
[ 1.670168] pinctrl-single 44e10800.pinmux: mux offset out of range: 0x92c (0x238)
[ 1.678094] pinctrl-single 44e10800.pinmux: could not add functions for myuart2_pins_default 2348x
[ 1.687832] omap_uart 48024000.serial: no wakeirq for uart2
[ 1.694179] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 37, base_baud = 3000000) is a OMAP UART2

There will be a /dev/ttyO2 present but no data is transferred or received.

What is the correct device tree config for uart2 using pins k18 and L18 on a AM3352  processor?

Why does "mux offset out of range" pop up?

UART0,1,3,4,5 work flawlessly

  • Hi,

    Mateusz Gwara said:
    I see the following error during boot:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    [ 0.632451] OMAP GPIO hardware version 0.1
    [ 0.736053] pinctrl-single 44e10800.pinmux: 142 pins, size 568
    [ 1.085993] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
    [ 1.094580] omap_uart 44e09000.serial: no wakeirq for uart0
    [ 1.095479] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 29, base_baud = 3000000) is a OMAP UART0
    [ 1.645500] printk: console [ttyO0] enabled
    [ 1.651710] omap_uart 48022000.serial: no wakeirq for uart1
    [ 1.658046] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 36, base_baud = 3000000) is a OMAP UART1
    [ 1.670133] pinctrl-single 44e10800.pinmux: pin PIN75 already requested by 48022000.serial; cannot claim for 48024000.serial
    [ 1.681965] pinctrl-single 44e10800.pinmux: pin-75 (48024000.serial) status -22

    What is your UART1 pinmux setting? It seems your UART2 pinmux setting is conflict with your UART1 pinmux setting.

    Mateusz Gwara said:
    Why does "mux offset out of range" pop up?

    Because your pinmux setting syntax is wrong - missing AM33XX_IOPAD.

    Mateusz Gwara said:
    0x92c (PIN_INPUT | MUX_MODE1) /* (K18) gmii1_txclk.uart2_rxd */
    0x930 (PIN_OUTPUT | MUX_MODE1) /* (L18) gmii1_rxclk.uart2_txd */

  • Here is the complete UART config I use:
    &uart0 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart0_pins>;
    
    	status = "okay";
    };
    
    &uart1 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart1_pins>;
    
    	status = "okay";
    };
    
    &uart2 {
            pinctrl-names = "default";
            pinctrl-0 = <&myuart2_pins_default>;
            status = "okay";
    };
    
    &uart3 {
            pinctrl-names = "default";
            pinctrl-0 = <&myuart3_pins_default>;
            status = "okay";
    };
    
    &uart4 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart4_pins>;
    	status = "okay";
    };
    
    &uart5 {
    	pinctrl-names = "default";
    	pinctrl-0 = <&uart5_pins>;
    	status = "okay";
    };


    and

    	uart0_pins: pinmux_uart0_pins {
    		pinctrl-single,pins = <
    			0x170 ( PIN_INPUT | MUX_MODE0 ) /* (E15) uart0_rxd.uart0_rxd */
    			0x174 ( PIN_OUTPUT | MUX_MODE0 ) /* (E16) uart0_txd.uart0_txd */	
    		/*	0x168 ( PIN_INPUT | MUX_MODE0 )  (E18) uart0_ctsn.uart0_ctsn */
    		/*	0x16c ( PIN_OUTPUT | MUX_MODE0 )  (E17) uart0_rtsn.uart0_rtsn */
    		>;
    	};
    
    	uart1_pins: pinmux_uart1_pins {
    		pinctrl-single,pins = <
    			0x12c (PIN_INPUT_PULLDOWN | MUX_MODE5)	/* mii1_txclk.uart1_dcd */
    			0x134 (PIN_OUTPUT | MUX_MODE5)		/* mii1_rxd3.uart1_dtr */
    			0x138 (PIN_INPUT_PULLUP | MUX_MODE5)	/* mii1_rxd2.uart1_ri */
    			0x178 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart1_cts.uart1_cts */
    			0x17C (PIN_OUTPUT | MUX_MODE0)		/* uart1_rts.uart1_rts */
    			0x180 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart1_rxd.uart1_rxd */
    			0x184 (PIN_OUTPUT | MUX_MODE0)		/* uart1_txd.uart1_txd */
    		>;
    	};
    	myuart2_pins_default: myuart2_pins_default {
    		pinctrl-single,pins = <
    			0x92c (PIN_INPUT | MUX_MODE1) /* (K18) gmii1_txclk.uart2_rxd */
    			0x930 (PIN_OUTPUT | MUX_MODE1) /* (L18) gmii1_rxclk.uart2_txd */
    		>;
    	};
    
            myuart3_pins_default: myuart3_pins_default {
                            pinctrl-single,pins = <
                                            0x160 ( PIN_INPUT_PULLUP | MUX_MODE1) /* (C15) spi0_cs1.uart3_rxd */
                                            0x164 ( PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* (C18) eCAP0_in_PWM0_out.uart3_txd */
                            >;
            };
    
    	uart4_pins: pinmux_uart4_pins {
    		pinctrl-single,pins = <
                            	0x070 0x26  /* P9_11, MODE6, UART4_RXD */
                            	0x074 0x06  /* P9_13, MODE6, UART4_TXD */
    		>;
    	};
    
    	uart5_pins: pinmux_uart5_pins {
    		pinctrl-single,pins = <
    			0x148 (PIN_INPUT_PULLUP | MUX_MODE2)	/* lcd_data9.uart5_rxd */
    			0x14c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)	/* lcd_data8.uart5_txd */
    		>;
    	};
    
    

    like I said, all Port work fine except UART2.

    Bin Liu said:
    Because your pinmux setting syntax is wrong - missing AM33XX_IOPAD.

    Please read my initial question please. I've started off with the syntax you mentioned. As you can see, both syntax styles are not "wrong" as you can see in the am33xx header files.

  • First of all, I am not sure where you get the kernel source code and where those UART pinmux setting come from. But if you use TI Processor SDK Linux package, all the AM335x DTS files use either AM33XX_PADCONF() or AM33XX_IOPAD() macro in pinmux settings.

    Now look at your pinmux:

    Mateusz Gwara said:
    uart1_pins: pinmux_uart1_pins {
        pinctrl-single,pins = <
            0x12c (PIN_INPUT_PULLDOWN | MUX_MODE5)  /* mii1_txclk.uart1_dcd */

    Mateusz Gwara said:
    myuart2_pins_default: myuart2_pins_default {
        pinctrl-single,pins = <
            AM33XX_IOPAD(0x92c, PIN_INPUT | MUX_MODE1) /* (K18) gmii1_txclk.uart2_rxd */

    These two pins are the same, that is why your UART2 doesn't work - its RXD is already used for UART1 DCD.

  • Excuse me, but how is "0x12c" the same as "0x92c" especially because one is the by default "mii1_txclk" ant the other "gmii1_txclk" which are totally different cpu pins.

    I use the current ti am335x cpu sdk which accepts both syntax variants.

    Actually I already use ALL 5 of 6 UART ports, which is why i need UART2 as well.

    The config above compiles with the TI CPU SDK and runs fine except UART2, which is why I asked my initial question.

  • - Please check the AM335x datasheet, there is no such pin called "mii1_txclk", only "gmii1_txclk".

    - 0x12c and 0x92c could be the same pin depending on the pinmux syntax:
        -- AM33XX_IOPAD(0x92c, ...) is the same pin as '0x12c' without the AM33XX_IOPAD macro, because there is 0x800 offset conversion in the macro;
        -- using syntax 0x92c without the macro is completely wrong, that is why you got the error "mux offset out of the range: 0x92c" in the second kernel log in your original post.

    Your first kernel log in your original post has the following message, which tells UART2 pin is already used by UART1. 0x48022000 is UART1 base address, 0x48024000 is UART2 base address. This is why I asked for your UART1 pin settings.

    [ 1.670133] pinctrl-single 44e10800.pinmux: pin PIN75 already requested by 48022000.serial; cannot claim for 48024000.serial

  • By the way, your kernel log seems indicating you use omap-serial UART driver. This driver is no longer maintained for quite some time, so I recommend you switch to 8250-omap UART driver.

  • Thank you very much for pointing out the macro offset.

    I was switching back&forth between ti-processor-sdk-linux-am335x-evm-06.00.00.07 and a pure linux 5.4.* kernel and didn't see the offset issue.

    Now my device tree for UART1&2 looks like this (because I only use rx/tx on uart 1 anyway):

    	uart1_pins: pinmux_uart1_pins {
    		pinctrl-single,pins = <
    			0x134 (PIN_OUTPUT | MUX_MODE5)		/* mii1_rxd3.uart1_dtr */
    			0x138 (PIN_INPUT_PULLUP | MUX_MODE5)	/* mii1_rxd2.uart1_ri */
    			0x178 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart1_cts.uart1_cts */
    			0x17C (PIN_OUTPUT | MUX_MODE0)		/* uart1_rts.uart1_rts */
    			0x180 (PIN_INPUT_PULLUP | MUX_MODE0)	/* uart1_rxd.uart1_rxd */
    			0x184 (PIN_OUTPUT | MUX_MODE0)		/* uart1_txd.uart1_txd */
    		>;
    	};
    	myuart2_pins_default: myuart2_pins_default {
    		pinctrl-single,pins = <
    			0x12C (PIN_INPUT | MUX_MODE1) /* (K18) gmii1_txclk.uart2_rxd */
    			0x130 (PIN_OUTPUT | MUX_MODE1) /* (L18) gmii1_rxclk.uart2_txd */
    		>;
    	};

    This device tree compiles well on the ti sdk as well as on linux kernel 5.*

    I used the old syntax because I use this device tree since 2014 in various sdk/kernel combos :)

    As for the 8250-omap UART driver I didn't notice any advantages so far, that's why I haven't changed the production kernel config yet.

    Thanks for pointing out that this is the most current to use anyway.