at91.c (238348) | at91.c (238389) |
---|---|
1/*- 2 * Copyright (c) 2005 Olivier Houchard. All rights reserved. 3 * Copyright (c) 2010 Greg Ansley. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 Olivier Houchard. All rights reserved. 3 * Copyright (c) 2010 Greg Ansley. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/arm/at91/at91.c 238348 2012-07-10 15:02:29Z imp $"); | 28__FBSDID("$FreeBSD: head/sys/arm/at91/at91.c 238389 2012-07-12 02:58:45Z imp $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/module.h> 36 --- 205 unchanged lines hidden (view full) --- 242 BUS_ADD_CHILD(parent, 0, "atmelarm", 0); 243} 244 245static int 246at91_attach(device_t dev) 247{ 248 struct at91_softc *sc = device_get_softc(dev); 249 const struct pmap_devmap *pdevmap; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/module.h> 36 --- 205 unchanged lines hidden (view full) --- 242 BUS_ADD_CHILD(parent, 0, "atmelarm", 0); 243} 244 245static int 246at91_attach(device_t dev) 247{ 248 struct at91_softc *sc = device_get_softc(dev); 249 const struct pmap_devmap *pdevmap; |
250 int i; |
|
250 251 at91_softc = sc; 252 sc->sc_st = &at91_bs_tag; 253 sc->sc_sh = AT91_BASE; | 251 252 at91_softc = sc; 253 sc->sc_st = &at91_bs_tag; 254 sc->sc_sh = AT91_BASE; |
255 sc->sc_aic_sh = AT91_BASE + AT91_SYS_BASE; |
|
254 sc->dev = dev; 255 256 sc->sc_irq_rman.rm_type = RMAN_ARRAY; 257 sc->sc_irq_rman.rm_descr = "AT91 IRQs"; 258 if (rman_init(&sc->sc_irq_rman) != 0 || 259 rman_manage_region(&sc->sc_irq_rman, 1, 31) != 0) 260 panic("at91_attach: failed to set up IRQ rman"); 261 262 sc->sc_mem_rman.rm_type = RMAN_ARRAY; 263 sc->sc_mem_rman.rm_descr = "AT91 Memory"; 264 if (rman_init(&sc->sc_mem_rman) != 0) 265 panic("at91_attach: failed to set up memory rman"); 266 for (pdevmap = at91_devmap; pdevmap->pd_va != 0; pdevmap++) { 267 if (rman_manage_region(&sc->sc_mem_rman, pdevmap->pd_va, 268 pdevmap->pd_va + pdevmap->pd_size - 1) != 0) 269 panic("at91_attach: failed to set up memory rman"); 270 } 271 | 256 sc->dev = dev; 257 258 sc->sc_irq_rman.rm_type = RMAN_ARRAY; 259 sc->sc_irq_rman.rm_descr = "AT91 IRQs"; 260 if (rman_init(&sc->sc_irq_rman) != 0 || 261 rman_manage_region(&sc->sc_irq_rman, 1, 31) != 0) 262 panic("at91_attach: failed to set up IRQ rman"); 263 264 sc->sc_mem_rman.rm_type = RMAN_ARRAY; 265 sc->sc_mem_rman.rm_descr = "AT91 Memory"; 266 if (rman_init(&sc->sc_mem_rman) != 0) 267 panic("at91_attach: failed to set up memory rman"); 268 for (pdevmap = at91_devmap; pdevmap->pd_va != 0; pdevmap++) { 269 if (rman_manage_region(&sc->sc_mem_rman, pdevmap->pd_va, 270 pdevmap->pd_va + pdevmap->pd_size - 1) != 0) 271 panic("at91_attach: failed to set up memory rman"); 272 } 273 |
274 /* 275 * Setup the interrupt table. 276 */ 277 if (soc_info.soc_data == NULL || soc_info.soc_data->soc_irq_prio == NULL) 278 panic("Interrupt priority table missing\n"); 279 for (i = 0; i < 32; i++) { 280 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + 281 i * 4, i); 282 /* Priority. */ 283 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SMR + i * 4, 284 soc_info.soc_data->soc_irq_prio[i]); 285 if (i < 8) 286 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_EOICR, 287 1); 288 } |
|
272 | 289 |
290 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SPU, 32); 291 /* No debug. */ 292 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_DCR, 0); 293 /* Disable and clear all interrupts. */ 294 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 0xffffffff); 295 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_ICCR, 0xffffffff); 296 |
|
273 /* | 297 /* |
274 * Our device list will be added automatically by the cpu device | 298 * Our device list will be added automatically by the cpu device |
275 * e.g. at91rm9200.c when it is identified. To ensure that the 276 * CPU and PMC are attached first any other "identified" devices 277 * call BUS_ADD_CHILD(9) with an "order" of at least 2. | 299 * e.g. at91rm9200.c when it is identified. To ensure that the 300 * CPU and PMC are attached first any other "identified" devices 301 * call BUS_ADD_CHILD(9) with an "order" of at least 2. |
278 */ | 302 */ |
279 280 bus_generic_probe(dev); 281 bus_generic_attach(dev); 282 enable_interrupts(I32_bit | F32_bit); 283 return (0); 284} 285 286static struct resource * --- 252 unchanged lines hidden --- | 303 304 bus_generic_probe(dev); 305 bus_generic_attach(dev); 306 enable_interrupts(I32_bit | F32_bit); 307 return (0); 308} 309 310static struct resource * --- 252 unchanged lines hidden --- |