| @@ -1,17 +1,17 @@ | | | @@ -1,17 +1,17 @@ |
1 | /* $Id: omap2_gpmc.c,v 1.9 2011/07/01 20:30:21 dyoung Exp $ */ | | 1 | /* $Id: omap2_gpmc.c,v 1.10 2016/10/04 15:23:40 kiyohara Exp $ */ |
2 | | | 2 | |
3 | /* adapted from: */ | | 3 | /* adapted from: */ |
4 | /* $NetBSD: omap2_gpmc.c,v 1.9 2011/07/01 20:30:21 dyoung Exp $ */ | | 4 | /* $NetBSD: omap2_gpmc.c,v 1.10 2016/10/04 15:23:40 kiyohara Exp $ */ |
5 | | | 5 | |
6 | | | 6 | |
7 | /* | | 7 | /* |
8 | * Autoconfiguration support for the Texas Instruments OMAP GPMC bus. | | 8 | * Autoconfiguration support for the Texas Instruments OMAP GPMC bus. |
9 | * Based on arm/omap/omap_emifs.c which in turn was derived | | 9 | * Based on arm/omap/omap_emifs.c which in turn was derived |
10 | * Based on arm/xscale/pxa2x0.c which in turn was derived | | 10 | * Based on arm/xscale/pxa2x0.c which in turn was derived |
11 | * from arm/sa11x0/sa11x0.c | | 11 | * from arm/sa11x0/sa11x0.c |
12 | * | | 12 | * |
13 | * Copyright (c) 2002, 2005 Genetec Corporation. All rights reserved. | | 13 | * Copyright (c) 2002, 2005 Genetec Corporation. All rights reserved. |
14 | * Written by Hiroyuki Bessho for Genetec Corporation. | | 14 | * Written by Hiroyuki Bessho for Genetec Corporation. |
15 | * | | 15 | * |
16 | * Redistribution and use in source and binary forms, with or without | | 16 | * Redistribution and use in source and binary forms, with or without |
17 | * modification, are permitted provided that the following conditions | | 17 | * modification, are permitted provided that the following conditions |
| @@ -92,27 +92,27 @@ | | | @@ -92,27 +92,27 @@ |
92 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 92 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
93 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 93 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
94 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 94 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
95 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 95 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
96 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 96 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
97 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 97 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
98 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 98 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
99 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 99 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
100 | * SUCH DAMAGE. | | 100 | * SUCH DAMAGE. |
101 | */ | | 101 | */ |
102 | | | 102 | |
103 | #include "opt_omap.h" | | 103 | #include "opt_omap.h" |
104 | #include <sys/cdefs.h> | | 104 | #include <sys/cdefs.h> |
105 | __KERNEL_RCSID(0, "$NetBSD: omap2_gpmc.c,v 1.9 2011/07/01 20:30:21 dyoung Exp $"); | | 105 | __KERNEL_RCSID(0, "$NetBSD: omap2_gpmc.c,v 1.10 2016/10/04 15:23:40 kiyohara Exp $"); |
106 | | | 106 | |
107 | #include "locators.h" | | 107 | #include "locators.h" |
108 | | | 108 | |
109 | #include <sys/param.h> | | 109 | #include <sys/param.h> |
110 | #include <sys/systm.h> | | 110 | #include <sys/systm.h> |
111 | #include <sys/device.h> | | 111 | #include <sys/device.h> |
112 | #include <sys/kernel.h> | | 112 | #include <sys/kernel.h> |
113 | #include <sys/reboot.h> | | 113 | #include <sys/reboot.h> |
114 | | | 114 | |
115 | #include <machine/cpu.h> | | 115 | #include <machine/cpu.h> |
116 | #include <sys/bus.h> | | 116 | #include <sys/bus.h> |
117 | | | 117 | |
118 | #include <arm/cpufunc.h> | | 118 | #include <arm/cpufunc.h> |
| @@ -268,27 +268,42 @@ gpmc_search(device_t parent, cfdata_t cf | | | @@ -268,27 +268,42 @@ gpmc_search(device_t parent, cfdata_t cf |
268 | break; | | 268 | break; |
269 | default: | | 269 | default: |
270 | panic("Unsupported EMIFS multiplier."); | | 270 | panic("Unsupported EMIFS multiplier."); |
271 | break; | | 271 | break; |
272 | } | | 272 | } |
273 | } | | 273 | } |
274 | | | 274 | |
275 | aa.gpmc_dmac = sc->sc_dmac; | | 275 | aa.gpmc_dmac = sc->sc_dmac; |
276 | aa.gpmc_addr = cf->cf_loc[GPMCCF_ADDR]; | | 276 | aa.gpmc_addr = cf->cf_loc[GPMCCF_ADDR]; |
277 | aa.gpmc_size = cf->cf_loc[GPMCCF_SIZE]; | | 277 | aa.gpmc_size = cf->cf_loc[GPMCCF_SIZE]; |
278 | aa.gpmc_intr = cf->cf_loc[GPMCCF_INTR]; | | 278 | aa.gpmc_intr = cf->cf_loc[GPMCCF_INTR]; |
279 | | | 279 | |
280 | cs = &sc->sc_csconfig[0]; | | 280 | cs = &sc->sc_csconfig[0]; |
281 | for (i=0; i < GPMC_NCS; i++) { | | 281 | for (i = 0; i < GPMC_NCS; i++) { |
| | | 282 | if (cf->cf_loc[GPMCCF_CS] != GPMCCF_CS_DEFAULT) { |
| | | 283 | if (i != cf->cf_loc[GPMCCF_CS]) { |
| | | 284 | cs++; |
| | | 285 | continue; |
| | | 286 | } |
| | | 287 | |
| | | 288 | if (aa.gpmc_addr != GPMCCF_ADDR_DEFAULT |
| | | 289 | && aa.gpmc_addr != cs->cs_addr) |
| | | 290 | panic("cs:addr missmatch:" |
| | | 291 | " cs %d(0x%08lx), addr 0x%08lx\n", |
| | | 292 | cf->cf_loc[GPMCCF_CS], cs->cs_addr, |
| | | 293 | aa.gpmc_addr); |
| | | 294 | aa.gpmc_addr = cs->cs_addr; |
| | | 295 | } |
| | | 296 | |
282 | if ((aa.gpmc_addr >= cs->cs_addr) | | 297 | if ((aa.gpmc_addr >= cs->cs_addr) |
283 | && (aa.gpmc_addr < (cs->cs_addr + cs->cs_size))) { | | 298 | && (aa.gpmc_addr < (cs->cs_addr + cs->cs_size))) { |
284 | /* XXX | | 299 | /* XXX |
285 | * if size was specified, then check it too | | 300 | * if size was specified, then check it too |
286 | * otherwise just assume it is OK | | 301 | * otherwise just assume it is OK |
287 | */ | | 302 | */ |
288 | if ((aa.gpmc_size != GPMCCF_SIZE_DEFAULT) | | 303 | if ((aa.gpmc_size != GPMCCF_SIZE_DEFAULT) |
289 | && ((aa.gpmc_addr + aa.gpmc_size) | | 304 | && ((aa.gpmc_addr + aa.gpmc_size) |
290 | >= (cs->cs_addr + cs->cs_size))) | | 305 | >= (cs->cs_addr + cs->cs_size))) |
291 | continue; /* NG */ | | 306 | continue; /* NG */ |
292 | aa.gpmc_cs = i; | | 307 | aa.gpmc_cs = i; |
293 | if (config_match(parent, cf, &aa)) { | | 308 | if (config_match(parent, cf, &aa)) { |
294 | config_attach(parent, cf, &aa, gpmc_print); | | 309 | config_attach(parent, cf, &aa, gpmc_print); |