CM-T3517: Linux: Kernel

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

Overview

Linux kernel for CM-T3517 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-T3517 modules.

Kernel command line

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

root=/dev/mmcblk0p2 rootwait console=ttyO2,115200 nohlt

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.


Admolition note.png Linux kernel command line must have the following parameter appended: nohlt.

This prevents the WFI instruction from halting the processor in idle state.

Building kernel for CM-T3517

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-T3517 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-T3517 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-t3517/kernel directory for CM-T3517 kernel development.

Snapshot download

  • Download v3.7.2 snapshot with your web browser.
  • Extract the downloaded archive linux-3.7.2.tar.bz2
cd /home/development/cm-t3517/kernel
tar xvf /path/to/downloaded/linux-3.7.2.tar.bz2
mv linux-3.7.2 linux-cm-t3517
This will create /home/development/cm-t3517/kernel/linux-cm-t3517 directory containing Linux kernel tree.
  • Apply the CM-T3517 patch
cd /home/development/cm-t3517/kernel/linux-cm-t3517
patch -p1 < /path/to/t3517-linux/kernel/linux-3.7.2-cm-t3517-3.patch

Git clone

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


Admolition note.png Future stable kernel versions of 3.7 can also be used by checking out any later tag of v3.7.y stable kernel tree.

Building the kernel

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

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

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

Basic platform support

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

LCD and Touchscreen support

CM-T3517 Evaluation Kit can be equipped with either of the following LCD touch panels: Toppoly TDO35S or DataImage SCF0403852GGU04. Toppoly TDO35S is registered as default OMAP DSS LCD device along with TSC2046 (TI) touchscreen controller as the default input device. To set DataImage LCD as OMAP DSS LCD device add the cm_t3x_lcd=dataimage boot option to the kernel command line parameters. The above parameter registers DataImage SCF0403852GGU04 as default OMAP DSS LCD device and registers Himax HX8520-C touchscreen controller as the default input device.

Toppoly TDO35S LCD and TSC2046 (TI) touchscreen controller

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

  • Toppoly TDO24M and TDO35S 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 >                        │  
└────────────────────────────────────────────────────────────────────────────────┘  

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 >                        │  
└────────────────────────────────────────────────────────────────────────────────┘  

DataImage SCF0403852GGU04 LCD and Himax HX8520-C touchscreen controller

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 >                        │  
└────────────────────────────────────────────────────────────────────────────────┘  

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 >                        │  
└────────────────────────────────────────────────────────────────────────────────┘  

Controller–area network (CAN) support

Controller Area Network (CAN) is a slow (up to 1Mbit/s) serial communications protocol used in automotive, marine, industrial and medical applications. The CM-T3517 features a TI High End CAN Controller (HECC), integrated into the Sitara AM3517/05 SoC. The TI HECC implements full CAN protocol version 2.0B. It supports both the base (standard) and the extended frame format as well as a programmable data bit rate with maximum of 1Mbit/s.

To enable CAN functionality of the CM-T3517, the following dependencies must be met:

  • CAN bus subsystem support enabled
  • Platform CAN drivers with Netlink support enabled
  • TI HECC device driver compiled into the kernel or as a module
  • Raw CAN protocol support enabled
  • CAN bit-timing calculation enabled

CAN bus subsystem support

In the kernel configuration menu choose "Networking Support" submenu and enable "CAN bus subsystem support". You can choose to either build it into the kernel or to compile it as a module. In the last case the module name will be can.

┌────────────────────────────── Networking support ──────────────────────────────┐
│ ┌────────────────────────────────────────────────────────────────────────────┐ │
│ │    --- Networking support                                                  │ │
│ │          Networking options  --->                                          │ │
│ │    [ ]   Amateur Radio support  --->                                       │ │
│ │    <M>   CAN bus subsystem support  --->                                   │ │
│ │    < >   IrDA (infrared) subsystem support  --->                           │ │
│ │    <M>   Bluetooth subsystem support  --->                                 │ │
│ │    < >   RxRPC session sockets                                             │ │
│ │    -*-   Wireless  --->                                                    │ │
│ │    < >   WiMAX Wireless Broadband support  --->                            │ │
│ │    < >   RF switch subsystem support  --->                                 │ │
│ │    < >   Plan 9 Resource Sharing Support (9P2000) (Experimental)  --->     │ │
│ │                                                                            │ │
│ └────────────────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────────────────┤
│                        <Select>    < Exit >    < Help >                        │
└────────────────────────────────────────────────────────────────────────────────┘

Raw CAN protocol support

In the kernel configuration menu choose Networking Support ---> CAN bus subsystem support submenu and enable "Raw CAN Protocol". If "CAN bus subsystem support" is built into the kernel, you can choose to build Raw CAN protocol into the kernel or as a module. The module name will be can-raw. For more information, please read Loading CAN modules chapter.

