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

From Compulab Mediawiki
Jump to: navigation, search
(SPI support)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Overview ==
+
#REDIRECT [[CM-X300: Linux: Kernel]]
 
 
Linux kernel for CM-X300 modules provides support for on-board peripherals. Current support coverage is specified at [http://www.compulab.co.il/x300cm/html/x300-os-support.htm 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 ==
 
 
 
<pre>
 
mkdir /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
 
tar xjf linux-2.6.31.tar.bz2
 
cd linux-2.6.31
 
cat /path/to/x300-linux/kernel/linux-2.6.31-cm-x300.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
 
</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.
 
 
 
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.
 
 
 
=== 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:
 
 
 
<pre>
 
mkdir /tmp/cm-x300-kernel/
 
cp /home/development/cm-x300/kernel/linux-2.6.31/arch/arm/boot/uImage
 
mkfs.jffs2 --no-cleanmarkers --pad --eraseblock=0x20000 --root=/tmp/cm-x300-kernel --output=/path/to/cm-x300-kernel.jffs2
 
</pre>
 
 
 
== 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 2.6.31 ===
 
* CM-X300 module revision 1.3 support
 
* PXA310 cpu support
 
* USB Host support
 
* Audio and Touchscreen support
 
* LCD and backlight support
 
* WIFI and Bluetooth support
 
* MMC binding fix
 
* DA9030 PMIC and battery charger support
 
 
 
=== 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 ==
 
=== Basic platform support ===
 
The CM-X300 basic platform support is implemented in the {{filename|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.<br>
 
In particular, you can enable the [[Linux_Kernel_for_CM-X300#Generic_i2c-dev_driver|generic i2c-dev driver]] that allows issuing read/write requests to i2c device through {{filename|/dev/i2c-X}} interface or
 
you can use/implement in-kernel device driver.<br>
 
 
 
==== Registering an I2C device ====
 
To register an I2C device, some code needs to be added to the platform initialization file {{filename|arch/arm/mach-pxa/cm-x300.c}}:
 
* Add '''''struct''' i2c_board_info'' and initialize it using the macro (defined in {{filename|linux/i2c.h}}) {{parameter|I2C_BOARD_INFO}}:
 
<pre>
 
static struct i2c_board_info cm_x300_i2c_device = {
 
I2C_BOARD_INFO("device name", <7 bit address>),
 
/* here initialize other fields if used */
 
...
 
};
 
</pre>
 
* Register the device with I2C bus controller:
 
<pre>
 
static void __init cm_x300_init_i2c(void)
 
{
 
...
 
i2c_register_board_info(<i2c bus number>, &cm_x300_i2c_device, 1);
 
}
 
</pre>
 
 
 
==== Generic {{filename|i2c-dev}} driver ====
 
To enable the generic {{filename|i2c-dev}} driver, in Linux Kernel configuration, in ''Device Drivers'' ---> ''I2C support'' select "''I2C device interface''" either as built-in driver or a module:
 
<pre>
 
  ┌─────────────────────────────────────────── 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                                                                    │ │
 
  │ │            <M>  I2C device interface                                                        │ │
 
  │ │            [*]  Autoselect pertinent helper modules                                          │ │
 
  │ │                  I2C Hardware Bus support  --->                                              │ │
 
  │ │                  Miscellaneous I2C Chip support  --->                                        │ │
 
  │ │            [ ]  I2C Core debugging messages                                                  │ │
 
  │ │            [ ]  I2C Algorithm debugging messages                                            │ │
 
  │ │            [ ]  I2C Bus debugging messages                                                  │ │
 
  │ │            [ ]  I2C Chip debugging messages                                                  │ │
 
  │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ │
 
  ├────────────────────────────────────────────────────────────────────────────────────────────────────┤
 
  │                                  <Select>    < Exit >    < Help >                                  │
 
  └────────────────────────────────────────────────────────────────────────────────────────────────────┘
 
</pre>
 
If you choose to compile the driver as a module, the module will be called {{filename|i2c-dev}}.<br>
 
This will create {{filename|/dev/i2c-X}} files for each registered I2C adapter.<br>
 
Information on accessing the I2C devices via the generic {{filename|i2c-dev}} driver could be found in {{filename|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 [[SPI support for CM-X270]] article.
 
 
 
== See also ==
 
 
 
* [[Getting started with Linux on CM-X300]]
 
* [[Linux Development for XScale modules]]
 
* [[Debian Linux for CM-X300]]
 

Latest revision as of 08:45, 23 December 2009