CM-FX6: Linux: Kernel

From Compulab Mediawiki
Revision as of 11:49, 13 March 2013 by Grinberg (talk | contribs) (TSC2046 (TI) touchscreen controller)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Linux kernel for CM-FX6 modules provides support for on-board peripherals and abstracts the functionality provided by the hardware. Current support coverage is specified at O/S support coverage map page. CompuLab provides ready-to-run binary kernel images, and source code of the modifications and additions made to the Linux kernel to work properly with CM-FX6 modules.

Kernel command line

The Linux kernel for CM-FX6 is shipped with built-in command line parameters:

console=ttymxc3,115200 root=/dev/mmcblk0p1 rootwait

The default kernel command line defines primary console and root device.

Setting U-Boot bootargs environment variable overrides default kernel command line and can be used to set desired kernel parameters.

Building kernel for CM-FX6

Cross-Compiler

There are several options for cross-compilation toolchain setup. You can either compile your cross-compiler or use an already built cross-compiler. The cross-compiler should support the ARM embedded-application binary interface ("EABI")

  • Pre-built toolchain:
  • Tools for creating cross-compilers:
    • Crosstool-ng: Builds a cross-compiler from source. Non-distribution specific.
    • Crossdev: Gentoo's cross-compiler builder. Needs Gentoo.

U-Boot mkimage tool

U-Boot mkimage utility is required in order to create kernel images that can be loaded by the CM-FX6 bootloader. You can download prebuilt mkimage binary or build it yourself:

mkdir ~/tmp
cd tmp
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjvf u-boot-latest.tar.bz2
cd u-boot-20xx.xx
touch include/config.{h,mk}
make tools
sudo install tools/mkimage /usr/local/bin

Getting kernel sources

There are two ways to get Linux kernel sources that can be used as a baseline for CM-FX6 kernel. You can create a copy of Linux git tree or download a snapshot and extract it. We assume that you have created /home/development/cm-fx6/kernel directory for CM-FX6 kernel development.

Snapshot download

  • Download v3.0.35 snapshot with your web browser.
  • Extract the downloaded archive linux-3.0.35.tar.bz2
cd /home/development/cm-fx6/kernel
tar xvf /path/to/downloaded/linux-3.0.35.tar.bz2
mv linux-3.0.35 linux-cm-fx6
This will create /home/development/cm-fx6/kernel/linux-cm-fx6 directory containing Linux kernel tree.
  • Apply the CM-FX6 patch
cd /home/development/cm-fx6/kernel/linux-cm-fx6
patch -p1 < /path/to/cm-fx6-linux/kernel/linux-3.0.35-cm-fx6-1.patch

Git clone

  • Install git version control system.
  • Create a clone of Linux kernel tree
cd /home/development/cm-fx6/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-cm-fx6
  • Create a branch for CM-FX6 development. The CM-FX6 patches are generated vs. v3.0.35 tag (839cf7a236278ae358ff12141a168c0982fa0cd9 commit) in the linux-stable tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-fx6-dev v3.0.35
  • Apply the CM-FX6 patch
cd /home/development/cm-fx6/kernel/linux-cm-fx6
git apply /path/to/cm-fx6-linux/kernel/linux-3.0.35-cm-fx6-1.patch

Building the kernel

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make cm_fx6_defconfig
make menuconfig
make && make uImage && \
     INSTALL_MOD_PATH=/home/development/cm-fx6/rootfs make modules_install

In the example above, the Linux kernel image (uImage) will be created in /home/development/cm-fx6/kernel/linux-cm-fx6/arch/arm/boot, and the loadable kernel modules will be installed into the /home/development/cm-fx6/rootfs/lib/modules directory.

When the CM-FX6 is booted with the kernel image created as described above and with networked root filesystem at /home/development/cm-fx6/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.

Basic platform support

The CM-FX6 basic platform support is implemented in the arch/arm/mach-mx6/board-cm-fx6.c file of Linux kernel source tree. This file includes default setup of multi-functional pins, registration of the devices integrated in the CM-FX6 module and definitions of platform-specific configuration for these devices.

LCD, DVI and HDMI support

CM-FX6 module can be used with at least three display interfaces: LCD, DVI, and HDMI. CM-FX6 Evaluation Kit is equipped with the DataImage SCF0403852GGU04 LCD touch panel and it is used as the default video output device. Both LCD and DVI are sharing the same display interface (DI0) and therefore only one of them can be used at the same time. HDMI uses another display interface and therefore can be used at the same time with either DVI or LCD interfaces.

Image Processing Unit (IPU)

In the kernel configuration menu choose Device Drivers ---> MXC support drivers submenu and enable:

  • Image Processing Unit Driver
┌──────────────────────────────── Graphics support ──────────────────────────────┐
│ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │
│ │    [*] Image Processing Unit Driver                                        │ │
│ │        MXC SSI support  --->                                               │ │
│ │        MXC Digital Audio Multiplexer support  --->                         │ │
│ │        MXC PMIC support  --->                                              │ │
│ └────v(+)────────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────────────────┤
│                         <Select>    < Exit >    < Help >                       │
└────────────────────────────────────────────────────────────────────────────────┘