┌────────────────────────── CAN bus subsystem support ───────────────────────────┐   
│ ┌────────────────────────────────────────────────────────────────────────────┐ │   
│ │    --- CAN bus subsystem support                                           │ │   
│ │    <M>   Raw CAN Protocol (raw access with CAN-ID filtering)               │ │   
│ │    < >   Broadcast Manager CAN Protocol (with content filtering)           │ │   
│ │          CAN Device Drivers  --->                                          │ │   
│ │                                                                            │ │   
│ └────────────────────────────────────────────────────────────────────────────┘ │   
├────────────────────────────────────────────────────────────────────────────────┤   
│                        <Select>    < Exit >    < Help >                        │   
└────────────────────────────────────────────────────────────────────────────────┘

Platform CAN drivers

In the kernel configuration menu choose Networking Support ---> CAN bus subsystem support ---> CAN Device Drivers submenu and enable:

  • Platform CAN drivers with Netlink support
  • CAN bit-timing calculation
  • TI High End CAN Controller

If "Platform CAN drivers with Netlink support" or "TI High End CAN Controller" are built as modules, then the module names are can-dev and ti_hecc respectively.

┌────────────────────────────── CAN Device Drivers ──────────────────────────────┐   
│ ┌────────────────────────────────────────────────────────────────────────────┐ │   
│ │    < > Virtual Local CAN Interface (vcan)                                  │ │   
│ │    <M> Platform CAN drivers with Netlink support                           │ │   
│ │    [*]   CAN bit-timing calculation                                        │ │   
│ │    <M>   TI High End CAN Controller                                        │ │   
│ │    < >   Microchip MCP251x SPI CAN controllers                             │ │   
│ │    < >   Philips/NXP SJA1000 devices  --->                                 │ │   
│ │          CAN USB interfaces  --->                                          │ │   
│ │    [ ] CAN devices debugging messages                                      │ │   
│ │                                                                            │ │   
│ └────────────────────────────────────────────────────────────────────────────┘ │   
├────────────────────────────────────────────────────────────────────────────────┤   
│                        <Select>    < Exit >    < Help >                        │
└────────────────────────────────────────────────────────────────────────────────┘


Admolition note.png Protocol, platform and device driver modules must be loaded prior to configuring CAN interface.

USB On-The-Go (OTG)

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

  • Support for Host-side USB
    • USB runtime power management (autosuspend) and wakeup
      • OTG support
 ┌───────────────────────────────── USB support ──────────────────────────────────┐
 │ ┌────────────────────────────────────────────────────────────────────────────┐ │  
 │ │    --- USB support                                                         │ │  
 │ │    <*>   Support for Host-side USB                                         │ │  
 │ │    [*]     USB verbose debug messages                                      │ │  
 │ │    [*]     USB announce new devices                                        │ │  
 │ │            *** Miscellaneous USB options ***                               │ │  
 │ │    [ ]     Dynamic USB minor allocation                                    │ │  
 │ │    [*]     USB runtime power management (autosuspend) and wakeup           │ │  
 │ │    [*]       OTG support                                                   │ │  
 │ │    [ ]   Rely on OTG Targeted Peripherals List                             │ │  
 │ │    [ ]   Disable external hubs                                             │ │  
 │ │    < >   DesignWare USB3 DRD Core Support                                  │ │  
 │ │    <*>   USB Monitor                                                       │ │  
 │ │    < >   Support WUSB Cable Based Association (CBA)                        │ │  
 │ │          *** USB Host Controller Drivers ***                               │ │  
 │ │    < >   Cypress C67x00 HCD support                                        │ │  
 │ │    <*>   EHCI HCD (USB 2.0) support                                        │ │  
 │ │    [*]   Root Hub Transaction Translators                                  │ │  
 │ │    [*]   Improved Transaction Translator scheduling                        │ │  
 │ │    [*]   EHCI support for OMAP3 and later chips                            │ │  
 │ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘  
   
  • Inventra Highspeed Dual Role Controller (TI, ADI, ...)
    • AM35x
    • MUSB DMA mode (Disable DMA (always use PIO)) - will be autoselected
 ┌───────────────────────────────── USB support ──────────────────────────────────┐
 │ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │  
 │ │    <M>   Inventra Highspeed Dual Role Controller (TI, ADI, ...)            │ │  
 │ │            Platform Glue Layer                                             │ │  
 │ │    < >       TUSB6010                                                      │ │  
 │ │    < >       OMAP2430 and onwards                                          │ │  
 │ │    <M>       AM35x                                                         │ │  
 │ │            MUSB DMA mode (Disable DMA (always use PIO))  --->              │ │  
 │ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘  
  • USB Gadget Support
  • NOP USB Transceiver Driver - will be autoselected
 ┌───────────────────────────────── USB support ──────────────────────────────────┐
 │ ┌────^(-)────────────────────────────────────────────────────────────────────┐ │  
 │ │    <M>   USB Gadget Support  --->                                          │ │  
 │ │          *** OTG and related infrastructure ***                            │ │  
 │ │    < >   GPIO based peripheral-only VBUS sensing 'transceiver'             │ │  
 │ │    < >   Philips ISP1301 with OMAP OTG                                     │ │  
 │ │    [ ]   Generic ULPI Transceiver Driver                                   │ │  
 │ │    <M>   TWL4030 USB Transceiver Driver                                    │ │  
 │ │    < >   TWL6030 USB Transceiver Driver                                    │ │  
 │ │    {M}   NOP USB Transceiver Driver                                        │ │  
 │ └────────────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘  
   

