at91sam9x5.c (238376) | at91sam9x5.c (238389) |
---|---|
1/*- 2 * Copyright (c) 2005 Olivier Houchard. All rights reserved. 3 * Copyright (c) 2010 Greg Ansley. All rights reserved. 4 * Copyright (c) 2012 M. Warner Losh.. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 Olivier Houchard. All rights reserved. 3 * Copyright (c) 2010 Greg Ansley. All rights reserved. 4 * Copyright (c) 2012 M. Warner Losh.. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/arm/at91/at91sam9x25.c 238376 2012-07-11 20:17:14Z imp $"); | 29__FBSDID("$FreeBSD: head/sys/arm/at91/at91sam9x25.c 238389 2012-07-12 02:58:45Z imp $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/bus.h> 34#include <sys/kernel.h> 35#include <sys/malloc.h> 36#include <sys/module.h> 37 --- 8 unchanged lines hidden (view full) --- 46#include <arm/at91/at91_pmcreg.h> 47#include <arm/at91/at91_pmcvar.h> 48#include <arm/at91/at91_rstreg.h> 49 50struct at91sam9x25_softc { 51 device_t dev; 52 bus_space_tag_t sc_st; 53 bus_space_handle_t sc_sh; | 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/bus.h> 34#include <sys/kernel.h> 35#include <sys/malloc.h> 36#include <sys/module.h> 37 --- 8 unchanged lines hidden (view full) --- 46#include <arm/at91/at91_pmcreg.h> 47#include <arm/at91/at91_pmcvar.h> 48#include <arm/at91/at91_rstreg.h> 49 50struct at91sam9x25_softc { 51 device_t dev; 52 bus_space_tag_t sc_st; 53 bus_space_handle_t sc_sh; |
54 bus_space_handle_t sc_sys_sh; 55 bus_space_handle_t sc_aic_sh; | |
56}; 57 58/* 59 * Standard priority levels for the system. 0 is lowest and 7 is highest. 60 * These values are the ones Atmel uses for its Linux port 61 */ 62static const int at91_irq_prio[32] = 63{ --- 124 unchanged lines hidden (view full) --- 188 return (0); 189} 190 191static int 192at91_attach(device_t dev) 193{ 194 struct at91_pmc_clock *clk; 195 struct at91sam9x25_softc *sc = device_get_softc(dev); | 54}; 55 56/* 57 * Standard priority levels for the system. 0 is lowest and 7 is highest. 58 * These values are the ones Atmel uses for its Linux port 59 */ 60static const int at91_irq_prio[32] = 61{ --- 124 unchanged lines hidden (view full) --- 186 return (0); 187} 188 189static int 190at91_attach(device_t dev) 191{ 192 struct at91_pmc_clock *clk; 193 struct at91sam9x25_softc *sc = device_get_softc(dev); |
196 int i; 197 | |
198 struct at91_softc *at91sc = device_get_softc(device_get_parent(dev)); 199 200 sc->sc_st = at91sc->sc_st; 201 sc->sc_sh = at91sc->sc_sh; 202 sc->dev = dev; 203 | 194 struct at91_softc *at91sc = device_get_softc(device_get_parent(dev)); 195 196 sc->sc_st = at91sc->sc_st; 197 sc->sc_sh = at91sc->sc_sh; 198 sc->dev = dev; 199 |
204 /* 205 * XXX These values work for the RM9200, SAM926[01], and SAM9X25 206 * will have to fix this when we want to support anything else. XXX 207 */ 208 if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9X25_SYS_BASE, 209 AT91SAM9X25_SYS_SIZE, &sc->sc_sys_sh) != 0) 210 panic("Enable to map system registers"); 211 212 if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9X25_AIC_BASE, 213 AT91SAM9X25_AIC_SIZE, &sc->sc_aic_sh) != 0) 214 panic("Enable to map system registers"); 215 216 /* XXX Hack to tell atmelarm about the AIC */ 217 at91sc->sc_aic_sh = sc->sc_aic_sh; 218 219 for (i = 0; i < 32; i++) { 220 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + 221 i * 4, i); 222 /* Priority. */ 223 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SMR + i * 4, 224 at91_irq_prio[i]); 225 if (i < 8) 226 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_EOICR, 227 1); 228 } 229 230 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SPU, 32); 231 /* No debug. */ 232 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_DCR, 0); 233 /* Disable and clear all interrupts. */ 234 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 0xffffffff); 235 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_ICCR, 0xffffffff); 236 | |
237 /* Update USB device port clock info */ 238 clk = at91_pmc_clock_ref("udpck"); 239 clk->pmc_mask = PMC_SCER_UDP_SAM9; 240 at91_pmc_clock_deref(clk); 241 242 /* Update USB host port clock info */ 243 clk = at91_pmc_clock_ref("uhpck"); 244 clk->pmc_mask = PMC_SCER_UHP_SAM9; --- 40 unchanged lines hidden (view full) --- 285}; 286 287static devclass_t at91sam9x25_devclass; 288 289DRIVER_MODULE(at91sam9x25, atmelarm, at91sam9x25_driver, at91sam9x25_devclass, 0, 0); 290 291static struct at91_soc_data soc_data = { 292 .soc_delay = at91_pit_delay, | 200 /* Update USB device port clock info */ 201 clk = at91_pmc_clock_ref("udpck"); 202 clk->pmc_mask = PMC_SCER_UDP_SAM9; 203 at91_pmc_clock_deref(clk); 204 205 /* Update USB host port clock info */ 206 clk = at91_pmc_clock_ref("uhpck"); 207 clk->pmc_mask = PMC_SCER_UHP_SAM9; --- 40 unchanged lines hidden (view full) --- 248}; 249 250static devclass_t at91sam9x25_devclass; 251 252DRIVER_MODULE(at91sam9x25, atmelarm, at91sam9x25_driver, at91sam9x25_devclass, 0, 0); 253 254static struct at91_soc_data soc_data = { 255 .soc_delay = at91_pit_delay, |
293 .soc_reset = at91_rst_cpu_reset | 256 .soc_reset = at91_rst_cpu_reset, 257 .soc_irq_prio = at91_irq_prio, |
294}; 295 296AT91_SOC_SUB(AT91_T_SAM9X5, AT91_ST_SAM9X25, &soc_data); | 258}; 259 260AT91_SOC_SUB(AT91_T_SAM9X5, AT91_ST_SAM9X25, &soc_data); |