Linux i.mx53 serial driver problem

cancel
Showing results for 
Search instead for 
Did you mean: 

Linux i.mx53 serial driver problem

3,012 Views
MarkRoy
Contributor III

Hello folks,

I am working on porting the freescale  Linux 11.09 BSP to a new board.   Right now i have pretty much cloned the mx53_loco configuration with a few changes.  I have re-done the iomuxing to suit my board,  and removed most references to the da905x PMIC since my board uses the MC34708 exclusively.     One other change that I had to make was to switch the boot console output from ttymxc0 to ttymxc1 since my board uses UART2 for the console interface. 

I am using the latest u-boot-imx from the git repository with it's own modifications and I can boot the board and get to a login screen on the console.    However, it seems that as soon as the early boot console hands off to the serial driver,  things start to get weird.    There seems to be a slight delay when I type or when the console output is sent, and it seems that after a while the whole serial driver seems to crash and ends up just spitting out all of the data that had ever been sent since the driver was initialized in an infinite loop. 

The odd thing is that I have compiled my kernel to also include the mx53_loco configuration, and when I run the same kernel binary on the mx53_loco, it works without problems.    This leads me to believe it must be a problem with my hardware or something I am doing in my configuration. 

Also, I was wondering what the difference between the mxc serial driver and the imx serial driver is?   I currently can only seem to get the mxc driver to work, as this is the one used by the mx53_loco board and I cant seem to find an example of a board that uses the imx driver.

Any advice is appreciated.

Mark

Labels (2)
9 Replies

114 Views
MarkRoy
Contributor III

Well, after a day of searching on my own for an answer, it makes perfect sense I would find it 10 mins after posting a question here..

I checked and found that in  arch/arm/mach-mx5/serial.h the configuration for UART2 was different for UART1.    It had a value of -1 in UART2_UCR4_CTSTL  when UART1 had a value of 16.  Also, I  noticed that DMA is not enabled in UART1 but it was in UART2.  Copying the values from UART1 to UART2 seems to have fixed the issue.

Perhaps there is a problem with the MXC serial driver and DMA ?

114 Views
hiromitakano
Contributor I

Hi Mark,

I'm using a custom board too, and I need to move the kernel serial output from uart1 to uart2.

I know how to do this in u-boot (I can change the u-boot output to uart2), and I know how to modify the environment variable to move the console output from ttymxc0 to ttymxc1, but still the kernel sends its first messages to uart1...

What should I do to change the output serial port even for the first (printk) messages in the kernel?

Thank You in advance,

Hiromi

0 Kudos

114 Views
MarkRoy
Contributor III

Hello Hiromi,

If you take a look at your board file, for the QSB this is  arch/arm/mach-mx5/mx53_loco.c    You can find the function mx53_loco_timer_init(void).   In this function, it initializes the clocks and sets up the early console.  

Simply change the line that gets the serial clock from :

uart_clk =clk_get_sys("mxcintuart.0", null); 

to:

uart_clk = clk_get_sys("mxcintuart.1", null);

and change the following line from:

early_console_setup(MX53_BASE_ADDR(UART1_BASE_ADDR), uart_clk); 

to:

early_console_setup(MX53_BASE_ADDR(UART2_BASE_ADDR), uart_clk);

You may also experience the problems I listed above with DMA, so you may need to edit the serial.h file as well.

Cheers.

114 Views
hiromitakano
Contributor I

Thank you for your reply.

Indeed I already tried that way with no success.

I made the changes, and kept the u-boot output on UART1. After sending the "boot" command I read "Starting kernel ... Linux verion 2.6.35 etc.". These messages are still on UART1. The last message on UART1 is "console [ttymxc1] enabled, bootconsole disabled". I would like all this stuff to be sent to UART2...

0 Kudos

114 Views
MarkRoy
Contributor III

You may be confused by the numbering systems in the kernel.  

UART1 -> ttymxc0

UART2 -> ttymxc1

UART3 -> ttymxc2

etc...

If you are not seeing any output on UART2 after it has switched to it (as your kernel is telling you), then it is probably a problem with your pin muxing.  Please make sure that you are setting up UART2 to output on the correct pads and that you arent mistakingly overwriting those pins later on in your initialization with GPIOs.

good luck.

0 Kudos

114 Views
hiromitakano
Contributor I

No, I'm not confused about the numbering system, and the muxes are ok, but maybe I didn't explain well the situation:

- u-boot: I can send the output of u-boot to UART1 or UART2 without problems;

- Linux kernel after the sentence "console [ttymxc<0 or 1>] enabled, bootconsole disabled": I can send the output to UART1 or UART2 without problems;

- Linux kernel before the sentence "console etc.": the output goes to UART1 whatever I do to redirect it to UART2. This is the problem, maybe I don't do the right things to redirect it...

0 Kudos

114 Views
nishad_kamdar
Contributor IV

Hi ,

I also faced a similar issue with the UART, in the sabreauto board.

I made the iomux and the early console setup as mentioned above to shift from UART4 to UART1.

But i had to modify one more file,

/arch/arm/plat-mxc/include/mach/uncompress.h

case MACH_TYPE_MX6Q_SABREAUTO:

  uart_base = MX6Q_UART4_BASE_ADDR;

to

case MACH_TYPE_MX6Q_SABREAUTO:

  uart_base = MX6Q_UART1_BASE_ADDR;

0 Kudos

114 Views
ProcessorProces
Contributor I

I'm also using UART2 for the console.  I had the same issue until I modified my board file under arch/arm/mach-mx5/ from...

static void __init mx53_loco_timer_init(void)

{

    struct clk *uart_clk;

    mx53_clocks_init(32768, 24000000, 0, 0);

    uart_clk = clk_get_sys("mxcintuart.0", NULL);

    early_console_setup(MX53_BASE_ADDR(UART1_BASE_ADDR), uart_clk);

}

to

static void __init mx53_loco_timer_init(void)

{

    struct clk *uart_clk;

    mx53_clocks_init(32768, 24000000, 0, 0);

    uart_clk = clk_get_sys("mxcintuart.1", NULL);

    early_console_setup(MX53_BASE_ADDR(UART2_BASE_ADDR), uart_clk);

}

114 Views
MarkRoy
Contributor III

Yup Craig,  that's the same change that got early console working for me.  

0 Kudos