Thu Jan 3 14:44:21 2019 UTC ()
Add Allwinner A80 SMP support.


(jmcneill)
diff -r1.58 -r1.59 src/sys/arch/arm/sunxi/files.sunxi
diff -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_mc_smp.c
diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_mc_smp.h
diff -r1.33 -r1.34 src/sys/arch/arm/sunxi/sunxi_platform.c

cvs diff -r1.58 -r1.59 src/sys/arch/arm/sunxi/files.sunxi (switch to unified diff)

--- src/sys/arch/arm/sunxi/files.sunxi 2019/01/03 11:01:59 1.58
+++ src/sys/arch/arm/sunxi/files.sunxi 2019/01/03 14:44:21 1.59
@@ -1,319 +1,319 @@ @@ -1,319 +1,319 @@
1# $NetBSD: files.sunxi,v 1.58 2019/01/03 11:01:59 jmcneill Exp $ 1# $NetBSD: files.sunxi,v 1.59 2019/01/03 14:44:21 jmcneill Exp $
2# 2#
3# Configuration info for Allwinner sunxi family SoCs 3# Configuration info for Allwinner sunxi family SoCs
4# 4#
5# 5#
6 6
7file arch/arm/sunxi/sunxi_platform.c soc_sunxi 7file arch/arm/sunxi/sunxi_platform.c soc_sunxi
8 8
9file arch/arm/sunxi/sunxi_mc_smp.c soc_sunxi_mc 9file arch/arm/sunxi/sunxi_mc_smp.c soc_sunxi_mc
10file arch/arm/sunxi/sunxi_mc_mpstart.S soc_sunxi_mc 10file arch/arm/sunxi/sunxi_mc_mpstart.S soc_sunxi_mc
11 11
12# CCU 12# CCU
13define sunxi_ccu 13define sunxi_ccu
14file arch/arm/sunxi/sunxi_ccu.c sunxi_ccu 14file arch/arm/sunxi/sunxi_ccu.c sunxi_ccu
15file arch/arm/sunxi/sunxi_ccu_div.c sunxi_ccu 15file arch/arm/sunxi/sunxi_ccu_div.c sunxi_ccu
16file arch/arm/sunxi/sunxi_ccu_fixed_factor.c sunxi_ccu 16file arch/arm/sunxi/sunxi_ccu_fixed_factor.c sunxi_ccu
17file arch/arm/sunxi/sunxi_ccu_fractional.c sunxi_ccu 17file arch/arm/sunxi/sunxi_ccu_fractional.c sunxi_ccu
18file arch/arm/sunxi/sunxi_ccu_gate.c sunxi_ccu 18file arch/arm/sunxi/sunxi_ccu_gate.c sunxi_ccu
19file arch/arm/sunxi/sunxi_ccu_nm.c sunxi_ccu 19file arch/arm/sunxi/sunxi_ccu_nm.c sunxi_ccu
20file arch/arm/sunxi/sunxi_ccu_nkmp.c sunxi_ccu 20file arch/arm/sunxi/sunxi_ccu_nkmp.c sunxi_ccu
21file arch/arm/sunxi/sunxi_ccu_phase.c sunxi_ccu 21file arch/arm/sunxi/sunxi_ccu_phase.c sunxi_ccu
22file arch/arm/sunxi/sunxi_ccu_prediv.c sunxi_ccu 22file arch/arm/sunxi/sunxi_ccu_prediv.c sunxi_ccu
23file arch/arm/sunxi/sunxi_ccu_display.c sunxi_ccu 23file arch/arm/sunxi/sunxi_ccu_display.c sunxi_ccu
24 24
25# CCU (A10/A20) 25# CCU (A10/A20)
26device sun4ia10ccu: sunxi_ccu 26device sun4ia10ccu: sunxi_ccu
27attach sun4ia10ccu at fdt with sunxi_a10_ccu 27attach sun4ia10ccu at fdt with sunxi_a10_ccu
28file arch/arm/sunxi/sun4i_a10_ccu.c sunxi_a10_ccu 28file arch/arm/sunxi/sun4i_a10_ccu.c sunxi_a10_ccu
29 29
30# CCU (A13) 30# CCU (A13)
31device sun5ia13ccu: sunxi_ccu 31device sun5ia13ccu: sunxi_ccu
32attach sun5ia13ccu at fdt with sunxi_a13_ccu 32attach sun5ia13ccu at fdt with sunxi_a13_ccu
33file arch/arm/sunxi/sun5i_a13_ccu.c sunxi_a13_ccu 33file arch/arm/sunxi/sun5i_a13_ccu.c sunxi_a13_ccu
34 34
35# CCU (A31) 35# CCU (A31)
36device sun6ia31ccu: sunxi_ccu 36device sun6ia31ccu: sunxi_ccu
37attach sun6ia31ccu at fdt with sunxi_a31_ccu 37attach sun6ia31ccu at fdt with sunxi_a31_ccu
38file arch/arm/sunxi/sun6i_a31_ccu.c sunxi_a31_ccu 38file arch/arm/sunxi/sun6i_a31_ccu.c sunxi_a31_ccu
39 39
40# CCU (A83T) 40# CCU (A83T)
41device sun8ia83tccu: sunxi_ccu 41device sun8ia83tccu: sunxi_ccu
42attach sun8ia83tccu at fdt with sunxi_a83t_ccu 42attach sun8ia83tccu at fdt with sunxi_a83t_ccu
43file arch/arm/sunxi/sun8i_a83t_ccu.c sunxi_a83t_ccu 43file arch/arm/sunxi/sun8i_a83t_ccu.c sunxi_a83t_ccu
44 44
45# CCU (H3) 45# CCU (H3)
46device sun8ih3ccu: sunxi_ccu 46device sun8ih3ccu: sunxi_ccu
47attach sun8ih3ccu at fdt with sunxi_h3_ccu 47attach sun8ih3ccu at fdt with sunxi_h3_ccu
48file arch/arm/sunxi/sun8i_h3_ccu.c sunxi_h3_ccu 48file arch/arm/sunxi/sun8i_h3_ccu.c sunxi_h3_ccu
49 49
50# CCU (H3 PRCM) 50# CCU (H3 PRCM)
51device sun8ih3rccu: sunxi_ccu 51device sun8ih3rccu: sunxi_ccu
52attach sun8ih3rccu at fdt with sunxi_h3_r_ccu 52attach sun8ih3rccu at fdt with sunxi_h3_r_ccu
53file arch/arm/sunxi/sun8i_h3_r_ccu.c sunxi_h3_r_ccu 53file arch/arm/sunxi/sun8i_h3_r_ccu.c sunxi_h3_r_ccu
54 54
55# CCU (A80) 55# CCU (A80)
56device sun9ia80ccu: sunxi_ccu 56device sun9ia80ccu: sunxi_ccu
57attach sun9ia80ccu at fdt with sunxi_a80_ccu 57attach sun9ia80ccu at fdt with sunxi_a80_ccu
58file arch/arm/sunxi/sun9i_a80_ccu.c sunxi_a80_ccu 58file arch/arm/sunxi/sun9i_a80_ccu.c sunxi_a80_ccu
59 59
60# CCU (A64) 60# CCU (A64)
61device sun50ia64ccu: sunxi_ccu 61device sun50ia64ccu: sunxi_ccu
62attach sun50ia64ccu at fdt with sunxi_a64_ccu 62attach sun50ia64ccu at fdt with sunxi_a64_ccu
63file arch/arm/sunxi/sun50i_a64_ccu.c sunxi_a64_ccu 63file arch/arm/sunxi/sun50i_a64_ccu.c sunxi_a64_ccu
64 64
65# CCU (A64 PRCM) 65# CCU (A64 PRCM)
66device sun50ia64rccu: sunxi_ccu 66device sun50ia64rccu: sunxi_ccu
67attach sun50ia64rccu at fdt with sunxi_a64_r_ccu 67attach sun50ia64rccu at fdt with sunxi_a64_r_ccu
68file arch/arm/sunxi/sun50i_a64_r_ccu.c sunxi_a64_r_ccu 68file arch/arm/sunxi/sun50i_a64_r_ccu.c sunxi_a64_r_ccu
69 69
70# CCU (H6) 70# CCU (H6)
71device sun50ih6ccu: sunxi_ccu 71device sun50ih6ccu: sunxi_ccu
72attach sun50ih6ccu at fdt with sunxi_h6_ccu 72attach sun50ih6ccu at fdt with sunxi_h6_ccu
73file arch/arm/sunxi/sun50i_h6_ccu.c sunxi_h6_ccu 73file arch/arm/sunxi/sun50i_h6_ccu.c sunxi_h6_ccu
74 74
75# CCU (H6 PRCM) 75# CCU (H6 PRCM)
76device sun50ih6rccu: sunxi_ccu 76device sun50ih6rccu: sunxi_ccu
77attach sun50ih6rccu at fdt with sunxi_h6_r_ccu 77attach sun50ih6rccu at fdt with sunxi_h6_r_ccu
78file arch/arm/sunxi/sun50i_h6_r_ccu.c sunxi_h6_r_ccu 78file arch/arm/sunxi/sun50i_h6_r_ccu.c sunxi_h6_r_ccu
79 79
80# Misc. clock resets 80# Misc. clock resets
81device sunxiresets 81device sunxiresets
82attach sunxiresets at fdt with sunxi_resets 82attach sunxiresets at fdt with sunxi_resets
83file arch/arm/sunxi/sunxi_resets.c sunxi_resets 83file arch/arm/sunxi/sunxi_resets.c sunxi_resets
84 84
85# Misc. clock gates 85# Misc. clock gates
86device sunxigates 86device sunxigates
87attach sunxigates at fdt with sunxi_gates 87attach sunxigates at fdt with sunxi_gates
88file arch/arm/sunxi/sunxi_gates.c sunxi_gates 88file arch/arm/sunxi/sunxi_gates.c sunxi_gates
89 89
90# GMAC MII/RGMII clock mux 90# GMAC MII/RGMII clock mux
91device sunxigmacclk 91device sunxigmacclk
92attach sunxigmacclk at fdt with sunxi_gmacclk 92attach sunxigmacclk at fdt with sunxi_gmacclk
93file arch/arm/sunxi/sunxi_gmacclk.c sunxi_gmacclk 93file arch/arm/sunxi/sunxi_gmacclk.c sunxi_gmacclk
94 94
95# SD/MMC-COMM (A80) 95# SD/MMC-COMM (A80)
96device sun9immcclk 96device sun9immcclk
97attach sun9immcclk at fdt with sunxi_a80_mmcclk 97attach sun9immcclk at fdt with sunxi_a80_mmcclk
98file arch/arm/sunxi/sun9i_a80_mmcclk.c sunxi_a80_mmcclk 98file arch/arm/sunxi/sun9i_a80_mmcclk.c sunxi_a80_mmcclk
99 99
100# Interrupt controller 100# Interrupt controller
101device sunxiintc: pic, pic_splfuncs 101device sunxiintc: pic, pic_splfuncs
102attach sunxiintc at fdt with sunxi_intc 102attach sunxiintc at fdt with sunxi_intc
103file arch/arm/sunxi/sunxi_intc.c sunxi_intc 103file arch/arm/sunxi/sunxi_intc.c sunxi_intc
104 104
105device sunxinmi 105device sunxinmi
106attach sunxinmi at fdt with sunxi_nmi 106attach sunxinmi at fdt with sunxi_nmi
107file arch/arm/sunxi/sunxi_nmi.c sunxi_nmi 107file arch/arm/sunxi/sunxi_nmi.c sunxi_nmi
108 108
109# GPIO 109# GPIO
110device sunxigpio: gpiobus 110device sunxigpio: gpiobus
111attach sunxigpio at fdt with sunxi_gpio 111attach sunxigpio at fdt with sunxi_gpio
112file arch/arm/sunxi/sunxi_gpio.c sunxi_gpio 112file arch/arm/sunxi/sunxi_gpio.c sunxi_gpio
113file arch/arm/sunxi/sun4i_a10_gpio.c sunxi_gpio & soc_sun4i_a10 113file arch/arm/sunxi/sun4i_a10_gpio.c sunxi_gpio & soc_sun4i_a10
114file arch/arm/sunxi/sun5i_a13_gpio.c sunxi_gpio & soc_sun5i_a13 114file arch/arm/sunxi/sun5i_a13_gpio.c sunxi_gpio & soc_sun5i_a13
115file arch/arm/sunxi/sun6i_a31_gpio.c sunxi_gpio & soc_sun6i_a31 115file arch/arm/sunxi/sun6i_a31_gpio.c sunxi_gpio & soc_sun6i_a31
116file arch/arm/sunxi/sun7i_a20_gpio.c sunxi_gpio & soc_sun7i_a20 116file arch/arm/sunxi/sun7i_a20_gpio.c sunxi_gpio & soc_sun7i_a20
117file arch/arm/sunxi/sun8i_a83t_gpio.c sunxi_gpio & soc_sun8i_a83t 117file arch/arm/sunxi/sun8i_a83t_gpio.c sunxi_gpio & soc_sun8i_a83t
118file arch/arm/sunxi/sun8i_h3_gpio.c sunxi_gpio & soc_sun8i_h3 118file arch/arm/sunxi/sun8i_h3_gpio.c sunxi_gpio & soc_sun8i_h3
119file arch/arm/sunxi/sun9i_a80_gpio.c sunxi_gpio & soc_sun9i_a80 119file arch/arm/sunxi/sun9i_a80_gpio.c sunxi_gpio & soc_sun9i_a80
120file arch/arm/sunxi/sun50i_a64_gpio.c sunxi_gpio & soc_sun50i_a64 120file arch/arm/sunxi/sun50i_a64_gpio.c sunxi_gpio & soc_sun50i_a64
121file arch/arm/sunxi/sun50i_h6_gpio.c sunxi_gpio & soc_sun50i_h6 121file arch/arm/sunxi/sun50i_h6_gpio.c sunxi_gpio & soc_sun50i_h6
122 122
123# PWM 123# PWM
124device sunxipwm: pwm 124device sunxipwm: pwm
125attach sunxipwm at fdt with sunxi_pwm 125attach sunxipwm at fdt with sunxi_pwm
126file arch/arm/sunxi/sunxi_pwm.c sunxi_pwm 126file arch/arm/sunxi/sunxi_pwm.c sunxi_pwm
127 127
128# SD/MMC 128# SD/MMC
129device sunximmc: sdmmcbus 129device sunximmc: sdmmcbus
130attach sunximmc at fdt with sunxi_mmc 130attach sunximmc at fdt with sunxi_mmc
131file arch/arm/sunxi/sunxi_mmc.c sunxi_mmc 131file arch/arm/sunxi/sunxi_mmc.c sunxi_mmc
132defparam opt_sunximmc.h SUNXI_MMC_DEBUG 132defparam opt_sunximmc.h SUNXI_MMC_DEBUG
133 133
134# USB PHY 134# USB PHY
135device sunxiusbphy 135device sunxiusbphy
136attach sunxiusbphy at fdt with sunxi_usbphy 136attach sunxiusbphy at fdt with sunxi_usbphy
137file arch/arm/sunxi/sunxi_usbphy.c sunxi_usbphy 137file arch/arm/sunxi/sunxi_usbphy.c sunxi_usbphy
138 138
139device sunxiusb3phy 139device sunxiusb3phy
140attach sunxiusb3phy at fdt with sunxi_usb3phy 140attach sunxiusb3phy at fdt with sunxi_usb3phy
141file arch/arm/sunxi/sunxi_usb3phy.c sunxi_usb3phy 141file arch/arm/sunxi/sunxi_usb3phy.c sunxi_usb3phy
142 142
143# EHCI 143# EHCI
144attach ehci at fdt with ehci_fdt 144attach ehci at fdt with ehci_fdt
145file dev/fdt/ehci_fdt.c ehci_fdt  145file dev/fdt/ehci_fdt.c ehci_fdt
146 146
147# OHCI 147# OHCI
148attach ohci at fdt with ohci_fdt 148attach ohci at fdt with ohci_fdt
149file dev/fdt/ohci_fdt.c ohci_fdt 149file dev/fdt/ohci_fdt.c ohci_fdt
150 150
151# TWI 151# TWI
152device sunxitwi: i2cbus, i2cexec, mvi2c 152device sunxitwi: i2cbus, i2cexec, mvi2c
153attach sunxitwi at fdt with sunxi_twi 153attach sunxitwi at fdt with sunxi_twi
154file arch/arm/sunxi/sunxi_twi.c sunxi_twi 154file arch/arm/sunxi/sunxi_twi.c sunxi_twi
155 155
156# P2WI/RSB 156# P2WI/RSB
157device sunxirsb: i2cbus, i2cexec 157device sunxirsb: i2cbus, i2cexec
158attach sunxirsb at fdt with sunxi_rsb 158attach sunxirsb at fdt with sunxi_rsb
159file arch/arm/sunxi/sunxi_rsb.c sunxi_rsb 159file arch/arm/sunxi/sunxi_rsb.c sunxi_rsb
160 160
161# RTC 161# RTC
162device sunxirtc 162device sunxirtc
163attach sunxirtc at fdt with sunxi_rtc 163attach sunxirtc at fdt with sunxi_rtc
164file arch/arm/sunxi/sunxi_rtc.c sunxi_rtc 164file arch/arm/sunxi/sunxi_rtc.c sunxi_rtc
165 165
166# EMAC (common) 166# EMAC (common)
167device emac: arp, ether, ifnet, mii 167device emac: arp, ether, ifnet, mii
168 168
169# EMAC (sun4i/sun5i/sun7i) 169# EMAC (sun4i/sun5i/sun7i)
170ifdef arm 170ifdef arm
171attach emac at fdt with sun4i_emac 171attach emac at fdt with sun4i_emac
172file arch/arm/sunxi/sun4i_emac.c sun4i_emac 172file arch/arm/sunxi/sun4i_emac.c sun4i_emac
173endif 173endif
174 174
175# EMAC (sun8i/sun50i) 175# EMAC (sun8i/sun50i)
176attach emac at fdt with sunxi_emac 176attach emac at fdt with sunxi_emac
177file arch/arm/sunxi/sunxi_emac.c sunxi_emac 177file arch/arm/sunxi/sunxi_emac.c sunxi_emac
178 178
179# GMAC 179# GMAC
180attach awge at fdt with sunxi_gmac 180attach awge at fdt with sunxi_gmac
181file arch/arm/sunxi/sunxi_gmac.c sunxi_gmac 181file arch/arm/sunxi/sunxi_gmac.c sunxi_gmac
182 182
183# Timer 183# Timer
184device sunxitimer 184device sunxitimer
185attach sunxitimer at fdt with sunxi_timer 185attach sunxitimer at fdt with sunxi_timer
186file arch/arm/sunxi/sunxi_timer.c sunxi_timer 186file arch/arm/sunxi/sunxi_timer.c sunxi_timer
187 187
188# Watchdog 188# Watchdog
189device sunxiwdt: sysmon_wdog 189device sunxiwdt: sysmon_wdog
190attach sunxiwdt at fdt with sunxi_wdt 190attach sunxiwdt at fdt with sunxi_wdt
191file arch/arm/sunxi/sunxi_wdt.c sunxi_wdt 191file arch/arm/sunxi/sunxi_wdt.c sunxi_wdt
192 192
193# DMA controller (sun4i) 193# DMA controller (sun4i)
194device sun4idma 194device sun4idma
195attach sun4idma at fdt with sun4i_dma 195attach sun4idma at fdt with sun4i_dma
196file arch/arm/sunxi/sun4i_dma.c sun4i_dma 196file arch/arm/sunxi/sun4i_dma.c sun4i_dma
197 197
198# DMA controller (sun6i) 198# DMA controller (sun6i)
199device sun6idma 199device sun6idma
200attach sun6idma at fdt with sun6i_dma 200attach sun6idma at fdt with sun6i_dma
201file arch/arm/sunxi/sun6i_dma.c sun6i_dma 201file arch/arm/sunxi/sun6i_dma.c sun6i_dma
202 202
203# Audio codec 203# Audio codec
204device sunxicodec: audiobus, auconv, mulaw, aurateconv 204device sunxicodec: audiobus, auconv, mulaw, aurateconv
205attach sunxicodec at fdt with sunxi_codec 205attach sunxicodec at fdt with sunxi_codec
206file arch/arm/sunxi/sunxi_codec.c sunxi_codec 206file arch/arm/sunxi/sunxi_codec.c sunxi_codec
207file arch/arm/sunxi/sun4i_a10_codec.c sunxi_codec 207file arch/arm/sunxi/sun4i_a10_codec.c sunxi_codec
208file arch/arm/sunxi/sun6i_a31_codec.c sunxi_codec 208file arch/arm/sunxi/sun6i_a31_codec.c sunxi_codec
209 209
210# Audio codec (sun8i) 210# Audio codec (sun8i)
211device sun8icodec 211device sun8icodec
212attach sun8icodec at fdt with sun8i_codec 212attach sun8icodec at fdt with sun8i_codec
213file arch/arm/sunxi/sun8i_codec.c sun8i_codec 213file arch/arm/sunxi/sun8i_codec.c sun8i_codec
214 214
215# H3 Audio codec (analog part) 215# H3 Audio codec (analog part)
216device h3codec 216device h3codec
217attach h3codec at fdt with h3_codec 217attach h3codec at fdt with h3_codec
218file arch/arm/sunxi/sun8i_h3_codec.c h3_codec needs-flag 218file arch/arm/sunxi/sun8i_h3_codec.c h3_codec needs-flag
219 219
220# A64 Audio codec (analog part) 220# A64 Audio codec (analog part)
221device a64acodec 221device a64acodec
222attach a64acodec at fdt with a64_acodec 222attach a64acodec at fdt with a64_acodec
223file arch/arm/sunxi/sun50i_a64_acodec.c a64_acodec 223file arch/arm/sunxi/sun50i_a64_acodec.c a64_acodec
224 224
225# I2S/PCM controller 225# I2S/PCM controller
226device sunxii2s: auconv, mulaw, aurateconv 226device sunxii2s: auconv, mulaw, aurateconv
227attach sunxii2s at fdt with sunxi_i2s 227attach sunxii2s at fdt with sunxi_i2s
228file arch/arm/sunxi/sunxi_i2s.c sunxi_i2s 228file arch/arm/sunxi/sunxi_i2s.c sunxi_i2s
229 229
230# A10/A20 LCD/TV timing controller (TCON) 230# A10/A20 LCD/TV timing controller (TCON)
231device sunxitcon 231device sunxitcon
232attach sunxitcon at fdt with sunxi_tcon 232attach sunxitcon at fdt with sunxi_tcon
233file arch/arm/sunxi/sunxi_tcon.c sunxi_tcon needs-flag 233file arch/arm/sunxi/sunxi_tcon.c sunxi_tcon needs-flag
234 234
235# A10/A20 Display engine backend (DE-BE) 235# A10/A20 Display engine backend (DE-BE)
236device sunxidebe { } 236device sunxidebe { }
237attach sunxidebe at fdt with sunxi_debe 237attach sunxidebe at fdt with sunxi_debe
238file arch/arm/sunxi/sunxi_debe.c sunxi_debe needs-flag 238file arch/arm/sunxi/sunxi_debe.c sunxi_debe needs-flag
239 239
240attach genfb at sunxidebe with sunxi_befb 240attach genfb at sunxidebe with sunxi_befb
241 241
242# A10/A20 HDMI 242# A10/A20 HDMI
243device sunxihdmi: edid, videomode 243device sunxihdmi: edid, videomode
244attach sunxihdmi at fdt with sunxi_hdmi 244attach sunxihdmi at fdt with sunxi_hdmi
245file arch/arm/sunxi/sunxi_hdmi.c sunxi_hdmi needs-flag 245file arch/arm/sunxi/sunxi_hdmi.c sunxi_hdmi needs-flag
246 246
247# A10/A20 display engine pipeline 247# A10/A20 display engine pipeline
248device sunxidep 248device sunxidep
249attach sunxidep at fdt with sunxi_dep 249attach sunxidep at fdt with sunxi_dep
250file arch/arm/sunxi/sunxi_dep.c sunxi_dep 250file arch/arm/sunxi/sunxi_dep.c sunxi_dep
251 251
252# Touch Screen controller 252# Touch Screen controller
253device sunxits: wsmousedev, tpcalib, sysmon_envsys 253device sunxits: wsmousedev, tpcalib, sysmon_envsys
254attach sunxits at fdt with sunxi_ts 254attach sunxits at fdt with sunxi_ts
255file arch/arm/sunxi/sunxi_ts.c sunxi_ts 255file arch/arm/sunxi/sunxi_ts.c sunxi_ts
256 256
257# USB OTG 257# USB OTG
258attach motg at fdt with sunxi_musb 258attach motg at fdt with sunxi_musb
259file arch/arm/sunxi/sunxi_musb.c sunxi_musb 259file arch/arm/sunxi/sunxi_musb.c sunxi_musb
260 260
261# Security ID EFUSE 261# Security ID EFUSE
262device sunxisid 262device sunxisid
263attach sunxisid at fdt with sunxi_sid 263attach sunxisid at fdt with sunxi_sid
264file arch/arm/sunxi/sunxi_sid.c sunxi_sid 264file arch/arm/sunxi/sunxi_sid.c sunxi_sid
265 265
266# Thermal sensor controller 266# Thermal sensor controller
267device sunxithermal: sysmon_envsys, sysmon_taskq 267device sunxithermal: sysmon_envsys, sysmon_taskq
268attach sunxithermal at fdt with sunxi_thermal 268attach sunxithermal at fdt with sunxi_thermal
269file arch/arm/sunxi/sunxi_thermal.c sunxi_thermal 269file arch/arm/sunxi/sunxi_thermal.c sunxi_thermal
270 270
271# SATA 271# SATA
272attach ahcisata at fdt with sunxi_sata 272attach ahcisata at fdt with sunxi_sata
273file arch/arm/sunxi/sunxi_sata.c sunxi_sata 273file arch/arm/sunxi/sunxi_sata.c sunxi_sata
274 274
275# SRAM Controller 275# SRAM Controller
276device sunxisramc 276device sunxisramc
277attach sunxisramc at fdt with sunxi_sramc 277attach sunxisramc at fdt with sunxi_sramc
278file arch/arm/sunxi/sunxi_sramc.c sunxi_sramc 278file arch/arm/sunxi/sunxi_sramc.c sunxi_sramc
279 279
280# NAND Flash Controller 280# NAND Flash Controller
281device sunxinand: nandbus 281device sunxinand: nandbus
282attach sunxinand at fdt with sunxi_nand 282attach sunxinand at fdt with sunxi_nand
283file arch/arm/sunxi/sunxi_nand.c sunxi_nand 283file arch/arm/sunxi/sunxi_nand.c sunxi_nand
284 284
285# SPI Controller (sun6i-compatible) 285# SPI Controller (sun6i-compatible)
286device sun6ispi: spibus 286device sun6ispi: spibus
287attach sun6ispi at fdt with sun6i_spi 287attach sun6ispi at fdt with sun6i_spi
288file arch/arm/sunxi/sun6i_spi.c sun6i_spi 288file arch/arm/sunxi/sun6i_spi.c sun6i_spi
289 289
290# A10/A20 CAN 290# A10/A20 CAN
291device sunxican { } : ifnet 291device sunxican { } : ifnet
292attach sunxican at fdt with sunxi_can 292attach sunxican at fdt with sunxi_can
293file arch/arm/sunxi/sunxi_can.c sunxi_can 293file arch/arm/sunxi/sunxi_can.c sunxi_can
294 294
295# LRADC 295# LRADC
296device sunxilradc 296device sunxilradc
297attach sunxilradc at fdt with sunxi_lradc 297attach sunxilradc at fdt with sunxi_lradc
298file arch/arm/sunxi/sunxi_lradc.c sunxi_lradc 298file arch/arm/sunxi/sunxi_lradc.c sunxi_lradc
299 299
300# SOC parameters 300# SOC parameters
301defflag opt_soc.h SOC_SUNXI 301defflag opt_soc.h SOC_SUNXI
302defflag opt_soc.h SOC_SUNXI_MC 302defflag opt_soc.h SOC_SUNXI_MC
303defflag opt_soc.h SOC_SUN4I: SOC_SUNXI 303defflag opt_soc.h SOC_SUN4I: SOC_SUNXI
304defflag opt_soc.h SOC_SUN4I_A10: SOC_SUN4I 304defflag opt_soc.h SOC_SUN4I_A10: SOC_SUN4I
305defflag opt_soc.h SOC_SUN5I: SOC_SUNXI 305defflag opt_soc.h SOC_SUN5I: SOC_SUNXI
306defflag opt_soc.h SOC_SUN5I_A13: SOC_SUN5I 306defflag opt_soc.h SOC_SUN5I_A13: SOC_SUN5I
307defflag opt_soc.h SOC_SUN6I: SOC_SUNXI 307defflag opt_soc.h SOC_SUN6I: SOC_SUNXI
308defflag opt_soc.h SOC_SUN6I_A31: SOC_SUN6I 308defflag opt_soc.h SOC_SUN6I_A31: SOC_SUN6I
309defflag opt_soc.h SOC_SUN7I: SOC_SUNXI 309defflag opt_soc.h SOC_SUN7I: SOC_SUNXI
310defflag opt_soc.h SOC_SUN7I_A20: SOC_SUN7I 310defflag opt_soc.h SOC_SUN7I_A20: SOC_SUN7I
311defflag opt_soc.h SOC_SUN8I: SOC_SUNXI 311defflag opt_soc.h SOC_SUN8I: SOC_SUNXI
312defflag opt_soc.h SOC_SUN8I_A83T: SOC_SUN8I, SOC_SUNXI_MC 312defflag opt_soc.h SOC_SUN8I_A83T: SOC_SUN8I, SOC_SUNXI_MC
313defflag opt_soc.h SOC_SUN8I_H3: SOC_SUN8I 313defflag opt_soc.h SOC_SUN8I_H3: SOC_SUN8I
314defflag opt_soc.h SOC_SUN9I: SOC_SUNXI 314defflag opt_soc.h SOC_SUN9I: SOC_SUNXI
315defflag opt_soc.h SOC_SUN9I_A80: SOC_SUN9I 315defflag opt_soc.h SOC_SUN9I_A80: SOC_SUN9I, SOC_SUNXI_MC
316defflag opt_soc.h SOC_SUN50I: SOC_SUNXI 316defflag opt_soc.h SOC_SUN50I: SOC_SUNXI
317defflag opt_soc.h SOC_SUN50I_A64: SOC_SUN50I 317defflag opt_soc.h SOC_SUN50I_A64: SOC_SUN50I
318defflag opt_soc.h SOC_SUN50I_H5: SOC_SUN50I, SOC_SUN8I_H3 318defflag opt_soc.h SOC_SUN50I_H5: SOC_SUN50I, SOC_SUN8I_H3
319defflag opt_soc.h SOC_SUN50I_H6: SOC_SUN50I 319defflag opt_soc.h SOC_SUN50I_H6: SOC_SUN50I

