Add 2.6.37 high-speed UART driver to 2.6.32 kernel

554 views
Skip to first unread message

Christine Chen

unread,
Mar 2, 2011, 12:48:54 AM3/2/11
to android-porting
Hi all:

I am running Android Ecalir on Devkit8000 board OMAP3530.
The kernel I used was git from 0xdroid branch omap3-2.6.32.

My goal is getting higher UART baud rate(3M).
I found the patch “serial: Add OMAP high-speed UART driver”.
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commitdiff;h=b612633b5928077441b979471869753bfa93d41a
I followed the patch to add the 2.6.37 omap-serial driver (omap-
serial.c, omap-serial.h,etc.) to 2.6.32 kernel.
Because 2.6.32 serial.c doesn’t mention about “CONFIG _SERIAL_OMAP”,
so I also replaced it with 2.6.37 serial.c.

Problem: I can’t use UART1 and UART3 to communicate with PC now.
Even the bootargs is “console=ttyS2,115200n8” or
“console=ttyO2,115200n8”, there is no boot information on console.
=====================================================================
The message stopped at :

Starting kernel ...
Uncompressing
Linux...............................................................................................................................................................................
done, booting the kernel.
=====================================================================

After booting, it can enter android filesystem successfully.
There is /dev/ttyS*, but there is no /dev/ttyO*.

Then I disabled the new driver CONFIG _SERIAL_OMAP and used 8250, but
the result is the same.
Is it because I missed to modify any related files when I replaced
2.6.32 serial.c with 2.6.37 version? (For example, changing
omap_hwmod_34xx.h to omap_hwmod_3xxx.c)

Any idea to add the 2.6.37 omap-serial driver to 2.6.32 kernel or get /
dev/ttyO* on 2.6.32?

Thanks.

Christine

Christine Chen

unread,
Mar 22, 2011, 5:00:45 AM3/22/11
to android-porting
The problem was solved.
Now the UART1 transmission can achieve 3.5Mbps.
I'll posted the method later, hope it will help others who is
developing on UART communication.

Christine

On 3月2日, 下午1時48分, Christine Chen <cyt95u...@gmail.com> wrote:
> Hi all:
>
> I am running Android Ecalir on Devkit8000 board OMAP3530.
> The kernel I used was git from 0xdroid branch omap3-2.6.32.
>
> My goal is getting higher UART baud rate(3M).
> I found the patch “serial: Add OMAP high-speed UART driver”.http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a...

Christine Chen

unread,
Mar 24, 2011, 10:42:54 AM3/24/11
to android-porting
As I said I use 0xdroid provided omap3-2.6.32 Kernel, there is no omap-
serial.c inside.
At first I wanted to add 2.6.37 file to 2.6.32, but it failed....since
file dependency.
So I added the 2.6.32 omap-serial.c to my kernel, here is my steps:

(Reference PATCH omap: Hack: Switch sholes to the omap serial driver
http://android.git.kernel.org/?p=kernel/omap.git;a=commitdiff;h=3e9adf317ef6930917923788033b67f669fa01e5)
1. Add new files
drivers/serial/omap-serial.c (http://android.git.kernel.org/?p=kernel/
omap.git;a=tree;f=drivers/
serial;h=55a7cb5d99fa6f9e666010eaf31920fe7df355d0;hb=refs/heads/
archive/android-omap-2.6.32)
arch/arm/plat-omap/include/plat/omap-serial.h  (http://
android.git.kernel.org/?p=kernel/omap.git;a=tree;f=arch/arm/plat-omap/
include/plat;h=7f4702eae7e73bed1d7bbc10a3e0a09b17237c54;hb=refs/heads/
archive/android-omap-2.6.32)
arch/arm/include/asm/mach/serial_omap.h (http://
android.git.kernel.org/?p=kernel/omap.git;a=tree;f=arch/arm/include/
asm/mach;h=0b1b6e286a8d36a58c0a5d4c7b4c6be7fbf66ca4;hb=refs/heads/
archive/android-omap-2.6.32)

2. Replace the 0xdroid files by the 2.6.32 latest one (http://
android.git.kernel.org/?p=kernel/omap.git;a=tree;hb=refs/heads/archive/
android-omap-2.6.32)
arch/arm/mach-omap2/serial.c 
arch/arm/plat-omap/include/plat/serial.h
include/linux/serial_core.h
include/linux/serial_reg.h
include/linux/tty.h

3. Modify 0xdroid ordinary files by reference patch (http://
android.git.kernel.org/?p=kernel/
omap.git;a=commitdiff;h=3e9adf317ef6930917923788033b67f669fa01e5)
arch/arm/plat-omap/include/plat/board.h
drivers/serial/Makefile
drivers/serial/Kconfig 
arch/arm/mach-omap2/board-sholes.c

4.Modify 0xdroid ordinary files which patch does not mention
(1) arch/arm/mach-omap2/board-devkit8000.c
- omap_serial_init();
+omap_serial_init(0,0);

static struct omap_board_config_kernel devkit8000_config[] _initdata =
{
- /* XXX

{ OMAP_TAG_UART, &devkit8000_uart_config },
- */
};
- /* XXX
static struct omap_uart_config devkit8000_uart_config _initdata = {
.enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
};
- */

(2) arch/arm/mach-omap2/board-omap3beagle.c
- omap_serial_init();
+omap_serial_init(0,0);

+static struct omap_board_config_kernel omap3_beagle_config[]
_initdata = {
+ { OMAP_TAG_LCD, &omap3_beagle_lcd_config },
+ //christine/* XXX
+ { OMAP_TAG_UART, &omap3_beagle_uart_config },
+};
+static struct omap_uart_config omap3_beagle_uart_config _initdata =
{
+ .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
+};

5. Modify the omap-serial.c to support the correct speed
Because 48000000/16/3=1M, not 48000000/13/x
And 48000000/16/2=1.5M, not 48000000/13/x

//devkit8000-0x5-kernel/drivers/serial/omap-serial.c
serial_omap_get_divisor(struct uart_port *port, unsigned int baud)
{
unsigned int divisor;

- if (baud > OMAP_MODE13X_SPEED && baud != 3000000)
+ if (baud > OMAP_MODE13X_SPEED && baud != 3000000 && baud !=
1000000 && baud != 1500000)
divisor = 13;
else
divisor = 16;
return port->uartclk/(baud * divisor);
}


static void
serial_omap_set_termios(struct uart_port *port, struct ktermios
*termios,
struct ktermios *old)
{
.
.
- if (baud > 230400 && baud != 3000000)
+ if (baud > 230400 && baud != 3000000 && baud != 1000000 &&
baud != 1500000)
serial_out(up, UART_OMAP_MDR1, OMAP_MDR1_MODE13X);
else
serial_out(up, UART_OMAP_MDR1, OMAP_MDR1_MODE16X);
.
.
.
}

6. Add new driver
$ make ARCH=arm menuconfig
<Y> to include the items
Device Drivers >
Character devices >
Serial drivers >
[*] OMAP serial port support
And choose all the drivers under omap serial port
support

7. make

Besides, make sure your serial application on Android set the speed as
you want.
I use busybox's microcom, and I have to define the speed > 921600bps
by myself.

Christine
Reply all
Reply to author
Forward
0 new messages