CNS21XX port completed


About six months ago, Stefan Bethke donated me some money to buy a device from dealextreme so I can port FreeBSD to that device (you can see the pictures here). This device uses ARM Cavium Econa CNS21XX (formerly known as STR8132). Within few days I have completed the driver for serial port, interrupt controller, EHCI/OHCI. Then I stopped working on it, three months later I continued and finished the network driver, then I stopped again.

The last part that wasn’t finished was the SPI controller and the SPI flash driver, so this weekend I spent some time to finish it. So now, I can say that the port is finished, all drivers have been written for the device. With SPI flash support, I can now write the kernel to the device, and boot it from there (I don’t need to boot from network anymore).

Actually, I am not really finished yet, since I still need to reformat the code according to the FreeBSD standard, and there might still be bugs in my code, so I invite everyone that has this device to try it out. There is also a feature in the network driver that is not implemented yet (multicast filtering), because the datasheet is not very clear ( I would be very happy if someone could help me to complete this, wait now I suddenly understand the documentation).

For the bootloader, I am still using the default boot loader. This bootloader will load the kernel from memory 0x600000, and since I can’t change the bootloader configuration in this particular device, I modified the kernel configuration to match this. The latest code can be accessed at http://gitorious.org/freebsd-arm.

To do initial boot, you will need a serial port. You will need to put your kernel on your tftp server. Hit any key during boot, and type:

setenv serverip 172.17.1.1
setenv ipaddr 172.17.1.2
tftpboot 0x600000 kernel.bin
go 0x600000

and to make it permanent:

dd if=kernel.gz.tramp.bin of=/dev/flash/spi0 obs=4k conv=osync seek=96

Please note that the block size is 4k, and 96 means the offset is 0x60000 (96*4096) which will be mapped to 0x600000 by the bootloader. If you are brave, you can just compile the image and dd using the default Linux, but I don’t recommend this, since you may have different hardware (especially SPI flash chip).

Another news: I have completed the driver for ThinLinx Hot-e NAND using NAND2 framework. I also completed the SPI part and support for the flash SPI (read-only).

Unicode: from text and font to display

I’ve always wanted to be able to support all kind of text on my Symbian bible. The problem is this: the Unicode support for Symbian is very limited and even non-existent for some languages. A few weeks ago someone asked me if I can make Symbian bible to support Malayalam bible (using Malayalam script of course). Malayalam writing system was only supported recently by major operating systems (such as Windows XP and OS X Leopard), and Symbian haven’t supported it yet (and even if it supports it, the support will only be activated to phones on certain sales area).

I know that there are several Unicode layout libraries, such as Pango, Qt or ICU. All of them are too big for me to understand and port to Symbian. So my solution was to use the FreeType library and harfbuzz font shaping. After using those two libraries on Symbian, I think now I can understand Unicode. Here is my quick guide to understanding Unicode, from having a data and a font, to displaying the data with that font.

The first thing that you need to understand is: Unicode defines a list of characters for many languages of the world.

Some languages don’t have the concept of lower or upper case. Some languages have their own numbering system. Every language has their own system of ordering things. If possible: always use the function provided by the library you are using.

Continue reading “Unicode: from text and font to display”

Fixing Space key on EEE PC

CIMG4171 I bought the  Eee PC 4G last week, but I haven’t used it optimally. Today when trying to write a new blog post using Eee PC, I felt that the space key is very difficult to press. After searching around, I found out that many people experience the same problem. Surprisingly it is very easy to take of the Eee PC keyboard. Just press on the three dots on top of the keyboard using screw driver, and it will pop out.

Fixing it quite easy, I used a tape to make the space key thicker and easier to press, and I put a tape also in the keyboard to keep the rubber part from moving.

You can see more pictures on my photo gallery.

Latest development (kernel space OK, user space: not yet OK)

Here is the current progress of the kernel porting:

  1. Basic architectural support (IRQ, timer, memory mapping)
  2. Serial port
  3. EHCI driver
  4. OHCI driver
  5. MTD driver

Here are some notes regarding the development:

  1. Serial port is 16550 compliant, but you need to remap the registers.
  2. STR9104 have PCI bus, but it is not connected anywhere. The old kernel have a driver for PCI bus, and it was used in the EHCI driver. I think this is kind of a hack, because the PCI stuff is not needed.
  3. The EHCI and OHCI is part of the SoC, not on the PCI bus. There is a quirk in the initialization of the OHCI part (you can look at it in the patch)
  4. MTD driver is based on CFI chipset (AMD/Fujitsu). I only tested reading and writing configuration partition (mtd2 and mtdblock2)
  5. Network Driver (STR9104 contains MAC hardware, and in Agestar it is connected to IP101A as the PHY hardware)

Continue reading “Latest development (kernel space OK, user space: not yet OK)”