cvs diff -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_mc_smp.c (switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_mc_smp.c 2019/01/03 12:52:40 1.2
+++ src/sys/arch/arm/sunxi/sunxi_mc_smp.c 2019/01/03 14:44:21 1.3
@@ -1,203 +1,263 @@ @@ -1,203 +1,263 @@
1/* $NetBSD: sunxi_mc_smp.c,v 1.2 2019/01/03 12:52:40 jmcneill Exp $ */ 1/* $NetBSD: sunxi_mc_smp.c,v 1.3 2019/01/03 14:44:21 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30 30
31__KERNEL_RCSID(0, "$NetBSD: sunxi_mc_smp.c,v 1.2 2019/01/03 12:52:40 jmcneill Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: sunxi_mc_smp.c,v 1.3 2019/01/03 14:44:21 jmcneill Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/bus.h> 34#include <sys/bus.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37 37
38#include <uvm/uvm_extern.h> 38#include <uvm/uvm_extern.h>
39 39
40#include <dev/fdt/fdtvar.h> 40#include <dev/fdt/fdtvar.h>
41 41
42#include <arm/armreg.h> 42#include <arm/armreg.h>
43#include <arm/cpu.h> 43#include <arm/cpu.h>
44#include <arm/cpufunc.h> 44#include <arm/cpufunc.h>
45#include <arm/locore.h> 45#include <arm/locore.h>
46 46
47#include <arm/sunxi/sunxi_mc_smp.h> 47#include <arm/sunxi/sunxi_mc_smp.h>
48 48
49#define A83T_SMP_ENABLE_METHOD "allwinner,sun8i-a83t-smp" 49#define A80_PRCM_BASE 0x08001400
 50#define A80_PRCM_SIZE 0x200
50 51
51#define PRCM_BASE 0x01f01400 52#define A83T_PRCM_BASE 0x01f01400
52#define PRCM_SIZE 0x800 53#define A83T_PRCM_SIZE 0x800
53 54
54#define PRCM_CL_RST_CTRL(cluster) (0x4 + (cluster) * 0x4) 55#define PRCM_CL_RST_CTRL(cluster) (0x4 + (cluster) * 0x4)
55#define PRCM_CL_PWROFF(cluster) (0x100 + (cluster) * 0x4) 56#define PRCM_CL_PWROFF(cluster) (0x100 + (cluster) * 0x4)
56#define PRCM_CL_PWR_CLAMP(cluster, cpu) (0x140 + (cluster) * 0x10 + (cpu) * 0x4) 57#define PRCM_CL_PWR_CLAMP(cluster, cpu) (0x140 + (cluster) * 0x10 + (cpu) * 0x4)
 58#define PRCM_CPU_SOFT_ENTRY 0x164
57 59
58#define CPUCFG_BASE 0x01f01c00 60#define CPUCFG_BASE 0x01f01c00
59#define CPUCFG_SIZE 0x400 61#define CPUCFG_SIZE 0x400
60 62
61#define CPUCFG_CL_RST(cluster) (0x30 + (cluster) * 0x4) 63#define CPUCFG_CL_RST(cluster) (0x30 + (cluster) * 0x4)
62#define CPUCFG_P_REG0 0x1a4 64#define CPUCFG_P_REG0 0x1a4
63 65
64#define CPUXCFG_BASE 0x01700000 66#define CPUXCFG_BASE 0x01700000
65#define CPUXCFG_SIZE 0x400 67#define CPUXCFG_SIZE 0x400
66 68
67#define CPUXCFG_CL_RST(cluster) (0x80 + (cluster) * 0x4) 69#define CPUXCFG_CL_RST(cluster) (0x80 + (cluster) * 0x4)
68#define CPUXCFG_CL_RST_SOC_DBG_RST __BIT(24) 70#define CPUXCFG_CL_RST_SOC_DBG_RST __BIT(24)
69#define CPUXCFG_CL_RST_ETM_RST(cpu) __BIT(20 + (cpu)) 71#define CPUXCFG_CL_RST_ETM_RST(cpu) __BIT(20 + (cpu))
70#define CPUXCFG_CL_RST_DBG_RST(cpu) __BIT(16 + (cpu)) 72#define CPUXCFG_CL_RST_DBG_RST(cpu) __BIT(16 + (cpu))
71#define CPUXCFG_CL_RST_H_RST __BIT(12) 73#define CPUXCFG_CL_RST_H_RST __BIT(12)
72#define CPUXCFG_CL_RST_L2_RST __BIT(8) 74#define CPUXCFG_CL_RST_L2_RST __BIT(8)
 75#define CPUXCFG_CL_RST_CX_RST(cpu) __BIT(4 + (cpu))
73#define CPUXCFG_CL_CTRL0(cluster) (0x0 + (cluster) * 0x10) 76#define CPUXCFG_CL_CTRL0(cluster) (0x0 + (cluster) * 0x10)
74#define CPUXCFG_CL_CTRL1(cluster) (0x4 + (cluster) * 0x10) 77#define CPUXCFG_CL_CTRL1(cluster) (0x4 + (cluster) * 0x10)
75#define CPUXCFG_CL_CTRL1_ACINACTM __BIT(0) 78#define CPUXCFG_CL_CTRL1_ACINACTM __BIT(0)
76 79
77#define CCI_BASE 0x01790000 80#define A80_CCI_BASE 0x01c90000
78#define CCI_SLAVEIF3_BASE (CCI_BASE + 0x4000) 81#define A83T_CCI_BASE 0x01790000
79#define CCI_SLAVEIF4_BASE (CCI_BASE + 0x5000) 82
 83#define CCI_SLAVEIF3_OFFSET 0x4000
 84#define CCI_SLAVEIF4_OFFSET 0x5000
80 85
81extern struct bus_space arm_generic_bs_tag; 86extern struct bus_space arm_generic_bs_tag;
82 87
83uint32_t sunxi_mc_cci_port[MAXCPUS] = { 88enum sunxi_mc_soc {
84 CCI_SLAVEIF3_BASE, 89 MC_SOC_A80,
85 CCI_SLAVEIF3_BASE, 90 MC_SOC_A83T
86 CCI_SLAVEIF3_BASE, 91};
87 CCI_SLAVEIF3_BASE, 92
88 CCI_SLAVEIF4_BASE, 93enum sunxi_mc_cpu {
89 CCI_SLAVEIF4_BASE, 94 MC_CORE_CA7,
90 CCI_SLAVEIF4_BASE, 95 MC_CORE_CA15
91 CCI_SLAVEIF4_BASE, 
92}; 96};
93 97
 98uint32_t sunxi_mc_cci_port[MAXCPUS];
 99
94static uint32_t 100static uint32_t
95sunxi_mc_smp_pa(void) 101sunxi_mc_smp_pa(void)
96{ 102{
97 extern void sunxi_mc_mpstart(void); 103 extern void sunxi_mc_mpstart(void);
98 bool ok __diagused; 104 bool ok __diagused;
99 paddr_t pa; 105 paddr_t pa;
100 106
101 ok = pmap_extract(pmap_kernel(), (vaddr_t)sunxi_mc_mpstart, &pa); 107 ok = pmap_extract(pmap_kernel(), (vaddr_t)sunxi_mc_mpstart, &pa);
102 KASSERT(ok); 108 KASSERT(ok);
103 109
104 return pa; 110 return pa;
105} 111}
106 112
107static int 113static int
108sunxi_mc_smp_start(bus_space_tag_t bst, bus_space_handle_t prcm, bus_space_handle_t cpucfg, 114sunxi_mc_smp_start(bus_space_tag_t bst, bus_space_handle_t prcm, bus_space_handle_t cpucfg,
109 bus_space_handle_t cpuxcfg, u_int cluster, u_int cpu) 115 bus_space_handle_t cpuxcfg, u_int cluster, u_int cpu, enum sunxi_mc_soc soc,
 116 enum sunxi_mc_cpu core)
110{ 117{
111 uint32_t val; 118 uint32_t val;
112 int i; 119 int i;
113 120
114 /* Set start vector */ 
115 bus_space_write_4(bst, cpucfg, CPUCFG_P_REG0, sunxi_mc_smp_pa()); 
116 
117 /* Assert core reset */ 121 /* Assert core reset */
118 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster)); 122 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster));
119 val &= ~__BIT(cpu); 123 val &= ~__BIT(cpu);
120 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster), val); 124 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster), val);
121 125
122 /* Assert power-on reset */ 126 if (soc == MC_SOC_A83T) {
123 val = bus_space_read_4(bst, cpucfg, CPUCFG_CL_RST(cluster)); 127 /* Assert power-on reset */
124 val &= ~__BIT(cpu); 128 val = bus_space_read_4(bst, cpucfg, CPUCFG_CL_RST(cluster));
125 bus_space_write_4(bst, cpucfg, CPUCFG_CL_RST(cluster), val); 129 val &= ~__BIT(cpu);
 130 bus_space_write_4(bst, cpucfg, CPUCFG_CL_RST(cluster), val);
 131 }
