Porting ARM board to Linux 3.x HOWTO

FSC Look C550

I found FSC Pocket Loox C550 device at home. Windows Mobile isn't much useful for my usecase. I tried generalize this article, to inspire people who willing try something new :) Status: old 2.6.27 patches Project: get Linux 3.x running and merged into mainline! Difficulty: Easy-Medium for system administrator with basic kernel and C knowledge

Lets start!

  • Clone Linux git tree (linux-stable recommended).
  • Learn git. This step can increase your workflow
    • git log v2.6.23..v2.6.24 -p file reveals changes between two versions
    • git bisect way how to find what git commit broken your device
  • Find out, how to initialize and use serial console.
  • If you have old patches for Linux 2.4, read them, understand them and don't try use them. 2.6 ARM architecture changed a lot!
  • If you have patches for 2.6, apply it on Linux version for it's created. Verify, that builded kernel work on device.
    • Try applying patch on next minor version, fix build errors (you may get inspiration from drivers in same directory)
    • Read kernel changelog.
    • search on internet build errors or changes related to new version
  • Try understand hardware, try find chips used on board.
  • Search for hardware datasheets and wiki pages.
  • Check existing Linux drivers (in-tree, outsource, russian forums ;) ).
  • Try find similiar devices supported by linux.
  • If you can't find enough information about board, debug existing system (in our case trough HaRET)
    • Ignore permanently changing values (clocks, generators)
    • Dump GPIO registers setting (GAFR and GPDR are mostly pernament, GPLR is variable).
    • Dump needed values from registers and memory.
    • Experiment with {AC plug, press touchscreen, blink with LED} and watch what GPIOs or memory changes.
  • You may want use disassembler on existing code, to find out what it does.
  • When writing code, use provieded kernel API - if you don't own some extraordinary HW, then it has already prepared infrastructure in kernel.
  • Make code readable and clean, so it can be simple maintained and included in upstream Linux kernel.
  • Learn Device Tree and try use it, if it's possible.

I'll try briefly describe process porting and extending patches (without serial console). base patch - 2.6.27 from akshaal (based on FSC 720 linux support)

  • usb drive not work
  • MMC only when is plugged at start
  • ERRATA: broken SD_POWER, SD detection


  • improved pxa270-ohci, ported patch bits


  • droped specific pxa270-lcd bits, no need anymore


  • getting gpio_keys error -16 for GPIO 0
  • ERRATA for spi: .gpio_cs = -1, All patchsets afected till 3.8.
  • moved mach-pxa.h to mach-pxa270.h (we need get rid of this PWM bits)
  • compiler problems with memory


  • just works


  • broken for pxa270

  • workaround for binutils extra carefull approach - /tmp/ccdKtQIR.s: Error: .size expression for xscsale_dma_a0_map_area does not evaluate to a constant by manual patching kernel
  • backlight has been little bit changed


  • works fine, not completly OK, sometimes not boot up
  • downgraded from crosscompiler gcc 4.8.1 to 4.7.3, FIXED random miscompilation (probably bug #57568)


Broken, even with correct gcc. Bisected to ARM: initial LMB trial. LMB discovered our existing problem. LMB fail, when memory can't be allocated (previous version didn't checked at boot time). Bootloader tells linux, we have 64M. That's correct. But we set memory start 2M higher (set RAMADDR 0xA0200000, to avoid some special memory), so we need decrease memory size to 62M (set RAMSIZE 0x03E00000). Fixed.


  • just works


  • .map_io = pxa_map_io changed to pxa27x_map_io


  • removed generated MACHine info from upstream... we need switch to Device Tree (DT)
  • renamed set_pxa_fb_info(&loox550_fb_info); -> pxa_set_fb_info(NULL, &loox550_fb_info);


  • added mach/pxa27x.h include and removed pxa2xx_regs.
  • reverted ARM: pxa: enable AUTO_ZRELADDR, to get C550 boot again. We need it anyway, so investigate later.


  • boot_params was recently renamed to atag_offset.
  • added irq_handler to MACHINE section



  • .nr_irq added to MACHINE_INFO


  • works


  • headers name changes
  • touchscreen ported to ads7846 driver (work with model 7845, but HW model is 2046)
  • increased number of GPIO from 256 to 192+112. Now last 3 banks of egpio-htc can be mapped.


  • keypad changed
  • RTC PXA27x/PXA3xx oops on 0x0000 0008.(as module work fine)


  • Porting done. Now lets extend functionality.

3.12 git-repository progress

  • PXA27x support in kernel matured.
  • Loox boot with 100% reliability.
  • Audio support - Alsa ASoC (for start, take some similiar driver, using same codec as you hardware do and play with it)
  • PWM - be carefull with that (check, what values register are used in installed system, then recalculate them and set in machine driver)
  • Bluetooth - in first place we need power on bluetooth chip, so Jakub Cejl created rf-kill driver,which will do this (by switching few GPIOs)

If you want try and have any from these devices, you can find me on irc #elinux or #htc-linux, nickname okias

  • Fujitsu Siemens Computers FSC Pocket Loox N520
  • Fujitsu Siemens Computers FSC Pocket Loox N560
  • Fujitsu Siemens Computers FSC Pocket Loox 720
  • Other PXA270, PXA271, PXA272 devices