summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91/at91_st.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2012-07-11 20:17:14 +0000
committerimp <imp@FreeBSD.org>2012-07-11 20:17:14 +0000
commit515d0c1d290c1ac2fb1aa99e74ef4175c158a007 (patch)
treecdb15b34649d1c3b0b980724718c54d34344146f /sys/arm/at91/at91_st.c
parent003ccf85faf91187b67eb412e643bb75b87ae2a6 (diff)
downloadFreeBSD-src-515d0c1d290c1ac2fb1aa99e74ef4175c158a007.zip
FreeBSD-src-515d0c1d290c1ac2fb1aa99e74ef4175c158a007.tar.gz
Make the SoC stuff a little more modular, and start to move away from
having the CPU device that's a child of atmelarm that does stuff. o Create a linker_set for the support fucntions for the SoCs. o Rename soc_data to soc_info. o Move the delay and reset function pointers to new soc_data struct o Create elements for all known SoCs o Add lookup of the SoC we found, and print a warning if it isn't one we know about.
Diffstat (limited to 'sys/arm/at91/at91_st.c')
-rw-r--r--sys/arm/at91/at91_st.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/arm/at91/at91_st.c b/sys/arm/at91/at91_st.c
index 7ac8175..a18be2e 100644
--- a/sys/arm/at91/at91_st.c
+++ b/sys/arm/at91/at91_st.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <machine/intr.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91_streg.h>
+#include <arm/at91/at91rm92reg.h>
static struct at91_st_softc {
struct resource * sc_irq_res;
@@ -57,6 +58,12 @@ static inline uint32_t
RD4(bus_size_t off)
{
+ if (timer_softc == NULL) {
+ uint32_t *p = (uint32_t *)(AT91_BASE + AT91RM92_ST_BASE + off);
+
+ return *p;
+ }
+
return (bus_read_4(timer_softc->sc_mem_res, off));
}
@@ -64,7 +71,13 @@ static inline void
WR4(bus_size_t off, uint32_t val)
{
- bus_write_4(timer_softc->sc_mem_res, off, val);
+ if (timer_softc == NULL) {
+ uint32_t *p = (uint32_t *)(AT91_BASE + AT91RM92_ST_BASE + off);
+
+ *p = val;
+ }
+ else
+ bus_write_4(timer_softc->sc_mem_res, off, val);
}
static void at91_st_watchdog(void *, u_int, int *);
@@ -105,7 +118,7 @@ clock_intr(void *arg)
return (FILTER_STRAY);
}
-static void
+void
at91_st_delay(int n)
{
uint32_t start, end, cur;
@@ -125,7 +138,7 @@ at91_st_delay(int n)
}
}
-static void
+void
at91_st_cpu_reset(void)
{
/*
@@ -209,9 +222,6 @@ at91_st_attach(device_t dev)
if (err)
return err;
- soc_data.delay = at91_st_delay;
- soc_data.reset = at91_st_cpu_reset; // XXX kinda late to be setting this...
-
timer_softc->sc_wet = EVENTHANDLER_REGISTER(watchdog_list,
at91_st_watchdog, dev, 0);
OpenPOWER on IntegriCloud