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).