126 132
127 /* Disable automatic L1 cache invalidate at reset */ 133 if (core == MC_CORE_CA7) {
128 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_CTRL0(cluster)); 134 /* Disable automatic L1 cache invalidate at reset */
129 val &= ~__BIT(cpu); 135 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_CTRL0(cluster));
130 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_CTRL0(cluster), val); 136 val &= ~__BIT(cpu);
 137 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_CTRL0(cluster), val);
 138 }
131 139
132 /* Release power clamp */ 140 /* Release power clamp */
133 for (i = 0; i <= 8; i++) { 141 for (i = 0; i <= 8; i++) {
134 bus_space_write_4(bst, prcm, PRCM_CL_PWR_CLAMP(cluster, cpu), 0xff >> i); 142 bus_space_write_4(bst, prcm, PRCM_CL_PWR_CLAMP(cluster, cpu), 0xff >> i);
135 delay(10); 143 delay(10);
136 } 144 }
137 for (i = 100000; i > 0; i--) { 145 for (i = 100000; i > 0; i--) {
138 if (bus_space_read_4(bst, prcm, PRCM_CL_PWR_CLAMP(cluster, cpu)) == 0) 146 if (bus_space_read_4(bst, prcm, PRCM_CL_PWR_CLAMP(cluster, cpu)) == 0)
139 break; 147 break;
140 } 148 }
141 if (i == 0) { 149 if (i == 0) {
142 printf("CPU %#llx failed to start\n", __SHIFTIN(cluster, MPIDR_AFF1) | __SHIFTIN(cpu, MPIDR_AFF0)); 150 printf("CPU %#llx failed to start\n", __SHIFTIN(cluster, MPIDR_AFF1) | __SHIFTIN(cpu, MPIDR_AFF0));
143 return ETIMEDOUT; 151 return ETIMEDOUT;
144 } 152 }
145 153
146 /* Clear power-off gating */ 154 /* Clear power-off gating */
147 val = bus_space_read_4(bst, prcm, PRCM_CL_PWROFF(cluster)); 155 val = bus_space_read_4(bst, prcm, PRCM_CL_PWROFF(cluster));
148 if (cpu == 0) 156 if (soc == MC_SOC_A83T) {
149 val &= ~__BIT(4); 157 if (cpu == 0)
150 val &= ~__BIT(cpu); 158 val &= ~__BIT(4);
 159 val &= ~__BIT(0); /* cluster power gate */
 160 } else {
 161 val &= ~__BIT(cpu);
 162 val &= ~__BIT(4); /* cluster power gate */
 163 }
