Difference between revisions of "CM-X300: Linux: Kernel"

From Compulab Mediawiki
Jump to: navigation, search
(Overview)
(See also)
 
Line 8: Line 8:
 
mkdir /home/development/cm-x300/kernel
 
mkdir /home/development/cm-x300/kernel
 
cd /home/development/cm-x300/kernel
 
cd /home/development/cm-x300/kernel
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.tar.bz2
+
wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.61.tar.bz2
tar xjf linux-2.6.31.tar.bz2
+
tar xjf linux-3.4.61.tar.bz2
cd linux-2.6.31
+
cd linux-3.4.61
cat /path/to/x300-linux/kernel/linux-2.6.31-cm-x300.patch | patch -p1
+
cat /path/to/x300-linux/kernel/linux-3.4.61-cm-x300-3.patch | patch -p1
 
export ARCH=arm
 
export ARCH=arm
 
export CROSS_COMPILE=arm-linux-
 
export CROSS_COMPILE=arm-linux-
Line 20: Line 20:
 
</pre>
 
</pre>
  
In the above example, the Linux kernel image ({{filename|uImage}}) will be created in {{filename|/home/development/cm-x300/kernel/linux-2.6.31/arch/arm/boot}}, and the loadable kernel modules will be installed into the {{filename|/home/development/cm-x300/rootfs/lib/modules}} directory.
+
In the above example, the Linux kernel image ({{filename|uImage}}) will be created in {{filename|/home/development/cm-x300/kernel/linux-3.4.61/arch/arm/boot}}, and the loadable kernel modules will be installed into the {{filename|/home/development/cm-x300/rootfs/lib/modules}} directory.
  
 
Now, if you boot CM-X300 with newly created kernel image and with networked root filesysem at {{filename|/home/development/cm-x300/rootfs/}} the system will be able to properly load kernel modules and you avoid modules versioning problems.
 
Now, if you boot CM-X300 with newly created kernel image and with networked root filesysem at {{filename|/home/development/cm-x300/rootfs/}} the system will be able to properly load kernel modules and you avoid modules versioning problems.
Line 30: Line 30:
 
<pre>
 
<pre>
 
mkdir /tmp/cm-x300-kernel/
 
mkdir /tmp/cm-x300-kernel/
cp /home/development/cm-x300/kernel/linux-2.6.31/arch/arm/boot/uImage
+
cp /home/development/cm-x300/kernel/linux-3.4.61/arch/arm/boot/uImage
 
mkfs.jffs2 --no-cleanmarkers --pad --eraseblock=0x20000 --root=/tmp/cm-x300-kernel --output=/path/to/cm-x300-kernel.jffs2
 
mkfs.jffs2 --no-cleanmarkers --pad --eraseblock=0x20000 --root=/tmp/cm-x300-kernel --output=/path/to/cm-x300-kernel.jffs2
 
</pre>
 
</pre>
Line 37: Line 37:
 
It is possible to use mainline Linux Kernel on CM-X300 "as is". Just keep in mind that features and fixes listed in below sections are still '''not present''' in the mainline kernel.
 
It is possible to use mainline Linux Kernel on CM-X300 "as is". Just keep in mind that features and fixes listed in below sections are still '''not present''' in the mainline kernel.
  
=== CM-X300 specific additions and changes to Linux kernel 2.6.31 ===
+
=== CM-X300 specific additions and changes to Linux kernel 3.4.61 ===
* CM-X300 module revision 1.3 support
+
* Suspend/Resume support
* PXA310 cpu support
+
* Regulators support
* USB Host support
+
* USB OTG charge pump support
* Audio and Touchscreen support
+
* Keypad support
* LCD and backlight support
+
* Battery capacity capability
* WIFI and Bluetooth support
+
* Fixed audio driver
* MMC binding fix
+
* Fixed DM9000 Ethernet controller driver
* DA9030 PMIC and battery charger support
+
* Fixed frame buffer shift issue
 
+
* Fixed Toppoly LCD and LCD control GPIOs warning
=== CM-X300 specific additions and changes to Linux kernel 2.6.26 ===
 
