Here is the current progress of the kernel porting:
- Basic architectural support (IRQ, timer, memory mapping)
- Serial port
- EHCI driver
- OHCI driver
- MTD driver
Here are some notes regarding the development:
- Serial port is 16550 compliant, but you need to remap the registers.
- 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.
- 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)
- MTD driver is based on CFI chipset (AMD/Fujitsu). I only tested reading and writing configuration partition (mtd2 and mtdblock2)
- 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)”
I finally managed to complete the OHCI part of the driver. Right now some of the most important parts of the kernel is ready: Networking and USB. It means that with the new kernel I will be able to make my Agestar to function as NAS. But of course this is not ready to use yet for most of the people.
Next parts that needs to be done are:
- MTD access –> so we can update the flash with the new kernel easily
- RTC (Real Time Clock) –> Not so important if the device is always connected to the internet (we can synchronize the time with NTP every few hours)
- Button –> Not so important (so we can assign the USB_EXIT button to do something when it is pressed)
I am not sure if I can do more work this weekend, so I am publishing the current patch that I have with the config file.
the patch for kernel 22.214.171.124:
The config file:
STR9100 has two Host Controller Interface, EHCI and OHCI. Enhanced Host Controller Interface (EHCI) is used for high speed USB, while Open Host Controller Interface (OHCI) is used for full and low speed devices. I think I have completed the EHCI part (it can detect my USB disk and the internal hard disk), but I haven’t tested this extensively. The OHCI part may not seem important if we only use high speed devices, but it is. When I tried plugging in low speed device, the port becomes unusable (even when I unplug the device and insert a new USB 2.0 device).
I will try to complete the OHCI part, and I hope I can post the source code this weekend after cleaning up the debugging part. I also plan to support the MTD device access so we can update the firmware easily. Updating from the old kernel to the new one will be easy with the web interface, but it is important that we can update the new one also (currently I am still booting from tftp server).
One of my distractions last weekend was my new Nintendo Wii. After playing my first game, I tried to get the Internet connection working without success. After spending few hours I finally found out why: The Wii Connection test DOES NOT send a user agent, and apparently my ISP uses a transparent proxy that will deny access to anything that doesn’t provide "User-Agent" header. It took me quite a long time to realize this.
It is quite a long story how I realized the problem. Connecting Wii trough direct connection never works, so I use my proxy server. It didn’t work either, so I looked at the log file, and tried to connect to URL listed in the log file (http://conntest.nintendowifi.net/) using my browser trhough my proxy server, and it works. I tried again using the Wii and now it works also. At that time I still don’t understand why. I just thought that Wii needs the proxy server, and since I don’t want to turn on my computer just to access the Internet through my Wii, I tried to install tinyproxy on my openwrt linksys router, and it still doesn’t work.
After sniffing with WireShark, I realized the difference in the header (Wii only sends 1 line of GET request). Squid is a caching server, when the Wii asks for the same document, it is already in the proxy server (because I tested the URL with Firefox), so the request was handled properly by my squid.
Realizing that, I installed squid on my router, with wget periodically pulling the connection test to refresh the cache. Now everything is OK, and I think may be I can just redirect the request to http://conntest.nintendowifi.net/ to my server, but I will wait to check at my squid log to make sure whether this URL is used for connection test only or for something else.
I finally managed to modify the STR9100 network card driver to work on Linux Kenel 2.6. There weren’t many modifications that i made (I will post the details later). So the next important thing will be to port the USB host driver. I think I began to understand the old driver, and I hope I can quickly port this last importang stuff.
There are quite many limitations using old kernel for Agestar, one of them is you can not install the latest Linux distribution. I am eager to make the new Linux kernel to work on the agestar hardware. So since my last post, mainly I am just hacking at the kernel and not at the userspace stuff. As of today, I managed to boot the new kernel, and wrote a serial driver for it (you can see the boot messages at the end of this post). My next target is to port the USB and/or NIC driver.
As you may have read from my earlier posts, there are no documentations available for the STR 9100 hardware, so I based my work on the source code of the earlier kernel (I can’t believe so many things have changed since the 2.4.36). The initial work is quite easy if you are an experienced kernel developer. Because I am not experienced, I need to study quite many things before reaching the current state.
Because I don’t have any documentation about the FA526 CPU, I took the CPU specific code from the Icy Box. They provide the source code for Kernel 2.6. The SoC uses the same Processor, but completely different hardware for the rest (well, something is better than nothing). For the serial port, I realized that the serial port used is "High-speed 16C550-compliant UART serial channel" http://www.starsemi.com/vChn/Prods/str9104.php, so I studied the source code for 8250.c and added a small code to specify the the UART speed, register mapping, and memory location for the UART IO. This creates a much cleaner code than the original serial_str9100.c source code. The serial_str9100.c was 3799 lines of code, mine was about 100 lines of code (70 lines of code in a separate file, and the rest is adding register mapping to 8250.c).
My next plan is to work on the network driver. This should be not so difficult, at least I have higher hope to make this work compared to the USB part. The old network driver have some conditional compilation that indicates it can be compiled in kernel 2.6. I have tried to compile it, and there were many errors and warnings. I will try removing many codes that was not meant for the Agestar configuration (the kernel was from the WAP2000 router, so it contains router specific codes such as to acess hardware NAT).
Continue reading “Porting Linux Kernel 126.96.36.199 To STAR STR9100 (Agestar)”