head 1.4; access; symbols netbsd-11-0-RC4:1.3 netbsd-11-0-RC3:1.3 netbsd-11-0-RC2:1.3 netbsd-11-0-RC1:1.3 perseant-exfatfs-base-20250801:1.3 netbsd-11:1.3.0.8 netbsd-11-base:1.3 netbsd-10-1-RELEASE:1.2.4.1 perseant-exfatfs-base-20240630:1.3 perseant-exfatfs:1.3.0.6 perseant-exfatfs-base:1.3 netbsd-10-0-RELEASE:1.2.4.1 netbsd-10-0-RC6:1.2.4.1 netbsd-10-0-RC5:1.2.4.1 netbsd-10-0-RC4:1.2.4.1 netbsd-10-0-RC3:1.2.4.1 netbsd-10-0-RC2:1.2.4.1 thorpej-ifq:1.3.0.4 thorpej-ifq-base:1.3 thorpej-altq-separation:1.3.0.2 thorpej-altq-separation-base:1.3 netbsd-10-0-RC1:1.2.4.1 netbsd-10:1.2.0.4 netbsd-10-base:1.2 bouyer-sunxi-drm:1.2.0.2 bouyer-sunxi-drm-base:1.2 thorpej-i2c-spi-conf2:1.1.0.16 thorpej-i2c-spi-conf2-base:1.1 thorpej-futex2:1.1.0.14 thorpej-futex2-base:1.1 thorpej-cfargs2:1.1.0.12 thorpej-cfargs2-base:1.1 cjep_sun2x-base1:1.1 cjep_sun2x:1.1.0.10 cjep_sun2x-base:1.1 cjep_staticlib_x-base1:1.1 cjep_staticlib_x:1.1.0.8 cjep_staticlib_x-base:1.1 thorpej-i2c-spi-conf:1.1.0.6 thorpej-i2c-spi-conf-base:1.1 thorpej-cfargs:1.1.0.4 thorpej-cfargs-base:1.1 thorpej-futex-base:1.1 thorpej-futex:1.1.0.2; locks; strict; comment @# @; 1.4 date 2025.09.06.15.44.03; author thorpej; state Exp; branches; next 1.3; commitid 9V4ybx31NXy5wF9G; 1.3 date 2023.05.04.13.25.07; author bouyer; state Exp; branches; next 1.2; commitid bdf4cIV07IVufEnE; 1.2 date 2022.07.20.10.01.10; author riastradh; state Exp; branches 1.2.4.1; next 1.1; commitid VC7SYcVdMu8voCMD; 1.1 date 2020.12.23.14.42.38; author skrll; state Exp; branches 1.1.2.1; next ; commitid 9XkXJMlUFPLGlSAC; 1.2.4.1 date 2023.05.28.10.14.35; author martin; state Exp; branches; next ; commitid Acqw2rx1joOjrIqE; 1.1.2.1 date 2020.12.23.14.42.38; author thorpej; state dead; branches; next 1.1.2.2; commitid hSJGvbJZNH5wFiCC; 1.1.2.2 date 2021.01.03.16.34.52; author thorpej; state Exp; branches; next ; commitid hSJGvbJZNH5wFiCC; desc @@ 1.4 log @Step towards modularizing the Flattened Device Tree code. Define attributes for each of the specific device bindings: clock, dai, dma, gpio, i2c, iommu, mbox, mmc_pwrseq, phy, power, power domain, pwm, regulator, reset controller, spi, system controller, pin controller. Include these support files only if either a provider or consumer with one of these attributes is present in the kernel config. Add the necessary attributes to the device / attach declarations for each provider and consumer. There are some bindings that are consumed by generic code (iommu, pinctrl, power, power domain). Provide weak stubs for these routines to handle situations where there is no provider. No actual code changed; NFCI. @ text @# $NetBSD: files.imx,v 1.3 2023/05/04 13:25:07 bouyer Exp $ # # Configuration info for the Freescale i.MX6 # file arch/arm/nxp/imx6_platform.c soc_imx # SOC parameters defflag opt_soc.h SOC_IMX defflag opt_soc.h SOC_IMX6DL: SOC_IMX defflag opt_soc.h SOC_IMX6Q: SOC_IMX defflag opt_soc.h SOC_IMX6QDL: SOC_IMX defflag opt_soc.h SOC_IMX6SX: SOC_IMX defflag opt_soc.h SOC_IMX7D: SOC_IMX defflag opt_imx.h IMX6 # Clock device imx6ccm : fdt_clock attach imx6ccm at fdt file arch/arm/nxp/imx6_clk.c imx6ccm device imx6sxccm : fdt_clock attach imx6sxccm at fdt file arch/arm/nxp/imx6sx_clk.c imx6sxccm file arch/arm/nxp/imx6_ccm.c imx6ccm | imx6sxccm # Common FDT clock framework define imx_ccm: fdt_clock file arch/arm/nxp/imx_ccm.c imx_ccm file arch/arm/nxp/imx_ccm_composite.c imx_ccm file arch/arm/nxp/imx_ccm_div.c imx_ccm file arch/arm/nxp/imx_ccm_extclk.c imx_ccm file arch/arm/nxp/imx_ccm_fixed.c imx_ccm file arch/arm/nxp/imx_ccm_fixed_factor.c imx_ccm file arch/arm/nxp/imx_ccm_gate.c imx_ccm file arch/arm/nxp/imx_ccm_mux.c imx_ccm file arch/arm/nxp/imx_ccm_pll.c imx_ccm # CCM (iMX7D) device imx7dccm: imx_ccm attach imx7dccm at fdt with imx7d_ccm file arch/arm/nxp/imx7d_ccm.c imx7d_ccm # CCM (iMX8MQ) device imx8mqccm: imx_ccm attach imx8mqccm at fdt with imx8mq_ccm file arch/arm/nxp/imx8mq_ccm.c imx8mq_ccm # GPC device imxgpc attach imxgpc at fdt file arch/arm/nxp/imx6_gpc.c imxgpc device imx7gpc attach imx7gpc at fdt file arch/arm/nxp/imx7_gpc.c imx7gpc # IOMUX device imxiomux: fdt_pinctrl attach imxiomux at fdt file arch/arm/nxp/imx6_iomux.c imxiomux # GPIO controller device imxgpio: fdt_gpio, gpiobus attach imxgpio at fdt file arch/arm/imx/imxgpio.c imxgpio needs-flag file arch/arm/nxp/imx_gpio.c imxgpio # UART device imxuart: tty attach imxuart at fdt with imx_com: fdt_clock file arch/arm/imx/imxuart.c imxuart needs-flag file arch/arm/nxp/imx_com.c imx_com needs-flag defflag opt_imxuart.h IMXUARTCONSOLE # FEC device enet: fdt_clock, fdt_gpio, ether, ifnet, arp, mii, bus_dma_generic attach enet at fdt with enet_fdt file arch/arm/imx/if_enet.c enet file arch/arm/nxp/if_enet_imx.c enet_fdt # SATA attach ahcisata at fdt with imx_ahcisata: fdt_clock file arch/arm/nxp/imx_ahcisata.c imx_ahcisata # USB Controller device imxusbc { [unit=-1], [irq=-1] } : fdt_clock, fdt_regulator, bus_dma_generic attach imxusbc at fdt with imxusbc_fdt file arch/arm/nxp/imx6_usb.c imxusbc_fdt attach ehci at imxusbc with imxehci file arch/arm/imx/imxusb.c imxehci # USB PHY device imxusbphy attach imxusbphy at fdt: fdt_clock file arch/arm/nxp/imx6_usbphy.c imxusbphy device imx8mqusbphy: fdt_phy, fdt_regulator attach imx8mqusbphy at fdt file arch/arm/nxp/imx8mq_usbphy.c imx8mqusbphy # SDMMC attach sdhc at fdt with imx_sdhc: fdt_clock, fdt_gpio, fdt_regulator file arch/arm/nxp/imx_sdhc.c imx_sdhc # PCIe device imxpcie: pcibus attach imxpcie at fdt with imxpcie_fdt: fdt_clock, fdt_gpio, fdt_regulator file arch/arm/nxp/imxpcie.c imxpcie file arch/arm/nxp/imx6_pcie.c imxpcie_fdt # iMX iic controller device imxi2c: fdt_clock, motoi2c, i2cbus, i2cexec attach imxi2c at fdt file arch/arm/imx/imxi2c.c imxi2c file arch/arm/nxp/imx_i2c.c imxi2c # SPI bus controller device imxspi: spibus attach imxspi at fdt with imxspi_fdt: fdt_clock, fdt_gpio, fdt_spi file arch/arm/imx/imxspi.c imxspi file arch/arm/nxp/imx6_spi.c imxspi_fdt defparam opt_imxspi.h IMXSPI_DEBUG # iMX6 On-Chip OTP controller device imxocotp attach imxocotp at fdt: fdt_clock file arch/arm/nxp/imx6_ocotp.c imxocotp needs-flag # iMX6 Enhanced Periodic Interrupt Timer #device imxclock #attach imxclock at axi #file arch/arm/imx/imxclock.c imxclock #file arch/arm/imx/imx6_clock.c imxclock # iMX6 Secure Non-Volatile Storage (SNVS) device imxsnvs attach imxsnvs at fdt file arch/arm/imx/imxsnvs.c imxsnvs file arch/arm/nxp/imx_snvs.c imxsnvs # Watchdog device imxwdog: sysmon_wdog attach imxwdog at fdt file arch/arm/nxp/imxwdog.c imxwdog # PWM device imxpwm attach imxpwm at fdt with imxpwm_fdt: fdt_clock, fdt_pwm file arch/arm/imx/imxpwm.c imxpwm file arch/arm/nxp/imx6_pwm.c imxpwm_fdt # HDMI TX (Designware based) attach dwhdmi at fdt with imx6_dwhdmi: fdt_dai, fdt_i2c file arch/arm/nxp/imx6_dwhdmi.c imx6_dwhdmi makeoptions imx6_dwhdmi "CPPFLAGS.imx6_dwhdmi"+="${CPPFLAGS.drmkms}" @ 1.3 log @i.mx6sx CPU support in the CCM module: the clock tree si different from the i.mx6q - move i.mx6q-specific functions and data to imx6_clk.c - add i.mx6sx specific imx6sx_clk.c - add a imx6sxccm device @ text @d1 1 a1 1 # $NetBSD: files.imx,v 1.2 2022/07/20 10:01:10 riastradh Exp $ d19 1 a19 1 device imx6ccm : clk d23 1 a23 1 device imx6sxccm : clk d30 1 a30 1 define imx_ccm: clk d61 1 a61 1 device imxiomux d66 1 a66 1 device imxgpio: gpiobus d73 1 a73 1 attach imxuart at fdt with imx_com d79 1 a79 1 device enet: ether, ifnet, arp, mii, bus_dma_generic d85 1 a85 1 attach ahcisata at fdt with imx_ahcisata d89 1 a89 1 device imxusbc { [unit=-1], [irq=-1] } : bus_dma_generic d98 1 a98 1 attach imxusbphy at fdt d101 1 a101 1 device imx8mqusbphy d106 1 a106 1 attach sdhc at fdt with imx_sdhc d110 2 a111 2 device imxpcie: pcibus, clk attach imxpcie at fdt with imxpcie_fdt d116 1 a116 1 device imxi2c: motoi2c, i2cbus, i2cexec d123 1 a123 1 attach imxspi at fdt with imxspi_fdt d130 1 a130 1 attach imxocotp at fdt d151 2 a152 2 device imxpwm: pwm, clk attach imxpwm at fdt with imxpwm_fdt d157 1 a157 1 attach dwhdmi at fdt with imx6_dwhdmi @ 1.2 log @drm: Use CPPFLAGS.drmkms in all local drm drivers too. This way we don't pollute the NetBSD kernel namespace with all the Linux compat shim definitions needed to build drm, except for the local drm drivers that need the API. @ text @d1 1 a1 1 # $NetBSD: files.imx,v 1.1 2020/12/23 14:42:38 skrll Exp $ d13 1 a20 1 file arch/arm/nxp/imx6_ccm.c imx6ccm d23 6 @ 1.2.4.1 log @Pull up following revision(s) (requested by bouyer in ticket #182): sys/arch/arm/nxp/imx6_platform.c: revision 1.8 (via patch) sys/arch/arm/nxp/imx6_platform.c: revision 1.9 (via patch) sys/arch/arm/nxp/imx6_ccmvar.h: revision 1.2 sys/arch/arm/nxp/imx6_ccmvar.h: revision 1.3 distrib/sets/lists/dtb/ad.earmv7hf: revision 1.10 sys/arch/arm/nxp/imx6sx_clk.c: revision 1.1 sys/arch/arm/nxp/imx6_ccm.c: revision 1.3 sys/arch/arm/nxp/imx6sx_clk.c: revision 1.2 sys/arch/arm/nxp/imx6_ccm.c: revision 1.4 sys/arch/arm/nxp/imx6sx_clk.c: revision 1.3 sys/arch/arm/nxp/imx6_spi.c: revision 1.8 sys/arch/arm/nxp/imx_sdhc.c: revision 1.8 sys/arch/arm/imx/imxusb.c: revision 1.19 sys/arch/arm/nxp/imx6_usb.c: revision 1.7 sys/arch/arm/nxp/imx6_usb.c: revision 1.8 sys/arch/arm/nxp/files.imx: revision 1.3 sys/arch/arm/nxp/imx6_clk.c: revision 1.5 sys/arch/arm/nxp/imx6_clk.c: revision 1.6 sys/arch/arm/nxp/imx6_reg.h: revision 1.2 sys/arch/arm/nxp/imx6_gpc.c: revision 1.4 sys/arch/arm/imx/imx23_usb.c: revision 1.6 sys/dtb/arm/Makefile: revision 1.6 sys/arch/arm/imx/imxusbvar.h: revision 1.7 sys/arch/evbarm/conf/GENERIC: revision 1.119 sys/arch/arm/nxp/imx6_ccmreg.h: revision 1.2 sys/arch/arm/nxp/imx6_iomux.c: revision 1.3 sys/arch/arm/nxp/imx6_usbphy.c: revision 1.3 sys/arch/arm/nxp/imx6_pcie.c: revision 1.7 In preparation of imx6sx support, move imx6q-specific definitions from imx6_ccm.c to imx6_clk.c, and prefix with IMX6Q/imx6q: - Clock IDs and related struct imx_clock_id - Clock Parents and Divider Tables - struct imx6_clk and related static functions Add a pointer to struct imx6_clk, and it's size to imx6ccm_softc Pass a pointer to imx6ccm_softc to all functions from imx6_ccm.c NFCI i.mx6sx CPU support in the CCM module: the clock tree si different from the i.mx6q - move i.mx6q-specific functions and data to imx6_clk.c - add i.mx6sx specific imx6sx_clk.c - add a imx6sxccm device i.mx6sx platform support: - the i.mx6sx has a third AIPS, so KERNEL_IO_IOREG map has to be larger - the uart clock is at 24Mhz instead of 80. Add i.mx6sx compatible entries to drivers that should work as is. Fix typo, preventing i2c4 from attaching remove commented out entries, leftover from the imx6q ccm code. introduce imx6sx_platform_bootstrap(), which calls imx_platform_bootstrap() and then checks for an "arm,cortex-a9-twd-timer" compatible entry in the fdt. If not present, create one so that a9ptmr will attach. We need this entry as this is the only timer we support for this platform, but the upstream imx6sx.dtsi is missing the entry for it (and all A9 CPUs have it anyway). Thanks to Jared McNeill for advices and review. Also build dtb files for CONFIG_SOC_IMX6SX experimental IMX6SX support: - add options SOC_IMX6SX - add imx6sxccm device tested on a UDOO Neo Full board. known to work: - uart (console) - sdmmc0 - ethernet (enet0) known to not work: - USB (device not detected). needs a modified device tree at this time (add arm,cortex-a9-twd-timer entry copied from the imx6qdl dtsi); for unkown reason the imx6sx.dtsi file lacks an entry for the a9ptmr although it is present in the soc (and, from what I understood, in all cortex A9 SoCs). Add imx6sx dtb files The i.mx6sx has 2 OTG and one host-only USB controller, while the 6q has only one OTG. Add a "uintptr_t data" argument to all sc_*_md_hook callbacks, which gets the sc_md_hook_data value when called. In imx6_usb.c use this to pass the number of OTG controllers to the callbacks. imx6_usb_init() can then properly call init_otg() or init_h1() for unit 1. In imx6_usb_attach(), test if there is a vbus-supply property in the fdt, and enable the regulator if present. Now the USB port of the UDOO Neo works. @ text @d1 1 a1 1 # $NetBSD: files.imx,v 1.2 2022/07/20 10:01:10 riastradh Exp $ a12 1 defflag opt_soc.h SOC_IMX6SX: SOC_IMX d20 1 a22 6 device imx6sxccm : clk attach imx6sxccm at fdt file arch/arm/nxp/imx6sx_clk.c imx6sxccm file arch/arm/nxp/imx6_ccm.c imx6ccm | imx6sxccm @ 1.1 log @Tidyup the i.MX SoC support by - Moving the FDTised code to sys/arch/arm/nxp to match the sys/arch/{cpu}/{vendor} convention - FDTise some more drivers - Secure Non-Volatile Storage - watchdog driver - On chip OTP - Match fsl,imx6dl - Add some more drivers to GENERIC that will be supported by i.MX 6 boards @ text @d1 1 a1 1 # $NetBSD: files.imx6,v 1.4 2019/07/30 06:52:57 hkenken Exp $ d153 1 @ 1.1.2.1 log @file files.imx was added on branch thorpej-futex on 2021-01-03 16:34:52 +0000 @ text @d1 152 @ 1.1.2.2 log @Sync w/ HEAD. @ text @a0 152 # $NetBSD: files.imx,v 1.1 2020/12/23 14:42:38 skrll Exp $ # # Configuration info for the Freescale i.MX6 # file arch/arm/nxp/imx6_platform.c soc_imx # SOC parameters defflag opt_soc.h SOC_IMX defflag opt_soc.h SOC_IMX6DL: SOC_IMX defflag opt_soc.h SOC_IMX6Q: SOC_IMX defflag opt_soc.h SOC_IMX6QDL: SOC_IMX defflag opt_soc.h SOC_IMX7D: SOC_IMX defflag opt_imx.h IMX6 # Clock device imx6ccm : clk attach imx6ccm at fdt file arch/arm/nxp/imx6_ccm.c imx6ccm file arch/arm/nxp/imx6_clk.c imx6ccm # Common FDT clock framework define imx_ccm: clk file arch/arm/nxp/imx_ccm.c imx_ccm file arch/arm/nxp/imx_ccm_composite.c imx_ccm file arch/arm/nxp/imx_ccm_div.c imx_ccm file arch/arm/nxp/imx_ccm_extclk.c imx_ccm file arch/arm/nxp/imx_ccm_fixed.c imx_ccm file arch/arm/nxp/imx_ccm_fixed_factor.c imx_ccm file arch/arm/nxp/imx_ccm_gate.c imx_ccm file arch/arm/nxp/imx_ccm_mux.c imx_ccm file arch/arm/nxp/imx_ccm_pll.c imx_ccm # CCM (iMX7D) device imx7dccm: imx_ccm attach imx7dccm at fdt with imx7d_ccm file arch/arm/nxp/imx7d_ccm.c imx7d_ccm # CCM (iMX8MQ) device imx8mqccm: imx_ccm attach imx8mqccm at fdt with imx8mq_ccm file arch/arm/nxp/imx8mq_ccm.c imx8mq_ccm # GPC device imxgpc attach imxgpc at fdt file arch/arm/nxp/imx6_gpc.c imxgpc device imx7gpc attach imx7gpc at fdt file arch/arm/nxp/imx7_gpc.c imx7gpc # IOMUX device imxiomux attach imxiomux at fdt file arch/arm/nxp/imx6_iomux.c imxiomux # GPIO controller device imxgpio: gpiobus attach imxgpio at fdt file arch/arm/imx/imxgpio.c imxgpio needs-flag file arch/arm/nxp/imx_gpio.c imxgpio # UART device imxuart: tty attach imxuart at fdt with imx_com file arch/arm/imx/imxuart.c imxuart needs-flag file arch/arm/nxp/imx_com.c imx_com needs-flag defflag opt_imxuart.h IMXUARTCONSOLE # FEC device enet: ether, ifnet, arp, mii, bus_dma_generic attach enet at fdt with enet_fdt file arch/arm/imx/if_enet.c enet file arch/arm/nxp/if_enet_imx.c enet_fdt # SATA attach ahcisata at fdt with imx_ahcisata file arch/arm/nxp/imx_ahcisata.c imx_ahcisata # USB Controller device imxusbc { [unit=-1], [irq=-1] } : bus_dma_generic attach imxusbc at fdt with imxusbc_fdt file arch/arm/nxp/imx6_usb.c imxusbc_fdt attach ehci at imxusbc with imxehci file arch/arm/imx/imxusb.c imxehci # USB PHY device imxusbphy attach imxusbphy at fdt file arch/arm/nxp/imx6_usbphy.c imxusbphy device imx8mqusbphy attach imx8mqusbphy at fdt file arch/arm/nxp/imx8mq_usbphy.c imx8mqusbphy # SDMMC attach sdhc at fdt with imx_sdhc file arch/arm/nxp/imx_sdhc.c imx_sdhc # PCIe device imxpcie: pcibus, clk attach imxpcie at fdt with imxpcie_fdt file arch/arm/nxp/imxpcie.c imxpcie file arch/arm/nxp/imx6_pcie.c imxpcie_fdt # iMX iic controller device imxi2c: motoi2c, i2cbus, i2cexec attach imxi2c at fdt file arch/arm/imx/imxi2c.c imxi2c file arch/arm/nxp/imx_i2c.c imxi2c # SPI bus controller device imxspi: spibus attach imxspi at fdt with imxspi_fdt file arch/arm/imx/imxspi.c imxspi file arch/arm/nxp/imx6_spi.c imxspi_fdt defparam opt_imxspi.h IMXSPI_DEBUG # iMX6 On-Chip OTP controller device imxocotp attach imxocotp at fdt file arch/arm/nxp/imx6_ocotp.c imxocotp needs-flag # iMX6 Enhanced Periodic Interrupt Timer #device imxclock #attach imxclock at axi #file arch/arm/imx/imxclock.c imxclock #file arch/arm/imx/imx6_clock.c imxclock # iMX6 Secure Non-Volatile Storage (SNVS) device imxsnvs attach imxsnvs at fdt file arch/arm/imx/imxsnvs.c imxsnvs file arch/arm/nxp/imx_snvs.c imxsnvs # Watchdog device imxwdog: sysmon_wdog attach imxwdog at fdt file arch/arm/nxp/imxwdog.c imxwdog # PWM device imxpwm: pwm, clk attach imxpwm at fdt with imxpwm_fdt file arch/arm/imx/imxpwm.c imxpwm file arch/arm/nxp/imx6_pwm.c imxpwm_fdt # HDMI TX (Designware based) attach dwhdmi at fdt with imx6_dwhdmi file arch/arm/nxp/imx6_dwhdmi.c imx6_dwhdmi @