* Basic platform support
 
* NAND flash support
 
* PXA frame buffer and LCD support
 
* WIFI and Bluetooth support
 
* RTC support
 
* DA9030 PMIC support
 
* CPU frequency change support
 
* Audio and Touchscreen support
 
* USB Host support
 
  
 
== Device support details ==
 
== Device support details ==
Line 97: Line 87:
 
   │ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │
 
   │ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │
 
   │ │            --- I2C support                                                                    │ │
 
   │ │            --- I2C support                                                                    │ │
   │ │            <M>  I2C device interface                                                        │ │
+
  │ │            [*]  Enable compatibility bits for old user-space                                │ │
 +
   │ │            <*>  I2C device interface                                                        │ │
 +
  │ │            < >  I2C bus multiplexing support                                                │ │
 
   │ │            [*]  Autoselect pertinent helper modules                                          │ │
 
   │ │            [*]  Autoselect pertinent helper modules                                          │ │
 
   │ │                  I2C Hardware Bus support  --->                                              │ │
 
   │ │                  I2C Hardware Bus support  --->                                              │ │
  │ │                  Miscellaneous I2C Chip support  --->                                        │ │
 
 
   │ │            [ ]  I2C Core debugging messages                                                  │ │
 
   │ │            [ ]  I2C Core debugging messages                                                  │ │
 
   │ │            [ ]  I2C Algorithm debugging messages                                            │ │
 
   │ │            [ ]  I2C Algorithm debugging messages                                            │ │
 
   │ │            [ ]  I2C Bus debugging messages                                                  │ │
 
   │ │            [ ]  I2C Bus debugging messages                                                  │ │
  │ │            [ ]  I2C Chip debugging messages                                                  │ │
 
 
   │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │
 
   │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │
 
   ├────────────────────────────────────────────────────────────────────────────────────────────────────┤
 
   ├────────────────────────────────────────────────────────────────────────────────────────────────────┤
Line 115: Line 105:
  
 
=== SPI support ===
 
=== SPI support ===
PXA3xx SPI controller is backward compatible with PXA2xx and it is handled on CM-X300 the same way as on CM-X270. Please refer to [[SPI support for CM-X270]] article.
+
PXA3xx SPI controller is backward compatible with PXA2xx and it is handled on CM-X300 the same way as on CM-X270. Please refer to [[CM-X270: Linux: SPI support]] article.
  
 
== See also ==
 
== See also ==
  
* [[Getting started with Linux on CM-X300]]
+
* [[CM-X300: Linux: Getting started]]
* [[Linux Development for XScale modules]]
+
* [[CM-X300: Linux: Debian]]
* [[Debian Linux for CM-X300]]
+
* [[Linux: Development for ARM modules]]
  
 
[[Category:Linux|Kernel]]
 
[[Category:Linux|Kernel]]
 
[[Category:CM-X300|Linux: Kernel]]
 
[[Category:CM-X300|Linux: Kernel]]

Latest revision as of 13:43, 29 September 2013

Overview

Linux kernel for CM-X300 modules provides support for on-board peripherals. 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-X300 modules.

Building Linux kernel for CM-X300

mkdir /home/development/cm-x300/kernel
cd /home/development/cm-x300/kernel
wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.61.tar.bz2
tar xjf linux-3.4.61.tar.bz2
cd linux-3.4.61
cat /path/to/x300-linux/kernel/linux-3.4.61-cm-x300-3.patch | patch -p1
export ARCH=arm
export CROSS_COMPILE=arm-linux-
make cm_x300_defconfig
make menuconfig
make && make uImage && \
     INSTALL_MOD_PATH=/home/development/cm-x300/rootfs make modules_install

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

Now, if you boot CM-X300 with newly created kernel image and with networked root filesysem at /home/development/cm-x300/rootfs/ the system will be able to properly load kernel modules and you avoid modules versioning problems.

Creating Linux kernel JFFS2 image

The Linux kernel should be stored in the CM-X300 NAND flash as a JFFS2 image. This image can be created as follows:

