Using an Upstream Kernel
N.B. work in progress
These instructions show how to use a mainline kernel (not the standard TS vendor supplied or Debian kernel trees), you should be aware the mainline kernel only currently supports the:
- typical orion5x chipset features - SATA, XOR DMA, hardware crypto, serial, watchdog, and USB
- RTC
- NAND operating in PIO mode (not DMA) - 3.4MiB/s read, 880kiB/s write speed
- hardware random number generator
This means things like the ADC and SD slots are not supported.
git
My working git tree lurks at https://github.com/jimdigriz/ts78xx.
A number of patches I produced that I really need to get back to and fix I have made available too.
Future Work
FPGA
I'm working on overhauling the FPGA support in the kernel and exploring using Device Tree to describe the loaded FPGA bitstream. This means that:
- we avoid hardcoding a lot of information into the kernel about every bitstream out there
- the FPGA ID/revision is less important (many BTD's could map to a single FPGA ID)
- opencore-esque modules can be released that you can import into your own FPGA project and trivially supported by the kernel by amending your BTS
It is straight forward to use the 'gpio-nand' driver and if we can work out how to ask the CPLD to power the SD slots the 'mmcspi' driver (coupled with 'spigpio') can be used to provide SD card support.
Technologic Systems Statement
I asked Technologic Systems for the following:
- FTP access to their FPGA bitstreams: now that you can put your own code onto the FPGA, I thought it would be handy to have the option to at runtime be able to put back the original TS FPGA bitstreams; another nice outcome of this would be that users should be able to upgrade their boards in the field to a newer FPGA revision to fix bugs. I asked TS if they could possibly put them in ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7800-linux/binaries/ts-bitstreams/
- Information to instruct the CPLD to power the SD slots: powering the SD slots is a task performed by the CPLD which is in turn instructed by a the FPGA (holding a TS bitstream) to do so. As we have no idea what the FPGA sends to the CPLD (anyone got a four channel 1Ghz digital oscilliscope?), if you put your own bitstream into the FPGA there is no way to power the SD slot. If this information was known you could at least get PIO bitbanged access the SD cards running in MMC/SPI mode (slow and CPU consuming, but useful)
To both these requests, TS declined to provide the answers. The bitstreams apparently can be reverse engineered (now I am no HDL engineer but I thought...) which is why they will not put them on the FTP site, whilst questions in regards to the SD slot powering were unfortunately overlooked/unnoticed. If you find, as a customer of TS, that having these features would be handy to you, then please email them so they can register the interest, feed that back into management and show there is demand for this.
Links
Cooking a Custom Kernel
You will need an armel toolchain, such as done by following my Installing an Emdebian Cross Compiling Toolchain instructions, before continuing.
Prepare the devicetree kernel:
$ git clone git://github.com/jimdigriz/ts78xx.git
$ cd ts78xx
$ git checkout rtc-m48t86
The branches available are (in acending order of 'latest' code):
- ts78xx: base, generally tracks arm-soc/for-next
- plat-nand: as above but with NAND support added
- timeriomem-rng: as above but with HWRNG support added
- rtc-m48t86: as above but with RTC support added
You will want to use my .config
file.
Select the configuration options you want and compile your kernel:
$ alias amake="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make"
$ amake menuconfig
$ amake
$ INSTALL_MOD_PATH=../linux-modules amake modules_install
N.B. enabling MV_XOR
(the DMA engine) will cause your system to crash on start due to unaligned memory access (a bug I am yet to find the time or interest to track down)
Now install your kernel:
$ tar -C linux-modules -zcf linux-modules.tar.gz .
$ [unpack linux-modules.tar.gz on your TS-7800 into /]
$ wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7800-linux/binaries/ts-images/sd-mbr.dd
# dd if=sd-mbr.dd of=/dev/mmcblk0
# blockdev --rereadpt /dev/mmcblk0
# { cat ts78xx/arch/arm/boot/zImage ts78xx/arch/arm/boot/dts/orion5x-ts7800.dtb; dd if=/dev/zero; } | dd of=/dev/mmcblk0p2
Non-Devicetree Kernel
If for some strange reason you prefer the non-devicetree kernel, then you should use the following to prime the SD card:
# { devio 'wl 0xe3a01c06,4' 'wl 0xe3811074,4'; cat ts78xx/arch/arm/boot/zImage; dd if=/dev/zero; } | dd of=/dev/mmcblk0p2