Parallel LCD interface

In the kernel configuration menu choose Device Drivers ---> Graphics support submenu and enable:

  • MXC Framebuffer support
    • MXC EDID support
    • Synchronous Panel Framebuffer
┌──────────────────────────────── Graphics support ──────────────────────────────┐
│ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │
│ │    <*> Lowlevel video output switch controls                               │ │
│ │    <*> Support for frame buffer devices  --->                              │ │
│ │    [*] Backlight & LCD device support  --->                                │ │
│ │        Display device support  --->                                        │ │
│ │    <*> MXC Framebuffer support                                             │ │
│ │    <*>   MXC EDID support                                                  │ │
│ │    <*>   Synchronous Panel Framebuffer                                     │ │
│ └────v(+)────────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────────────────┤
│                         <Select>    < Exit >    < Help >                       │
└────────────────────────────────────────────────────────────────────────────────┘
DataImage SCF0403852GGU04 LCD output

In the kernel configuration menu choose Device Drivers ---> Graphics support ---> Backlight & LCD device support submenu and enable:

  • DataImage SCF0403852GGU04 LCD Panels support
┌──────────────────────── Backlight & LCD device support ────────────────────────┐
│ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │
│ │    < >     ILI Technology ILI9320 controller support                       │ │
│ │    < >     Toppoly TDO24M  and TDO35S LCD Panels support                   │ │
│ │    <*>     DataImage SCF0403852GGU04 LCD Panels support                    │ │
│ │    < >     VGG2432A4 LCM device support                                    │ │
│ └────v(+)────────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────────────────┤
│                         <Select>    < Exit >    < Help >                       │
└────────────────────────────────────────────────────────────────────────────────┘

Since the DataImage is the default video output device, there is no special kernel command line argument required.

DVI

For the DVI interface to function properly, either LCD or DVI should be attached at the same time.
The following kernel parameter must be appended to the kernel command line:

video=mxcfb0:dev=dvi,1280x800-24M@50,if=RGB24

HDMI

In the kernel configuration menu choose Device Drivers ---> Graphics support submenu and enable:

  • MXC HDMI driver support
┌──────────────────────────────── Graphics support ──────────────────────────────┐
│ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │
│ │    < >   E-Ink Panel Framebuffer                                           │ │
│ │    < >   SIPIX Panel Framebuffer                                           │ │
│ │    < > Support MXC ELCDIF framebuffer                                      │ │
│ │    <*> MXC HDMI driver support                                             │ │
│ │        Console display driver support  --->                                │ │
│ │    [*] Bootup logo  --->                                                   │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────────────────┤
│                         <Select>    < Exit >    < Help >                       │
└────────────────────────────────────────────────────────────────────────────────┘

In the default configuration the second frame buffer is routed to the HDMI interface. Therefore to use the HDMI on the second frame buffer, no special kernel arguments are required. For routing the first frame buffer to the HDMI interface, the following kernel parameter must be appended to the kernel command line:

video=mxcfb0:dev=hdmi,1280x720-24M@50,if=RGB24

Touchscreen controllers support

CM-FX6 Evaluation Kit has two separate touch screen controllers: Himax HX8520-C (assembled on the DataImage LCD) and TI TSC2046 (on-board of the CM-FX6 module). The Himax HX8520-C is a dual touch capacitive touchscreen connected to the I2C1 bus of the CM-FX6 module. The TI TSC2046 is a resistive touchscreen controller conneted to the SPI1 bus of the CM-FX6 module. To use the TI TSC2046 controller, the resistive touchscreen must be connected to one of the interfaces on the SB-FX6 base board.

Himax HX8520-C touchscreen controller

In the kernel configuration menu choose Device Drivers ---> Input device support ---> Touchscreens submenu and enable:

  • HX8520-C touchscreen support
┌───────────────────────────────── Touchscreens ─────────────────────────────────┐
│ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │  
│ │    < >   TSC2007 based touchscreens                                        │ │  
│ │    < >   W90P910 touchscreen driver                                        │ │  
│ │    <M>   HX8520-C touchscreen support                                      │ │  
│ │    < >   Sitronix ST1232 touchscreen controllers                           │ │  
│ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
├────────────────────────────────────────────────────────────────────────────────┤  
│                        <Select>    < Exit >    < Help >                        │  
└────────────────────────────────────────────────────────────────────────────────┘  

TI TSC2046 touchscreen controller

In the kernel configuration menu choose Device Drivers ---> Input device support ---> Touchscreens submenu and enable:

  • ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens
┌───────────────────────────────── Touchscreens ─────────────────────────────────┐
│ ┌────────────────────────────────────────────────────────────────────────────┐ │  
│ │    --- Touchscreens                                                        │ │  
│ │    <M>   ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens           │ │  
│ │    < >   AD7877 based touchscreens                                         │ │  
│ │    < >   Analog Devices AD7879-1/AD7889-1 touchscreen interface            │ │  
│ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
├────────────────────────────────────────────────────────────────────────────────┤  
│                        <Select>    < Exit >    < Help >                        │  
└────────────────────────────────────────────────────────────────────────────────┘  

See also