summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2012-07-10 04:17:49 +0000
committerimp <imp@FreeBSD.org>2012-07-10 04:17:49 +0000
commit06d108a4b9b6dfc32d9347085028a1d1c76ec75f (patch)
tree3a8f626a9f3fd210556c03ce787b6397d58cb2d4 /sys/arm/at91
parentaf0280285fc0fa4162b42705fcdd4a09e9f9b842 (diff)
downloadFreeBSD-src-06d108a4b9b6dfc32d9347085028a1d1c76ec75f.zip
FreeBSD-src-06d108a4b9b6dfc32d9347085028a1d1c76ec75f.tar.gz
Collapse all copies of at91_add_child into at91.c. They were
logically identical before today, and actually identical after today's changes.
Diffstat (limited to 'sys/arm/at91')
-rw-r--r--sys/arm/at91/at91.c41
-rw-r--r--sys/arm/at91/at91rm9200.c35
-rw-r--r--sys/arm/at91/at91sam9260.c35
-rw-r--r--sys/arm/at91/at91sam9g20.c35
-rw-r--r--sys/arm/at91/at91sam9x25.c35
-rw-r--r--sys/arm/at91/at91var.h3
6 files changed, 42 insertions, 142 deletions
diff --git a/sys/arm/at91/at91.c b/sys/arm/at91/at91.c
index 877b746..fc79da2 100644
--- a/sys/arm/at91/at91.c
+++ b/sys/arm/at91/at91.c
@@ -270,10 +270,12 @@ at91_attach(device_t dev)
}
- /* Our device list will be added automatically by the cpu device
+ /*
+ * Our device list will be added automatically by the cpu device
* e.g. at91rm9200.c when it is identified. To ensure that the
* CPU and PMC are attached first any other "identified" devices
- * call BUS_ADD_CHILD(9) with an "order" of at least 2. */
+ * call BUS_ADD_CHILD(9) with an "order" of at least 2.
+ */
bus_generic_probe(dev);
bus_generic_attach(dev);
@@ -471,6 +473,41 @@ at91_eoi(void *unused)
IC_EOICR, 0);
}
+void
+at91_add_child(device_t dev, int prio, const char *name, int unit,
+ bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
+{
+ device_t kid;
+ struct at91_ivar *ivar;
+
+ kid = device_add_child_ordered(dev, prio, name, unit);
+ if (kid == NULL) {
+ printf("Can't add child %s%d ordered\n", name, unit);
+ return;
+ }
+ ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (ivar == NULL) {
+ device_delete_child(dev, kid);
+ printf("Can't add alloc ivar\n");
+ return;
+ }
+ device_set_ivars(kid, ivar);
+ resource_list_init(&ivar->resources);
+ if (irq0 != -1) {
+ bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
+ if (irq0 != AT91_IRQ_SYSTEM)
+ at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
+ }
+ if (irq1 != 0)
+ bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
+ if (irq2 != 0)
+ bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
+ if (addr != 0 && addr < AT91_BASE)
+ addr += AT91_BASE;
+ if (addr != 0)
+ bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
+}
+
static device_method_t at91_methods[] = {
DEVMETHOD(device_probe, at91_probe),
DEVMETHOD(device_attach, at91_attach),
diff --git a/sys/arm/at91/at91rm9200.c b/sys/arm/at91/at91rm9200.c
index d1e2676..1a7a446 100644
--- a/sys/arm/at91/at91rm9200.c
+++ b/sys/arm/at91/at91rm9200.c
@@ -137,41 +137,6 @@ static const struct cpu_devs at91_devs[] =
};
static void
-at91_add_child(device_t dev, int prio, const char *name, int unit,
- bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
-{
- device_t kid;
- struct at91_ivar *ivar;
-
- kid = device_add_child_ordered(dev, prio, name, unit);
- if (kid == NULL) {
- printf("Can't add child %s%d ordered\n", name, unit);
- return;
- }
- ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ivar == NULL) {
- device_delete_child(dev, kid);
- printf("Can't add alloc ivar\n");
- return;
- }
- device_set_ivars(kid, ivar);
- resource_list_init(&ivar->resources);
- if (irq0 != -1) {
- bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
- if (irq0 != AT91_IRQ_SYSTEM)
- at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
- }
- if (irq1 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
- if (irq2 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
- if (addr != 0 && addr < AT91_BASE)
- addr += AT91_BASE;
- if (addr != 0)
- bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
-}
-
-static void
at91_cpu_add_builtin_children(device_t dev)
{
int i;
diff --git a/sys/arm/at91/at91sam9260.c b/sys/arm/at91/at91sam9260.c
index e6183aa..c6dd887 100644
--- a/sys/arm/at91/at91sam9260.c
+++ b/sys/arm/at91/at91sam9260.c
@@ -130,41 +130,6 @@ static const struct cpu_devs at91_devs[] =
};
static void
-at91_add_child(device_t dev, int prio, const char *name, int unit,
- bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
-{
- device_t kid;
- struct at91_ivar *ivar;
-
- kid = device_add_child_ordered(dev, prio, name, unit);
- if (kid == NULL) {
- printf("Can't add child %s%d ordered\n", name, unit);
- return;
- }
- ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ivar == NULL) {
- device_delete_child(dev, kid);
- printf("Can't add alloc ivar\n");
- return;
- }
- device_set_ivars(kid, ivar);
- resource_list_init(&ivar->resources);
- if (irq0 != -1) {
- bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
- if (irq0 != AT91_IRQ_SYSTEM)
- at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
- }
- if (irq1 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
- if (irq2 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
- if (addr != 0 && addr < AT91_BASE)
- addr += AT91_BASE;
- if (addr != 0)
- bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
-}
-
-static void
at91_cpu_add_builtin_children(device_t dev)
{
int i;
diff --git a/sys/arm/at91/at91sam9g20.c b/sys/arm/at91/at91sam9g20.c
index 24064b0..5a9c172 100644
--- a/sys/arm/at91/at91sam9g20.c
+++ b/sys/arm/at91/at91sam9g20.c
@@ -130,41 +130,6 @@ static const struct cpu_devs at91_devs[] =
};
static void
-at91_add_child(device_t dev, int prio, const char *name, int unit,
- bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
-{
- device_t kid;
- struct at91_ivar *ivar;
-
- kid = device_add_child_ordered(dev, prio, name, unit);
- if (kid == NULL) {
- printf("Can't add child %s%d ordered\n", name, unit);
- return;
- }
- ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ivar == NULL) {
- device_delete_child(dev, kid);
- printf("Can't add alloc ivar\n");
- return;
- }
- device_set_ivars(kid, ivar);
- resource_list_init(&ivar->resources);
- if (irq0 != -1) {
- bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
- if (irq0 != AT91_IRQ_SYSTEM)
- at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
- }
- if (irq1 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
- if (irq2 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
- if (addr != 0 && addr < AT91_BASE)
- addr += AT91_BASE;
- if (addr != 0)
- bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
-}
-
-static void
at91_cpu_add_builtin_children(device_t dev)
{
int i;
diff --git a/sys/arm/at91/at91sam9x25.c b/sys/arm/at91/at91sam9x25.c
index 34eda49..8943669 100644
--- a/sys/arm/at91/at91sam9x25.c
+++ b/sys/arm/at91/at91sam9x25.c
@@ -133,41 +133,6 @@ static const struct cpu_devs at91_devs[] =
};
static void
-at91_add_child(device_t dev, int prio, const char *name, int unit,
- bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
-{
- device_t kid;
- struct at91_ivar *ivar;
-
- kid = device_add_child_ordered(dev, prio, name, unit);
- if (kid == NULL) {
- printf("Can't add child %s%d ordered\n", name, unit);
- return;
- }
- ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (ivar == NULL) {
- device_delete_child(dev, kid);
- printf("Can't add alloc ivar\n");
- return;
- }
- device_set_ivars(kid, ivar);
- resource_list_init(&ivar->resources);
- if (irq0 != -1) {
- bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
- if (irq0 != AT91_IRQ_SYSTEM)
- at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
- }
- if (irq1 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
- if (irq2 != 0)
- bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
- if (addr != 0 && addr < AT91_BASE)
- addr += AT91_BASE;
- if (addr != 0)
- bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
-}
-
-static void
at91_cpu_add_builtin_children(device_t dev)
{
int i;
diff --git a/sys/arm/at91/at91var.h b/sys/arm/at91/at91var.h
index 7a3ce95..e58d974 100644
--- a/sys/arm/at91/at91var.h
+++ b/sys/arm/at91/at91var.h
@@ -151,6 +151,9 @@ at91_cpu_is(u_int cpu)
return (soc_data.type == cpu);
}
+void at91_add_child(device_t dev, int prio, const char *name, int unit,
+ bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2);
+
extern uint32_t at91_irq_system;
extern uint32_t at91_master_clock;
void at91_pmc_init_clock(void);
OpenPOWER on IntegriCloud