151 bus_space_write_4(bst, prcm, PRCM_CL_PWROFF(cluster), val); 164 bus_space_write_4(bst, prcm, PRCM_CL_PWROFF(cluster), val);
152 165
153 /* De-assert power-on reset */ 166 /* De-assert power-on reset */
154 val = bus_space_read_4(bst, prcm, PRCM_CL_RST_CTRL(cluster)); 167 val = bus_space_read_4(bst, prcm, PRCM_CL_RST_CTRL(cluster));
155 val |= __BIT(cpu); 168 val |= __BIT(cpu);
156 bus_space_write_4(bst, prcm, PRCM_CL_RST_CTRL(cluster), val); 169 bus_space_write_4(bst, prcm, PRCM_CL_RST_CTRL(cluster), val);
157 170
158 val = bus_space_read_4(bst, cpucfg, CPUCFG_CL_RST(cluster)); 171 if (soc == MC_SOC_A83T) {
159 val |= __BIT(cpu); 172 val = bus_space_read_4(bst, cpucfg, CPUCFG_CL_RST(cluster));
160 bus_space_write_4(bst, cpucfg, CPUCFG_CL_RST(cluster), val); 173 val |= __BIT(cpu);
161 delay(10); 174 bus_space_write_4(bst, cpucfg, CPUCFG_CL_RST(cluster), val);
 175 delay(10);
 176 }
162 177
163 /* De-assert core reset */ 178 /* De-assert core reset */
164 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster)); 179 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster));
165 val |= __BIT(cpu); 180 val |= __BIT(cpu);
166 val |= CPUXCFG_CL_RST_SOC_DBG_RST; 181 val |= CPUXCFG_CL_RST_SOC_DBG_RST;
167 val |= CPUXCFG_CL_RST_ETM_RST(cpu); 182 if (core == MC_CORE_CA7)
 183 val |= CPUXCFG_CL_RST_ETM_RST(cpu);
 184 else
 185 val |= CPUXCFG_CL_RST_CX_RST(cpu);
