[Resolved] Need some help to get the auart1 working

Started by Christian Jann, September 11, 2013, 04:57:11 PM

Previous topic - Next topic

Christian Jann

Hi, I could really need some help to get the second application uart working on my imx23 based board. I've already asked this question on the linux-serial mailing list (http://thread.gmane.org/gmane.linux.serial/12556) but have no tips received so far.

Hopefully here is somebody that can help me to get this damned uart working.

I was able to debug this problem a bit (http://www.jann.cc/2013/08/31/porting_linux_to_a_new_board.html#step-4-the-application-uart), if I type some characters on the serial terminal then they are landing in the input buffer under Linux and the output buffer gets filled with the characters that should be sent back, but I'm receiving nothing.

Christian Jann

So I've finally solved the issue after reading Documentation/devicetree/bindings/pinctrl/fsl,mxs-pinctrl.txt again, the pinmux-ids were wrong.

Required subnode-properties:
- fsl,pinmux-ids: An integer array.  Each integer in the array specify a pin
  with given mux function, with bank, pin and mux packed as below.

    [15..12] : bank number
    [11..4]  : pin number
    [3..0]   : mux selection

[  ][      ][  ]
bank  pin    mux

0000000011100000 0x00e0 /* MX23_PAD_GPMI_D14__GPMI_D14 */
0000000011110000 0x00f0 /* MX23_PAD_GPMI_D15__GPMI_D15 */
  0b00001110 = 14
  0b00001111 = 15

Looking at the datasheet, mux for auart should be 01:

0000000011100001 0x00e1 /* MX23_PAD_GPMI_D14__AUART2_TX */
0000000011110001 0x00f1 /* MX23_PAD_GPMI_D15__AUART2_RX */

Before I haven't understood the exact functioning of fsl,pinmux-ids but now I've corrected arch/arm/boot/dts/imx23.dtsi:

auart1_2pins_a: auart1-2pins@0 {
  reg = <0>;
  fsl,pinmux-ids = <
    0x00e1 /* MX23_PAD_GPMI_D14__AUART2_TX */
    0x00f1 /* MX23_PAD_GPMI_D15__AUART2_RX */
  fsl,drive-strength = <0>;
  fsl,voltage = <1>;
  fsl,pull-up = <0>;

Fadil Berisha

Hi Christian,

imx233 with 128QFP has 1 Debug UART and 1 App UART (named UART1) and variant with 169 BGA has 1 Debug and 2 App UART's (named UART1 and UART2).

imx233.dtsi file defines two devices uart0 (serial UART1) and uart1 (serial UART2) but imx23-olinuxino board with 128QFP processor has only uart0!

Which serial is status = "okay" on your  imx23-olinuxino.dts file? 

Fadil Berisha

Christian Jann

Hi Fadil,

you are right, I'm using the BGA169 version of the i.MX23, you can find a picture of the board in my blog post. But it is working now, so no problem.

I've actually chosen to write auart1 in title in small letters because Freescale starts to count from 1 to name the UARTs and the kernel developers start from 0 and withing the device tree the auarts are written in small letters. I've written a bit more in the mailing list post that is linked above.

The status for auart1 is set to "okay" in imx23-olinuxino.dts:

duart: serial@80070000 {
  pinctrl-names = "default";
  pinctrl-0 = <&duart_pins_a>;
  status = "okay";

auart0: serial@8006c000 {
  pinctrl-names = "default";
  pinctrl-0 = <&auart0_2pins_a>;
  status = "okay";

auart1: serial@8006e000 {
  pinctrl-names = "default";
  pinctrl-0 = <&auart1_2pins_a>;
  status = "okay";

Later I've to create a new dts file for the board that I'm working on and see whether it is useful/possible/necessary to merge everything into the kernel.

Best regards

Fadil Berisha

Hi Christian,

That's my thought. Congratulations on very nice work.

Best regards

Fadil Berisha