Integrate a new CPU (MACH)

Features required for every CPU:

Time keeping

In barebox we are using the clocksource mechanism from the Linux Kernel. This makes it fairly easy to add timer functionality for a new board or architecture.

Apart from initialization there is only one function to be registerd: clocksource_read(). This function returns the current value of a free running counter. Other functions like udelay() and get_time_ns() are derived from this function. The only thing you have to implement is a clocksource driver and to register it at runtime.

static uint64_t mycpu_clocksource_read(void)
{
        TODO
}

static struct clocksource cs = {
        .read   = mycpu_clocksource_read,
        .mask   = 0xffffffff,
        .shift  = 10,
};

....
        init_clock(&cs);
....

See arch/arm/mach-imx/clocksource.c for an example. clocksource drivers from the Linux Kernel can be used nearly 1:1, except for the register accesses.

Note: For clocksources the __lshrdi3 symbol is needed. You can find the function for your architecture in the Linux Kernel or a libc of your choice.

Note:
barebox expects an upward counting counter!

Reset function

TODO


Generated on Fri Dec 25 14:13:15 2009 for barebox by  doxygen 1.5.6