168 val |= CPUXCFG_CL_RST_DBG_RST(cpu); 186 val |= CPUXCFG_CL_RST_DBG_RST(cpu);
169 val |= CPUXCFG_CL_RST_L2_RST; 187 val |= CPUXCFG_CL_RST_L2_RST;
170 val |= CPUXCFG_CL_RST_H_RST; 188 val |= CPUXCFG_CL_RST_H_RST;
171 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster), val); 189 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_RST(cluster), val);
172 190
173 /* De-assert ACINACTM */ 191 /* De-assert ACINACTM */
174 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_CTRL1(cluster)); 192 val = bus_space_read_4(bst, cpuxcfg, CPUXCFG_CL_CTRL1(cluster));
175 val &= ~CPUXCFG_CL_CTRL1_ACINACTM; 193 val &= ~CPUXCFG_CL_CTRL1_ACINACTM;
176 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_CTRL1(cluster), val); 194 bus_space_write_4(bst, cpuxcfg, CPUXCFG_CL_CTRL1(cluster), val);
177 195
178 return 0; 196 return 0;
179} 197}
180 198
181int 199int
182sunxi_mc_smp_enable(u_int mpidr) 200sun8i_a83t_smp_enable(u_int mpidr)
183{ 201{
184 bus_space_tag_t bst = &arm_generic_bs_tag; 202 bus_space_tag_t bst = &arm_generic_bs_tag;
185 bus_space_handle_t prcm, cpucfg, cpuxcfg; 203 bus_space_handle_t prcm, cpucfg, cpuxcfg;
186 int error; 204 int error;
187 205
188 const u_int cluster = __SHIFTOUT(mpidr, MPIDR_AFF1); 206 const u_int cluster = __SHIFTOUT(mpidr, MPIDR_AFF1);
189 const u_int cpu = __SHIFTOUT(mpidr, MPIDR_AFF0); 207 const u_int cpu = __SHIFTOUT(mpidr, MPIDR_AFF0);
190 208
191 if (bus_space_map(bst, PRCM_BASE, PRCM_SIZE, 0, &prcm) != 0 || 209 if (bus_space_map(bst, A83T_PRCM_BASE, A83T_PRCM_SIZE, 0, &prcm) != 0 ||
192 bus_space_map(bst, CPUCFG_BASE, CPUCFG_SIZE, 0, &cpucfg) != 0 || 210 bus_space_map(bst, CPUCFG_BASE, CPUCFG_SIZE, 0, &cpucfg) != 0 ||
193 bus_space_map(bst, CPUXCFG_BASE, CPUXCFG_SIZE, 0, &cpuxcfg) != 0) 211 bus_space_map(bst, CPUXCFG_BASE, CPUXCFG_SIZE, 0, &cpuxcfg) != 0)
194 return ENOMEM; 212 return ENOMEM;
195 213
196 error = sunxi_mc_smp_start(bst, prcm, cpucfg, cpuxcfg, cluster, cpu); 214 for (int i = 0; i < 4; i++)
 215 sunxi_mc_cci_port[i] = A83T_CCI_BASE + CCI_SLAVEIF3_OFFSET;
 216 for (int i = 4; i < 8; i++)
 217 sunxi_mc_cci_port[i] = A83T_CCI_BASE + CCI_SLAVEIF4_OFFSET;
 218
 219 /* Set start vector */
 220 bus_space_write_4(bst, cpucfg, CPUCFG_P_REG0, sunxi_mc_smp_pa());
 221 cpu_idcache_wbinv_all();
 222
 223 error = sunxi_mc_smp_start(bst, prcm, cpucfg, cpuxcfg, cluster, cpu,
 224 MC_SOC_A83T, MC_CORE_CA7);
197 225
198 bus_space_unmap(bst, cpuxcfg, CPUXCFG_SIZE); 226 bus_space_unmap(bst, cpuxcfg, CPUXCFG_SIZE);
199 bus_space_unmap(bst, cpucfg, CPUCFG_SIZE); 227 bus_space_unmap(bst, cpucfg, CPUCFG_SIZE);
200 bus_space_unmap(bst, prcm, PRCM_SIZE); 228 bus_space_unmap(bst, prcm, A83T_PRCM_SIZE);
 229
 230 return error;
 231}
 232
 233int
 234sun9i_a80_smp_enable(u_int mpidr)
 235{
 236 bus_space_tag_t bst = &arm_generic_bs_tag;
 237 bus_space_handle_t prcm, cpuxcfg;
 238 int error;
 239
 240 const u_int cluster = __SHIFTOUT(mpidr, MPIDR_AFF1);
 241 const u_int cpu = __SHIFTOUT(mpidr, MPIDR_AFF0);
 242
 243 if (bus_space_map(bst, A80_PRCM_BASE, A80_PRCM_SIZE, 0, &prcm) != 0 ||
 244 bus_space_map(bst, CPUXCFG_BASE, CPUXCFG_SIZE, 0, &cpuxcfg) != 0)
 245 return ENOMEM;
 246
 247 for (int i = 0; i < 4; i++)
 248 sunxi_mc_cci_port[i] = A80_CCI_BASE + CCI_SLAVEIF3_OFFSET;
 249 for (int i = 4; i < 8; i++)
 250 sunxi_mc_cci_port[i] = A80_CCI_BASE + CCI_SLAVEIF4_OFFSET;
 251
 252 /* Set start vector */
 253 bus_space_write_4(bst, prcm, PRCM_CPU_SOFT_ENTRY, sunxi_mc_smp_pa());
 254 cpu_idcache_wbinv_all();
 255
 256 error = sunxi_mc_smp_start(bst, prcm, 0, cpuxcfg, cluster, cpu,
 257 MC_SOC_A80, cluster == 0 ? MC_CORE_CA7 : MC_CORE_CA15);
 258
 259 bus_space_unmap(bst, cpuxcfg, CPUXCFG_SIZE);
 260 bus_space_unmap(bst, prcm, A80_PRCM_SIZE);
201 261
202 return error; 262 return error;
203} 263}

