Tue Oct 4 15:23:40 2016 UTC ()
Support locator "cs".


(kiyohara)
diff -r1.33 -r1.34 src/sys/arch/arm/omap/files.omap2
diff -r1.9 -r1.10 src/sys/arch/arm/omap/omap2_gpmc.c

cvs diff -r1.33 -r1.34 src/sys/arch/arm/omap/Attic/files.omap2 (switch to unified diff)

--- src/sys/arch/arm/omap/Attic/files.omap2 2016/07/04 15:35:55 1.33
+++ src/sys/arch/arm/omap/Attic/files.omap2 2016/10/04 15:23:40 1.34
@@ -1,185 +1,185 @@ @@ -1,185 +1,185 @@
1# $NetBSD: files.omap2,v 1.33 2016/07/04 15:35:55 kiyohara Exp $ 1# $NetBSD: files.omap2,v 1.34 2016/10/04 15:23:40 kiyohara Exp $
2# 2#
3# Configuration info for Texas Instruments OMAP2/OMAP3 CPU support 3# Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
4# Based on xscale/files.pxa2x0 4# Based on xscale/files.pxa2x0
5# 5#
6 6
7include "arch/arm/pic/files.pic" 7include "arch/arm/pic/files.pic"
8include "arch/arm/cortex/files.cortex" 8include "arch/arm/cortex/files.cortex"
9 9
10file arch/arm/arm32/irq_dispatch.S 10file arch/arm/arm32/irq_dispatch.S
11file arch/arm/omap/omap_dma.c 11file arch/arm/omap/omap_dma.c
12 12
13# Memory size in megabytes 13# Memory size in megabytes
14defparam opt_omap.h MEMSIZE 14defparam opt_omap.h MEMSIZE
15defparam opt_omap.h OMAP_EMIFF_PBASE OMAP_EMIFF_SIZE 15defparam opt_omap.h OMAP_EMIFF_PBASE OMAP_EMIFF_SIZE
16defflag opt_omap.h OMAP2 16defflag opt_omap.h OMAP2
17defflag opt_omap.h OMAP3: OMAP2 17defflag opt_omap.h OMAP3: OMAP2
18defflag opt_omap.h OMAP4: OMAP3 18defflag opt_omap.h OMAP4: OMAP3
19defflag opt_omap.h OMAP5: OMAP4 19defflag opt_omap.h OMAP5: OMAP4
20defflag opt_omap.h OMAP_2XXX: OMAP2 20defflag opt_omap.h OMAP_2XXX: OMAP2
21defflag opt_omap.h OMAP_2430: OMAP_2XXX 21defflag opt_omap.h OMAP_2430: OMAP_2XXX
22defflag opt_omap.h OMAP_2420: OMAP_2XXX 22defflag opt_omap.h OMAP_2420: OMAP_2XXX
23defflag opt_omap.h OMAP_3XXX: OMAP3 23defflag opt_omap.h OMAP_3XXX: OMAP3
24defflag opt_omap.h OMAP_3430: OMAP_3XXX 24defflag opt_omap.h OMAP_3430: OMAP_3XXX
25defflag opt_omap.h OMAP_3530: OMAP_3XXX 25defflag opt_omap.h OMAP_3530: OMAP_3XXX
26defflag opt_omap.h OMAP_4XXX: OMAP4 26defflag opt_omap.h OMAP_4XXX: OMAP4
27defflag opt_omap.h OMAP_4430: OMAP_4XXX 27defflag opt_omap.h OMAP_4430: OMAP_4XXX
28defflag opt_omap.h OMAP_4460: OMAP_4XXX 28defflag opt_omap.h OMAP_4460: OMAP_4XXX
29defflag opt_omap.h OMAP_5XXX: OMAP5 29defflag opt_omap.h OMAP_5XXX: OMAP5
30defflag opt_omap.h OMAP_5430: OMAP_5XXX 30defflag opt_omap.h OMAP_5430: OMAP_5XXX
31defflag opt_omap.h TI_AM335X: OMAP3 31defflag opt_omap.h TI_AM335X: OMAP3
32defflag opt_omap.h TI_DM37XX: OMAP3 32defflag opt_omap.h TI_DM37XX: OMAP3
33 33
34# OBIO just an attach point 34# OBIO just an attach point
35device obio { [addr=-1], [size=0], [intr=-1], [mult=1], [intrbase=-1], [nobyteacc=0], [edmabase=-1] 35device obio { [addr=-1], [size=0], [intr=-1], [mult=1], [intrbase=-1], [nobyteacc=0], [edmabase=-1]
36 } : bus_space_generic 36 } : bus_space_generic
37attach obio at mainbus 37attach obio at mainbus
38file arch/arm/omap/omap2_obio.c obio needs-count 38file arch/arm/omap/omap2_obio.c obio needs-count
39 39
40# OBIO files 40# OBIO files
41file arch/arm/omap/omap_space.c obio 41file arch/arm/omap/omap_space.c obio
42file arch/arm/omap/omap_a2x_space.c obio 42file arch/arm/omap/omap_a2x_space.c obio
43file arch/arm/arm/bus_space_a2x.S obio 43file arch/arm/arm/bus_space_a2x.S obio
44file arch/arm/omap/omap_a4x_space.c obio 44file arch/arm/omap/omap_a4x_space.c obio
45file arch/arm/arm/bus_space_a4x.S obio 45file arch/arm/arm/bus_space_a4x.S obio
46 46
47# TI Sitara control module 47# TI Sitara control module
48device sitaracm 48device sitaracm
49attach sitaracm at obio with sitaracm 49attach sitaracm at obio with sitaracm
50file arch/arm/omap/sitara_cm.c sitaracm 50file arch/arm/omap/sitara_cm.c sitaracm
51file arch/arm/omap/am335x_cm_padconf.c ti_am335x 51file arch/arm/omap/am335x_cm_padconf.c ti_am335x
52 52
53# OMAP2 interrupt controller 53# OMAP2 interrupt controller
54device omapicu: pic, pic_splfuncs 54device omapicu: pic, pic_splfuncs
55attach omapicu at obio with omap2icu 55attach omapicu at obio with omap2icu
56file arch/arm/omap/omap2_icu.c (omap2 | omap3) & omapicu 56file arch/arm/omap/omap2_icu.c (omap2 | omap3) & omapicu
57file arch/arm/omap/omap2430_intr.c omap2 & !omapicu & !omap4 57file arch/arm/omap/omap2430_intr.c omap2 & !omapicu & !omap4
58 58
59# OMAP2 GPIO controllers 59# OMAP2 GPIO controllers
60device omapgpio: gpiobus 60device omapgpio: gpiobus
61attach omapgpio at obio with omap2gpio 61attach omapgpio at obio with omap2gpio
62file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & !ti_am335x & omapgpio 62file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & !ti_am335x & omapgpio
63file arch/arm/omap/am335x_gpio.c ti_am335x & omapgpio 63file arch/arm/omap/am335x_gpio.c ti_am335x & omapgpio
64 64
65# TI_AM335X (and maybe TI OMAP4) I2C controllers 65# TI_AM335X (and maybe TI OMAP4) I2C controllers
66device tiiic: i2cbus, i2cexec 66device tiiic: i2cbus, i2cexec
67attach tiiic at obio with ti_iic 67attach tiiic at obio with ti_iic
68file arch/arm/omap/ti_iic.c ti_iic 68file arch/arm/omap/ti_iic.c ti_iic
69 69
70# OMAP3 I2C controllers 70# OMAP3 I2C controllers
71device omapiic: i2cbus, i2cexec 71device omapiic: i2cbus, i2cexec
72attach omapiic at obio with omap3_i2c 72attach omapiic at obio with omap3_i2c
73file arch/arm/omap/omap3_i2c.c omap3_i2c 73file arch/arm/omap/omap3_i2c.c omap3_i2c
74 74
75# OMAP3 system control module 75# OMAP3 system control module
76device omapscm: sysmon_envsys 76device omapscm: sysmon_envsys
77attach omapscm at obio with omap3_scm 77attach omapscm at obio with omap3_scm
78file arch/arm/omap/omap3_scm.c omap3_scm 78file arch/arm/omap/omap3_scm.c omap3_scm
79 79
80# OMAP dual-mode timer 80# OMAP dual-mode timer
81device omapdmtimer 81device omapdmtimer
82file arch/arm/omap/omap_dmtimer.c omapdmtimer 82file arch/arm/omap/omap_dmtimer.c omapdmtimer
83defparam opt_omap.h OMAP_SYSTEM_CLOCK_FREQ 83defparam opt_omap.h OMAP_SYSTEM_CLOCK_FREQ
84 84
85attach omapdmtimer at obio with omap_dmtimer_obio 85attach omapdmtimer at obio with omap_dmtimer_obio
86file arch/arm/omap/am335x_dmtimer.c ti_am335x & omapdmtimer 86file arch/arm/omap/am335x_dmtimer.c ti_am335x & omapdmtimer
87 87
88# OMAP 2430 General Purpose Timer 88# OMAP 2430 General Purpose Timer
89device omapmputmr 89device omapmputmr
90file arch/arm/omap/omap2_mputmr.c omapmputmr 90file arch/arm/omap/omap2_mputmr.c omapmputmr
91defparam opt_omap.h OMAP_GP_TIMER_CLOCK_FREQ 91defparam opt_omap.h OMAP_GP_TIMER_CLOCK_FREQ
92 92
93# OBIO/2430 GP Timer 93# OBIO/2430 GP Timer
94attach omapmputmr at obio with obiomputmr 94attach omapmputmr at obio with obiomputmr
95file arch/arm/omap/obio_mputmr.c obiomputmr 95file arch/arm/omap/obio_mputmr.c obiomputmr
96 96
97# Dual Mode (General Purpose) Timer 97# Dual Mode (General Purpose) Timer
98device omapgptmr 98device omapgptmr
99attach omapgptmr at obio 99attach omapgptmr at obio
100file arch/arm/omap/omap2_gptmr.c omapgptmr 100file arch/arm/omap/omap2_gptmr.c omapgptmr
101#file arch/arm/omap/omap_pwm.c omapgptmr 101#file arch/arm/omap/omap_pwm.c omapgptmr
102 102
103# Watchdog timers 103# Watchdog timers
104 104
105device omapwdt32k: sysmon_wdog 105device omapwdt32k: sysmon_wdog
106file arch/arm/omap/omap_wdt.c omapwdt32k needs-flag 106file arch/arm/omap/omap_wdt.c omapwdt32k needs-flag
107 107
108attach omapwdt32k at obio with obiowdt32k 108attach omapwdt32k at obio with obiowdt32k
109file arch/arm/omap/obio_wdt.c obiowdt32k 109file arch/arm/omap/obio_wdt.c obiowdt32k
110 110
111# L3 Interconnect 111# L3 Interconnect
112device L3i { [addr=-1], [size=0], [intr=-1], [mult=1], [nobyteacc=0] 112device L3i { [addr=-1], [size=0], [intr=-1], [mult=1], [nobyteacc=0]
113 } : bus_space_generic 113 } : bus_space_generic
114attach L3i at mainbus 114attach L3i at mainbus
115file arch/arm/omap/omap2_l3i.c omap2 | omap3 115file arch/arm/omap/omap2_l3i.c omap2 | omap3
116 116
117# General Purpose Memory Controller 117# General Purpose Memory Controller
118# XXX some addl. chip select config parms may be desired here (e.g. timing) 118# XXX some addl. chip select config parms may be desired here (e.g. timing)
119# XXX so far we just use the setup established by boot firmware 119# XXX so far we just use the setup established by boot firmware
120device gpmc { [addr=-1], [size=0], [intr=-1], [mult=1], [nobyteacc=0] 120device gpmc { [cs=-1], [addr=-1], [size=0], [intr=-1], [mult=1], [nobyteacc=0]
121 } : bus_space_generic 121 } : bus_space_generic
122attach gpmc at mainbus 122attach gpmc at mainbus
123file arch/arm/omap/omap2_gpmc.c gpmc 123file arch/arm/omap/omap2_gpmc.c gpmc
124 124
125device edma 125device edma
126attach edma at mainbus 126attach edma at mainbus
127file arch/arm/omap/omap_edma.c edma needs-flag 127file arch/arm/omap/omap_edma.c edma needs-flag
128 128
129# TI OTG controller 129# TI OTG controller
130define tiotg_port {[port = -1], [mode = -1]} 130define tiotg_port {[port = -1], [mode = -1]}
131device tiotg: tiotg_port 131device tiotg: tiotg_port
132attach tiotg at mainbus 132attach tiotg at mainbus
133file arch/arm/omap/tiotg.c tiotg 133file arch/arm/omap/tiotg.c tiotg
134attach motg at tiotg_port 134attach motg at tiotg_port
135 135
136# SDMMC controller 136# SDMMC controller
137attach sdhc at obio with obiosdhc 137attach sdhc at obio with obiosdhc
138file arch/arm/omap/omap3_sdhc.c obiosdhc 138file arch/arm/omap/omap3_sdhc.c obiosdhc
139 139
140# NAND flash controller 140# NAND flash controller
141device omapnand: nandbus 141device omapnand: nandbus
142attach omapnand at gpmc 142attach omapnand at gpmc
143file arch/arm/omap/omap2_nand.c omapnand 143file arch/arm/omap/omap2_nand.c omapnand
144 144
145# PRCM interface 145# PRCM interface
146device prcm 146device prcm
147attach prcm at obio 147attach prcm at obio
148file arch/arm/omap/omap2_prcm.c prcm needs-flag 148file arch/arm/omap/omap2_prcm.c prcm needs-flag
149file arch/arm/omap/am335x_prcm.c ti_am335x 149file arch/arm/omap/am335x_prcm.c ti_am335x
150 150
151# OHCI USB controller 151# OHCI USB controller
152attach ohci at obio with obioohci 152attach ohci at obio with obioohci
153file arch/arm/omap/obio_ohci.c obioohci 153file arch/arm/omap/obio_ohci.c obioohci
154 154
155attach ehci at obio with omap3_ehci 155attach ehci at obio with omap3_ehci
156file arch/arm/omap/omap3_ehci.c omap3_ehci 156file arch/arm/omap/omap3_ehci.c omap3_ehci
157 157
158attach ahcisata at obio with omap5_ahcisata 158attach ahcisata at obio with omap5_ahcisata
159file arch/arm/omap/omap5_ahcisata.c omap5_ahcisata 159file arch/arm/omap/omap5_ahcisata.c omap5_ahcisata
160 160
161device omapfb: rasops16, rasops8, wsemuldisplaydev, vcons, edid 161device omapfb: rasops16, rasops8, wsemuldisplaydev, vcons, edid
162attach omapfb at obio 162attach omapfb at obio
163file arch/arm/omap/omapfb.c omapfb 163file arch/arm/omap/omapfb.c omapfb
164 164
165# TI AM335x framebuffer 165# TI AM335x framebuffer
166device tifb: rasops32, rasops24, rasops16, rasops8, wsemuldisplaydev, vcons, edid 166device tifb: rasops32, rasops24, rasops16, rasops8, wsemuldisplaydev, vcons, edid
167attach tifb at obio 167attach tifb at obio
168file arch/arm/omap/tifb.c tifb 168file arch/arm/omap/tifb.c tifb
169 169
170device cpsw: ether, ifnet, arp, mii, mii_phy 170device cpsw: ether, ifnet, arp, mii, mii_phy
171attach cpsw at obio 171attach cpsw at obio
172file arch/arm/omap/if_cpsw.c cpsw 172file arch/arm/omap/if_cpsw.c cpsw
173 173
174device omapdma 174device omapdma
175attach omapdma at obio 175attach omapdma at obio
176file arch/arm/omap/omap3_sdma.c omapdma needs-flag 176file arch/arm/omap/omap3_sdma.c omapdma needs-flag
177 177
178device trng 178device trng
179attach trng at obio 179attach trng at obio
180file arch/arm/omap/am335x_trng.c trng 180file arch/arm/omap/am335x_trng.c trng
181 181
182# these bus space methods are not bus-specific ... 182# these bus space methods are not bus-specific ...
183# 183#
184file arch/arm/omap/omap_nobyteacc_space.c emifs | gpmc 184file arch/arm/omap/omap_nobyteacc_space.c emifs | gpmc
185file arch/arm/omap/omap_nobyteacc_io.S emifs | gpmc 185file arch/arm/omap/omap_nobyteacc_io.S emifs | gpmc

