at91sam9x5.c (238389) | at91sam9x5.c (238390) |
---|---|
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 238389 2012-07-12 02:58:45Z imp $"); | 29__FBSDID("$FreeBSD: head/sys/arm/at91/at91sam9x25.c 238390 2012-07-12 04:23:11Z 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 --- 5 unchanged lines hidden (view full) --- 43#include <arm/at91/at91_aicreg.h> 44#include <arm/at91/at91sam9x25reg.h> 45#include <arm/at91/at91_pitreg.h> 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 { | 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 --- 5 unchanged lines hidden (view full) --- 43#include <arm/at91/at91_aicreg.h> 44#include <arm/at91/at91sam9x25reg.h> 45#include <arm/at91/at91_pitreg.h> 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; | 51 int filler; |
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{ --- 64 unchanged lines hidden (view full) --- 126 DEVICE("macb", EMAC0, 0), 127 DEVICE("macb", EMAC1, 0), 128 DEVICE("nand", NAND, 0), 129 DEVICE("ohci", OHCI, 0), 130 DEVICE("ehci", EHCI, 0), 131 { 0, 0, 0, 0, 0 } 132}; 133 | 52}; 53 54/* 55 * Standard priority levels for the system. 0 is lowest and 7 is highest. 56 * These values are the ones Atmel uses for its Linux port 57 */ 58static const int at91_irq_prio[32] = 59{ --- 64 unchanged lines hidden (view full) --- 124 DEVICE("macb", EMAC0, 0), 125 DEVICE("macb", EMAC1, 0), 126 DEVICE("nand", NAND, 0), 127 DEVICE("ohci", OHCI, 0), 128 DEVICE("ehci", EHCI, 0), 129 { 0, 0, 0, 0, 0 } 130}; 131 |
134static void 135at91_cpu_add_builtin_children(device_t dev) 136{ 137 int i; 138 const struct cpu_devs *walker; 139 140 for (i = 1, walker = at91_devs; walker->name; i++, walker++) { 141 at91_add_child(dev, i, walker->name, walker->unit, 142 walker->mem_base, walker->mem_len, walker->irq0, 143 walker->irq1, walker->irq2); 144 } 145} 146 | |
147static uint32_t 148at91_pll_outa(int freq) 149{ 150 151 switch (freq / 10000000) { 152 case 747 ... 801: return ((1 << 29) | (0 << 14)); 153 case 697 ... 746: return ((1 << 29) | (1 << 14)); 154 case 647 ... 696: return ((1 << 29) | (2 << 14)); --- 12 unchanged lines hidden (view full) --- 167 168 return (0); 169} 170 171static void 172at91_identify(driver_t *drv, device_t parent) 173{ 174 | 132static uint32_t 133at91_pll_outa(int freq) 134{ 135 136 switch (freq / 10000000) { 137 case 747 ... 801: return ((1 << 29) | (0 << 14)); 138 case 697 ... 746: return ((1 << 29) | (1 << 14)); 139 case 647 ... 696: return ((1 << 29) | (2 << 14)); --- 12 unchanged lines hidden (view full) --- 152 153 return (0); 154} 155 156static void 157at91_identify(driver_t *drv, device_t parent) 158{ 159 |
175 if (soc_info.type == AT91_T_SAM9X5 && soc_info.subtype == AT91_ST_SAM9X25) { | 160 if (soc_info.type == AT91_T_SAM9X5 && soc_info.subtype == AT91_ST_SAM9X25) |
176 at91_add_child(parent, 0, "at91sam9x25", 0, 0, 0, -1, 0, 0); | 161 at91_add_child(parent, 0, "at91sam9x25", 0, 0, 0, -1, 0, 0); |
177 at91_cpu_add_builtin_children(parent); 178 } | |
179} 180 181static int 182at91_probe(device_t dev) 183{ 184 185 device_set_desc(dev, "AT91SAM9X25"); 186 return (0); 187} 188 189static int 190at91_attach(device_t dev) 191{ 192 struct at91_pmc_clock *clk; | 162} 163 164static int 165at91_probe(device_t dev) 166{ 167 168 device_set_desc(dev, "AT91SAM9X25"); 169 return (0); 170} 171 172static int 173at91_attach(device_t dev) 174{ 175 struct at91_pmc_clock *clk; |
193 struct at91sam9x25_softc *sc = device_get_softc(dev); 194 struct at91_softc *at91sc = device_get_softc(device_get_parent(dev)); | |
195 | 176 |
196 sc->sc_st = at91sc->sc_st; 197 sc->sc_sh = at91sc->sc_sh; 198 sc->dev = dev; 199 | |
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; --- 42 unchanged lines hidden (view full) --- 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, 256 .soc_reset = at91_rst_cpu_reset, 257 .soc_irq_prio = at91_irq_prio, | 177 /* Update USB device port clock info */ 178 clk = at91_pmc_clock_ref("udpck"); 179 clk->pmc_mask = PMC_SCER_UDP_SAM9; 180 at91_pmc_clock_deref(clk); 181 182 /* Update USB host port clock info */ 183 clk = at91_pmc_clock_ref("uhpck"); 184 clk->pmc_mask = PMC_SCER_UHP_SAM9; --- 42 unchanged lines hidden (view full) --- 227static devclass_t at91sam9x25_devclass; 228 229DRIVER_MODULE(at91sam9x25, atmelarm, at91sam9x25_driver, at91sam9x25_devclass, 0, 0); 230 231static struct at91_soc_data soc_data = { 232 .soc_delay = at91_pit_delay, 233 .soc_reset = at91_rst_cpu_reset, 234 .soc_irq_prio = at91_irq_prio, |
235 .soc_childpren = at91_devs, |
|
258}; 259 260AT91_SOC_SUB(AT91_T_SAM9X5, AT91_ST_SAM9X25, &soc_data); | 236}; 237 238AT91_SOC_SUB(AT91_T_SAM9X5, AT91_ST_SAM9X25, &soc_data); |