mkdir /tmp/cm-x300-kernel/
cp /home/development/cm-x300/kernel/linux-3.4.61/arch/arm/boot/uImage
mkfs.jffs2 --no-cleanmarkers --pad --eraseblock=0x20000 --root=/tmp/cm-x300-kernel --output=/path/to/cm-x300-kernel.jffs2

Using mainline Linux kernel on CM-X300

It is possible to use mainline Linux Kernel on CM-X300 "as is". Just keep in mind that features and fixes listed in below sections are still not present in the mainline kernel.

CM-X300 specific additions and changes to Linux kernel 3.4.61

  • Suspend/Resume support
  • Regulators support
  • USB OTG charge pump support
  • Keypad support
  • Battery capacity capability
  • Fixed audio driver
  • Fixed DM9000 Ethernet controller driver
  • Fixed frame buffer shift issue
  • Fixed Toppoly LCD and LCD control GPIOs warning

Device support details

Basic platform support

The CM-X300 basic platform support is implemented in the linux/arch/arm/mach-pxa/cm-x300.c file. This file includes default setup of multifunction pins, registration of the devices integrated in the CM-X300 module and definitions of platform-specific configuration of these devices. This file also includes several routines needed for proper operation of the WI2WI chip (WiFI and Bluetooth).

I2C support

The I2C bus controller support is enabled in the default Linux Kernel for CM-X300. Standard I2C drivers can be used to access I2C bus on CM-X300 module.
In particular, you can enable the generic i2c-dev driver that allows issuing read/write requests to i2c device through /dev/i2c-X interface or you can use/implement in-kernel device driver.

Registering an I2C device

To register an I2C device, some code needs to be added to the platform initialization file arch/arm/mach-pxa/cm-x300.c:

  • Add struct i2c_board_info and initialize it using the macro (defined in linux/i2c.h) I2C_BOARD_INFO:
static struct i2c_board_info cm_x300_i2c_device = {
	I2C_BOARD_INFO("device name", <7 bit address>),
	/* here initialize other fields if used */
	...
};
  • Register the device with I2C bus controller:
static void __init cm_x300_init_i2c(void)
{
	...
	i2c_register_board_info(<i2c bus number>, &cm_x300_i2c_device, 1);
}

Generic i2c-dev driver

To enable the generic i2c-dev driver, in Linux Kernel configuration, in Device Drivers ---> I2C support select "I2C device interface" either as built-in driver or a module:

  ┌─────────────────────────────────────────── I2C support ────────────────────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted letters are hotkeys.   │
  │  Pressing <Y> includes, <N> excludes, <M> modularizes features.  Press <Esc><Esc> to exit, <?> for │
  │  Help, </> for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable         │
  │                                                                                                    │
  │ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │
  │ │             --- I2C support                                                                    │ │
  │ │             [*]   Enable compatibility bits for old user-space                                 │ │
  │ │             <*>   I2C device interface                                                         │ │
  │ │             < >   I2C bus multiplexing support                                                 │ │
  │ │             [*]   Autoselect pertinent helper modules                                          │ │
  │ │                   I2C Hardware Bus support  --->                                               │ │
  │ │             [ ]   I2C Core debugging messages                                                  │ │
  │ │             [ ]   I2C Algorithm debugging messages                                             │ │
  │ │             [ ]   I2C Bus debugging messages                                                   │ │
  │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │
  ├────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │                                  <Select>    < Exit >    < Help >                                  │
  └────────────────────────────────────────────────────────────────────────────────────────────────────┘

If you choose to compile the driver as a module, the module will be called i2c-dev.
This will create /dev/i2c-X files for each registered I2C adapter.
Information on accessing the I2C devices via the generic i2c-dev driver could be found in Documentation/i2c/dev-interface in the Linux Kernel tree.

SPI support

PXA3xx SPI controller is backward compatible with PXA2xx and it is handled on CM-X300 the same way as on CM-X270. Please refer to CM-X270: Linux: SPI support article.

See also