cvs diff -r1.9 -r1.10 src/sys/arch/arm/omap/Attic/omap2_gpmc.c (switch to unified diff)

--- src/sys/arch/arm/omap/Attic/omap2_gpmc.c 2011/07/01 20:30:21 1.9
+++ src/sys/arch/arm/omap/Attic/omap2_gpmc.c 2016/10/04 15:23:40 1.10
@@ -1,330 +1,345 @@ @@ -1,330 +1,345 @@
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
18 * are met: 18 * are met:
19 * 1. Redistributions of source code must retain the above copyright 19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer. 20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright 21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the 22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution. 23 * documentation and/or other materials provided with the distribution.
24 * 3. All advertising materials mentioning features or use of this software 24 * 3. All advertising materials mentioning features or use of this software
25 * must display the following acknowledgement: 25 * must display the following acknowledgement:
26 * This product includes software developed for the NetBSD Project by 26 * This product includes software developed for the NetBSD Project by
27 * Genetec Corporation. 27 * Genetec Corporation.
28 * 4. The name of Genetec Corporation may not be used to endorse or 28 * 4. The name of Genetec Corporation may not be used to endorse or
29 * promote products derived from this software without specific prior 29 * promote products derived from this software without specific prior
30 * written permission. 30 * written permission.
31 * 31 *
32 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND 32 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
33 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 33 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
34 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 34 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION 35 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
36 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 36 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 40 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGE. 42 * POSSIBILITY OF SUCH DAMAGE.
43 * 43 *
44 * Copyright (c) 1997,1998, 2001, The NetBSD Foundation, Inc. 44 * Copyright (c) 1997,1998, 2001, The NetBSD Foundation, Inc.
45 * All rights reserved. 45 * All rights reserved.
46 * 46 *
47 * This code is derived from software contributed to The NetBSD Foundation 47 * This code is derived from software contributed to The NetBSD Foundation
48 * by IWAMOTO Toshihiro, Ichiro FUKUHARA and Paul Kranenburg. 48 * by IWAMOTO Toshihiro, Ichiro FUKUHARA and Paul Kranenburg.
49 * 49 *
50 * Redistribution and use in source and binary forms, with or without 50 * Redistribution and use in source and binary forms, with or without
51 * modification, are permitted provided that the following conditions 51 * modification, are permitted provided that the following conditions
52 * are met: 52 * are met:
53 * 1. Redistributions of source code must retain the above copyright 53 * 1. Redistributions of source code must retain the above copyright
54 * notice, this list of conditions and the following disclaimer. 54 * notice, this list of conditions and the following disclaimer.
55 * 2. Redistributions in binary form must reproduce the above copyright 55 * 2. Redistributions in binary form must reproduce the above copyright
56 * notice, this list of conditions and the following disclaimer in the 56 * notice, this list of conditions and the following disclaimer in the
57 * documentation and/or other materials provided with the distribution. 57 * documentation and/or other materials provided with the distribution.
58 * 58 *
59 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 59 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
60 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 60 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
61 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 61 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
62 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 62 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
63 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 63 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
64 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 64 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
65 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 65 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
66 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 66 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
67 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 67 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
68 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 68 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
69 * POSSIBILITY OF SUCH DAMAGE. 69 * POSSIBILITY OF SUCH DAMAGE.
70 * 70 *
71 * Copyright (c) 1999 71 * Copyright (c) 1999
72 * Shin Takemura and PocketBSD Project. All rights reserved. 72 * Shin Takemura and PocketBSD Project. All rights reserved.
73 * 73 *
74 * Redistribution and use in source and binary forms, with or without 74 * Redistribution and use in source and binary forms, with or without
75 * modification, are permitted provided that the following conditions 75 * modification, are permitted provided that the following conditions
76 * are met: 76 * are met:
77 * 1. Redistributions of source code must retain the above copyright 77 * 1. Redistributions of source code must retain the above copyright
78 * notice, this list of conditions and the following disclaimer. 78 * notice, this list of conditions and the following disclaimer.
79 * 2. Redistributions in binary form must reproduce the above copyright 79 * 2. Redistributions in binary form must reproduce the above copyright
80 * notice, this list of conditions and the following disclaimer in the 80 * notice, this list of conditions and the following disclaimer in the
81 * documentation and/or other materials provided with the distribution. 81 * documentation and/or other materials provided with the distribution.
82 * 3. All advertising materials mentioning features or use of this software 82 * 3. All advertising materials mentioning features or use of this software
83 * must display the following acknowledgement: 83 * must display the following acknowledgement:
84 * This product includes software developed by the PocketBSD project 84 * This product includes software developed by the PocketBSD project
85 * and its contributors. 85 * and its contributors.
86 * 4. Neither the name of the project nor the names of its contributors 86 * 4. Neither the name of the project nor the names of its contributors
87 * may be used to endorse or promote products derived from this software 87 * may be used to endorse or promote products derived from this software
88 * without specific prior written permission. 88 * without specific prior written permission.
89 * 89 *
90 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 90 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
91 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 91 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
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>
119#include <arm/mainbus/mainbus.h> 119#include <arm/mainbus/mainbus.h>
120#include <arm/omap/omap_var.h> 120#include <arm/omap/omap_var.h>
121 121
122#include <arm/omap/omap2_gpmcreg.h> 122#include <arm/omap/omap2_gpmcreg.h>
123#include <arm/omap/omap2_gpmcvar.h> 123#include <arm/omap/omap2_gpmcvar.h>
124 124
125typedef struct { 125typedef struct {
126 boolean_t cs_valid; 126 boolean_t cs_valid;
127 ulong cs_addr; 127 ulong cs_addr;
128 ulong cs_size; 128 ulong cs_size;
129} gpmc_csconfig_t; 129} gpmc_csconfig_t;
130 130
131struct gpmc_softc { 131struct gpmc_softc {
132 device_t sc_dev; 132 device_t sc_dev;
133 bus_dma_tag_t sc_dmac; 133 bus_dma_tag_t sc_dmac;
134 bus_space_tag_t sc_iot; 134 bus_space_tag_t sc_iot;
135 bus_space_handle_t sc_ioh; 135 bus_space_handle_t sc_ioh;
136 gpmc_csconfig_t sc_csconfig[GPMC_NCS]; 136 gpmc_csconfig_t sc_csconfig[GPMC_NCS];
137}; 137};
138 138
139 139
140static bus_size_t csreg7[GPMC_NCS] = { 140static bus_size_t csreg7[GPMC_NCS] = {
141 GPMC_CONFIG7_0, 141 GPMC_CONFIG7_0,
142 GPMC_CONFIG7_1, 142 GPMC_CONFIG7_1,
143 GPMC_CONFIG7_2, 143 GPMC_CONFIG7_2,
144 GPMC_CONFIG7_3, 144 GPMC_CONFIG7_3,
145 GPMC_CONFIG7_4, 145 GPMC_CONFIG7_4,
146 GPMC_CONFIG7_5, 146 GPMC_CONFIG7_5,
147 GPMC_CONFIG7_6, 147 GPMC_CONFIG7_6,
148 GPMC_CONFIG7_7, 148 GPMC_CONFIG7_7,
149}; 149};
150 150
151 151
152/* prototypes */ 152/* prototypes */
153static int gpmc_match(device_t, cfdata_t, void *); 153static int gpmc_match(device_t, cfdata_t, void *);
154static void gpmc_attach(device_t, device_t, void *); 154static void gpmc_attach(device_t, device_t, void *);
155static void gpmc_csconfig_init(struct gpmc_softc *); 155static void gpmc_csconfig_init(struct gpmc_softc *);
156static int gpmc_search(device_t, cfdata_t, const int *, void *); 156static int gpmc_search(device_t, cfdata_t, const int *, void *);
157static int gpmc_print(void *, const char *); 157static int gpmc_print(void *, const char *);
158 158
159/* attach structures */ 159/* attach structures */
160CFATTACH_DECL_NEW(gpmc, sizeof(struct gpmc_softc), 160CFATTACH_DECL_NEW(gpmc, sizeof(struct gpmc_softc),
161 gpmc_match, gpmc_attach, NULL, NULL); 161 gpmc_match, gpmc_attach, NULL, NULL);
162 162
163static int gpmc_attached; /* XXX assumes only 1 instance */ 163static int gpmc_attached; /* XXX assumes only 1 instance */
164 164
165static int 165static int
166gpmc_match(device_t parent, cfdata_t match, void *aux) 166gpmc_match(device_t parent, cfdata_t match, void *aux)
167{ 167{
168 struct mainbus_attach_args *mb = aux; 168 struct mainbus_attach_args *mb = aux;
169 169
170 if (gpmc_attached != 0) 170 if (gpmc_attached != 0)
171 return 0; 171 return 0;
172 172
173#if defined(OMAP2) 173#if defined(OMAP2)
174 if (mb->mb_iobase == GPMC_BASE) 174 if (mb->mb_iobase == GPMC_BASE)
175 return 1; 175 return 1;
176#endif 176#endif
177 177
178 return 0; 178 return 0;
179} 179}
180 180
181static void 181static void
182gpmc_attach(device_t parent, device_t self, void *aux) 182gpmc_attach(device_t parent, device_t self, void *aux)
183{ 183{
184 struct gpmc_softc *sc = device_private(self); 184 struct gpmc_softc *sc = device_private(self);
185 struct mainbus_attach_args *mb = aux; 185 struct mainbus_attach_args *mb = aux;
186 bus_space_handle_t ioh; 186 bus_space_handle_t ioh;
187 uint32_t rev; 187 uint32_t rev;
188 int err; 188 int err;
189 189
190 sc->sc_dev = self; 190 sc->sc_dev = self;
191 sc->sc_iot = &omap_bs_tag; 191 sc->sc_iot = &omap_bs_tag;
192 192
193 err = bus_space_map(sc->sc_iot, mb->mb_iobase, GPMC_SIZE, 0, &ioh); 193 err = bus_space_map(sc->sc_iot, mb->mb_iobase, GPMC_SIZE, 0, &ioh);
194 if (err != 0) 194 if (err != 0)
195 panic("%s: Cannot map registers, error %d", 195 panic("%s: Cannot map registers, error %d",
196 device_xname(self), err); 196 device_xname(self), err);
197 197
198 aprint_normal(": General Purpose Memory Controller"); 198 aprint_normal(": General Purpose Memory Controller");
199 199
200 rev = bus_space_read_4(sc->sc_iot, ioh, GPMC_REVISION); 200 rev = bus_space_read_4(sc->sc_iot, ioh, GPMC_REVISION);
201 201
202 aprint_normal(", rev %d.%d\n", 202 aprint_normal(", rev %d.%d\n",
203 GPMC_REVISION_REV_MAJ(rev), 203 GPMC_REVISION_REV_MAJ(rev),
204 GPMC_REVISION_REV_MIN(rev)); 204 GPMC_REVISION_REV_MIN(rev));
205 205
206 sc->sc_ioh = ioh; 206 sc->sc_ioh = ioh;
207 sc->sc_dmac = NULL; 207 sc->sc_dmac = NULL;
208 208
209 gpmc_csconfig_init(sc); 209 gpmc_csconfig_init(sc);
210 210
211 gpmc_attached = 1; 211 gpmc_attached = 1;
212 212
213 /* 213 /*
214 * Attach all our devices 214 * Attach all our devices
215 */ 215 */
216 config_search_ia(gpmc_search, self, "gpmc", NULL); 216 config_search_ia(gpmc_search, self, "gpmc", NULL);
217} 217}
218 218
219static void 219static void
220gpmc_csconfig_init(struct gpmc_softc *sc) 220gpmc_csconfig_init(struct gpmc_softc *sc)
221{ 221{
222 gpmc_csconfig_t *cs; 222 gpmc_csconfig_t *cs;
223 uint32_t r; 223 uint32_t r;
224 int i; 224 int i;
225 225
226 cs = &sc->sc_csconfig[0]; 226 cs = &sc->sc_csconfig[0];
227 for (i=0; i < GPMC_NCS; i++) { 227 for (i=0; i < GPMC_NCS; i++) {
228 memset(cs, 0, sizeof(gpmc_csconfig_t)); 228 memset(cs, 0, sizeof(gpmc_csconfig_t));
229 r = bus_space_read_4(sc->sc_iot, sc->sc_ioh, csreg7[i]); 229 r = bus_space_read_4(sc->sc_iot, sc->sc_ioh, csreg7[i]);
230 if ((r & GPMC_CONFIG7_CSVALID) != 0) { 230 if ((r & GPMC_CONFIG7_CSVALID) != 0) {
231 cs->cs_valid = TRUE; 231 cs->cs_valid = TRUE;
232 cs->cs_addr = omap_gpmc_config7_addr(r); 232 cs->cs_addr = omap_gpmc_config7_addr(r);
233 cs->cs_size = omap_gpmc_config7_size(r); 233 cs->cs_size = omap_gpmc_config7_size(r);
234 aprint_normal("%s: CS#%d valid, " 234 aprint_normal("%s: CS#%d valid, "
235 "addr 0x%08lx, size %3ldMB\n", 235 "addr 0x%08lx, size %3ldMB\n",
236 device_xname(sc->sc_dev), i, 236 device_xname(sc->sc_dev), i,
237 cs->cs_addr, (cs->cs_size >> 20)); 237 cs->cs_addr, (cs->cs_size >> 20));
238 } 238 }
239 cs++; 239 cs++;
240 } 240 }
241} 241}
242 242
243static int 243static int
244gpmc_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) 244gpmc_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
245{ 245{
246 struct gpmc_softc *sc = device_private(parent); 246 struct gpmc_softc *sc = device_private(parent);
247 struct gpmc_attach_args aa; 247 struct gpmc_attach_args aa;
248 gpmc_csconfig_t *cs; 248 gpmc_csconfig_t *cs;
249 int i; 249 int i;
250 250
251 /* Set up the attach args. */ 251 /* Set up the attach args. */
252 if (cf->cf_loc[GPMCCF_NOBYTEACC] == 1) { 252 if (cf->cf_loc[GPMCCF_NOBYTEACC] == 1) {
253 if (cf->cf_loc[GPMCCF_MULT] == 1) 253 if (cf->cf_loc[GPMCCF_MULT] == 1)
254 aa.gpmc_iot = &nobyteacc_bs_tag; 254 aa.gpmc_iot = &nobyteacc_bs_tag;
255 else 255 else
256 panic("nobyteacc specified for device with " 256 panic("nobyteacc specified for device with "
257 "non-byte multiplier\n"); 257 "non-byte multiplier\n");
258 } else { 258 } else {
259 switch (cf->cf_loc[GPMCCF_MULT]) { 259 switch (cf->cf_loc[GPMCCF_MULT]) {
260 case 1: 260 case 1:
261 aa.gpmc_iot = &omap_bs_tag; 261 aa.gpmc_iot = &omap_bs_tag;
262 break; 262 break;
263 case 2: 263 case 2:
264 aa.gpmc_iot = &omap_a2x_bs_tag; 264 aa.gpmc_iot = &omap_a2x_bs_tag;
265 break; 265 break;
266 case 4: 266 case 4:
267 aa.gpmc_iot = &omap_a4x_bs_tag; 267 aa.gpmc_iot = &omap_a4x_bs_tag;
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);
295 return 0; /* love it */ 310 return 0; /* love it */
296 } 311 }
297 } 312 }
298 cs++; 313 cs++;
299 } 314 }
300 return 1; /* NG */ 315 return 1; /* NG */
301} 316}
302 317
303static int 318static int
304gpmc_print(void *aux, const char *name) 319gpmc_print(void *aux, const char *name)
305{ 320{
306 struct gpmc_attach_args *sa = (struct gpmc_attach_args*)aux; 321 struct gpmc_attach_args *sa = (struct gpmc_attach_args*)aux;
307 322
308 if (sa->gpmc_addr != GPMCCF_ADDR_DEFAULT) { 323 if (sa->gpmc_addr != GPMCCF_ADDR_DEFAULT) {
309 aprint_normal(" addr 0x%08lx", sa->gpmc_addr); 324 aprint_normal(" addr 0x%08lx", sa->gpmc_addr);
310 if (sa->gpmc_size != GPMCCF_SIZE_DEFAULT) 325 if (sa->gpmc_size != GPMCCF_SIZE_DEFAULT)
311 aprint_normal("-0x%08lx", 326 aprint_normal("-0x%08lx",
312 sa->gpmc_addr + sa->gpmc_size-1); 327 sa->gpmc_addr + sa->gpmc_size-1);
313 } 328 }
314 if (sa->gpmc_intr != GPMCCF_INTR_DEFAULT) 329 if (sa->gpmc_intr != GPMCCF_INTR_DEFAULT)
315 aprint_normal(" intr %d", sa->gpmc_intr); 330 aprint_normal(" intr %d", sa->gpmc_intr);
316 331
317 return UNCONF; 332 return UNCONF;
318} 333}
319 334
320uint32_t 335uint32_t
321gpmc_register_read(struct gpmc_softc *sc, bus_size_t reg) 336gpmc_register_read(struct gpmc_softc *sc, bus_size_t reg)
322{ 337{
323 return bus_space_read_4(sc->sc_iot, sc->sc_ioh, reg); 338 return bus_space_read_4(sc->sc_iot, sc->sc_ioh, reg);
324} 339}
325 340
326void 341void
327gpmc_register_write(struct gpmc_softc *sc, bus_size_t reg, const uint32_t data) 342gpmc_register_write(struct gpmc_softc *sc, bus_size_t reg, const uint32_t data)
328{ 343{
329 bus_space_write_4(sc->sc_iot, sc->sc_ioh, reg, data); 344 bus_space_write_4(sc->sc_iot, sc->sc_ioh, reg, data);
330} 345}