Enter Device drivers ---> USB support ---> USB Gadget Support and at least one gadget driver:

  • Gadget Zero (DEVELOPMENT)
  • Ethernet Gadget (with CDC Ethernet support)
  • Mass Storage Gadget
    • RNDIS support
    • Ethernet Emulation Model (EEM) support
  • Serial Gadget (with CDC ACM and CDC OBEX support)
 ┌────────────────────────────── USB Gadget Support ──────────────────────────────┐
 │ ┌────────────────────────────────────────────────────────────────────────────┐ │  
 │ │    --- USB Gadget Support                                                  │ │  
 │ │    [*]   Debugging messages (DEVELOPMENT)                                  │ │  
 │ │    [*]   Debugging information files (DEVELOPMENT)                         │ │  
 │ │    [*]   Debugging information files in debugfs (DEVELOPMENT)              │ │  
 │ │    (100) Maximum VBUS Power usage (2-500 mA)                               │ │  
 │ │    (2)   Number of storage pipeline buffers                                │ │  
 │ │          USB Peripheral Controller  --->                                   │ │  
 │ │          USB Gadget Drivers                                                │ │  
 │ │    <M>     Gadget Zero (DEVELOPMENT)                                       │ │  
 │ │    [ ]       HNP Test Device                                               │ │  
 │ │    < >     Audio Gadget (EXPERIMENTAL)                                     │ │  
 │ │    <M>     Ethernet Gadget (with CDC Ethernet support)                     │ │  
 │ │    [*]       RNDIS support                                                 │ │  
 │ │    [*]       Ethernet Emulation Model (EEM) support                        │ │  
 │ │    < >     Network Control Model (NCM) support                             │ │  
 │ │    < >     Gadget Filesystem (EXPERIMENTAL)                                │ │  
 │ │    < >     Function Filesystem (EXPERIMENTAL)                              │ │  
 │ │    < >     File-backed Storage Gadget (DEPRECATED)                         │ │  
 │ │    <M>     Mass Storage Gadget                                             │ │  
 │ │    <M>     Serial Gadget (with CDC ACM and CDC OBEX support)               │ │  
 │ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘

Bluetooth

In the kernel configuration menu choose Networking Support and enable Bluetooth subsystem support

 ┌────────────────────────────── Networking support ──────────────────────────────┐
 │ ┌────────────────────────────────────────────────────────────────────────────┐ │  
 │ │    --- Networking support                                                  │ │  
 │ │          Networking options  --->                                          │ │  
 │ │    [ ]   Amateur Radio support  --->                                       │ │  
 │ │    <M>   CAN bus subsystem support  --->                                   │ │  
 │ │    < >   IrDA (infrared) subsystem support  --->                           │ │  
 │ │    <M>   Bluetooth subsystem support  --->                                 │ │  
 │ │    < >   RxRPC session sockets                                             │ │  
 │ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘  
 

Enter Networking Support ---> Bluetooth subsystem support submenu and enable RFCOMM protocol support (for OBEX FTP support)

 ┌───────────────────────── Bluetooth subsystem support ──────────────────────────┐
 │ ┌────────────────────────────────────────────────────────────────────────────┐ │  
 │ │    --- Bluetooth subsystem support                                         │ │  
 │ │    <M>   RFCOMM protocol support                                           │ │  
 │ │    [*]     RFCOMM TTY support                                              │ │  
 │ │    < >   BNEP protocol support                                             │ │  
 │ │    <M>   HIDP protocol support                                             │ │  
 │ │          Bluetooth device drivers  --->                                    │ │  
 │ │                                                                            │ │  
 │ └────────────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘  
   

Enter Networking Support ---> Bluetooth subsystem support ---> Bluetooth device drivers submenu and enable HCI UART driver.

Select:

  • UART (H4) protocol support
  • HCILL protocol support
 ┌─────────────────────────── Bluetooth device drivers ───────────────────────────┐
 │ ┌────────────────────────────────────────────────────────────────────────────┐ │  
 │ │    < > HCI USB driver                                                      │ │  
 │ │    < > HCI SDIO driver                                                     │ │  
 │ │    <M> HCI UART driver                                                     │ │  
 │ │    [*]   UART (H4) protocol support                                        │ │  
 │ │    [*]   BCSP protocol support                                             │ │  
 │ │    [ ]   Atheros AR300x serial support                                     │ │  
 │ │    [*]   HCILL protocol support                                            │ │  
 │ └────v(+)────────────────────────────────────────────────────────────────────┘ │  
 ├────────────────────────────────────────────────────────────────────────────────┤  
 │                        <Select>    < Exit >    < Help >                        │  
 └────────────────────────────────────────────────────────────────────────────────┘

See also