cvs diff -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_mc_smp.h (switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_mc_smp.h 2019/01/03 11:01:59 1.1
+++ src/sys/arch/arm/sunxi/sunxi_mc_smp.h 2019/01/03 14:44:21 1.2
@@ -1,35 +1,36 @@ @@ -1,35 +1,36 @@
1/* $NetBSD: sunxi_mc_smp.h,v 1.1 2019/01/03 11:01:59 jmcneill Exp $ */ 1/* $NetBSD: sunxi_mc_smp.h,v 1.2 2019/01/03 14:44:21 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#ifndef _SUNXI_MC_SMP_H 29#ifndef _SUNXI_MC_SMP_H
30#define _SUNXI_MC_SMP_H 30#define _SUNXI_MC_SMP_H
31 31
32int sunxi_mc_smp_match(const char *); 32int sunxi_mc_smp_match(const char *);
33int sunxi_mc_smp_enable(u_int); 33int sun8i_a83t_smp_enable(u_int);
 34int sun9i_a80_smp_enable(u_int);
34 35
35#endif /* !_SUNXI_MC_SMP_H */ 36#endif /* !_SUNXI_MC_SMP_H */

cvs diff -r1.33 -r1.34 src/sys/arch/arm/sunxi/sunxi_platform.c (switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_platform.c 2019/01/03 12:52:40 1.33
+++ src/sys/arch/arm/sunxi/sunxi_platform.c 2019/01/03 14:44:21 1.34
@@ -1,451 +1,486 @@ @@ -1,451 +1,486 @@
1/* $NetBSD: sunxi_platform.c,v 1.33 2019/01/03 12:52:40 jmcneill Exp $ */ 1/* $NetBSD: sunxi_platform.c,v 1.34 2019/01/03 14:44:21 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_soc.h" 29#include "opt_soc.h"
30#include "opt_multiprocessor.h" 30#include "opt_multiprocessor.h"
31#include "opt_console.h" 31#include "opt_console.h"
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.33 2019/01/03 12:52:40 jmcneill Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.34 2019/01/03 14:44:21 jmcneill Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/termios.h> 40#include <sys/termios.h>
41 41
42#include <dev/fdt/fdtvar.h> 42#include <dev/fdt/fdtvar.h>
43#include <arm/fdt/arm_fdtvar.h> 43#include <arm/fdt/arm_fdtvar.h>
44 44
45#include <uvm/uvm_extern.h> 45#include <uvm/uvm_extern.h>
46 46
47#include <machine/bootconfig.h> 47#include <machine/bootconfig.h>
48#include <arm/cpufunc.h> 48#include <arm/cpufunc.h>
49 49
50#include <arm/cortex/gtmr_var.h> 50#include <arm/cortex/gtmr_var.h>
51#include <arm/cortex/gic_reg.h> 51#include <arm/cortex/gic_reg.h>
52 52
53#include <dev/ic/ns16550reg.h> 53#include <dev/ic/ns16550reg.h>
54#include <dev/ic/comreg.h> 54#include <dev/ic/comreg.h>
55 55
56#include <arm/arm/psci.h> 56#include <arm/arm/psci.h>
57#include <arm/fdt/psci_fdtvar.h> 57#include <arm/fdt/psci_fdtvar.h>
58 58
59#include <arm/sunxi/sunxi_platform.h> 59#include <arm/sunxi/sunxi_platform.h>
60 60
61#if defined(SOC_SUNXI_MC) 61#if defined(SOC_SUNXI_MC)
62#include <arm/sunxi/sunxi_mc_smp.h> 62#include <arm/sunxi/sunxi_mc_smp.h>
63#endif 63#endif
64 64
65#include <libfdt.h> 65#include <libfdt.h>
66 66
67#define SUNXI_REF_FREQ 24000000 67#define SUNXI_REF_FREQ 24000000
68 68
69#define SUN4I_TIMER_BASE 0x01c20c00 69#define SUN4I_TIMER_BASE 0x01c20c00
70#define SUN4I_TIMER_SIZE 0x90 70#define SUN4I_TIMER_SIZE 0x90
71#define SUN4I_TIMER_1_CTRL 0x20 71#define SUN4I_TIMER_1_CTRL 0x20
72#define SUN4I_TIMER_1_CTRL_CLK_SRC __BITS(3,2) 72#define SUN4I_TIMER_1_CTRL_CLK_SRC __BITS(3,2)
73#define SUN4I_TIMER_1_CTRL_CLK_SRC_OSC24M 1 73#define SUN4I_TIMER_1_CTRL_CLK_SRC_OSC24M 1
74#define SUN4I_TIMER_1_CTRL_RELOAD __BIT(1) 74#define SUN4I_TIMER_1_CTRL_RELOAD __BIT(1)
75#define SUN4I_TIMER_1_CTRL_EN __BIT(0) 75#define SUN4I_TIMER_1_CTRL_EN __BIT(0)
76#define SUN4I_TIMER_1_INTV_VALUE 0x24 76#define SUN4I_TIMER_1_INTV_VALUE 0x24
77#define SUN4I_TIMER_1_VAL 0x28 77#define SUN4I_TIMER_1_VAL 0x28
78 78
79#define SUN4I_WDT_BASE 0x01c20c90 79#define SUN4I_WDT_BASE 0x01c20c90
80#define SUN4I_WDT_SIZE 0x10 80#define SUN4I_WDT_SIZE 0x10
81#define SUN4I_WDT_CTRL 0x00 81#define SUN4I_WDT_CTRL 0x00
82#define SUN4I_WDT_CTRL_KEY (0x333 << 1) 82#define SUN4I_WDT_CTRL_KEY (0x333 << 1)
83#define SUN4I_WDT_CTRL_RESTART __BIT(0) 83#define SUN4I_WDT_CTRL_RESTART __BIT(0)
84#define SUN4I_WDT_MODE 0x04 84#define SUN4I_WDT_MODE 0x04
85#define SUN4I_WDT_MODE_RST_EN __BIT(1) 85#define SUN4I_WDT_MODE_RST_EN __BIT(1)
86#define SUN4I_WDT_MODE_EN __BIT(0) 86#define SUN4I_WDT_MODE_EN __BIT(0)
87 87
88#define SUN6I_WDT_BASE 0x01c20ca0 88#define SUN6I_WDT_BASE 0x01c20ca0
89#define SUN6I_WDT_SIZE 0x20 89#define SUN6I_WDT_SIZE 0x20
90#define SUN6I_WDT_CFG 0x14 90#define SUN6I_WDT_CFG 0x14
91#define SUN6I_WDT_CFG_SYS __BIT(0) 91#define SUN6I_WDT_CFG_SYS __BIT(0)
92#define SUN6I_WDT_MODE 0x18 92#define SUN6I_WDT_MODE 0x18
93#define SUN6I_WDT_MODE_EN __BIT(0) 93#define SUN6I_WDT_MODE_EN __BIT(0)
94 94
95#define SUN9I_WDT_BASE 0x06000ca0 95#define SUN9I_WDT_BASE 0x06000ca0
96#define SUN9I_WDT_SIZE 0x20 96#define SUN9I_WDT_SIZE 0x20
97#define SUN9I_WDT_CFG 0x14 97#define SUN9I_WDT_CFG 0x14
98#define SUN9I_WDT_CFG_SYS __BIT(0) 98#define SUN9I_WDT_CFG_SYS __BIT(0)
99#define SUN9I_WDT_MODE 0x18 99#define SUN9I_WDT_MODE 0x18
100#define SUN9I_WDT_MODE_EN __BIT(0) 100#define SUN9I_WDT_MODE_EN __BIT(0)
101 101
102#define SUN50I_H6_WDT_BASE 0x01c20ca0 102#define SUN50I_H6_WDT_BASE 0x01c20ca0
103#define SUN50I_H6_WDT_SIZE 0x20 103#define SUN50I_H6_WDT_SIZE 0x20
104#define SUN50I_H6_WDT_CFG 0x14 104#define SUN50I_H6_WDT_CFG 0x14
105#define SUN50I_H6_WDT_CFG_SYS __BIT(0) 105#define SUN50I_H6_WDT_CFG_SYS __BIT(0)
106#define SUN50I_H6_WDT_MODE 0x18 106#define SUN50I_H6_WDT_MODE 0x18
107#define SUN50I_H6_WDT_MODE_EN __BIT(0) 107#define SUN50I_H6_WDT_MODE_EN __BIT(0)
108 108
109extern struct arm32_bus_dma_tag arm_generic_dma_tag; 109extern struct arm32_bus_dma_tag arm_generic_dma_tag;
110extern struct bus_space arm_generic_bs_tag; 110extern struct bus_space arm_generic_bs_tag;
111extern struct bus_space arm_generic_a4x_bs_tag; 111extern struct bus_space arm_generic_a4x_bs_tag;
112 112
113#define sunxi_dma_tag arm_generic_dma_tag 113#define sunxi_dma_tag arm_generic_dma_tag
114#define sunxi_bs_tag arm_generic_bs_tag 114#define sunxi_bs_tag arm_generic_bs_tag
115#define sunxi_a4x_bs_tag arm_generic_a4x_bs_tag 115#define sunxi_a4x_bs_tag arm_generic_a4x_bs_tag
116 116
117static const struct pmap_devmap * 117static const struct pmap_devmap *
118sunxi_platform_devmap(void) 118sunxi_platform_devmap(void)
119{ 119{
120 static const struct pmap_devmap devmap[] = { 120 static const struct pmap_devmap devmap[] = {
121 DEVMAP_ENTRY(SUNXI_CORE_VBASE, 121 DEVMAP_ENTRY(SUNXI_CORE_VBASE,
122 SUNXI_CORE_PBASE, 122 SUNXI_CORE_PBASE,
123 SUNXI_CORE_SIZE), 123 SUNXI_CORE_SIZE),
124 DEVMAP_ENTRY_END 124 DEVMAP_ENTRY_END
125 }; 125 };
126 126
127 return devmap; 127 return devmap;
128} 128}
129 129
130#define SUN8I_A83T_CPU_VBASE (SUNXI_CORE_VBASE + SUNXI_CORE_SIZE) 130#define SUNXI_MC_CPU_VBASE (SUNXI_CORE_VBASE + SUNXI_CORE_SIZE)
131#define SUN8I_A83T_CPU_PBASE 0x01700000 131#define SUNXI_MC_CPU_PBASE 0x01700000
132#define SUN8I_A83T_CPU_SIZE 0x00100000 132#define SUNXI_MC_CPU_SIZE 0x00100000
133 133
134static const struct pmap_devmap * 134static const struct pmap_devmap *
135sun8i_a83t_platform_devmap(void) 135sun8i_a83t_platform_devmap(void)
136{ 136{
137 static const struct pmap_devmap devmap[] = { 137 static const struct pmap_devmap devmap[] = {
138 DEVMAP_ENTRY(SUNXI_CORE_VBASE, 138 DEVMAP_ENTRY(SUNXI_CORE_VBASE,
139 SUNXI_CORE_PBASE, 139 SUNXI_CORE_PBASE,
140 SUNXI_CORE_SIZE), 140 SUNXI_CORE_SIZE),
141 DEVMAP_ENTRY(SUN8I_A83T_CPU_VBASE, 141 DEVMAP_ENTRY(SUNXI_MC_CPU_VBASE,
142 SUN8I_A83T_CPU_PBASE, 142 SUNXI_MC_CPU_PBASE,
143 SUN8I_A83T_CPU_SIZE), 143 SUNXI_MC_CPU_SIZE),
144 DEVMAP_ENTRY_END 144 DEVMAP_ENTRY_END
145 }; 145 };
146 146
147 return devmap; 147 return devmap;
148} 148}
149 149
 150#define SUN9I_A80_PRCM_VBASE (SUNXI_MC_CPU_VBASE + SUNXI_MC_CPU_PBASE)
 151#define SUN9I_A80_PRCM_PBASE 0x08000000
 152#define SUN9I_A80_PRCM_SIZE 0x00100000
 153
 154static const struct pmap_devmap *
 155sun9i_a80_platform_devmap(void)
 156{
 157 static const struct pmap_devmap devmap[] = {
 158 DEVMAP_ENTRY(SUNXI_CORE_VBASE,
 159 SUNXI_CORE_PBASE,
 160 SUNXI_CORE_SIZE),
 161 DEVMAP_ENTRY(SUNXI_MC_CPU_VBASE,
 162 SUNXI_MC_CPU_PBASE,
 163 SUNXI_MC_CPU_SIZE),
 164 DEVMAP_ENTRY(SUN9I_A80_PRCM_VBASE,
 165 SUN9I_A80_PRCM_PBASE,
 166 SUN9I_A80_PRCM_SIZE),
 167 DEVMAP_ENTRY_END
 168 };
 169
 170 return devmap;
 171}
 172
 173
150static void 174static void
151sunxi_platform_init_attach_args(struct fdt_attach_args *faa) 175sunxi_platform_init_attach_args(struct fdt_attach_args *faa)
152{ 176{
153 faa->faa_bst = &sunxi_bs_tag; 177 faa->faa_bst = &sunxi_bs_tag;
154 faa->faa_a4x_bst = &sunxi_a4x_bs_tag; 178 faa->faa_a4x_bst = &sunxi_a4x_bs_tag;
155 faa->faa_dmat = &sunxi_dma_tag; 179 faa->faa_dmat = &sunxi_dma_tag;
156} 180}
157 181
158void sunxi_platform_early_putchar(char); 182void sunxi_platform_early_putchar(char);
159 183
160void 184void
161sunxi_platform_early_putchar(char c) 185sunxi_platform_early_putchar(char c)
162{ 186{
163#ifdef CONSADDR 187#ifdef CONSADDR
164#define CONSADDR_VA ((CONSADDR - SUNXI_CORE_PBASE) + SUNXI_CORE_VBASE) 188#define CONSADDR_VA ((CONSADDR - SUNXI_CORE_PBASE) + SUNXI_CORE_VBASE)
165 volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ? 189 volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ?
166 (volatile uint32_t *)CONSADDR_VA : 190 (volatile uint32_t *)CONSADDR_VA :
167 (volatile uint32_t *)CONSADDR; 191 (volatile uint32_t *)CONSADDR;
168 192
169 while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0) 193 while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0)
170 ; 194 ;
171 195
172 uartaddr[com_data] = htole32(c); 196 uartaddr[com_data] = htole32(c);
173#endif 197#endif
174} 198}
175 199
176static void 200static void
177sunxi_platform_device_register(device_t self, void *aux) 201sunxi_platform_device_register(device_t self, void *aux)
178{ 202{
179 prop_dictionary_t prop = device_properties(self); 203 prop_dictionary_t prop = device_properties(self);
180 204
181 if (device_is_a(self, "rgephy")) { 205 if (device_is_a(self, "rgephy")) {
182 /* Pine64+ and NanoPi NEO Plus2 gigabit ethernet workaround */ 206 /* Pine64+ and NanoPi NEO Plus2 gigabit ethernet workaround */
183 const char * compat[] = { 207 const char * compat[] = {
184 "pine64,pine64-plus", 208 "pine64,pine64-plus",
185 "friendlyarm,nanopi-neo-plus2", 209 "friendlyarm,nanopi-neo-plus2",
186 NULL 210 NULL
187 }; 211 };
188 if (of_match_compatible(OF_finddevice("/"), compat)) { 212 if (of_match_compatible(OF_finddevice("/"), compat)) {
189 prop_dictionary_set_bool(prop, "no-rx-delay", true); 213 prop_dictionary_set_bool(prop, "no-rx-delay", true);
190 } 214 }
191 } 215 }
192 216
193 if (device_is_a(self, "armgtmr")) { 217 if (device_is_a(self, "armgtmr")) {
194 /* Allwinner A64 has an unstable architectural timer */ 218 /* Allwinner A64 has an unstable architectural timer */
195 const char * compat[] = { 219 const char * compat[] = {
196 "allwinner,sun50i-a64", 220 "allwinner,sun50i-a64",
197 NULL 221 NULL
198 }; 222 };
199 if (of_match_compatible(OF_finddevice("/"), compat)) { 223 if (of_match_compatible(OF_finddevice("/"), compat)) {
200 prop_dictionary_set_bool(prop, "sun50i-a64-unstable-timer", true); 224 prop_dictionary_set_bool(prop, "sun50i-a64-unstable-timer", true);
201 } 225 }
202 } 226 }
203} 227}
204 228
205static u_int 229static u_int
206sunxi_platform_uart_freq(void) 230sunxi_platform_uart_freq(void)
207{ 231{
208 return SUNXI_REF_FREQ; 232 return SUNXI_REF_FREQ;
209} 233}
210 234
211static void 235static void
212sunxi_platform_bootstrap(void) 236sunxi_platform_bootstrap(void)
213{ 237{
214 arm_fdt_cpu_bootstrap(); 238 arm_fdt_cpu_bootstrap();
215 239
216 void *fdt_data = __UNCONST(fdtbus_get_data()); 240 void *fdt_data = __UNCONST(fdtbus_get_data());
217 const int chosen_off = fdt_path_offset(fdt_data, "/chosen"); 241 const int chosen_off = fdt_path_offset(fdt_data, "/chosen");
218 if (chosen_off < 0) 242 if (chosen_off < 0)
219 return; 243 return;
220 244
221 if (match_bootconf_option(boot_args, "console", "fb")) { 245 if (match_bootconf_option(boot_args, "console", "fb")) {
222 const int framebuffer_off = 246 const int framebuffer_off =
223 fdt_path_offset(fdt_data, "/chosen/framebuffer"); 247 fdt_path_offset(fdt_data, "/chosen/framebuffer");
224 if (framebuffer_off >= 0) { 248 if (framebuffer_off >= 0) {
225 const char *status = fdt_getprop(fdt_data, 249 const char *status = fdt_getprop(fdt_data,
226 framebuffer_off, "status", NULL); 250 framebuffer_off, "status", NULL);
227 if (status == NULL || strncmp(status, "ok", 2) == 0) { 251 if (status == NULL || strncmp(status, "ok", 2) == 0) {
228 fdt_setprop_string(fdt_data, chosen_off, 252 fdt_setprop_string(fdt_data, chosen_off,
229 "stdout-path", "/chosen/framebuffer"); 253 "stdout-path", "/chosen/framebuffer");
230 } 254 }
231 } 255 }
232 } else if (match_bootconf_option(boot_args, "console", "serial")) { 256 } else if (match_bootconf_option(boot_args, "console", "serial")) {
233 fdt_setprop_string(fdt_data, chosen_off, 257 fdt_setprop_string(fdt_data, chosen_off,
234 "stdout-path", "serial0:115200n8"); 258 "stdout-path", "serial0:115200n8");
235 } 259 }
236} 260}
237 261
238#if defined(SOC_SUNXI_MC) 262#if defined(SOC_SUNXI_MC)
239static int 263static int
240cpu_enable_sunxi_mc(int phandle) 264cpu_enable_sun8i_a83t(int phandle)
241{ 265{
242 uint64_t mpidr; 266 uint64_t mpidr;
243 267
244 fdtbus_get_reg64(phandle, 0, &mpidr, NULL); 268 fdtbus_get_reg64(phandle, 0, &mpidr, NULL);
245 269
246 return sunxi_mc_smp_enable(mpidr); 270 return sun8i_a83t_smp_enable(mpidr);
247} 271}
248ARM_CPU_METHOD(sun8i_a83t, "allwinner,sun8i-a83t-smp", cpu_enable_sunxi_mc); 272ARM_CPU_METHOD(sun8i_a83t, "allwinner,sun8i-a83t-smp", cpu_enable_sun8i_a83t);
 273
 274static int
 275cpu_enable_sun9i_a80(int phandle)
 276{
 277 uint64_t mpidr;
 278
 279 fdtbus_get_reg64(phandle, 0, &mpidr, NULL);
 280
 281 return sun9i_a80_smp_enable(mpidr);
 282}
 283ARM_CPU_METHOD(sun9i_a80, "allwinner,sun9i-a80-smp", cpu_enable_sun9i_a80);
