| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: omap2_nand.c,v 1.5 2012/10/27 17:17:40 chs Exp $ */ | | 1 | /* $NetBSD: omap2_nand.c,v 1.6 2016/10/04 15:32:02 kiyohara Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2010 Department of Software Engineering, | | 4 | * Copyright (c) 2010 Department of Software Engineering, |
5 | * University of Szeged, Hungary | | 5 | * University of Szeged, Hungary |
6 | * Copyright (c) 2010 Adam Hoka <ahoka@NetBSD.org> | | 6 | * Copyright (c) 2010 Adam Hoka <ahoka@NetBSD.org> |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * This code is derived from software contributed to The NetBSD Foundation | | 9 | * This code is derived from software contributed to The NetBSD Foundation |
10 | * by the Department of Software Engineering, University of Szeged, Hungary | | 10 | * by the Department of Software Engineering, University of Szeged, Hungary |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
28 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 28 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
31 | * SUCH DAMAGE. | | 31 | * SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | /* Device driver for the NAND controller found in Texas Instruments OMAP2 | | 34 | /* Device driver for the NAND controller found in Texas Instruments OMAP2 |
35 | * and later SOCs. | | 35 | * and later SOCs. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: omap2_nand.c,v 1.5 2012/10/27 17:17:40 chs Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: omap2_nand.c,v 1.6 2016/10/04 15:32:02 kiyohara Exp $"); |
40 | | | 40 | |
41 | #include "opt_omap.h" | | 41 | #include "opt_omap.h" |
42 | #include "opt_flash.h" | | 42 | #include "opt_flash.h" |
43 | | | 43 | |
44 | /* TODO move to opt_* */ | | 44 | /* TODO move to opt_* */ |
45 | #undef OMAP2_NAND_HARDWARE_ECC | | 45 | #undef OMAP2_NAND_HARDWARE_ECC |
46 | | | 46 | |
47 | #include <sys/param.h> | | 47 | #include <sys/param.h> |
48 | #include <sys/systm.h> | | 48 | #include <sys/systm.h> |
49 | #include <sys/cdefs.h> | | 49 | #include <sys/cdefs.h> |
50 | #include <sys/device.h> | | 50 | #include <sys/device.h> |
51 | | | 51 | |
52 | #include <sys/bus.h> | | 52 | #include <sys/bus.h> |
| @@ -199,27 +199,26 @@ omap2_nand_attach(device_t parent, devic | | | @@ -199,27 +199,26 @@ omap2_nand_attach(device_t parent, devic |
199 | { | | 199 | { |
200 | struct omap2_nand_softc *sc = device_private(self); | | 200 | struct omap2_nand_softc *sc = device_private(self); |
201 | sc->sc_gpmcsc = device_private(parent); | | 201 | sc->sc_gpmcsc = device_private(parent); |
202 | struct gpmc_attach_args *gpmc = aux; | | 202 | struct gpmc_attach_args *gpmc = aux; |
203 | bus_size_t cs_offset; | | 203 | bus_size_t cs_offset; |
204 | uint32_t val; | | 204 | uint32_t val; |
205 | | | 205 | |
206 | aprint_normal("\n"); | | 206 | aprint_normal("\n"); |
207 | | | 207 | |
208 | sc->sc_iot = gpmc->gpmc_iot; | | 208 | sc->sc_iot = gpmc->gpmc_iot; |
209 | sc->sc_dev = self; | | 209 | sc->sc_dev = self; |
210 | sc->sc_cs = gpmc->gpmc_cs; | | 210 | sc->sc_cs = gpmc->gpmc_cs; |
211 | | | 211 | |
212 | // cs_offset = GPMC_BASE + GPMC_CONFIG1_0 + sc->sc_cs * GPMC_CS_SIZE; | | | |
213 | cs_offset = GPMC_CS_CONFIG_BASE(sc->sc_cs); | | 212 | cs_offset = GPMC_CS_CONFIG_BASE(sc->sc_cs); |
214 | | | 213 | |
215 | /* map i/o space */ | | 214 | /* map i/o space */ |
216 | if (bus_space_map(sc->sc_iot, cs_offset, GPMC_CS_SIZE, 0, | | 215 | if (bus_space_map(sc->sc_iot, cs_offset, GPMC_CS_SIZE, 0, |
217 | &sc->sc_ioh) != 0) { | | 216 | &sc->sc_ioh) != 0) { |
218 | aprint_error(": omap2_nand_attach: can't map i/o space"); | | 217 | aprint_error(": omap2_nand_attach: can't map i/o space"); |
219 | return; | | 218 | return; |
220 | } | | 219 | } |
221 | | | 220 | |
222 | sc->sc_cmd_reg = GPMC_NAND_COMMAND_0 - GPMC_CONFIG1_0; | | 221 | sc->sc_cmd_reg = GPMC_NAND_COMMAND_0 - GPMC_CONFIG1_0; |
223 | sc->sc_addr_reg = GPMC_NAND_ADDRESS_0 - GPMC_CONFIG1_0; | | 222 | sc->sc_addr_reg = GPMC_NAND_ADDRESS_0 - GPMC_CONFIG1_0; |
224 | sc->sc_data_reg = GPMC_NAND_DATA_0 - GPMC_CONFIG1_0; | | 223 | sc->sc_data_reg = GPMC_NAND_DATA_0 - GPMC_CONFIG1_0; |
225 | | | 224 | |