Hi, one of the reasons Allwinner A20/sun7i-based boards, like the Cubieboard 2 or Banana Pi, don't boot is that the sxitimer does not work for us. We are getting no hardclock ticks and so the system can't work.
There's a simple fix for that. We can just not use the sxitimer and instead use the ARM architected timer (agtimer) that is supposed to be a generic implementation for all new cores and already attaches anyway. The sxitimer attachment currently overrides the agtimer. Removing sxitimer thus allows agtimer to actually do its work. Currently sxirtc uncondtionally ties into sxitimer. To make this work, just make sxirtc map its own page instead of relying on the existence of a mapping created by sxitimer. The address/size used for the sxirtc is from a device tree source. Patrick diff --git sys/arch/armv7/sunxi/sunxi.c sys/arch/armv7/sunxi/sunxi.c index accd475..80cc08f 100644 --- sys/arch/armv7/sunxi/sunxi.c +++ sys/arch/armv7/sunxi/sunxi.c @@ -67,9 +67,6 @@ struct board_dev sun4i_devs[] = { struct board_dev sun7i_devs[] = { { "sxipio", 0 }, { "sxiccmu", 0 }, - { "sxitimer", 0 }, - { "sxitimer", 1 }, - { "sxitimer", 2 }, { "sxidog", 0 }, { "sxirtc", 0 }, { "sxiuart", 0 }, diff --git sys/arch/armv7/sunxi/sunxireg.h sys/arch/armv7/sunxi/sunxireg.h index e1d4f55..59eb0f2 100644 --- sys/arch/armv7/sunxi/sunxireg.h +++ sys/arch/armv7/sunxi/sunxireg.h @@ -69,8 +69,8 @@ #define WDOG_SIZE 0x08 #define WDOG_IRQ 24 -#define RTC_ADDR 0x0104 -#define RTC_SIZE 0x08 +#define RTC_ADDR 0x01c20d00 +#define RTC_SIZE 0x20 /* Clock Control Module/Unit */ #define CCMU_ADDR 0x01c20000 diff --git sys/arch/armv7/sunxi/sxirtc.c sys/arch/armv7/sunxi/sxirtc.c index b0e0653..3ecbf5e 100644 --- sys/arch/armv7/sunxi/sxirtc.c +++ sys/arch/armv7/sunxi/sxirtc.c @@ -31,8 +31,8 @@ #include <armv7/armv7/armv7var.h> #include <armv7/sunxi/sunxireg.h> -#define SXIRTC_YYMMDD 0x00 -#define SXIRTC_HHMMSS 0x04 +#define SXIRTC_YYMMDD 0x04 +#define SXIRTC_HHMMSS 0x08 #define LEAPYEAR(y) \ (((y) % 4 == 0 && \ @@ -76,8 +76,8 @@ sxirtc_attach(struct device *parent, struct device *self, void *args) panic("sxirtc_attach: couldn't allocate todr_handle"); sc->sc_iot = aa->aa_iot; - if (bus_space_subregion(sc->sc_iot, sxitimer_ioh, - aa->aa_dev->mem[0].addr, aa->aa_dev->mem[0].size, &sc->sc_ioh)) + if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr, + aa->aa_dev->mem[0].size, 0, &sc->sc_ioh)) panic("sxirtc_attach: bus_space_subregion failed!"); handle->cookie = self;