249#endif 284#endif
250 285
251static void 286static void
252sun4i_platform_reset(void) 287sun4i_platform_reset(void)
253{ 288{
254 bus_space_tag_t bst = &sunxi_bs_tag; 289 bus_space_tag_t bst = &sunxi_bs_tag;
255 bus_space_handle_t bsh; 290 bus_space_handle_t bsh;
256 291
257 bus_space_map(bst, SUN4I_WDT_BASE, SUN4I_WDT_SIZE, 0, &bsh); 292 bus_space_map(bst, SUN4I_WDT_BASE, SUN4I_WDT_SIZE, 0, &bsh);
258 293
259 bus_space_write_4(bst, bsh, SUN4I_WDT_CTRL, 294 bus_space_write_4(bst, bsh, SUN4I_WDT_CTRL,
260 SUN4I_WDT_CTRL_KEY | SUN4I_WDT_CTRL_RESTART); 295 SUN4I_WDT_CTRL_KEY | SUN4I_WDT_CTRL_RESTART);
261 for (;;) { 296 for (;;) {
262 bus_space_write_4(bst, bsh, SUN4I_WDT_MODE, 297 bus_space_write_4(bst, bsh, SUN4I_WDT_MODE,
263 SUN4I_WDT_MODE_EN | SUN4I_WDT_MODE_RST_EN); 298 SUN4I_WDT_MODE_EN | SUN4I_WDT_MODE_RST_EN);
264 } 299 }
265} 300}
266 301
267static void 302static void
268sun4i_platform_delay(u_int n) 303sun4i_platform_delay(u_int n)
269{ 304{
270 static bus_space_tag_t bst = &sunxi_bs_tag; 305 static bus_space_tag_t bst = &sunxi_bs_tag;
271 static bus_space_handle_t bsh = 0; 306 static bus_space_handle_t bsh = 0;
272 const long incs_per_us = SUNXI_REF_FREQ / 1000000; 307 const long incs_per_us = SUNXI_REF_FREQ / 1000000;
273 long ticks = n * incs_per_us; 308 long ticks = n * incs_per_us;
274 uint32_t cur, prev; 309 uint32_t cur, prev;
275 310
276 if (bsh == 0) { 311 if (bsh == 0) {
277 bus_space_map(bst, SUN4I_TIMER_BASE, SUN4I_TIMER_SIZE, 0, &bsh); 312 bus_space_map(bst, SUN4I_TIMER_BASE, SUN4I_TIMER_SIZE, 0, &bsh);
278 313
279 /* Enable Timer 1 */ 314 /* Enable Timer 1 */
280 bus_space_write_4(bst, bsh, SUN4I_TIMER_1_INTV_VALUE, ~0U); 315 bus_space_write_4(bst, bsh, SUN4I_TIMER_1_INTV_VALUE, ~0U);
281 bus_space_write_4(bst, bsh, SUN4I_TIMER_1_CTRL, 316 bus_space_write_4(bst, bsh, SUN4I_TIMER_1_CTRL,
282 SUN4I_TIMER_1_CTRL_EN | 317 SUN4I_TIMER_1_CTRL_EN |
283 SUN4I_TIMER_1_CTRL_RELOAD | 318 SUN4I_TIMER_1_CTRL_RELOAD |
284 __SHIFTIN(SUN4I_TIMER_1_CTRL_CLK_SRC_OSC24M, 319 __SHIFTIN(SUN4I_TIMER_1_CTRL_CLK_SRC_OSC24M,
285 SUN4I_TIMER_1_CTRL_CLK_SRC)); 320 SUN4I_TIMER_1_CTRL_CLK_SRC));
286 } 321 }
287 322
288 prev = ~bus_space_read_4(bst, bsh, SUN4I_TIMER_1_VAL); 323 prev = ~bus_space_read_4(bst, bsh, SUN4I_TIMER_1_VAL);
289 while (ticks > 0) { 324 while (ticks > 0) {
290 cur = ~bus_space_read_4(bst, bsh, SUN4I_TIMER_1_VAL); 325 cur = ~bus_space_read_4(bst, bsh, SUN4I_TIMER_1_VAL);
291 if (cur > prev) 326 if (cur > prev)
292 ticks -= (cur - prev); 327 ticks -= (cur - prev);
293 else 328 else
294 ticks -= (~0U - cur + prev); 329 ticks -= (~0U - cur + prev);
295 prev = cur; 330 prev = cur;
296 } 331 }
297} 332}
298 333
299static void 334static void
300sun6i_platform_reset(void) 335sun6i_platform_reset(void)
301{ 336{
302 bus_space_tag_t bst = &sunxi_bs_tag; 337 bus_space_tag_t bst = &sunxi_bs_tag;
303 bus_space_handle_t bsh; 338 bus_space_handle_t bsh;
304 339
305 bus_space_map(bst, SUN6I_WDT_BASE, SUN6I_WDT_SIZE, 0, &bsh); 340 bus_space_map(bst, SUN6I_WDT_BASE, SUN6I_WDT_SIZE, 0, &bsh);
306 341
307 bus_space_write_4(bst, bsh, SUN6I_WDT_CFG, SUN6I_WDT_CFG_SYS); 342 bus_space_write_4(bst, bsh, SUN6I_WDT_CFG, SUN6I_WDT_CFG_SYS);
308 bus_space_write_4(bst, bsh, SUN6I_WDT_MODE, SUN6I_WDT_MODE_EN); 343 bus_space_write_4(bst, bsh, SUN6I_WDT_MODE, SUN6I_WDT_MODE_EN);
309} 344}
310 345
311static void 346static void
312sun9i_platform_reset(void) 347sun9i_platform_reset(void)
313{ 348{
314 bus_space_tag_t bst = &sunxi_bs_tag; 349 bus_space_tag_t bst = &sunxi_bs_tag;
315 bus_space_handle_t bsh; 350 bus_space_handle_t bsh;
316 351
317 bus_space_map(bst, SUN9I_WDT_BASE, SUN9I_WDT_SIZE, 0, &bsh); 352 bus_space_map(bst, SUN9I_WDT_BASE, SUN9I_WDT_SIZE, 0, &bsh);
318 353
319 bus_space_write_4(bst, bsh, SUN9I_WDT_CFG, SUN9I_WDT_CFG_SYS); 354 bus_space_write_4(bst, bsh, SUN9I_WDT_CFG, SUN9I_WDT_CFG_SYS);
320 bus_space_write_4(bst, bsh, SUN9I_WDT_MODE, SUN9I_WDT_MODE_EN); 355 bus_space_write_4(bst, bsh, SUN9I_WDT_MODE, SUN9I_WDT_MODE_EN);
321} 356}
322 357
323static void 358static void
324sun50i_h6_platform_reset(void) 359sun50i_h6_platform_reset(void)
325{ 360{
326 bus_space_tag_t bst = &sunxi_bs_tag; 361 bus_space_tag_t bst = &sunxi_bs_tag;
327 bus_space_handle_t bsh; 362 bus_space_handle_t bsh;
328 363
329 bus_space_map(bst, SUN50I_H6_WDT_BASE, SUN50I_H6_WDT_SIZE, 0, &bsh); 364 bus_space_map(bst, SUN50I_H6_WDT_BASE, SUN50I_H6_WDT_SIZE, 0, &bsh);
330 365
331 bus_space_write_4(bst, bsh, SUN50I_H6_WDT_CFG, SUN50I_H6_WDT_CFG_SYS); 366 bus_space_write_4(bst, bsh, SUN50I_H6_WDT_CFG, SUN50I_H6_WDT_CFG_SYS);
332 bus_space_write_4(bst, bsh, SUN50I_H6_WDT_MODE, SUN50I_H6_WDT_MODE_EN); 367 bus_space_write_4(bst, bsh, SUN50I_H6_WDT_MODE, SUN50I_H6_WDT_MODE_EN);
333} 368}
334 369
335static const struct arm_platform sun4i_platform = { 370static const struct arm_platform sun4i_platform = {
336 .ap_devmap = sunxi_platform_devmap, 371 .ap_devmap = sunxi_platform_devmap,
337 .ap_bootstrap = sunxi_platform_bootstrap, 372 .ap_bootstrap = sunxi_platform_bootstrap,
338 .ap_init_attach_args = sunxi_platform_init_attach_args, 373 .ap_init_attach_args = sunxi_platform_init_attach_args,
339 .ap_device_register = sunxi_platform_device_register, 374 .ap_device_register = sunxi_platform_device_register,
340 .ap_reset = sun4i_platform_reset, 375 .ap_reset = sun4i_platform_reset,
341 .ap_delay = sun4i_platform_delay, 376 .ap_delay = sun4i_platform_delay,
342 .ap_uart_freq = sunxi_platform_uart_freq, 377 .ap_uart_freq = sunxi_platform_uart_freq,
343}; 378};
344 379
345ARM_PLATFORM(sun4i_a10, "allwinner,sun4i-a10", &sun4i_platform); 380ARM_PLATFORM(sun4i_a10, "allwinner,sun4i-a10", &sun4i_platform);
346 381
347static const struct arm_platform sun5i_platform = { 382static const struct arm_platform sun5i_platform = {
348 .ap_devmap = sunxi_platform_devmap, 383 .ap_devmap = sunxi_platform_devmap,
349 .ap_bootstrap = sunxi_platform_bootstrap, 384 .ap_bootstrap = sunxi_platform_bootstrap,
350 .ap_init_attach_args = sunxi_platform_init_attach_args, 385 .ap_init_attach_args = sunxi_platform_init_attach_args,
351 .ap_device_register = sunxi_platform_device_register, 386 .ap_device_register = sunxi_platform_device_register,
352 .ap_reset = sun4i_platform_reset, 387 .ap_reset = sun4i_platform_reset,
353 .ap_delay = sun4i_platform_delay, 388 .ap_delay = sun4i_platform_delay,
354 .ap_uart_freq = sunxi_platform_uart_freq, 389 .ap_uart_freq = sunxi_platform_uart_freq,
355}; 390};
356 391
357ARM_PLATFORM(sun5i_a13, "allwinner,sun5i-a13", &sun5i_platform); 392ARM_PLATFORM(sun5i_a13, "allwinner,sun5i-a13", &sun5i_platform);
358ARM_PLATFORM(sun5i_gr8, "nextthing,gr8", &sun5i_platform); 393ARM_PLATFORM(sun5i_gr8, "nextthing,gr8", &sun5i_platform);
359 394
360static const struct arm_platform sun6i_platform = { 395static const struct arm_platform sun6i_platform = {
361 .ap_devmap = sunxi_platform_devmap, 396 .ap_devmap = sunxi_platform_devmap,
362 .ap_bootstrap = sunxi_platform_bootstrap, 397 .ap_bootstrap = sunxi_platform_bootstrap,
363 .ap_init_attach_args = sunxi_platform_init_attach_args, 398 .ap_init_attach_args = sunxi_platform_init_attach_args,
364 .ap_device_register = sunxi_platform_device_register, 399 .ap_device_register = sunxi_platform_device_register,
365 .ap_reset = sun6i_platform_reset, 400 .ap_reset = sun6i_platform_reset,
366 .ap_delay = gtmr_delay, 401 .ap_delay = gtmr_delay,
367 .ap_uart_freq = sunxi_platform_uart_freq, 402 .ap_uart_freq = sunxi_platform_uart_freq,
368 .ap_mpstart = arm_fdt_cpu_mpstart, 403 .ap_mpstart = arm_fdt_cpu_mpstart,
369}; 404};
370 405
371ARM_PLATFORM(sun6i_a31, "allwinner,sun6i-a31", &sun6i_platform); 406ARM_PLATFORM(sun6i_a31, "allwinner,sun6i-a31", &sun6i_platform);
372 407
373static const struct arm_platform sun7i_platform = { 408static const struct arm_platform sun7i_platform = {
374 .ap_devmap = sunxi_platform_devmap, 409 .ap_devmap = sunxi_platform_devmap,
375 .ap_bootstrap = sunxi_platform_bootstrap, 410 .ap_bootstrap = sunxi_platform_bootstrap,
376 .ap_init_attach_args = sunxi_platform_init_attach_args, 411 .ap_init_attach_args = sunxi_platform_init_attach_args,
377 .ap_device_register = sunxi_platform_device_register, 412 .ap_device_register = sunxi_platform_device_register,
378 .ap_reset = sun4i_platform_reset, 413 .ap_reset = sun4i_platform_reset,
379 .ap_delay = sun4i_platform_delay, 414 .ap_delay = sun4i_platform_delay,
380 .ap_uart_freq = sunxi_platform_uart_freq, 415 .ap_uart_freq = sunxi_platform_uart_freq,
381 .ap_mpstart = arm_fdt_cpu_mpstart, 416 .ap_mpstart = arm_fdt_cpu_mpstart,
382}; 417};
383 418
384ARM_PLATFORM(sun7i_a20, "allwinner,sun7i-a20", &sun7i_platform); 419ARM_PLATFORM(sun7i_a20, "allwinner,sun7i-a20", &sun7i_platform);
385 420
386static const struct arm_platform sun8i_platform = { 421static const struct arm_platform sun8i_platform = {
387 .ap_devmap = sunxi_platform_devmap, 422 .ap_devmap = sunxi_platform_devmap,
388 .ap_bootstrap = sunxi_platform_bootstrap, 423 .ap_bootstrap = sunxi_platform_bootstrap,
389 .ap_init_attach_args = sunxi_platform_init_attach_args, 424 .ap_init_attach_args = sunxi_platform_init_attach_args,
390 .ap_device_register = sunxi_platform_device_register, 425 .ap_device_register = sunxi_platform_device_register,
391 .ap_reset = sun6i_platform_reset, 426 .ap_reset = sun6i_platform_reset,
392 .ap_delay = gtmr_delay, 427 .ap_delay = gtmr_delay,
393 .ap_uart_freq = sunxi_platform_uart_freq, 428 .ap_uart_freq = sunxi_platform_uart_freq,
394 .ap_mpstart = arm_fdt_cpu_mpstart, 429 .ap_mpstart = arm_fdt_cpu_mpstart,
395}; 430};
396 431
397ARM_PLATFORM(sun8i_h2plus, "allwinner,sun8i-h2-plus", &sun8i_platform); 432ARM_PLATFORM(sun8i_h2plus, "allwinner,sun8i-h2-plus", &sun8i_platform);
398ARM_PLATFORM(sun8i_h3, "allwinner,sun8i-h3", &sun8i_platform); 433ARM_PLATFORM(sun8i_h3, "allwinner,sun8i-h3", &sun8i_platform);
399 434
400static const struct arm_platform sun8i_a83t_platform = { 435static const struct arm_platform sun8i_a83t_platform = {
401 .ap_devmap = sun8i_a83t_platform_devmap, 436 .ap_devmap = sun8i_a83t_platform_devmap,
402 .ap_bootstrap = sunxi_platform_bootstrap, 437 .ap_bootstrap = sunxi_platform_bootstrap,
403 .ap_init_attach_args = sunxi_platform_init_attach_args, 438 .ap_init_attach_args = sunxi_platform_init_attach_args,
404 .ap_device_register = sunxi_platform_device_register, 439 .ap_device_register = sunxi_platform_device_register,
405 .ap_reset = sun6i_platform_reset, 440 .ap_reset = sun6i_platform_reset,
406 .ap_delay = gtmr_delay, 441 .ap_delay = gtmr_delay,
407 .ap_uart_freq = sunxi_platform_uart_freq, 442 .ap_uart_freq = sunxi_platform_uart_freq,
408 .ap_mpstart = arm_fdt_cpu_mpstart, 443 .ap_mpstart = arm_fdt_cpu_mpstart,
409}; 444};
410 445
411ARM_PLATFORM(sun8i_a83t, "allwinner,sun8i-a83t", &sun8i_a83t_platform); 446ARM_PLATFORM(sun8i_a83t, "allwinner,sun8i-a83t", &sun8i_a83t_platform);
412 447
413static const struct arm_platform sun9i_platform = { 448static const struct arm_platform sun9i_platform = {
414 .ap_devmap = sunxi_platform_devmap, 449 .ap_devmap = sun9i_a80_platform_devmap,
415 .ap_bootstrap = sunxi_platform_bootstrap, 450 .ap_bootstrap = sunxi_platform_bootstrap,
416 .ap_init_attach_args = sunxi_platform_init_attach_args, 451 .ap_init_attach_args = sunxi_platform_init_attach_args,
417 .ap_device_register = sunxi_platform_device_register, 452 .ap_device_register = sunxi_platform_device_register,
418 .ap_reset = sun9i_platform_reset, 453 .ap_reset = sun9i_platform_reset,
419 .ap_delay = gtmr_delay, 454 .ap_delay = gtmr_delay,
420 .ap_uart_freq = sunxi_platform_uart_freq, 455 .ap_uart_freq = sunxi_platform_uart_freq,
421 .ap_mpstart = arm_fdt_cpu_mpstart, 456 .ap_mpstart = arm_fdt_cpu_mpstart,
422}; 457};
423 458
424ARM_PLATFORM(sun9i_a80, "allwinner,sun9i-a80", &sun9i_platform); 459ARM_PLATFORM(sun9i_a80, "allwinner,sun9i-a80", &sun9i_platform);
425 460
426static const struct arm_platform sun50i_platform = { 461static const struct arm_platform sun50i_platform = {
427 .ap_devmap = sunxi_platform_devmap, 462 .ap_devmap = sunxi_platform_devmap,
428 .ap_bootstrap = sunxi_platform_bootstrap, 463 .ap_bootstrap = sunxi_platform_bootstrap,
429 .ap_init_attach_args = sunxi_platform_init_attach_args, 464 .ap_init_attach_args = sunxi_platform_init_attach_args,
430 .ap_device_register = sunxi_platform_device_register, 465 .ap_device_register = sunxi_platform_device_register,
431 .ap_reset = sun6i_platform_reset, 466 .ap_reset = sun6i_platform_reset,
432 .ap_delay = gtmr_delay, 467 .ap_delay = gtmr_delay,
433 .ap_uart_freq = sunxi_platform_uart_freq, 468 .ap_uart_freq = sunxi_platform_uart_freq,
434 .ap_mpstart = arm_fdt_cpu_mpstart, 469 .ap_mpstart = arm_fdt_cpu_mpstart,
435}; 470};
436 471
437ARM_PLATFORM(sun50i_a64, "allwinner,sun50i-a64", &sun50i_platform); 472ARM_PLATFORM(sun50i_a64, "allwinner,sun50i-a64", &sun50i_platform);
438ARM_PLATFORM(sun50i_h5, "allwinner,sun50i-h5", &sun50i_platform); 473ARM_PLATFORM(sun50i_h5, "allwinner,sun50i-h5", &sun50i_platform);
439 474
440static const struct arm_platform sun50i_h6_platform = { 475static const struct arm_platform sun50i_h6_platform = {
441 .ap_devmap = sunxi_platform_devmap, 476 .ap_devmap = sunxi_platform_devmap,
442 .ap_bootstrap = sunxi_platform_bootstrap, 477 .ap_bootstrap = sunxi_platform_bootstrap,
443 .ap_init_attach_args = sunxi_platform_init_attach_args, 478 .ap_init_attach_args = sunxi_platform_init_attach_args,
444 .ap_device_register = sunxi_platform_device_register, 479 .ap_device_register = sunxi_platform_device_register,
445 .ap_reset = sun50i_h6_platform_reset, 480 .ap_reset = sun50i_h6_platform_reset,
446 .ap_delay = gtmr_delay, 481 .ap_delay = gtmr_delay,
447 .ap_uart_freq = sunxi_platform_uart_freq, 482 .ap_uart_freq = sunxi_platform_uart_freq,
448 .ap_mpstart = arm_fdt_cpu_mpstart, 483 .ap_mpstart = arm_fdt_cpu_mpstart,
449}; 484};
450 485
451ARM_PLATFORM(sun50i_h6, "allwinner,sun50i-h6", &sun50i_h6_platform); 486ARM_PLATFORM(sun50i_h6, "allwinner,sun50i-h6", &sun50i_h6_platform);