Deleted Added
full compact
at91sam9260.c (238376) at91sam9260.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/at91sam9260.c 238376 2012-07-11 20:17:14Z imp $");
28__FBSDID("$FreeBSD: head/sys/arm/at91/at91sam9260.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

--- 9 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 at91sam9_softc {
51 device_t dev;
52 bus_space_tag_t sc_st;
53 bus_space_handle_t sc_sh;
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

--- 9 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 at91sam9_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 bus_space_handle_t sc_matrix_sh;
57};
58
59/*
60 * Standard priority levels for the system. 0 is lowest and 7 is highest.
61 * These values are the ones Atmel uses for its Linux port
62 */
63static const int at91_irq_prio[32] =

--- 115 unchanged lines hidden (view full) ---

179 return (0);
180}
181
182static int
183at91_attach(device_t dev)
184{
185 struct at91_pmc_clock *clk;
186 struct at91sam9_softc *sc = device_get_softc(dev);
54 bus_space_handle_t sc_matrix_sh;
55};
56
57/*
58 * Standard priority levels for the system. 0 is lowest and 7 is highest.
59 * These values are the ones Atmel uses for its Linux port
60 */
61static const int at91_irq_prio[32] =

--- 115 unchanged lines hidden (view full) ---

177 return (0);
178}
179
180static int
181at91_attach(device_t dev)
182{
183 struct at91_pmc_clock *clk;
184 struct at91sam9_softc *sc = device_get_softc(dev);
187 int i;
188
189 struct at91_softc *at91sc = device_get_softc(device_get_parent(dev));
185 struct at91_softc *at91sc = device_get_softc(device_get_parent(dev));
186 uint32_t i;
190
191 sc->sc_st = at91sc->sc_st;
192 sc->sc_sh = at91sc->sc_sh;
193 sc->dev = dev;
194
187
188 sc->sc_st = at91sc->sc_st;
189 sc->sc_sh = at91sc->sc_sh;
190 sc->dev = dev;
191
195 if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9260_SYS_BASE,
196 AT91SAM9260_SYS_SIZE, &sc->sc_sys_sh) != 0)
197 panic("Enable to map system registers");
198
199 if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9260_AIC_BASE,
200 AT91SAM9260_AIC_SIZE, &sc->sc_aic_sh) != 0)
201 panic("Enable to map system registers");
202
203 /* XXX Hack to tell atmelarm about the AIC */
204 at91sc->sc_aic_sh = sc->sc_aic_sh;
205
206 for (i = 0; i < 32; i++) {
207 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR +
208 i * 4, i);
209 /* Priority. */
210 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SMR + i * 4,
211 at91_irq_prio[i]);
212 if (i < 8)
213 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_EOICR,
214 1);
215 }
216
217 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SPU, 32);
218 /* No debug. */
219 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_DCR, 0);
220 /* Disable and clear all interrupts. */
221 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 0xffffffff);
222 bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_ICCR, 0xffffffff);
223
224 if (bus_space_subregion(sc->sc_st, sc->sc_sh,
225 AT91SAM9260_MATRIX_BASE, AT91SAM9260_MATRIX_SIZE,
226 &sc->sc_matrix_sh) != 0)
227 panic("Enable to map matrix registers");
228
229 /* activate NAND */
230 i = bus_space_read_4(sc->sc_st, sc->sc_matrix_sh,
231 AT91SAM9260_EBICSA);

--- 62 unchanged lines hidden (view full) ---

294
295static devclass_t at91sam9260_devclass;
296
297DRIVER_MODULE(at91sam9260, atmelarm, at91sam9260_driver, at91sam9260_devclass,
298 NULL, NULL);
299
300static struct at91_soc_data soc_data = {
301 .soc_delay = at91_pit_delay,
192 if (bus_space_subregion(sc->sc_st, sc->sc_sh,
193 AT91SAM9260_MATRIX_BASE, AT91SAM9260_MATRIX_SIZE,
194 &sc->sc_matrix_sh) != 0)
195 panic("Enable to map matrix registers");
196
197 /* activate NAND */
198 i = bus_space_read_4(sc->sc_st, sc->sc_matrix_sh,
199 AT91SAM9260_EBICSA);

--- 62 unchanged lines hidden (view full) ---

262
263static devclass_t at91sam9260_devclass;
264
265DRIVER_MODULE(at91sam9260, atmelarm, at91sam9260_driver, at91sam9260_devclass,
266 NULL, NULL);
267
268static struct at91_soc_data soc_data = {
269 .soc_delay = at91_pit_delay,
302 .soc_reset = at91_rst_cpu_reset
270 .soc_reset = at91_rst_cpu_reset,
271 .soc_irq_prio = at91_irq_prio,
303};
304
305AT91_SOC(AT91_T_SAM9260, &soc_data);
272};
273
274AT91_SOC(AT91_T_SAM9260, &soc_data);