diff options
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/at91/at91.c | 41 | ||||
-rw-r--r-- | sys/arm/at91/at91rm9200.c | 35 | ||||
-rw-r--r-- | sys/arm/at91/at91sam9260.c | 35 | ||||
-rw-r--r-- | sys/arm/at91/at91sam9g20.c | 35 | ||||
-rw-r--r-- | sys/arm/at91/at91sam9x25.c | 35 | ||||
-rw-r--r-- | sys/arm/at91/at91var.h | 3 |
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); |