Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Sitara Linux UART - Switching to 8250 Driver

From Texas Instruments Wiki
Jump to: navigation, search

Validation

This document was created for the kernel, U-boot and filesystem provided by AMSDK 8.0. The AM335x General Purpose evm was used for validation. The steps will be the same for any board using AM335x and AM437x.

Assumptions

Rebuilding the Kernel

The document assumes you understand how to use the kernel menuconfig to update kernel config options, compile the kernel and kernel modules and install them on the filesystem. If any of the steps are not familiar please read the Linux Kernel Users Guide first.

Rebuilding U-Boot

The document assumes you understand how to compile U-Boot and install it on the SD card boot partition. If any of the steps are not familiar please read the U-Boot Users Guide first.

Overview

The 8250 UART driver framework has been used for many years for several processors including x86. Therefore, TI plans on shifting away from omap-serial driver to the generic 8250 framework. 8250 support for OMAP devices was accepted into mainline 3.19 kernel.

Currently there are two UART drivers available to the user and by default the legacy omap-serial driver is used. The current plan is to eventually make the 8250 driver the default for OMAP devices after several kernel releases to insure proper testing.

However, the 8250 driver includes several features that are extremely useful for some users right now. The biggest new feature is support for DMA when using UART which significantly increases throughput and reliability while at the same time significantly decreasing CPU load. If you will be transferring alot of data via UART at a very high baud rate then it is recommend to use the 8250 driver.

This document explains the steps required to use 8250 support on AMSDK 8.0.


U-boot Changes

Although U-Boot does not use kernel drivers, it is responsible for passing various arguments to the kernel. The console argument determines which UART interface to output boot messages to. The U-boot "console" environment variable specifies the console value that is included in the boot args.

For Ubuntu 2014.07 which is included in AMSDK 8.0, the majority of U-Boot environment variables can be found for the specific SOC header file within <u-boot path>/include/configs. For am335x, this would be am335x_evm.h and for am437x this would be am43xx_evm.h.

Open that file and search for "console=". You should see code similar to below:

    "bootfile=zImage\0" \
    "fdtfile=undefined\0" \
    "console=ttyO0,115200n8\0" \
    "partitions=" \
        "uuid_disk=${uuid_gpt_disk};" \
        "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
    "optargs=\0" \
    "mmcdev=0\0" \

You want to change ttyO0 to ttyS0 so the above code would look like the following:

    "bootfile=zImage\0" \
    "fdtfile=undefined\0" \
    "console=ttyS0,115200n8\0" \
    "partitions=" \
        "uuid_disk=${uuid_gpt_disk};" \
        "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
    "optargs=\0" \
    "mmcdev=0\0" \

After making this change recompile U-boot for your SOC/board and install u-boot.img and MLO on to the boot partition of the SD card.


Kernel Changes

Although 8250 omap support was added to the 3.19 mainline kernel for customers convenience the driver has been back ported to the 3.14.26 TI kernel included in AMSDK 8.0. The only kernel changes needed is to enable "Support for OMAP internal UART (8250 based driver)" and disable "OMAP serial port support" within menuconfig.

From menuconfig navigate to:

Device Drivers ->   
    Character devices ->
        Serial drivers ->
            Support for OMAP internal UART

From there enable and disable the following options:

  • Support for OMAP internal UART (8250 based driver) - Enable
  • OMAP serial port support - Disable


8250-menuconfig.gif


After tweaking those two config options, save and exit menuconfig, rebuild the kernel and kernel modules, and install both onto the rootfs.

When using the omap-serial driver the UART interfaces are referenced as ttyOx. 8250 instead uses ttySx. To insure the kernel knows which serial interface to write to for boot messages U-Boot must be updated to change ttyO0 to ttyS0 in the kernel boot args.


Filesystem Changes

The final step is to insure that the user can see and login to the Arago Project "prompt".

Screenshot from 2015-02-17 18-28-35.png


As an example the SDK root file system will be used which is sysvinit based. If your using a systemd based filesystem/distribution then the exact changes will differ.

Once the kernel is done loading itself and its kernel modules it hands control to the file system which first runs various init scripts. One of the final steps of the init scripts is to launch a "terminal" for the user. This allows the user to login and interact with the filesystem/Linux distribution. The program used within the SDK filesystem to accomplish this is called Getty. Getty must be told what interface to use to read and write to for each virtual terminal. Since ttyO0 is used for the UART for interacting with U-Boot, Kernel and filesystem Getty is instructed to launch a virtual terminal for that interface. However, since ttyS0 will be used instead we need to let Getty know to launch a virtual terminal for the new interface.

This can be done editing /etc/inittab target's root filesystem.

NOTE

Verify that your editing /etc/inittab from your target's root filesystem and not from your PC's root filesystem

Open the file and search for ttyO0 and you will something similar to below:

 28 l6:6:wait:/etc/init.d/rc 6
 29 # Normally not reached, but fallthrough in case of emergency.
 30 z6:6:respawn:/sbin/sulogin
 31 O0:12345:respawn:/sbin/getty 115200 ttyO0
 32 # /sbin/getty invocations for the runlevels.
 33 #
 34 # The "id" field MUST be the same as the last
 35 # characters of the device (after "tty").

Replace ttyO0 with ttyS0 and O0 with S0. The file should now look like the below.

 28 l6:6:wait:/etc/init.d/rc 6
 29 # Normally not reached, but fallthrough in case of emergency.
 30 z6:6:respawn:/sbin/sulogin
 32 S0:12345:respawn:/sbin/getty 115200 ttyS0
 33 # /sbin/getty invocations for the runlevels.
 34 #
 35 # The "id" field MUST be the same as the last
 36 # characters of the device (after "tty").

Archived

Sitara Linux SDK 08.00.00.00