From 646c0f59eff06314f690c829933038c41a2074cf Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 18 Jan 2021 02:35:48 +0000 Subject: [PATCH] Remove "struct of_compat_data" and replace its usage with "struct device_compatible_entry"; they are ABI-compatible. Fix several "loses const qualifier" bugs encountered during this conversion. --- sys/arch/arm/amlogic/meson_pinctrl.c | 34 ++++++++----- sys/arch/arm/amlogic/meson_pwm.c | 15 +++--- sys/arch/arm/amlogic/meson_thermal.c | 17 ++++--- sys/arch/arm/amlogic/meson_usbctrl.c | 15 +++--- sys/arch/arm/amlogic/meson_usbphy.c | 17 ++++--- sys/arch/arm/amlogic/mesong12_clkc.c | 15 +++--- sys/arch/arm/amlogic/mesongx_mmc.c | 17 ++++--- sys/arch/arm/amlogic/mesongxbb_clkc.c | 15 +++--- sys/arch/arm/broadcom/bcm2835_emmc.c | 13 ++--- sys/arch/arm/fdt/pcihost_fdt.c | 15 +++--- sys/arch/arm/nvidia/tegra_ahcisata.c | 18 +++---- sys/arch/arm/nvidia/tegra_nouveau.c | 18 +++---- sys/arch/arm/nvidia/tegra_pinmux.c | 12 ++--- sys/arch/arm/nvidia/tegra_soctherm.c | 14 +++--- sys/arch/arm/nvidia/tegra_xusb.c | 18 +++---- sys/arch/arm/nxp/if_enet_imx.c | 15 +++--- sys/arch/arm/nxp/imx6_pcie.c | 16 +++--- sys/arch/arm/nxp/imx6_spi.c | 14 +++--- sys/arch/arm/nxp/imx8mq_usbphy.c | 11 +++-- sys/arch/arm/nxp/imx_sdhc.c | 15 +++--- sys/arch/arm/rockchip/rk3328_iomux.c | 13 ++--- sys/arch/arm/rockchip/rk3399_iomux.c | 10 ++-- sys/arch/arm/rockchip/rk_gmac.c | 15 +++--- sys/arch/arm/rockchip/rk_i2s.c | 19 ++++---- sys/arch/arm/rockchip/rk_pwm.c | 11 +++-- sys/arch/arm/rockchip/rk_usb.c | 15 +++--- sys/arch/arm/rockchip/rk_v1crypto.c | 11 +++-- sys/arch/arm/rockchip/rk_vop.c | 20 +++++--- sys/arch/arm/samsung/exynos_gpio.c | 7 +-- sys/arch/arm/samsung/exynos_pinctrl.c | 19 +++++--- sys/arch/arm/samsung/exynos_pinctrl.h | 4 +- sys/arch/arm/samsung/exynos_platform.c | 21 ++++---- sys/arch/arm/samsung/exynos_usbdrdphy.c | 11 +++-- sys/arch/arm/samsung/exynos_usbphy.c | 11 +++-- sys/arch/arm/samsung/exynos_var.h | 4 +- sys/arch/arm/sociox/if_ave.c | 21 ++++---- sys/arch/arm/sunxi/sun4i_a10_ccu.c | 15 +++--- sys/arch/arm/sunxi/sun4i_dma.c | 11 +++-- sys/arch/arm/sunxi/sun6i_dma.c | 23 +++++---- sys/arch/arm/sunxi/sun8i_crypto.c | 11 +++-- sys/arch/arm/sunxi/sunxi_can.c | 11 +++-- sys/arch/arm/sunxi/sunxi_codec.c | 11 +++-- sys/arch/arm/sunxi/sunxi_codec.h | 22 +++++---- sys/arch/arm/sunxi/sunxi_de2_ccu.c | 20 +++++--- sys/arch/arm/sunxi/sunxi_debe.c | 16 +++--- sys/arch/arm/sunxi/sunxi_dep.c | 13 ++--- sys/arch/arm/sunxi/sunxi_emac.c | 19 ++++---- sys/arch/arm/sunxi/sunxi_gpio.c | 65 ++++++++++++++++--------- sys/arch/arm/sunxi/sunxi_hdmi.c | 16 +++--- sys/arch/arm/sunxi/sunxi_hdmiphy.c | 17 ++++--- sys/arch/arm/sunxi/sunxi_i2s.c | 20 ++++---- sys/arch/arm/sunxi/sunxi_lcdc.c | 17 ++++--- sys/arch/arm/sunxi/sunxi_lradc.c | 11 +++-- sys/arch/arm/sunxi/sunxi_mixer.c | 20 +++++--- sys/arch/arm/sunxi/sunxi_mmc.c | 38 +++++++++------ sys/arch/arm/sunxi/sunxi_musb.c | 19 ++++---- sys/arch/arm/sunxi/sunxi_nmi.c | 20 +++++--- sys/arch/arm/sunxi/sunxi_pwm.c | 11 +++-- sys/arch/arm/sunxi/sunxi_rsb.c | 15 +++--- sys/arch/arm/sunxi/sunxi_rtc.c | 38 +++++++++------ sys/arch/arm/sunxi/sunxi_sid.c | 21 ++++---- sys/arch/arm/sunxi/sunxi_tcon.c | 16 +++--- sys/arch/arm/sunxi/sunxi_thermal.c | 21 ++++---- sys/arch/arm/sunxi/sunxi_ts.c | 17 ++++--- sys/arch/arm/sunxi/sunxi_twi.c | 15 +++--- sys/arch/arm/sunxi/sunxi_usb3phy.c | 13 ++--- sys/arch/arm/sunxi/sunxi_usbphy.c | 27 +++++----- sys/arch/arm/sunxi/sunxi_wdt.c | 15 +++--- sys/arch/arm/ti/ti_dpll_clock.c | 20 +++++--- sys/arch/arm/ti/ti_gpio.c | 15 +++--- sys/arch/arm/ti/ti_iic.c | 17 ++++--- sys/arch/arm/ti/ti_omapintc.c | 15 +++--- sys/arch/arm/ti/ti_omaptimer.c | 17 ++++--- sys/arch/arm/ti/ti_sdhc.c | 23 +++++---- sys/arch/mips/cavium/dev/octeon_cib.c | 11 +++-- sys/arch/mips/cavium/dev/octeon_intc.c | 13 ++--- sys/dev/fdt/amdccp_fdt.c | 11 +++-- sys/dev/fdt/arasan_sdhc_fdt.c | 14 +++--- sys/dev/fdt/connector_fdt.c | 19 ++++---- sys/dev/fdt/dwc2_fdt.c | 23 +++++---- sys/dev/fdt/dwcmmc_fdt.c | 13 ++--- sys/dev/fdt/i2cmux_fdt.c | 13 +++-- sys/dev/fdt/ns8250_uart.c | 25 +++++----- sys/dev/fdt/panel_fdt.c | 15 +++--- sys/dev/fdt/pinctrl_single.c | 15 +++--- sys/dev/fdt/vmt_fdt.c | 11 +++-- sys/dev/ofw/ofw_subr.c | 13 +++-- sys/dev/ofw/openfirm.h | 15 +++--- 88 files changed, 821 insertions(+), 657 deletions(-) diff --git a/sys/arch/arm/amlogic/meson_pinctrl.c b/sys/arch/arm/amlogic/meson_pinctrl.c index 7d69a5ed86ac..d4a7a083993d 100644 --- a/sys/arch/arm/amlogic/meson_pinctrl.c +++ b/sys/arch/arm/amlogic/meson_pinctrl.c @@ -1,4 +1,4 @@ -/* $NetBSD: meson_pinctrl.c,v 1.7 2021/01/01 07:21:58 ryo Exp $ */ +/* $NetBSD: meson_pinctrl.c,v 1.8 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -29,7 +29,7 @@ #include "opt_soc.h" #include -__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.7 2021/01/01 07:21:58 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.8 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -71,24 +71,32 @@ struct meson_pinctrl_gpio_pin { bool pin_actlo; }; -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { #ifdef SOC_MESON8B - { "amlogic,meson8b-aobus-pinctrl", (uintptr_t)&meson8b_aobus_pinctrl_config }, - { "amlogic,meson8b-cbus-pinctrl", (uintptr_t)&meson8b_cbus_pinctrl_config }, + { .compat = "amlogic,meson8b-aobus-pinctrl", + .data = &meson8b_aobus_pinctrl_config }, + { .compat = "amlogic,meson8b-cbus-pinctrl", + .data = &meson8b_cbus_pinctrl_config }, #endif #ifdef SOC_MESONGXBB - { "amlogic,meson-gxbb-aobus-pinctrl", (uintptr_t)&mesongxbb_aobus_pinctrl_config }, - { "amlogic,meson-gxbb-periphs-pinctrl", (uintptr_t)&mesongxbb_periphs_pinctrl_config }, + { .compat = "amlogic,meson-gxbb-aobus-pinctrl", + .data = &mesongxbb_aobus_pinctrl_config }, + { .compat = "amlogic,meson-gxbb-periphs-pinctrl", + .data = &mesongxbb_periphs_pinctrl_config }, #endif #ifdef SOC_MESONGXL - { "amlogic,meson-gxl-aobus-pinctrl", (uintptr_t)&mesongxl_aobus_pinctrl_config }, - { "amlogic,meson-gxl-periphs-pinctrl", (uintptr_t)&mesongxl_periphs_pinctrl_config }, + { .compat = "amlogic,meson-gxl-aobus-pinctrl", + .data = &mesongxl_aobus_pinctrl_config }, + { .compat = "amlogic,meson-gxl-periphs-pinctrl", + .data = &mesongxl_periphs_pinctrl_config }, #endif #ifdef SOC_MESONG12 - { "amlogic,meson-g12a-aobus-pinctrl", (uintptr_t)&mesong12a_aobus_pinctrl_config }, - { "amlogic,meson-g12a-periphs-pinctrl", (uintptr_t)&mesong12a_periphs_pinctrl_config }, + { .compat = "amlogic,meson-g12a-aobus-pinctrl", + .data = &mesong12a_aobus_pinctrl_config }, + { .compat = "amlogic,meson-g12a-periphs-pinctrl", + .data = &mesong12a_periphs_pinctrl_config }, #endif - { NULL, 0 } + { 0 } }; #define MUX_READ(sc, reg) \ @@ -578,7 +586,7 @@ meson_pinctrl_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = faa->faa_phandle; sc->sc_bst = faa->faa_bst; - sc->sc_conf = (void *)of_search_compatible(sc->sc_phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(sc->sc_phandle, compat_data)->data; mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); if (meson_pinctrl_initres(sc) != 0) diff --git a/sys/arch/arm/amlogic/meson_pwm.c b/sys/arch/arm/amlogic/meson_pwm.c index f23612319b7b..9b6b7723ddb5 100644 --- a/sys/arch/arm/amlogic/meson_pwm.c +++ b/sys/arch/arm/amlogic/meson_pwm.c @@ -1,4 +1,4 @@ -/* $NetBSD: meson_pwm.c,v 1.1 2021/01/01 07:21:58 ryo Exp $ */ +/* $NetBSD: meson_pwm.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */ /* * Copyright (c) 2021 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_pwm.c,v 1.1 2021/01/01 07:21:58 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_pwm.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -65,11 +65,12 @@ __KERNEL_RCSID(0, "$NetBSD: meson_pwm.c,v 1.1 2021/01/01 07:21:58 ryo Exp $"); #define PWM_WRITE_REG(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg) * 4, (val)) -static const struct of_compat_data compat_data[] = { - { "amlogic,meson-g12a-ao-pwm-ab", 0 }, - { "amlogic,meson-g12a-ao-pwm-cd", 0 }, - { "amlogic,meson-g12a-ee-pwm", 0 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,meson-g12a-ao-pwm-ab" }, + { .compat = "amlogic,meson-g12a-ao-pwm-cd" }, + { .compat = "amlogic,meson-g12a-ee-pwm" }, + + { 0 } }; #define MESON_PWM_NCHAN 2 diff --git a/sys/arch/arm/amlogic/meson_thermal.c b/sys/arch/arm/amlogic/meson_thermal.c index 22eb97ddd923..f9ebeb0e0f5f 100644 --- a/sys/arch/arm/amlogic/meson_thermal.c +++ b/sys/arch/arm/amlogic/meson_thermal.c @@ -1,4 +1,4 @@ -/* $NetBSD: meson_thermal.c,v 1.2 2021/01/08 00:13:20 macallan Exp $ */ +/* $NetBSD: meson_thermal.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */ /* * Copyright (c) 2021 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_thermal.c,v 1.2 2021/01/08 00:13:20 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_thermal.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -87,10 +87,11 @@ static struct meson_thermal_config thermal_ddr_conf = { .aosec_reg = 0xf0 }; -static const struct of_compat_data compat_data[] = { - { "amlogic,g12a-cpu-thermal", (uintptr_t)&thermal_cpu_conf }, - { "amlogic,g12a-ddr-thermal", (uintptr_t)&thermal_ddr_conf }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,g12a-cpu-thermal", .data = &thermal_cpu_conf }, + { .compat = "amlogic,g12a-ddr-thermal", .data = &thermal_ddr_conf }, + + { 0 } }; struct meson_thermal_softc { @@ -98,7 +99,7 @@ struct meson_thermal_softc { bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; bus_space_handle_t sc_bsh_ao; - struct meson_thermal_config *sc_conf; + const struct meson_thermal_config *sc_conf; int sc_phandle; int sc_ao_calib; @@ -187,7 +188,7 @@ meson_thermal_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_bst = faa->faa_bst; sc->sc_phandle = phandle = faa->faa_phandle; - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/amlogic/meson_usbctrl.c b/sys/arch/arm/amlogic/meson_usbctrl.c index f395382fee76..ebc2fcf778f1 100644 --- a/sys/arch/arm/amlogic/meson_usbctrl.c +++ b/sys/arch/arm/amlogic/meson_usbctrl.c @@ -1,4 +1,4 @@ -/* $NetBSD: meson_usbctrl.c,v 1.1 2021/01/01 07:21:58 ryo Exp $ */ +/* $NetBSD: meson_usbctrl.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */ /* * Copyright (c) 2021 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_usbctrl.c,v 1.1 2021/01/01 07:21:58 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_usbctrl.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -110,16 +110,17 @@ struct meson_usbctrl_config mesong12_conf = { .num_phys = 3 }; -static const struct of_compat_data compat_data[] = { - { "amlogic,meson-g12a-usb-ctrl", (uintptr_t)&mesong12_conf }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,meson-g12a-usb-ctrl", .data = &mesong12_conf }, + + { 0 } }; struct meson_usbctrl_softc { device_t sc_dev; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; - struct meson_usbctrl_config *sc_conf; + const struct meson_usbctrl_config *sc_conf; struct fdtbus_regulator *sc_supply; int sc_phandle; }; @@ -267,7 +268,7 @@ meson_usbctrl_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_bst = faa->faa_bst; sc->sc_phandle = phandle = faa->faa_phandle; - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/amlogic/meson_usbphy.c b/sys/arch/arm/amlogic/meson_usbphy.c index be62894334c0..c1fee0317b6d 100644 --- a/sys/arch/arm/amlogic/meson_usbphy.c +++ b/sys/arch/arm/amlogic/meson_usbphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: meson_usbphy.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */ +/* $NetBSD: meson_usbphy.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: meson_usbphy.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_usbphy.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -59,10 +59,13 @@ enum meson_usbphy_type { USBPHY_MESON8B, }; -static const struct of_compat_data compat_data[] = { - { "amlogic,meson8b-usb2-phy", USBPHY_MESON8B }, - { "amlogic,meson-gxbb-usb2-phy", USBPHY_MESON8B }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,meson8b-usb2-phy", + .value = USBPHY_MESON8B }, + { .compat = "amlogic,meson-gxbb-usb2-phy", + .value = USBPHY_MESON8B }, + + { 0 } }; struct meson_usbphy_softc { @@ -202,7 +205,7 @@ meson_usbphy_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_bst = faa->faa_bst; sc->sc_phandle = phandle; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/amlogic/mesong12_clkc.c b/sys/arch/arm/amlogic/mesong12_clkc.c index 4d37ba11146f..b0e77f130f30 100644 --- a/sys/arch/arm/amlogic/mesong12_clkc.c +++ b/sys/arch/arm/amlogic/mesong12_clkc.c @@ -1,4 +1,4 @@ -/* $NetBSD: mesong12_clkc.c,v 1.1 2021/01/01 07:21:58 ryo Exp $ */ +/* $NetBSD: mesong12_clkc.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mesong12_clkc.c,v 1.1 2021/01/01 07:21:58 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mesong12_clkc.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -1489,10 +1489,11 @@ static const struct mesong12_clkc_config g12b_config = { .nclks = __arraycount(mesong12b_clkc_clks), }; -static const struct of_compat_data compat_data[] = { - { "amlogic,g12a-clkc", (uintptr_t)&g12a_config }, - { "amlogic,g12b-clkc", (uintptr_t)&g12b_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,g12a-clkc", .data = &g12a_config }, + { .compat = "amlogic,g12b-clkc", .data = &g12b_config }, + + { 0 } }; CFATTACH_DECL_NEW(mesong12_clkc, sizeof(struct meson_clk_softc), @@ -1522,7 +1523,7 @@ mesong12_clkc_attach(device_t parent, device_t self, void *aux) return; } - conf = (const void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; sc->sc_clks = conf->clks; sc->sc_nclks = conf->nclks; diff --git a/sys/arch/arm/amlogic/mesongx_mmc.c b/sys/arch/arm/amlogic/mesongx_mmc.c index a60c5c6a1858..c8458ec9bc23 100644 --- a/sys/arch/arm/amlogic/mesongx_mmc.c +++ b/sys/arch/arm/amlogic/mesongx_mmc.c @@ -1,4 +1,4 @@ -/* $NetBSD: mesongx_mmc.c,v 1.9 2021/01/15 18:42:40 ryo Exp $ */ +/* $NetBSD: mesongx_mmc.c,v 1.10 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.9 2021/01/15 18:42:40 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.10 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -267,11 +267,12 @@ enum { MESONGX_MMC_V3 = 3, }; -static const struct of_compat_data compat_data[] = { - { "amlogic,meson-gx-mmc", MESONGX_MMC_V2 }, - { "amlogic,meson-gxbb-mmc", MESONGX_MMC_V2 }, - { "amlogic,meson-axg-mmc", MESONGX_MMC_V3 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,meson-gx-mmc", .value = MESONGX_MMC_V2 }, + { .compat = "amlogic,meson-gxbb-mmc", .value = MESONGX_MMC_V2 }, + { .compat = "amlogic,meson-axg-mmc", .value = MESONGX_MMC_V3 }, + + { 0 } }; static int @@ -292,7 +293,7 @@ mesongx_mmc_attach(device_t parent, device_t self, void *aux) bus_addr_t addr; bus_size_t size; - sc->sc_hwtype = (int)of_search_compatible(phandle, compat_data)->data; + sc->sc_hwtype = of_search_compatible(phandle, compat_data)->value; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/amlogic/mesongxbb_clkc.c b/sys/arch/arm/amlogic/mesongxbb_clkc.c index 384aba3f405d..35bb9cbb8983 100644 --- a/sys/arch/arm/amlogic/mesongxbb_clkc.c +++ b/sys/arch/arm/amlogic/mesongxbb_clkc.c @@ -1,4 +1,4 @@ -/* $NetBSD: mesongxbb_clkc.c,v 1.2 2019/04/19 19:07:56 jmcneill Exp $ */ +/* $NetBSD: mesongxbb_clkc.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: mesongxbb_clkc.c,v 1.2 2019/04/19 19:07:56 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: mesongxbb_clkc.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -78,10 +78,11 @@ static const struct mesongxbb_clkc_config gxl_config = { .name = "Meson GXL", }; -static const struct of_compat_data compat_data[] = { - { "amlogic,gxbb-clkc", (uintptr_t)&gxbb_config }, - { "amlogic,gxl-clkc", (uintptr_t)&gxl_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,gxbb-clkc", .data = &gxbb_config }, + { .compat = "amlogic,gxl-clkc", .data = &gxl_config }, + + { 0 } }; CFATTACH_DECL_NEW(mesongxbb_clkc, sizeof(struct meson_clk_softc), @@ -252,7 +253,7 @@ mesongxbb_clkc_attach(device_t parent, device_t self, void *aux) meson_clk_attach(sc); - conf = (const void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": %s clock controller\n", conf->name); diff --git a/sys/arch/arm/broadcom/bcm2835_emmc.c b/sys/arch/arm/broadcom/bcm2835_emmc.c index 9298f4ee5991..d5c908f9deb1 100644 --- a/sys/arch/arm/broadcom/bcm2835_emmc.c +++ b/sys/arch/arm/broadcom/bcm2835_emmc.c @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_emmc.c,v 1.39 2020/12/01 04:15:04 rin Exp $ */ +/* $NetBSD: bcm2835_emmc.c,v 1.40 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.39 2020/12/01 04:15:04 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.40 2021/01/18 02:35:48 thorpej Exp $"); #include "bcmdmac.h" @@ -96,9 +96,9 @@ enum bcmemmc_type { BCM2711_EMMC2, }; -static const struct of_compat_data compat_data[] = { - { "brcm,bcm2835-sdhci", BCM2835_SDHCI }, - { "brcm,bcm2711-emmc2", BCM2711_EMMC2 }, +static const struct device_compatible_entry compat_data[] = { + { .compat = "brcm,bcm2835-sdhci", .value = BCM2835_SDHCI }, + { .compat = "brcm,bcm2711-emmc2", .value = BCM2711_EMMC2 }, { NULL } }; @@ -183,7 +183,8 @@ bcmemmc_attach(device_t parent, device_t self, void *aux) aprint_normal_dev(self, "interrupting on %s\n", intrstr); #if NBCMDMAC > 0 - enum bcmemmc_type type = of_search_compatible(phandle, compat_data)->data; + enum bcmemmc_type type = + of_search_compatible(phandle, compat_data)->value; if (type != BCM2835_SDHCI) goto done; diff --git a/sys/arch/arm/fdt/pcihost_fdt.c b/sys/arch/arm/fdt/pcihost_fdt.c index ec919267bfdd..75f78df48a1a 100644 --- a/sys/arch/arm/fdt/pcihost_fdt.c +++ b/sys/arch/arm/fdt/pcihost_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcihost_fdt.c,v 1.19 2021/01/15 17:17:04 ryo Exp $ */ +/* $NetBSD: pcihost_fdt.c,v 1.20 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.19 2021/01/15 17:17:04 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.20 2021/01/18 02:35:48 thorpej Exp $"); #include @@ -95,10 +95,11 @@ static int pcihost_bus_space_map(void *, bus_addr_t, bus_size_t, CFATTACH_DECL_NEW(pcihost_fdt, sizeof(struct pcihost_softc), pcihost_match, pcihost_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "pci-host-cam-generic", PCIHOST_CAM }, - { "pci-host-ecam-generic", PCIHOST_ECAM }, - { NULL, 0 } +static const struct device_compatible_entry compat_data[] = { + { .compat = "pci-host-cam-generic", .value = PCIHOST_CAM }, + { .compat = "pci-host-ecam-generic", .value = PCIHOST_ECAM }, + + { 0 } }; static int @@ -133,7 +134,7 @@ pcihost_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't map registers: %d\n", error); return; } - sc->sc_type = of_search_compatible(sc->sc_phandle, compat_data)->data; + sc->sc_type = of_search_compatible(sc->sc_phandle, compat_data)->value; #ifdef __HAVE_PCI_MSI_MSIX if (sc->sc_type == PCIHOST_ECAM) { diff --git a/sys/arch/arm/nvidia/tegra_ahcisata.c b/sys/arch/arm/nvidia/tegra_ahcisata.c index 0c4293e56aac..4ecdcb3a201e 100644 --- a/sys/arch/arm/nvidia/tegra_ahcisata.c +++ b/sys/arch/arm/nvidia/tegra_ahcisata.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_ahcisata.c,v 1.14 2021/01/15 23:11:59 jmcneill Exp $ */ +/* $NetBSD: tegra_ahcisata.c,v 1.15 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_ahcisata.c,v 1.14 2021/01/15 23:11:59 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_ahcisata.c,v 1.15 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -68,7 +68,7 @@ struct tegra_ahcisata_softc { struct tegra_gpio_pin *sc_pin_power; - struct tegra_ahcisata_data + const struct tegra_ahcisata_data *sc_tad; }; @@ -102,10 +102,11 @@ struct tegra_ahcisata_data tegra210_ahcisata_data = { }; -static const struct of_compat_data compat_data[] = { - { "nvidia,tegra124-ahci", (uintptr_t)&tegra124_ahcisata_data }, - { "nvidia,tegra210-ahci", (uintptr_t)&tegra210_ahcisata_data }, - { NULL }, +static const struct device_compatible_entry compat_data[] = { + { .compat = "nvidia,tegra124-ahci", .data = &tegra124_ahcisata_data }, + { .compat = "nvidia,tegra210-ahci", .data = &tegra210_ahcisata_data }, + + { 0 }, }; @@ -169,8 +170,7 @@ tegra_ahcisata_attach(device_t parent, device_t self, void *aux) return; } - uintptr_t data = of_search_compatible(faa->faa_phandle, compat_data)->data; - sc->sc_tad = (struct tegra_ahcisata_data *)data; + sc->sc_tad = of_search_compatible(faa->faa_phandle, compat_data)->data; if (sc->sc_tad->tad_type == TEGRA124) { sc->sc_clk_cml1 = fdtbus_clock_get(phandle, "cml1"); if (sc->sc_clk_cml1 == NULL) { diff --git a/sys/arch/arm/nvidia/tegra_nouveau.c b/sys/arch/arm/nvidia/tegra_nouveau.c index 473bf2a6a9c0..a8ccb62a462c 100644 --- a/sys/arch/arm/nvidia/tegra_nouveau.c +++ b/sys/arch/arm/nvidia/tegra_nouveau.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_nouveau.c,v 1.13 2021/01/15 23:11:59 jmcneill Exp $ */ +/* $NetBSD: tegra_nouveau.c,v 1.14 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_nouveau.c,v 1.13 2021/01/15 23:11:59 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_nouveau.c,v 1.14 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -110,10 +110,11 @@ static const struct nvkm_device_tegra_func gk20a_platform_data = { .iommu_bit = 34, }; -static const struct of_compat_data compat_data[] = { - { "nvidia,gk20a", (uintptr_t)&gk20a_platform_data }, - { "nvidia,gm20b", (uintptr_t)&gk20a_platform_data }, - { NULL, 0 }, +static const struct device_compatible_entry compat_data[] = { + { .compat = "nvidia,gk20a", .data = &gk20a_platform_data }, + { .compat = "nvidia,gm20b", .data = &gk20a_platform_data }, + + { 0 } }; static int @@ -130,10 +131,9 @@ tegra_nouveau_attach(device_t parent, device_t self, void *aux) struct tegra_nouveau_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; prop_dictionary_t prop = device_properties(self); - const struct of_compat_data *data = + const struct device_compatible_entry *data = of_search_compatible(faa->faa_phandle, compat_data); - const struct nvkm_device_tegra_func *tegra_func __diagused = - (const void *)data->data; + const struct nvkm_device_tegra_func *tegra_func __diagused = data->data; int error; KASSERT(tegra_func != NULL); diff --git a/sys/arch/arm/nvidia/tegra_pinmux.c b/sys/arch/arm/nvidia/tegra_pinmux.c index 0755b30b5742..a1a853040651 100644 --- a/sys/arch/arm/nvidia/tegra_pinmux.c +++ b/sys/arch/arm/nvidia/tegra_pinmux.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_pinmux.c,v 1.6 2019/10/13 06:11:31 skrll Exp $ */ +/* $NetBSD: tegra_pinmux.c,v 1.7 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_tegra.h" #include -__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.6 2019/10/13 06:11:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.7 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -75,11 +75,11 @@ struct tegra_pinmux_softc { #define PINMUX_READ(sc, reg) \ bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh[1], (reg)) -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { #ifdef SOC_TEGRA210 - { "nvidia,tegra210-pinmux", (uintptr_t)&tegra210_pinmux_conf }, + { .compat = "nvidia,tegra210-pinmux", .data = &tegra210_pinmux_conf }, #endif - { NULL } + { 0 } }; static const struct tegra_pinmux_pins * @@ -277,7 +277,7 @@ tegra_pinmux_attach(device_t parent, device_t self, void *aux) return; } } - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": Pinmux\n"); diff --git a/sys/arch/arm/nvidia/tegra_soctherm.c b/sys/arch/arm/nvidia/tegra_soctherm.c index 1794200e5c5c..f5e86e8b70be 100644 --- a/sys/arch/arm/nvidia/tegra_soctherm.c +++ b/sys/arch/arm/nvidia/tegra_soctherm.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_soctherm.c,v 1.9 2019/10/13 06:11:31 skrll Exp $ */ +/* $NetBSD: tegra_soctherm.c,v 1.10 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_soctherm.c,v 1.9 2019/10/13 06:11:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_soctherm.c,v 1.10 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -159,9 +159,11 @@ CFATTACH_DECL_NEW(tegra_soctherm, sizeof(struct tegra_soctherm_softc), #define SENSOR_SET_CLEAR(sc, s, reg, set, clr) \ tegra_reg_set_clear((sc)->sc_bst, (sc)->sc_bsh, (s)->s_base + (reg), (set), (clr)) -static const struct of_compat_data compat_data[] = { - { "nvidia,tegra124-soctherm", (uintptr_t)&tegra124_soctherm_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "nvidia,tegra124-soctherm", + .data = &tegra124_soctherm_config }, + + { 0 } }; static int @@ -213,7 +215,7 @@ tegra_soctherm_attach(device_t parent, device_t self, void *aux) aprint_naive("\n"); aprint_normal(": SOC_THERM\n"); - sc->sc_config = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_config = of_search_compatible(phandle, compat_data)->data; if (sc->sc_config == NULL) { aprint_error_dev(self, "unsupported SoC\n"); return; diff --git a/sys/arch/arm/nvidia/tegra_xusb.c b/sys/arch/arm/nvidia/tegra_xusb.c index c772f5437907..a9bee65cdcb5 100644 --- a/sys/arch/arm/nvidia/tegra_xusb.c +++ b/sys/arch/arm/nvidia/tegra_xusb.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_xusb.c,v 1.22 2021/01/15 23:11:59 jmcneill Exp $ */ +/* $NetBSD: tegra_xusb.c,v 1.23 2021/01/18 02:35:48 thorpej Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -30,7 +30,7 @@ #include "opt_tegra.h" #include -__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.22 2021/01/15 23:11:59 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.23 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -145,10 +145,11 @@ struct tegra_xhci_data tegra210_xhci_data = { .txd_scale_ss_clock = false, }; -static const struct of_compat_data compat_data[] = { - { "nvidia,tegra124-xusb", (uintptr_t)&tegra124_xhci_data }, - { "nvidia,tegra210-xusb", (uintptr_t)&tegra210_xhci_data }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "nvidia,tegra124-xusb", .data = &tegra124_xhci_data }, + { .compat = "nvidia,tegra210-xusb", .data = &tegra210_xhci_data }, + + { 0 } }; struct fw_dma { @@ -170,7 +171,7 @@ struct tegra_xusb_softc { struct fw_dma sc_fw_dma; struct clk *sc_clk_ss_src; - struct tegra_xhci_data *sc_txd; + const struct tegra_xhci_data *sc_txd; }; static uint32_t csb_read_4(struct tegra_xusb_softc * const, bus_size_t); @@ -230,8 +231,7 @@ tegra_xusb_attach(device_t parent, device_t self, void *aux) sc->sc_quirks = XHCI_DEFERRED_START; psc->sc_phandle = faa->faa_phandle; - uintptr_t data = of_search_compatible(faa->faa_phandle, compat_data)->data; - psc->sc_txd = (struct tegra_xhci_data *)data; + psc->sc_txd = of_search_compatible(faa->faa_phandle, compat_data)->data; if (fdtbus_get_reg_byname(faa->faa_phandle, "hcd", &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/nxp/if_enet_imx.c b/sys/arch/arm/nxp/if_enet_imx.c index f6796d89f56c..6c438d8498e4 100644 --- a/sys/arch/arm/nxp/if_enet_imx.c +++ b/sys/arch/arm/nxp/if_enet_imx.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_enet_imx.c,v 1.2 2021/01/15 23:58:18 jmcneill Exp $ */ +/* $NetBSD: if_enet_imx.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Genetec Corporation. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.2 2021/01/15 23:58:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $"); #include "opt_fdt.h" @@ -49,11 +49,12 @@ struct enet_fdt_softc { CFATTACH_DECL_NEW(enet_fdt, sizeof(struct enet_fdt_softc), enet_match, enet_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { /* compatible imxtype */ - { "fsl,imx6q-fec", 6 }, - { "fsl,imx6sx-fec", 7 }, - { NULL } + { .compat = "fsl,imx6q-fec", .value = 6 }, + { .compat = "fsl,imx6sx-fec", .value = 7 }, + + { 0 } }; static int enet_init_clocks(struct enet_softc *); @@ -127,7 +128,7 @@ enet_attach(device_t parent, device_t self, void *aux) sc->sc_ioh = bsh; sc->sc_dmat = faa->faa_dmat; - sc->sc_imxtype = of_search_compatible(phandle, compat_data)->data; + sc->sc_imxtype = of_search_compatible(phandle, compat_data)->value; sc->sc_unit = 0; sc->sc_phyid = enet_phy_id(sc, phandle); diff --git a/sys/arch/arm/nxp/imx6_pcie.c b/sys/arch/arm/nxp/imx6_pcie.c index 782fb4df026d..5511ac2c72a4 100644 --- a/sys/arch/arm/nxp/imx6_pcie.c +++ b/sys/arch/arm/nxp/imx6_pcie.c @@ -1,4 +1,4 @@ -/* $NetBSD: imx6_pcie.c,v 1.2 2021/01/15 23:58:18 jmcneill Exp $ */ +/* $NetBSD: imx6_pcie.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Genetec Corporation. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.2 2021/01/15 23:58:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $"); #include "opt_pci.h" #include "opt_fdt.h" @@ -89,10 +89,11 @@ static void imx6_pcie_reset(void *); CFATTACH_DECL_NEW(imxpcie_fdt, sizeof(struct imxpcie_fdt_softc), imx6_pcie_match, imx6_pcie_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "fsl,imx6q-pcie", false }, - { "fsl,imx6qp-pcie", true }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "fsl,imx6q-pcie", .value = false }, + { .compat = "fsl,imx6qp-pcie", .value = true }, + + { 0 } }; static int @@ -126,7 +127,8 @@ imx6_pcie_attach(device_t parent, device_t self, void *aux) sc->sc_gpr_read = imx6_pcie_gpr_read; sc->sc_gpr_write = imx6_pcie_gpr_write; sc->sc_reset = imx6_pcie_reset; - sc->sc_have_sw_reset = of_search_compatible(phandle, compat_data)->data; + sc->sc_have_sw_reset = + (bool)of_search_compatible(phandle, compat_data)->value; if (fdtbus_get_reg_byname(phandle, "dbi", &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/nxp/imx6_spi.c b/sys/arch/arm/nxp/imx6_spi.c index f6945889e104..b5344892b908 100644 --- a/sys/arch/arm/nxp/imx6_spi.c +++ b/sys/arch/arm/nxp/imx6_spi.c @@ -1,4 +1,4 @@ -/* $NetBSD: imx6_spi.c,v 1.3 2021/01/15 23:58:18 jmcneill Exp $ */ +/* $NetBSD: imx6_spi.c,v 1.4 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Genetec Corporation. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imx6_spi.c,v 1.3 2021/01/15 23:58:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx6_spi.c,v 1.4 2021/01/18 02:35:48 thorpej Exp $"); #include "opt_imxspi.h" @@ -60,9 +60,10 @@ static const struct imx_spi_config imx6q_spi_config = { .type = IMX51_ECSPI, }; -static const struct of_compat_data compat_data[] = { - { "fsl,imx6q-ecspi", (uintptr_t)&imx6q_spi_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "fsl,imx6q-ecspi", .data = &imx6q_spi_config }, + + { 0 } }; CFATTACH_DECL_NEW(imxspi_fdt, sizeof(struct imxspi_fdt_softc), @@ -138,7 +139,8 @@ imxspi_attach(device_t parent, device_t self, void *aux) sc->sc_phandle = phandle; sc->sc_iot = faa->faa_bst; - struct imx_spi_config *config = (void *)of_search_compatible(phandle, compat_data)->data; + const struct imx_spi_config *config = + of_search_compatible(phandle, compat_data)->data; sc->sc_enhanced = config->enhanced; sc->sc_type = config->type; diff --git a/sys/arch/arm/nxp/imx8mq_usbphy.c b/sys/arch/arm/nxp/imx8mq_usbphy.c index 05ab104ef16e..413bd396b6a3 100644 --- a/sys/arch/arm/nxp/imx8mq_usbphy.c +++ b/sys/arch/arm/nxp/imx8mq_usbphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: imx8mq_usbphy.c,v 1.1 2020/12/23 14:42:38 skrll Exp $ */ +/* $NetBSD: imx8mq_usbphy.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: imx8mq_usbphy.c,v 1.1 2020/12/23 14:42:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx8mq_usbphy.c,v 1.2 2021/01/18 02:35:48 thorpej Exp $"); #include #include @@ -55,9 +55,10 @@ __KERNEL_RCSID(0, "$NetBSD: imx8mq_usbphy.c,v 1.1 2020/12/23 14:42:38 skrll Exp static int imx8mq_usbphy_match(device_t, cfdata_t, void *); static void imx8mq_usbphy_attach(device_t, device_t, void *); -static const struct of_compat_data compat_data[] = { - { "fsl,imx8mq-usb-phy", 0 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "fsl,imx8mq-usb-phy" }, + + { 0 } }; struct imx8mq_usbphy_softc { diff --git a/sys/arch/arm/nxp/imx_sdhc.c b/sys/arch/arm/nxp/imx_sdhc.c index adc872ba5bc9..cd2e1c8c4bdb 100644 --- a/sys/arch/arm/nxp/imx_sdhc.c +++ b/sys/arch/arm/nxp/imx_sdhc.c @@ -1,4 +1,4 @@ -/* $NetBSD: imx_sdhc.c,v 1.2 2021/01/15 23:58:18 jmcneill Exp $ */ +/* $NetBSD: imx_sdhc.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $ */ /*- * Copyright (c) 2019 Genetec Corporation. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imx_sdhc.c,v 1.2 2021/01/15 23:58:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx_sdhc.c,v 1.3 2021/01/18 02:35:48 thorpej Exp $"); #include "opt_fdt.h" @@ -84,10 +84,11 @@ static const struct imx6_sdhc_config imx7d_config = { .flags = 0 }; -static const struct of_compat_data compat_data[] = { - { "fsl,imx6q-usdhc", (uintptr_t)&imx6q_config }, - { "fsl,imx7d-usdhc", (uintptr_t)&imx7d_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "fsl,imx6q-usdhc", .data = &imx6q_config }, + { .compat = "fsl,imx7d-usdhc", .data = &imx7d_config }, + + { 0 } }; static int @@ -129,7 +130,7 @@ imx_sdhc_attach(device_t parent, device_t self, void *aux) sc->sc_vmmc_supply = fdtbus_regulator_acquire(phandle, "vmmc-supply"); - conf = (void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; sc->sc_sdhc.sc_dev = self; sc->sc_sdhc.sc_dmat = faa->faa_dmat; diff --git a/sys/arch/arm/rockchip/rk3328_iomux.c b/sys/arch/arm/rockchip/rk3328_iomux.c index 9f0d0acd933f..864b9f4747c4 100644 --- a/sys/arch/arm/rockchip/rk3328_iomux.c +++ b/sys/arch/arm/rockchip/rk3328_iomux.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk3328_iomux.c,v 1.3 2019/10/01 23:32:52 jmcneill Exp $ */ +/* $NetBSD: rk3328_iomux.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk3328_iomux.c,v 1.3 2019/10/01 23:32:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk3328_iomux.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -114,9 +114,10 @@ static const struct rk3328_iomux_conf rk3328_iomux_conf = { .nbanks = __arraycount(rk3328_iomux_banks), }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3328-pinctrl", (uintptr_t)&rk3328_iomux_conf }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3328-pinctrl", .data = &rk3328_iomux_conf }, + + { 0 } }; struct rk3328_iomux_softc { @@ -295,7 +296,7 @@ rk3328_iomux_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't acquire grf syscon\n"); return; } - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": RK3328 IOMUX control\n"); diff --git a/sys/arch/arm/rockchip/rk3399_iomux.c b/sys/arch/arm/rockchip/rk3399_iomux.c index 7517f1dbf356..e558d2453a98 100644 --- a/sys/arch/arm/rockchip/rk3399_iomux.c +++ b/sys/arch/arm/rockchip/rk3399_iomux.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk3399_iomux.c,v 1.6 2019/10/01 23:32:52 jmcneill Exp $ */ +/* $NetBSD: rk3399_iomux.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -29,7 +29,7 @@ //#define RK3399_IOMUX_DEBUG #include -__KERNEL_RCSID(0, "$NetBSD: rk3399_iomux.c,v 1.6 2019/10/01 23:32:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk3399_iomux.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -181,8 +181,8 @@ static const struct rk3399_iomux_conf rk3399_iomux_conf = { .nbanks = __arraycount(rk3399_iomux_banks), }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3399-pinctrl", (uintptr_t)&rk3399_iomux_conf }, +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3399-pinctrl", .data = &rk3399_iomux_conf }, { NULL } }; @@ -499,7 +499,7 @@ rk3399_iomux_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't acquire pmu syscon\n"); return; } - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": RK3399 IOMUX control\n"); diff --git a/sys/arch/arm/rockchip/rk_gmac.c b/sys/arch/arm/rockchip/rk_gmac.c index c5a51cf5db2c..77f3a00b66d3 100644 --- a/sys/arch/arm/rockchip/rk_gmac.c +++ b/sys/arch/arm/rockchip/rk_gmac.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk_gmac.c,v 1.16 2021/01/15 18:42:41 ryo Exp $ */ +/* $NetBSD: rk_gmac.c,v 1.17 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.16 2021/01/15 18:42:41 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.17 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -58,10 +58,11 @@ enum rk_gmac_type { GMAC_RK3399 }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3328-gmac", GMAC_RK3328 }, - { "rockchip,rk3399-gmac", GMAC_RK3399 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3328-gmac", .value = GMAC_RK3328 }, + { .compat = "rockchip,rk3399-gmac", .value = GMAC_RK3399 }, + + { 0 } }; struct rk_gmac_softc { @@ -363,7 +364,7 @@ rk_gmac_attach(device_t parent, device_t self, void *aux) return; } - rk_sc->sc_type = of_search_compatible(phandle, compat_data)->data; + rk_sc->sc_type = of_search_compatible(phandle, compat_data)->value; rk_sc->sc_syscon = fdtbus_syscon_acquire(phandle, "rockchip,grf"); if (rk_sc->sc_syscon == NULL) { diff --git a/sys/arch/arm/rockchip/rk_i2s.c b/sys/arch/arm/rockchip/rk_i2s.c index 01a989c9053d..25c595ebf396 100644 --- a/sys/arch/arm/rockchip/rk_i2s.c +++ b/sys/arch/arm/rockchip/rk_i2s.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk_i2s.c,v 1.7 2021/01/15 18:42:41 ryo Exp $ */ +/* $NetBSD: rk_i2s.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_i2s.c,v 1.7 2021/01/15 18:42:41 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_i2s.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -117,12 +117,13 @@ static const struct rk_i2s_config rk3399_i2s_config = { .oe_val = 0x7, }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3066-i2s", 0 }, - { "rockchip,rk3188-i2s", 0 }, - { "rockchip,rk3288-i2s", 0 }, - { "rockchip,rk3399-i2s", (uintptr_t)&rk3399_i2s_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3066-i2s", }, + { .compat = "rockchip,rk3188-i2s", }, + { .compat = "rockchip,rk3288-i2s", }, + { .compat = "rockchip,rk3399-i2s", .data = &rk3399_i2s_config }, + + { 0 } }; struct rk_i2s_softc; @@ -586,7 +587,7 @@ rk_i2s_attach(device_t parent, device_t self, void *aux) mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; if (sc->sc_conf != NULL && sc->sc_conf->oe_mask != 0) { sc->sc_grf = fdtbus_syscon_acquire(phandle, "rockchip,grf"); if (sc->sc_grf == NULL) { diff --git a/sys/arch/arm/rockchip/rk_pwm.c b/sys/arch/arm/rockchip/rk_pwm.c index 9b0ee5df34b8..5ebfe1be0546 100644 --- a/sys/arch/arm/rockchip/rk_pwm.c +++ b/sys/arch/arm/rockchip/rk_pwm.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk_pwm.c,v 1.3 2019/12/19 00:42:12 jakllsch Exp $ */ +/* $NetBSD: rk_pwm.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: rk_pwm.c,v 1.3 2019/12/19 00:42:12 jakllsch Exp $"); +__KERNEL_RCSID(1, "$NetBSD: rk_pwm.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -63,9 +63,10 @@ enum rk_pwm_type { PWM_RK3288 = 1, }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3288-pwm", PWM_RK3288 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3288-pwm", .value = PWM_RK3288 }, + + { 0 } }; struct rk_pwm_softc { diff --git a/sys/arch/arm/rockchip/rk_usb.c b/sys/arch/arm/rockchip/rk_usb.c index 471399578c3b..fec09f231284 100644 --- a/sys/arch/arm/rockchip/rk_usb.c +++ b/sys/arch/arm/rockchip/rk_usb.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk_usb.c,v 1.7 2018/09/09 07:21:17 aymeric Exp $ */ +/* $NetBSD: rk_usb.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rk_usb.c,v 1.7 2018/09/09 07:21:17 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_usb.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -68,10 +68,11 @@ enum rk_usb_type { USB_RK3399, }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3328-usb2phy", USB_RK3328 }, - { "rockchip,rk3399-usb2phy", USB_RK3399 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3328-usb2phy", .value = USB_RK3328 }, + { .compat = "rockchip,rk3399-usb2phy", .value = USB_RK3399 }, + + { 0 } }; struct rk_usb_clk { @@ -227,7 +228,7 @@ rk_usb_attach(device_t parent, device_t self, void *aux) } sc->sc_dev = self; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; sc->sc_syscon = fdtbus_syscon_lookup(OF_parent(phandle)); if (sc->sc_syscon == NULL) { aprint_error(": couldn't get grf syscon\n"); diff --git a/sys/arch/arm/rockchip/rk_v1crypto.c b/sys/arch/arm/rockchip/rk_v1crypto.c index 7cc46d1862b2..c89cee6c5d28 100644 --- a/sys/arch/arm/rockchip/rk_v1crypto.c +++ b/sys/arch/arm/rockchip/rk_v1crypto.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk_v1crypto.c,v 1.3 2020/10/19 13:44:25 tnn Exp $ */ +/* $NetBSD: rk_v1crypto.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.3 2020/10/19 13:44:25 tnn Exp $"); +__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include @@ -98,9 +98,10 @@ RKC_CTRL(struct rk_v1crypto_softc *sc, uint16_t m, uint16_t v) CFATTACH_DECL_NEW(rk_v1crypto, sizeof(struct rk_v1crypto_softc), rk_v1crypto_match, rk_v1crypto_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - {"rockchip,rk3288-crypto", 0}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3288-crypto" }, + + { 0 } }; static int diff --git a/sys/arch/arm/rockchip/rk_vop.c b/sys/arch/arm/rockchip/rk_vop.c index 7d9aa98d5823..1fd9536a94a3 100644 --- a/sys/arch/arm/rockchip/rk_vop.c +++ b/sys/arch/arm/rockchip/rk_vop.c @@ -1,4 +1,4 @@ -/* $NetBSD: rk_vop.c,v 1.6 2020/01/05 12:14:35 mrg Exp $ */ +/* $NetBSD: rk_vop.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.6 2020/01/05 12:14:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -140,7 +140,7 @@ struct rk_vop_softc { struct fdt_device_ports sc_ports; - struct rk_vop_config *sc_conf; + const struct rk_vop_config *sc_conf; }; #define to_rk_vop_crtc(x) container_of(x, struct rk_vop_crtc, base) @@ -218,10 +218,13 @@ static const struct rk_vop_config rk3399_vop_big_config = { .set_polarity = rk3399_vop_set_polarity, }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3399-vop-big", (uintptr_t)&rk3399_vop_big_config }, - { "rockchip,rk3399-vop-lit", (uintptr_t)&rk3399_vop_lit_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3399-vop-big", + .data = &rk3399_vop_big_config }, + { .compat = "rockchip,rk3399-vop-lit", + .data = &rk3399_vop_lit_config }, + + { 0 } }; static int @@ -236,6 +239,7 @@ rk_vop_mode_do_set_base(struct drm_crtc *crtc, struct drm_framebuffer *fb, uint64_t paddr = (uint64_t)sfb->obj->dmamap->dm_segs[0].ds_addr; + paddr += y * sfb->base.pitches[0]; paddr += x * drm_format_plane_cpp(sfb->base.pixel_format, 0); @@ -580,7 +584,7 @@ rk_vop_attach(device_t parent, device_t self, void *aux) return; } sc->sc_phandle = faa->faa_phandle; - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": %s\n", sc->sc_conf->descr); diff --git a/sys/arch/arm/samsung/exynos_gpio.c b/sys/arch/arm/samsung/exynos_gpio.c index f2afe9f5a3f6..72e7872d04ef 100644 --- a/sys/arch/arm/samsung/exynos_gpio.c +++ b/sys/arch/arm/samsung/exynos_gpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.29 2020/03/20 06:38:16 skrll Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.30 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.29 2020/03/20 06:38:16 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.30 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -418,7 +418,8 @@ exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent, * the '-', or the four character string if the dash is not present. */ struct exynos_gpio_bank * -exynos_gpio_bank_lookup(struct exynos_pinctrl_banks *epb, const char *name) +exynos_gpio_bank_lookup(const struct exynos_pinctrl_banks *epb, + const char *name) { struct exynos_gpio_bank *bank; diff --git a/sys/arch/arm/samsung/exynos_pinctrl.c b/sys/arch/arm/samsung/exynos_pinctrl.c index ca68e74c2159..b156c8b01413 100644 --- a/sys/arch/arm/samsung/exynos_pinctrl.c +++ b/sys/arch/arm/samsung/exynos_pinctrl.c @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_pinctrl.c,v 1.17 2020/03/20 06:38:16 skrll Exp $ */ +/* $NetBSD: exynos_pinctrl.c,v 1.18 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.17 2020/03/20 06:38:16 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.18 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -73,10 +73,13 @@ CFATTACH_DECL_NEW(exynos_pinctrl, sizeof(struct exynos_pinctrl_softc), exynos_pinctrl_match, exynos_pinctrl_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "samsung,exynos5410-pinctrl", (uintptr_t)&exynos5410_pinctrl_banks }, - { "samsung,exynos5420-pinctrl", (uintptr_t)&exynos5420_pinctrl_banks }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "samsung,exynos5410-pinctrl", + .data = &exynos5410_pinctrl_banks }, + { .compat = "samsung,exynos5420-pinctrl", + .data = &exynos5420_pinctrl_banks }, + + { 0 } }; static int @@ -107,7 +110,7 @@ exynos_pinctrl_attach(device_t parent, device_t self, void *aux) self->dv_private = sc; sc->sc_dev = self; sc->sc_bst = faa->faa_bst; - sc->sc_epb = (struct exynos_pinctrl_banks *)of_search_compatible(faa->faa_phandle, compat_data)->data; + sc->sc_epb = of_search_compatible(faa->faa_phandle, compat_data)->data; error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh); if (error) { @@ -162,7 +165,7 @@ static int exynos_do_config(struct exynos_pinctrl_config *pc) { struct exynos_gpio_pin_cfg *gc = &pc->pc_pincfg; - struct exynos_pinctrl_banks *epb = pc->pc_sc->sc_epb; + const struct exynos_pinctrl_banks *epb = pc->pc_sc->sc_epb; struct exynos_gpio_bank *bank; const char *pins; int pin; diff --git a/sys/arch/arm/samsung/exynos_pinctrl.h b/sys/arch/arm/samsung/exynos_pinctrl.h index 944cdc522681..0a28193b61b6 100644 --- a/sys/arch/arm/samsung/exynos_pinctrl.h +++ b/sys/arch/arm/samsung/exynos_pinctrl.h @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_pinctrl.h,v 1.3 2020/03/20 06:38:16 skrll Exp $ */ +/* $NetBSD: exynos_pinctrl.h,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc. @@ -36,5 +36,5 @@ struct exynos_pinctrl_softc { bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; - struct exynos_pinctrl_banks *sc_epb; + const struct exynos_pinctrl_banks *sc_epb; }; diff --git a/sys/arch/arm/samsung/exynos_platform.c b/sys/arch/arm/samsung/exynos_platform.c index 8db66c8a3ada..c5c3c777f254 100644 --- a/sys/arch/arm/samsung/exynos_platform.c +++ b/sys/arch/arm/samsung/exynos_platform.c @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_platform.c,v 1.32 2020/11/27 07:11:49 skrll Exp $ */ +/* $NetBSD: exynos_platform.c,v 1.33 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared D. McNeill @@ -35,7 +35,7 @@ #include "ukbd.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.32 2020/11/27 07:11:49 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.33 2021/01/18 02:35:49 thorpej Exp $"); /* @@ -196,9 +196,10 @@ exynos5800_mpstart(void) return ret; } -static struct of_compat_data mp_compat_data[] = { - { "samsung,exynos5800", (uintptr_t)exynos5800_mpstart }, - { NULL } +static struct device_compatible_entry mp_compat_data[] = { + { .compat = "samsung,exynos5800", .data = exynos5800_mpstart }, + + { 0 } }; static int @@ -207,9 +208,10 @@ exynos_platform_mpstart(void) int (*mp_start)(void) = NULL; - const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data); + const struct device_compatible_entry *cd = + of_search_compatible(OF_finddevice("/"), mp_compat_data); if (cd) - mp_start = (int (*)(void))cd->data; + mp_start = cd->data; if (mp_start) return mp_start(); @@ -337,8 +339,9 @@ exynos5_platform_bootstrap(void) exynos_bootstrap(5); #if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER) - const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data); - if (cd && cd->data == (uintptr_t)exynos5800_mpstart) { + const struct device_compatible_entry *cd = + of_search_compatible(OF_finddevice("/"), mp_compat_data); + if (cd && cd->data == exynos5800_mpstart) { void *fdt_data = __UNCONST(fdtbus_get_data()); int cpu_off, cpus_off, len; diff --git a/sys/arch/arm/samsung/exynos_usbdrdphy.c b/sys/arch/arm/samsung/exynos_usbdrdphy.c index 4b51c099d886..eda1920f05a0 100644 --- a/sys/arch/arm/samsung/exynos_usbdrdphy.c +++ b/sys/arch/arm/samsung/exynos_usbdrdphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_usbdrdphy.c,v 1.2 2018/07/03 16:22:48 jmcneill Exp $ */ +/* $NetBSD: exynos_usbdrdphy.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.2 2018/07/03 16:22:48 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -89,9 +89,10 @@ enum { NPHY_ID }; -static const struct of_compat_data compat_data[] = { - { "samsung,exynos5420-usbdrd-phy", 0 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "samsung,exynos5420-usbdrd-phy" }, + + { 0 } }; struct exynos_usbdrdphy_softc; diff --git a/sys/arch/arm/samsung/exynos_usbphy.c b/sys/arch/arm/samsung/exynos_usbphy.c index 74d9272b63a9..f8d0c8bbba77 100644 --- a/sys/arch/arm/samsung/exynos_usbphy.c +++ b/sys/arch/arm/samsung/exynos_usbphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_usbphy.c,v 1.2 2018/07/03 16:09:04 jmcneill Exp $ */ +/* $NetBSD: exynos_usbphy.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_usbphy.c,v 1.2 2018/07/03 16:09:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_usbphy.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -66,9 +66,10 @@ enum { static int exynos_usbphy_match(device_t, cfdata_t, void *); static void exynos_usbphy_attach(device_t, device_t, void *); -static const struct of_compat_data compat_data[] = { - { "samsung,exynos5250-usb2-phy", 0 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "samsung,exynos5250-usb2-phy" }, + + { 0 } }; struct exynos_usbphy_softc; diff --git a/sys/arch/arm/samsung/exynos_var.h b/sys/arch/arm/samsung/exynos_var.h index 162143b01815..1b404223c694 100644 --- a/sys/arch/arm/samsung/exynos_var.h +++ b/sys/arch/arm/samsung/exynos_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_var.h,v 1.28 2020/03/20 06:38:16 skrll Exp $ */ +/* $NetBSD: exynos_var.h,v 1.29 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -176,7 +176,7 @@ extern void exyo_device_register_post_config(device_t self, void *aux); extern struct exynos_pinctrl_banks exynos5410_pinctrl_banks; extern struct exynos_pinctrl_banks exynos5420_pinctrl_banks; -extern struct exynos_gpio_bank *exynos_gpio_bank_lookup(struct exynos_pinctrl_banks *, const char *name); +extern struct exynos_gpio_bank *exynos_gpio_bank_lookup(const struct exynos_pinctrl_banks *, const char *name); extern bool exynos_gpio_pinset_available(const struct exynos_gpio_pinset *); extern void exynos_gpio_pinset_acquire(const struct exynos_gpio_pinset *); extern void exynos_gpio_pinset_release(const struct exynos_gpio_pinset *); diff --git a/sys/arch/arm/sociox/if_ave.c b/sys/arch/arm/sociox/if_ave.c index 8b662d5cc1eb..a667995e9f27 100644 --- a/sys/arch/arm/sociox/if_ave.c +++ b/sys/arch/arm/sociox/if_ave.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ave.c,v 1.17 2020/09/23 23:38:24 nisimura Exp $ */ +/* $NetBSD: if_ave.c,v 1.18 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.17 2020/09/23 23:38:24 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.18 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -321,13 +321,14 @@ struct desops ave32ops = { oinit_rdes, }; -static const struct of_compat_data compat_data[] = { - { "socionext,unifier-ld20-ave4", 64 }, - { "socionext,unifier-pro4-ave4", 32 }, - { "socionext,unifier-pxs2-ave4", 32 }, - { "socionext,unifier-ld11-ave4", 32 }, - { "socionext,unifier-pxs3-ave4", 32 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "socionext,unifier-ld20-ave4", .value = 64 }, + { .compat = "socionext,unifier-pro4-ave4", .value = 32 }, + { .compat = "socionext,unifier-pxs2-ave4", .value = 32 }, + { .compat = "socionext,unifier-ld11-ave4", .value = 32 }, + { .compat = "socionext,unifier-pxs3-ave4", .value = 32 }, + + { 0 } }; static int @@ -382,7 +383,7 @@ ave_fdt_attach(device_t parent, device_t self, void *aux) hwimp = CSR_READ(sc, AVEID); hwver = CSR_READ(sc, AVEHWVER); - sc->sc_model = of_search_compatible(phandle, compat_data)->data; + sc->sc_model = of_search_compatible(phandle, compat_data)->value; phy_mode = fdtbus_get_string(phandle, "phy-mode"); if (phy_mode == NULL) diff --git a/sys/arch/arm/sunxi/sun4i_a10_ccu.c b/sys/arch/arm/sunxi/sun4i_a10_ccu.c index d18643c988ac..fee9813fd6aa 100644 --- a/sys/arch/arm/sunxi/sun4i_a10_ccu.c +++ b/sys/arch/arm/sunxi/sun4i_a10_ccu.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun4i_a10_ccu.c,v 1.12 2020/05/07 11:24:47 jmcneill Exp $ */ +/* $NetBSD: sun4i_a10_ccu.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sun4i_a10_ccu.c,v 1.12 2020/05/07 11:24:47 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sun4i_a10_ccu.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -93,10 +93,11 @@ enum sun4i_a10_ccu_type { CCU_A20, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-ccu", CCU_A10 }, - { "allwinner,sun7i-a20-ccu", CCU_A20 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-ccu", .value = CCU_A10 }, + { .compat = "allwinner,sun7i-a20-ccu", .value = CCU_A20 }, + + { 0 } }; CFATTACH_DECL_NEW(sunxi_a10_ccu, sizeof(struct sunxi_ccu_softc), @@ -875,7 +876,7 @@ sun4i_a10_ccu_attach(device_t parent, device_t self, void *aux) aprint_naive("\n"); - type = of_search_compatible(faa->faa_phandle, compat_data)->data; + type = of_search_compatible(faa->faa_phandle, compat_data)->value; switch (type) { case CCU_A10: diff --git a/sys/arch/arm/sunxi/sun4i_dma.c b/sys/arch/arm/sunxi/sun4i_dma.c index ba4205d11a84..d8de97d43375 100644 --- a/sys/arch/arm/sunxi/sun4i_dma.c +++ b/sys/arch/arm/sunxi/sun4i_dma.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun4i_dma.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sun4i_dma.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: sun4i_dma.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sun4i_dma.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -96,9 +96,10 @@ __KERNEL_RCSID(0, "$NetBSD: sun4i_dma.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $ __SHIFTIN(2, DDMA_PARA_DST_WAIT_CLK_CYC) | \ __SHIFTIN(2, DDMA_PARA_SRC_WAIT_CLK_CYC)) -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-dma", 1 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-dma" }, + + { 0 } }; struct sun4idma_channel { diff --git a/sys/arch/arm/sunxi/sun6i_dma.c b/sys/arch/arm/sunxi/sun6i_dma.c index 5988d61aa774..e413073d7c5f 100644 --- a/sys/arch/arm/sunxi/sun6i_dma.c +++ b/sys/arch/arm/sunxi/sun6i_dma.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun6i_dma.c,v 1.10 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sun6i_dma.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.10 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -151,12 +151,17 @@ static const struct sun6idma_config sun50i_a64_dma_config = { .widths = WIDTHS_1_2_4_8, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun6i-a31-dma", (uintptr_t)&sun6i_a31_dma_config }, - { "allwinner,sun8i-a83t-dma", (uintptr_t)&sun8i_a83t_dma_config }, - { "allwinner,sun8i-h3-dma", (uintptr_t)&sun8i_h3_dma_config }, - { "allwinner,sun50i-a64-dma", (uintptr_t)&sun50i_a64_dma_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun6i-a31-dma", + .data = &sun6i_a31_dma_config }, + { .compat = "allwinner,sun8i-a83t-dma", + .data = &sun8i_a83t_dma_config }, + { .compat = "allwinner,sun8i-h3-dma", + .data = &sun8i_h3_dma_config }, + { .compat = "allwinner,sun50i-a64-dma", + .data = &sun50i_a64_dma_config }, + + { 0 } }; struct sun6idma_channel { @@ -459,7 +464,7 @@ sun6idma_attach(device_t parent, device_t self, void *aux) return; } - conf = (void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; sc->sc_burst_mask = conf->burst_mask; sc->sc_nchan = conf->num_channels; diff --git a/sys/arch/arm/sunxi/sun8i_crypto.c b/sys/arch/arm/sunxi/sun8i_crypto.c index e615e0287b25..e6886526c43d 100644 --- a/sys/arch/arm/sunxi/sun8i_crypto.c +++ b/sys/arch/arm/sunxi/sun8i_crypto.c @@ -1,4 +1,4 @@ -/* $NetBSD: sun8i_crypto.c,v 1.19 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sun8i_crypto.c,v 1.20 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.19 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.20 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -318,9 +318,10 @@ sun8i_crypto_write(struct sun8i_crypto_softc *sc, bus_size_t reg, uint32_t v) CFATTACH_DECL_NEW(sun8i_crypto, sizeof(struct sun8i_crypto_softc), sun8i_crypto_match, sun8i_crypto_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - {"allwinner,sun50i-a64-crypto", 0}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun50i-a64-crypto" }, + + { 0 } }; static int diff --git a/sys/arch/arm/sunxi/sunxi_can.c b/sys/arch/arm/sunxi/sunxi_can.c index c80d8b39f355..9caad88efdac 100644 --- a/sys/arch/arm/sunxi/sunxi_can.c +++ b/sys/arch/arm/sunxi/sunxi_can.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_can.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_can.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017,2018 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -85,9 +85,10 @@ struct sunxi_can_softc { #define sc_timings sc_cansc.csc_timings #define sc_linkmodes sc_cansc.csc_linkmodes -static const struct of_compat_data compat_data[] = { - {"allwinner,sun4i-a10-can", 0}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-can" }, + + { 0 } }; static int sunxi_can_match(device_t, cfdata_t, void *); diff --git a/sys/arch/arm/sunxi/sunxi_codec.c b/sys/arch/arm/sunxi/sunxi_codec.c index 299580a26613..858b64dc50dd 100644 --- a/sys/arch/arm/sunxi/sunxi_codec.c +++ b/sys/arch/arm/sunxi/sunxi_codec.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_codec.c,v 1.8 2020/02/29 05:51:10 isaki Exp $ */ +/* $NetBSD: sunxi_codec.c,v 1.9 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.8 2020/02/29 05:51:10 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.9 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -88,11 +88,12 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.8 2020/02/29 05:51:10 isaki Exp $" #define AC_DAC_CNT(_sc) ((_sc)->sc_cfg->DAC_CNT) #define AC_ADC_CNT(_sc) ((_sc)->sc_cfg->ADC_CNT) -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { A10_CODEC_COMPATDATA, A31_CODEC_COMPATDATA, H3_CODEC_COMPATDATA, - { NULL } + + { 0 } }; #define CODEC_READ(sc, reg) \ @@ -604,7 +605,7 @@ sunxi_codec_attach(device_t parent, device_t self, void *aux) } sc->sc_dmat = faa->faa_dmat; LIST_INIT(&sc->sc_dmalist); - sc->sc_cfg = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_cfg = of_search_compatible(phandle, compat_data)->data; mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); diff --git a/sys/arch/arm/sunxi/sunxi_codec.h b/sys/arch/arm/sunxi/sunxi_codec.h index 8c697628f74b..b22f79a53e9d 100644 --- a/sys/arch/arm/sunxi/sunxi_codec.h +++ b/sys/arch/arm/sunxi/sunxi_codec.h @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_codec.h,v 1.5 2019/05/08 13:40:14 isaki Exp $ */ +/* $NetBSD: sunxi_codec.h,v 1.6 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -100,7 +100,7 @@ struct sunxi_codec_softc { int sc_phandle; bus_addr_t sc_baseaddr; - struct sunxi_codec_conf *sc_cfg; + const struct sunxi_codec_conf *sc_cfg; void *sc_codec_priv; struct fdtbus_gpio_pin *sc_pin_pa; @@ -118,19 +118,23 @@ struct sunxi_codec_softc { #if NH3_CODEC > 0 extern const struct sunxi_codec_conf sun8i_h3_codecconf; -#define H3_CODEC_COMPATDATA \ - { "allwinner,sun8i-h3-codec", (uintptr_t)&sun8i_h3_codecconf } +#define H3_CODEC_COMPATDATA \ + { .compat = "allwinner,sun8i-h3-codec", \ + .data = &sun8i_h3_codecconf } #else #define H3_CODEC_COMPATDATA #endif extern const struct sunxi_codec_conf sun4i_a10_codecconf; -#define A10_CODEC_COMPATDATA \ - { "allwinner,sun4i-a10-codec", (uintptr_t)&sun4i_a10_codecconf }, \ - { "allwinner,sun7i-a20-codec", (uintptr_t)&sun4i_a10_codecconf } +#define A10_CODEC_COMPATDATA \ + { .compat = "allwinner,sun4i-a10-codec", \ + .data = &sun4i_a10_codecconf }, \ + { .compat = "allwinner,sun7i-a20-codec", \ + .data = &sun4i_a10_codecconf } extern const struct sunxi_codec_conf sun6i_a31_codecconf; -#define A31_CODEC_COMPATDATA \ - { "allwinner,sun6i-a31-codec", (uintptr_t)&sun6i_a31_codecconf } +#define A31_CODEC_COMPATDATA \ + { .compat = "allwinner,sun6i-a31-codec", \ + .data = &sun6i_a31_codecconf } #endif /* !_ARM_SUNXI_CODEC_H */ diff --git a/sys/arch/arm/sunxi/sunxi_de2_ccu.c b/sys/arch/arm/sunxi/sunxi_de2_ccu.c index d15e1a0aa210..5dabe0daa0cd 100644 --- a/sys/arch/arm/sunxi/sunxi_de2_ccu.c +++ b/sys/arch/arm/sunxi/sunxi_de2_ccu.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_de2_ccu.c,v 1.3 2019/01/31 01:49:28 jmcneill Exp $ */ +/* $NetBSD: sunxi_de2_ccu.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sunxi_de2_ccu.c,v 1.3 2019/01/31 01:49:28 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sunxi_de2_ccu.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -97,11 +97,15 @@ static const struct sunxi_de2_ccu_config sun50i_a64_de2_config = { .nclks = __arraycount(sun8i_h3_de2_ccu_clks), }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun8i-h3-de2-clk", (uintptr_t)&sun8i_h3_de2_config }, - { "allwinner,sun50i-a64-de2-clk", (uintptr_t)&sun50i_a64_de2_config }, - { "allwinner,sun50i-h5-de2-clk", (uintptr_t)&sun50i_a64_de2_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-h3-de2-clk", + .data = &sun8i_h3_de2_config }, + { .compat = "allwinner,sun50i-a64-de2-clk", + .data = &sun50i_a64_de2_config }, + { .compat = "allwinner,sun50i-h5-de2-clk", + .data = &sun50i_a64_de2_config }, + + { 0 } }; static int @@ -126,7 +130,7 @@ sunxi_de2_ccu_attach(device_t parent, device_t self, void *aux) sc->sc_phandle = phandle; sc->sc_bst = faa->faa_bst; - conf = (void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; sc->sc_resets = conf->resets; sc->sc_nresets = conf->nresets; diff --git a/sys/arch/arm/sunxi/sunxi_debe.c b/sys/arch/arm/sunxi/sunxi_debe.c index 3bbbbd4b5e45..da4e80d20b8f 100644 --- a/sys/arch/arm/sunxi/sunxi_debe.c +++ b/sys/arch/arm/sunxi/sunxi_debe.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_debe.c,v 1.10 2020/10/19 01:13:41 rin Exp $ */ +/* $NetBSD: sunxi_debe.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Manuel Bouyer @@ -38,7 +38,7 @@ #define SUNXI_DEBE_CURMAX 64 #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_debe.c,v 1.10 2020/10/19 01:13:41 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_debe.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -101,10 +101,11 @@ struct sunxi_debe_softc { #define DEBE_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) -static const struct of_compat_data compat_data[] = { - {"allwinner,sun4i-a10-display-backend", DEBE_A10}, - {"allwinner,sun7i-a20-display-backend", DEBE_A10}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-display-backend", .value = DEBE_A10 }, + { .compat = "allwinner,sun7i-a20-display-backend", .value = DEBE_A10 }, + + { 0 } }; struct sunxifb_attach_args { @@ -188,7 +189,8 @@ sunxi_debe_attach(device_t parent, device_t self, void *aux) return; } - sc->sc_type = of_search_compatible(faa->faa_phandle, compat_data)->data; + sc->sc_type = + of_search_compatible(faa->faa_phandle, compat_data)->value; aprint_naive("\n"); aprint_normal(": Display Engine Backend (%s)\n", diff --git a/sys/arch/arm/sunxi/sunxi_dep.c b/sys/arch/arm/sunxi/sunxi_dep.c index 0b7be8f3ce74..622ea2f03e53 100644 --- a/sys/arch/arm/sunxi/sunxi_dep.c +++ b/sys/arch/arm/sunxi/sunxi_dep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_dep.c,v 1.3 2018/04/07 18:09:33 bouyer Exp $ */ +/* $NetBSD: sunxi_dep.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sunxi_dep.c,v 1.3 2018/04/07 18:09:33 bouyer Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sunxi_dep.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -51,10 +51,11 @@ struct sunxi_dep_softc { int sc_phandle; }; -static const struct of_compat_data compat_data[] = { - {"allwinner,sun4i-a10-display-engine", 0}, - {"allwinner,sun7i-a20-display-engine", 0}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-display-engine" }, + { .compat = "allwinner,sun7i-a20-display-engine" }, + + { 0 } }; static const char *fb_compat[] = { diff --git a/sys/arch/arm/sunxi/sunxi_emac.c b/sys/arch/arm/sunxi/sunxi_emac.c index fdccbfeb7a08..a38ea21552d6 100644 --- a/sys/arch/arm/sunxi/sunxi_emac.c +++ b/sys/arch/arm/sunxi/sunxi_emac.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_emac.c,v 1.30 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_emac.c,v 1.31 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2016-2017 Jared McNeill @@ -33,7 +33,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.30 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.31 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -131,12 +131,13 @@ enum sunxi_emac_type { EMAC_H6, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun8i-a83t-emac", EMAC_A83T }, - { "allwinner,sun8i-h3-emac", EMAC_H3 }, - { "allwinner,sun50i-a64-emac", EMAC_A64 }, - { "allwinner,sun50i-h6-emac", EMAC_H6 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-a83t-emac", .value = EMAC_A83T }, + { .compat = "allwinner,sun8i-h3-emac", .value = EMAC_H3 }, + { .compat = "allwinner,sun50i-a64-emac", .value = EMAC_A64 }, + { .compat = "allwinner,sun50i-h6-emac", .value = EMAC_H6 }, + + { 0 } }; struct sunxi_emac_bufmap { @@ -1373,7 +1374,7 @@ sunxi_emac_attach(device_t parent, device_t self, void *aux) sc->phandle = phandle; sc->bst = faa->faa_bst; sc->dmat = faa->faa_dmat; - sc->type = of_search_compatible(phandle, compat_data)->data; + sc->type = of_search_compatible(phandle, compat_data)->value; sc->phy_id = sunxi_emac_get_phyid(sc); aprint_naive("\n"); diff --git a/sys/arch/arm/sunxi/sunxi_gpio.c b/sys/arch/arm/sunxi/sunxi_gpio.c index 6e2f1aae6099..7e640c65a6c5 100644 --- a/sys/arch/arm/sunxi/sunxi_gpio.c +++ b/sys/arch/arm/sunxi/sunxi_gpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_gpio.c,v 1.30 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_gpio.c,v 1.31 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_soc.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.30 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.31 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -78,46 +78,65 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.30 2021/01/15 22:47:32 jmcneill Exp #define SUNXI_GPIO_GRP_CONFIG(bank) (0x300 + 0x4 * (bank)) #define SUNXI_GPIO_GRP_IO_BIAS_CONFIGMASK 0xf -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { #ifdef SOC_SUN4I_A10 - { "allwinner,sun4i-a10-pinctrl", (uintptr_t)&sun4i_a10_padconf }, + { .compat = "allwinner,sun4i-a10-pinctrl", + .data = &sun4i_a10_padconf }, #endif #ifdef SOC_SUN5I_A13 - { "allwinner,sun5i-a13-pinctrl", (uintptr_t)&sun5i_a13_padconf }, - { "nextthing,gr8-pinctrl", (uintptr_t)&sun5i_a13_padconf }, + { .compat = "allwinner,sun5i-a13-pinctrl", + .data = &sun5i_a13_padconf }, + { .compat = "nextthing,gr8-pinctrl", + .data = &sun5i_a13_padconf }, #endif #ifdef SOC_SUN6I_A31 - { "allwinner,sun6i-a31-pinctrl", (uintptr_t)&sun6i_a31_padconf }, - { "allwinner,sun6i-a31-r-pinctrl", (uintptr_t)&sun6i_a31_r_padconf }, + { .compat = "allwinner,sun6i-a31-pinctrl", + .data = &sun6i_a31_padconf }, + { .compat = "allwinner,sun6i-a31-r-pinctrl", + .data = &sun6i_a31_r_padconf }, #endif #ifdef SOC_SUN7I_A20 - { "allwinner,sun7i-a20-pinctrl", (uintptr_t)&sun7i_a20_padconf }, + { .compat = "allwinner,sun7i-a20-pinctrl", + .data = &sun7i_a20_padconf }, #endif #ifdef SOC_SUN8I_A83T - { "allwinner,sun8i-a83t-pinctrl", (uintptr_t)&sun8i_a83t_padconf }, - { "allwinner,sun8i-a83t-r-pinctrl", (uintptr_t)&sun8i_a83t_r_padconf }, + { .compat = "allwinner,sun8i-a83t-pinctrl", + .data = &sun8i_a83t_padconf }, + { .compat = "allwinner,sun8i-a83t-r-pinctrl", + .data = &sun8i_a83t_r_padconf }, #endif #ifdef SOC_SUN8I_H3 - { "allwinner,sun8i-h3-pinctrl", (uintptr_t)&sun8i_h3_padconf }, - { "allwinner,sun8i-h3-r-pinctrl", (uintptr_t)&sun8i_h3_r_padconf }, + { .compat = "allwinner,sun8i-h3-pinctrl", + .data = &sun8i_h3_padconf }, + { .compat = "allwinner,sun8i-h3-r-pinctrl", + .data = &sun8i_h3_r_padconf }, #endif #ifdef SOC_SUN9I_A80 - { "allwinner,sun9i-a80-pinctrl", (uintptr_t)&sun9i_a80_padconf }, - { "allwinner,sun9i-a80-r-pinctrl", (uintptr_t)&sun9i_a80_r_padconf }, + { .compat = "allwinner,sun9i-a80-pinctrl", + .data = &sun9i_a80_padconf }, + { .compat = "allwinner,sun9i-a80-r-pinctrl", + .data = &sun9i_a80_r_padconf }, #endif #ifdef SOC_SUN50I_A64 - { "allwinner,sun50i-a64-pinctrl", (uintptr_t)&sun50i_a64_padconf }, - { "allwinner,sun50i-a64-r-pinctrl", (uintptr_t)&sun50i_a64_r_padconf }, + { .compat = "allwinner,sun50i-a64-pinctrl", + .data = &sun50i_a64_padconf }, + { .compat = "allwinner,sun50i-a64-r-pinctrl", + .data = &sun50i_a64_r_padconf }, #endif #ifdef SOC_SUN50I_H5 - { "allwinner,sun50i-h5-pinctrl", (uintptr_t)&sun8i_h3_padconf }, - { "allwinner,sun50i-h5-r-pinctrl", (uintptr_t)&sun8i_h3_r_padconf }, + { .compat = "allwinner,sun50i-h5-pinctrl", + .data = &sun8i_h3_padconf }, + { .compat = "allwinner,sun50i-h5-r-pinctrl", + .data = &sun8i_h3_r_padconf }, #endif #ifdef SOC_SUN50I_H6 - { "allwinner,sun50i-h6-pinctrl", (uintptr_t)&sun50i_h6_padconf }, - { "allwinner,sun50i-h6-r-pinctrl", (uintptr_t)&sun50i_h6_r_padconf }, + { .compat = "allwinner,sun50i-h6-pinctrl", + .data = &sun50i_h6_padconf }, + { .compat = "allwinner,sun50i-h6-r-pinctrl", + .data = &sun50i_h6_r_padconf }, #endif - { NULL } + + { 0 } }; struct sunxi_gpio_eint { @@ -1003,7 +1022,7 @@ sunxi_gpio_attach(device_t parent, device_t self, void *aux) return; } mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); - sc->sc_padconf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_padconf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": PIO\n"); diff --git a/sys/arch/arm/sunxi/sunxi_hdmi.c b/sys/arch/arm/sunxi/sunxi_hdmi.c index 9dc89dc70e8e..8954ef05fbed 100644 --- a/sys/arch/arm/sunxi/sunxi_hdmi.c +++ b/sys/arch/arm/sunxi/sunxi_hdmi.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_hdmi.c,v 1.10 2019/12/23 18:20:02 thorpej Exp $ */ +/* $NetBSD: sunxi_hdmi.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014 Jared D. McNeill @@ -29,7 +29,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmi.c,v 1.10 2019/12/23 18:20:02 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmi.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -105,10 +105,11 @@ struct sunxi_hdmi_softc { #define HDMI_1_3_P(sc) ((sc)->sc_ver == 0x00010003) #define HDMI_1_4_P(sc) ((sc)->sc_ver == 0x00010004) -static const struct of_compat_data compat_data[] = { - {"allwinner,sun4i-a10-hdmi", HDMI_A10}, - {"allwinner,sun7i-a20-hdmi", HDMI_A10}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-hdmi", .value = HDMI_A10}, + { .compat = "allwinner,sun7i-a20-hdmi", .value = HDMI_A10}, + + { 0 } }; static int sunxi_hdmi_match(device_t, cfdata_t, void *); @@ -169,7 +170,8 @@ sunxi_hdmi_attach(device_t parent, device_t self, void *aux) sc->sc_phandle = phandle; sc->sc_bst = faa->faa_bst; - sc->sc_type = of_search_compatible(faa->faa_phandle, compat_data)->data; + sc->sc_type = + of_search_compatible(faa->faa_phandle, compat_data)->value; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); diff --git a/sys/arch/arm/sunxi/sunxi_hdmiphy.c b/sys/arch/arm/sunxi/sunxi_hdmiphy.c index e17759e2dd1e..3032a94ff35c 100644 --- a/sys/arch/arm/sunxi/sunxi_hdmiphy.c +++ b/sys/arch/arm/sunxi/sunxi_hdmiphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_hdmiphy.c,v 1.4 2019/11/23 18:54:26 jmcneill Exp $ */ +/* $NetBSD: sunxi_hdmiphy.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmiphy.c,v 1.4 2019/11/23 18:54:26 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmiphy.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -115,10 +115,13 @@ static const struct sunxi_hdmiphy_data sun8i_h3_hdmiphy_data = { .config = sun8i_h3_hdmiphy_config, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun8i-h3-hdmi-phy", (uintptr_t)&sun8i_h3_hdmiphy_data }, - { "allwinner,sun50i-a64-hdmi-phy", (uintptr_t)&sun8i_h3_hdmiphy_data }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-h3-hdmi-phy", + .data = &sun8i_h3_hdmiphy_data }, + { .compat = "allwinner,sun50i-a64-hdmi-phy", + .data = &sun8i_h3_hdmiphy_data }, + + { 0 } }; struct sunxi_hdmiphy_softc { @@ -428,7 +431,7 @@ sunxi_hdmiphy_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_bst = faa->faa_bst; - sc->sc_data = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_data = of_search_compatible(phandle, compat_data)->data; if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) { aprint_error(": couldn't map registers\n"); return; diff --git a/sys/arch/arm/sunxi/sunxi_i2s.c b/sys/arch/arm/sunxi/sunxi_i2s.c index ad1403520935..8d8b566810e9 100644 --- a/sys/arch/arm/sunxi/sunxi_i2s.c +++ b/sys/arch/arm/sunxi/sunxi_i2s.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_i2s.c,v 1.8 2020/02/29 05:51:10 isaki Exp $ */ +/* $NetBSD: sunxi_i2s.c,v 1.9 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_i2s.c,v 1.8 2020/02/29 05:51:10 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_i2s.c,v 1.9 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -139,13 +139,13 @@ static const struct sunxi_i2s_config sun8i_h3_config = { .rxchmap = 0x58, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun50i-a64-codec-i2s", - (uintptr_t)&sun50i_a64_codec_config }, - { "allwinner,sun8i-h3-i2s", - (uintptr_t)&sun8i_h3_config }, +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun50i-a64-codec-i2s", + .data = &sun50i_a64_codec_config }, + { .compat = "allwinner,sun8i-h3-i2s", + .data = &sun8i_h3_config }, - { NULL } + { 0 } }; struct sunxi_i2s_softc; @@ -186,7 +186,7 @@ struct sunxi_i2s_softc { bus_addr_t sc_baseaddr; struct clk *sc_clk; - struct sunxi_i2s_config *sc_cfg; + const struct sunxi_i2s_config *sc_cfg; LIST_HEAD(, sunxi_i2s_dma) sc_dmalist; @@ -888,7 +888,7 @@ sunxi_i2s_attach(device_t parent, device_t self, void *aux) } sc->sc_dmat = faa->faa_dmat; LIST_INIT(&sc->sc_dmalist); - sc->sc_cfg = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_cfg = of_search_compatible(phandle, compat_data)->data; mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); diff --git a/sys/arch/arm/sunxi/sunxi_lcdc.c b/sys/arch/arm/sunxi/sunxi_lcdc.c index 0bde9ba8e027..a7236aac62df 100644 --- a/sys/arch/arm/sunxi/sunxi_lcdc.c +++ b/sys/arch/arm/sunxi/sunxi_lcdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_lcdc.c,v 1.8 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_lcdc.c,v 1.9 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_lcdc.c,v 1.8 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_lcdc.c,v 1.9 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -106,11 +106,12 @@ enum tcon_type { TYPE_TCON1, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun8i-h3-tcon-tv", TYPE_TCON1 }, - { "allwinner,sun50i-a64-tcon-lcd", TYPE_TCON0 }, - { "allwinner,sun50i-a64-tcon-tv", TYPE_TCON1 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-h3-tcon-tv", .value = TYPE_TCON1 }, + { .compat = "allwinner,sun50i-a64-tcon-lcd", .value = TYPE_TCON0 }, + { .compat = "allwinner,sun50i-a64-tcon-tv", .value = TYPE_TCON1 }, + + { 0 } }; struct sunxi_lcdc_softc; @@ -512,7 +513,7 @@ sunxi_lcdc_attach(device_t parent, device_t self, void *aux) return; } sc->sc_phandle = faa->faa_phandle; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; sc->sc_clk_ch[0] = fdtbus_clock_get(phandle, "tcon-ch0"); sc->sc_clk_ch[1] = fdtbus_clock_get(phandle, "tcon-ch1"); diff --git a/sys/arch/arm/sunxi/sunxi_lradc.c b/sys/arch/arm/sunxi/sunxi_lradc.c index 6dd1a535d690..65ea28e054a6 100644 --- a/sys/arch/arm/sunxi/sunxi_lradc.c +++ b/sys/arch/arm/sunxi/sunxi_lradc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_lradc.c,v 1.2 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_lradc.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2016, 2018 Manuel Bouyer @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_lradc.c,v 1.2 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_lradc.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -75,9 +75,10 @@ static void sunxi_lradc_get_levels(struct sunxi_lradc_softc *, int, int); static void sunxi_lradc_print_levels(struct sunxi_lradc_softc *, int); static bool sunxi_lradc_register_switches(struct sunxi_lradc_softc *, int); -static const struct of_compat_data compat_data[] = { - {"allwinner,sun4i-a10-lradc-keys", 0}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-lradc-keys" }, + + { 0 } }; diff --git a/sys/arch/arm/sunxi/sunxi_mixer.c b/sys/arch/arm/sunxi/sunxi_mixer.c index 623c0e69b6c2..3988b4024afd 100644 --- a/sys/arch/arm/sunxi/sunxi_mixer.c +++ b/sys/arch/arm/sunxi/sunxi_mixer.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_mixer.c,v 1.12 2020/10/18 14:00:08 jmcneill Exp $ */ +/* $NetBSD: sunxi_mixer.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.12 2020/10/18 14:00:08 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -198,11 +198,15 @@ struct sunxi_mixer_compat_data mixer1_data = { .mixer_index = 1, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun8i-h3-de2-mixer-0", (uintptr_t)&mixer0_data }, - { "allwinner,sun50i-a64-de2-mixer-0", (uintptr_t)&mixer0_data }, - { "allwinner,sun50i-a64-de2-mixer-1", (uintptr_t)&mixer1_data }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-h3-de2-mixer-0", + .data = &mixer0_data }, + { .compat = "allwinner,sun50i-a64-de2-mixer-0", + .data = &mixer0_data }, + { .compat = "allwinner,sun50i-a64-de2-mixer-1", + .data = &mixer1_data }, + + { 0 } }; struct sunxi_mixer_softc; @@ -1256,7 +1260,7 @@ sunxi_mixer_attach(device_t parent, device_t self, void *aux) struct fdt_endpoint *out_ep; const int phandle = faa->faa_phandle; const struct sunxi_mixer_compat_data * const cd = - (const void *)of_search_compatible(phandle, compat_data)->data; + of_search_compatible(phandle, compat_data)->data; struct clk *clk_bus, *clk_mod; struct fdtbus_reset *rst; bus_addr_t addr; diff --git a/sys/arch/arm/sunxi/sunxi_mmc.c b/sys/arch/arm/sunxi/sunxi_mmc.c index 84021e8f269c..a8816ec6da94 100644 --- a/sys/arch/arm/sunxi/sunxi_mmc.c +++ b/sys/arch/arm/sunxi/sunxi_mmc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_mmc.c,v 1.42 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_mmc.c,v 1.43 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_sunximmc.h" #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.42 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.43 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -162,7 +162,7 @@ struct sunxi_mmc_softc { device_t sc_sdmmc_dev; - struct sunxi_mmc_config *sc_config; + const struct sunxi_mmc_config *sc_config; bus_dma_segment_t sc_idma_segs[1]; int sc_idma_nsegs; @@ -279,16 +279,26 @@ static const struct sunxi_mmc_config sun50i_h6_emmc_config = { .flags = SUNXI_MMC_FLAG_CALIB_REG, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-mmc", (uintptr_t)&sun4i_a10_mmc_config }, - { "allwinner,sun5i-a13-mmc", (uintptr_t)&sun5i_a13_mmc_config }, - { "allwinner,sun7i-a20-mmc", (uintptr_t)&sun7i_a20_mmc_config }, - { "allwinner,sun8i-a83t-emmc", (uintptr_t)&sun8i_a83t_emmc_config }, - { "allwinner,sun9i-a80-mmc", (uintptr_t)&sun9i_a80_mmc_config }, - { "allwinner,sun50i-a64-mmc", (uintptr_t)&sun50i_a64_mmc_config }, - { "allwinner,sun50i-a64-emmc", (uintptr_t)&sun50i_a64_emmc_config }, - { "allwinner,sun50i-h6-mmc", (uintptr_t)&sun50i_h6_mmc_config }, - { "allwinner,sun50i-h6-emmc", (uintptr_t)&sun50i_h6_emmc_config }, +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-mmc", + .data = &sun4i_a10_mmc_config }, + { .compat = "allwinner,sun5i-a13-mmc", + .data = &sun5i_a13_mmc_config }, + { .compat = "allwinner,sun7i-a20-mmc", + .data = &sun7i_a20_mmc_config }, + { .compat = "allwinner,sun8i-a83t-emmc", + .data = &sun8i_a83t_emmc_config }, + { .compat = "allwinner,sun9i-a80-mmc", + .data = &sun9i_a80_mmc_config }, + { .compat = "allwinner,sun50i-a64-mmc", + .data = &sun50i_a64_mmc_config }, + { .compat = "allwinner,sun50i-a64-emmc", + .data = &sun50i_a64_emmc_config }, + { .compat = "allwinner,sun50i-h6-mmc", + .data = &sun50i_h6_mmc_config }, + { .compat = "allwinner,sun50i-h6-emmc", + .data = &sun50i_h6_emmc_config }, + { NULL } }; @@ -349,7 +359,7 @@ sunxi_mmc_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = phandle; - sc->sc_config = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_config = of_search_compatible(phandle, compat_data)->data; sc->sc_bst = faa->faa_bst; sc->sc_dmat = faa->faa_dmat; mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_BIO); diff --git a/sys/arch/arm/sunxi/sunxi_musb.c b/sys/arch/arm/sunxi/sunxi_musb.c index d9e60381124a..7306b93f5974 100644 --- a/sys/arch/arm/sunxi/sunxi_musb.c +++ b/sys/arch/arm/sunxi/sunxi_musb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_musb.c,v 1.6 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_musb.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_musb.c,v 1.6 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_musb.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -60,12 +60,13 @@ struct sunxi_musb_softc { CFATTACH_DECL_NEW(sunxi_musb, sizeof(struct sunxi_musb_softc), sunxi_musb_match, sunxi_musb_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-musb", 5 }, - { "allwinner,sun6i-a13-musb", 5 }, - { "allwinner,sun8i-h3-musb", 4 }, - { "allwinner,sun8i-a33-musb", 5 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-musb", .value = 5 }, + { .compat = "allwinner,sun6i-a13-musb", .value = 5 }, + { .compat = "allwinner,sun8i-h3-musb", .value = 4 }, + { .compat = "allwinner,sun8i-a33-musb", .value = 5 }, + + { 0 } }; #define REMAPFLAG 0x8000 @@ -370,7 +371,7 @@ sunxi_musb_attach(device_t parent, device_t self, void *aux) sc->sc_intr_poll = sunxi_musb_poll; sc->sc_intr_poll_arg = sc; sc->sc_mode = MOTG_MODE_HOST; - sc->sc_ep_max = of_search_compatible(phandle, compat_data)->data; + sc->sc_ep_max = of_search_compatible(phandle, compat_data)->value; sc->sc_ep_fifosize = 512; aprint_naive("\n"); diff --git a/sys/arch/arm/sunxi/sunxi_nmi.c b/sys/arch/arm/sunxi/sunxi_nmi.c index ab50dc9c327d..b0d1cf50fd5e 100644 --- a/sys/arch/arm/sunxi/sunxi_nmi.c +++ b/sys/arch/arm/sunxi/sunxi_nmi.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_nmi.c,v 1.7 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_nmi.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -29,7 +29,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,v 1.7 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_nmi.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -88,11 +88,15 @@ static const struct sunxi_nmi_config sun9i_a80_nmi_config = { .enable_reg = 0x08, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun7i-a20-sc-nmi", (uintptr_t)&sun7i_a20_sc_nmi_config }, - { "allwinner,sun6i-a31-r-intc", (uintptr_t)&sun6i_a31_r_intc_config }, - { "allwinner,sun9i-a80-nmi", (uintptr_t)&sun9i_a80_nmi_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun7i-a20-sc-nmi", + .data = &sun7i_a20_sc_nmi_config }, + { .compat = "allwinner,sun6i-a31-r-intc", + .data = &sun6i_a31_r_intc_config }, + { .compat = "allwinner,sun9i-a80-nmi", + .data = &sun9i_a80_nmi_config }, + + { 0 } }; struct sunxi_nmi_softc { @@ -330,7 +334,7 @@ sunxi_nmi_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = phandle; - sc->sc_config = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_config = of_search_compatible(phandle, compat_data)->data; sc->sc_bst = faa->faa_bst; if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) { aprint_error(": couldn't map registers\n"); diff --git a/sys/arch/arm/sunxi/sunxi_pwm.c b/sys/arch/arm/sunxi/sunxi_pwm.c index 7887cb9514d3..23f52ef722ae 100644 --- a/sys/arch/arm/sunxi/sunxi_pwm.c +++ b/sys/arch/arm/sunxi/sunxi_pwm.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_pwm.c,v 1.3 2019/10/13 06:03:56 skrll Exp $ */ +/* $NetBSD: sunxi_pwm.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sunxi_pwm.c,v 1.3 2019/10/13 06:03:56 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sunxi_pwm.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -58,9 +58,10 @@ enum sunxi_pwm_type { PWM_A64 = 1, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun50i-a64-pwm", PWM_A64 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun50i-a64-pwm", .value = PWM_A64 }, + + { 0 } }; struct sunxi_pwm_softc { diff --git a/sys/arch/arm/sunxi/sunxi_rsb.c b/sys/arch/arm/sunxi/sunxi_rsb.c index d7a5f9ab3b71..df2da54c7116 100644 --- a/sys/arch/arm/sunxi/sunxi_rsb.c +++ b/sys/arch/arm/sunxi/sunxi_rsb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_rsb.c,v 1.10 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_rsb.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_rsb.c,v 1.10 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_rsb.c,v 1.11 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -49,10 +49,11 @@ enum sunxi_rsb_type { SUNXI_RSB, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun6i-a31-p2wi", SUNXI_P2WI }, - { "allwinner,sun8i-a23-rsb", SUNXI_RSB }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun6i-a31-p2wi", .value = SUNXI_P2WI }, + { .compat = "allwinner,sun8i-a23-rsb", .value = SUNXI_RSB }, + + { 0 } }; #define RSB_ADDR_PMIC_PRIMARY 0x3a3 @@ -156,7 +157,7 @@ sunxi_rsb_attach(device_t parent, device_t self, void *aux) } sc->sc_dev = self; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; sc->sc_bst = faa->faa_bst; if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) { aprint_error(": couldn't map registers\n"); diff --git a/sys/arch/arm/sunxi/sunxi_rtc.c b/sys/arch/arm/sunxi/sunxi_rtc.c index 896a99480883..206981f12ffc 100644 --- a/sys/arch/arm/sunxi/sunxi_rtc.c +++ b/sys/arch/arm/sunxi/sunxi_rtc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_rtc.c,v 1.6 2020/03/27 01:42:10 thorpej Exp $ */ +/* $NetBSD: sunxi_rtc.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2014-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_rtc.c,v 1.6 2020/03/27 01:42:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_rtc.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -241,17 +241,27 @@ static const struct sunxi_rtc_config sun50i_h6_rtc_config = { .flags = SUNXI_RTC_F_HAS_VAR_PRESCALER, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-rtc", (uintptr_t)&sun4i_rtc_config }, - { "allwinner,sun6i-a31-rtc", (uintptr_t)&sun6i_a31_rtc_config }, - { "allwinner,sun7i-a20-rtc", (uintptr_t)&sun7i_rtc_config }, - { "allwinner,sun8i-a23-rtc", (uintptr_t)&sun8i_a23_rtc_config }, - { "allwinner,sun8i-r40-rtc", (uintptr_t)&sun8i_r40_rtc_config }, - { "allwinner,sun8i-v3-rtc", (uintptr_t)&sun8i_v3_rtc_config }, - { "allwinner,sun8i-h3-rtc", (uintptr_t)&sun8i_h3_rtc_config }, - { "allwinner,sun50i-h5-rtc", (uintptr_t)&sun8i_h3_rtc_config }, - { "allwinner,sun50i-h6-rtc", (uintptr_t)&sun50i_h6_rtc_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-rtc", + .data = &sun4i_rtc_config }, + { .compat = "allwinner,sun6i-a31-rtc", + .data = &sun6i_a31_rtc_config }, + { .compat = "allwinner,sun7i-a20-rtc", + .data = &sun7i_rtc_config }, + { .compat = "allwinner,sun8i-a23-rtc", + .data = &sun8i_a23_rtc_config }, + { .compat = "allwinner,sun8i-r40-rtc", + .data = &sun8i_r40_rtc_config }, + { .compat = "allwinner,sun8i-v3-rtc", + .data = &sun8i_v3_rtc_config }, + { .compat = "allwinner,sun8i-h3-rtc", + .data = &sun8i_h3_rtc_config }, + { .compat = "allwinner,sun50i-h5-rtc", + .data = &sun8i_h3_rtc_config }, + { .compat = "allwinner,sun50i-h6-rtc", + .data = &sun50i_h6_rtc_config }, + + { 0 } }; #define SUNXI_RTC_CLK_LOSC 0 @@ -376,7 +386,7 @@ sunxi_rtc_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't map registers\n"); return; } - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": RTC\n"); diff --git a/sys/arch/arm/sunxi/sunxi_sid.c b/sys/arch/arm/sunxi/sunxi_sid.c index b31bd81e7f9e..f3bc8846784f 100644 --- a/sys/arch/arm/sunxi/sunxi_sid.c +++ b/sys/arch/arm/sunxi/sunxi_sid.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_sid.c,v 1.3 2019/01/30 11:36:42 jmcneill Exp $ */ +/* $NetBSD: sunxi_sid.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_sid.c,v 1.3 2019/01/30 11:36:42 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_sid.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -54,13 +54,14 @@ static const struct sunxi_sid_config sun8i_h3_sid_config = { .efuse_offset = 0x200, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-sid", (uintptr_t)&sun4i_a10_sid_config }, - { "allwinner,sun7i-a20-sid", (uintptr_t)&sun4i_a10_sid_config }, - { "allwinner,sun8i-h3-sid", (uintptr_t)&sun8i_h3_sid_config }, - { "allwinner,sun8i-a83t-sid", (uintptr_t)&sun8i_h3_sid_config }, - { "allwinner,sun50i-a64-sid", (uintptr_t)&sun8i_h3_sid_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-sid", .data = &sun4i_a10_sid_config }, + { .compat = "allwinner,sun7i-a20-sid", .data = &sun4i_a10_sid_config }, + { .compat = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_sid_config }, + { .compat = "allwinner,sun8i-a83t-sid", .data = &sun8i_h3_sid_config }, + { .compat = "allwinner,sun50i-a64-sid", .data = &sun8i_h3_sid_config }, + + { 0 } }; struct sunxi_sid_softc { @@ -105,7 +106,7 @@ sunxi_sid_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't map registers\n"); return; } - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": Security ID EFUSE\n"); diff --git a/sys/arch/arm/sunxi/sunxi_tcon.c b/sys/arch/arm/sunxi/sunxi_tcon.c index 592a2c7e4b50..e7a8fdaf912a 100644 --- a/sys/arch/arm/sunxi/sunxi_tcon.c +++ b/sys/arch/arm/sunxi/sunxi_tcon.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_tcon.c,v 1.7 2018/06/01 17:18:44 bouyer Exp $ */ +/* $NetBSD: sunxi_tcon.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Manuel Bouyer @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_tcon.c,v 1.7 2018/06/01 17:18:44 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_tcon.c,v 1.8 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -93,10 +93,11 @@ void sunxi_tcon_dump_regs(int); #define TCON_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) -static const struct of_compat_data compat_data[] = { - {"allwinner,sun4i-a10-tcon", TCON_A10}, - {"allwinner,sun7i-a20-tcon", TCON_A10}, - {NULL} +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-tcon", .value = TCON_A10}, + { .compat = "allwinner,sun7i-a20-tcon", .value = TCON_A10}, + + { 0 } }; static int sunxi_tcon_match(device_t, cfdata_t, void *); @@ -156,7 +157,8 @@ sunxi_tcon_attach(device_t parent, device_t self, void *aux) sc->sc_lvds_rst = fdtbus_reset_get(phandle, "lvds"); - sc->sc_type = of_search_compatible(faa->faa_phandle, compat_data)->data; + sc->sc_type = + of_search_compatible(faa->faa_phandle, compat_data)->value; aprint_naive("\n"); aprint_normal(": LCD/TV timing controller (%s)\n", diff --git a/sys/arch/arm/sunxi/sunxi_thermal.c b/sys/arch/arm/sunxi/sunxi_thermal.c index 497d2c1c9643..8cff1fb1ee67 100644 --- a/sys/arch/arm/sunxi/sunxi_thermal.c +++ b/sys/arch/arm/sunxi/sunxi_thermal.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_thermal.c,v 1.9 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_thermal.c,v 1.10 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2016-2017 Jared McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.9 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.10 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -305,12 +305,13 @@ static const struct sunxi_thermal_config h5_config = { .to_reg = h5_to_reg, }; -static struct of_compat_data compat_data[] = { - { "allwinner,sun8i-a83t-ts", (uintptr_t)&a83t_config }, - { "allwinner,sun8i-h3-ts", (uintptr_t)&h3_config }, - { "allwinner,sun50i-a64-ts", (uintptr_t)&a64_config }, - { "allwinner,sun50i-h5-ts", (uintptr_t)&h5_config }, - { NULL, (uintptr_t)NULL } +static struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun8i-a83t-ts", .data = &a83t_config }, + { .compat = "allwinner,sun8i-h3-ts", .data = &h3_config }, + { .compat = "allwinner,sun50i-a64-ts", .data = &a64_config }, + { .compat = "allwinner,sun50i-h5-ts", .data = &h5_config }, + + { 0 } }; struct sunxi_thermal_softc { @@ -318,7 +319,7 @@ struct sunxi_thermal_softc { int phandle; bus_space_tag_t bst; bus_space_handle_t bsh; - struct sunxi_thermal_config *conf; + const struct sunxi_thermal_config *conf; kmutex_t lock; callout_t tick; @@ -567,7 +568,7 @@ sunxi_thermal_attach(device_t parent, device_t self, void *aux) sc->dev = self; sc->phandle = phandle; sc->bst = faa->faa_bst; - sc->conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->conf = of_search_compatible(phandle, compat_data)->data; if (bus_space_map(sc->bst, addr, size, 0, &sc->bsh) != 0) { aprint_error(": couldn't map registers\n"); return; diff --git a/sys/arch/arm/sunxi/sunxi_ts.c b/sys/arch/arm/sunxi/sunxi_ts.c index 5e2b37be8694..b742fb39249d 100644 --- a/sys/arch/arm/sunxi/sunxi_ts.c +++ b/sys/arch/arm/sunxi/sunxi_ts.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_ts.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_ts.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_ts.c,v 1.4 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_ts.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -131,11 +131,12 @@ static const struct sunxi_ts_config sun6i_a31_ts_config = { .tp_mode_en_mask = TP_CTRL1_TP_DUAL_EN, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-ts", (uintptr_t)&sun4i_a10_ts_config }, - { "allwinner,sun5i-a13-ts", (uintptr_t)&sun5i_a13_ts_config }, - { "allwinner,sun6i-a31-ts", (uintptr_t)&sun6i_a31_ts_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-ts", .data = &sun4i_a10_ts_config }, + { .compat = "allwinner,sun5i-a13-ts", .data = &sun5i_a13_ts_config }, + { .compat = "allwinner,sun6i-a31-ts", .data = &sun6i_a31_ts_config }, + + { 0 } }; static struct wsmouse_calibcoords sunxi_ts_default_calib = { @@ -375,7 +376,7 @@ sunxi_ts_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't map registers\n"); return; } - sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + sc->sc_conf = of_search_compatible(phandle, compat_data)->data; sc->sc_ts_attached = of_getprop_bool(phandle, "allwinner,ts-attached"); sc->sc_ts_inverted_x = of_getprop_bool(phandle, diff --git a/sys/arch/arm/sunxi/sunxi_twi.c b/sys/arch/arm/sunxi/sunxi_twi.c index 2aa9867f125b..7bf09e2d02df 100644 --- a/sys/arch/arm/sunxi/sunxi_twi.c +++ b/sys/arch/arm/sunxi/sunxi_twi.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_twi.c,v 1.13 2021/01/15 22:47:32 jmcneill Exp $ */ +/* $NetBSD: sunxi_twi.c,v 1.14 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.13 2021/01/15 22:47:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.14 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -72,10 +72,11 @@ static const struct sunxi_twi_config sun6i_a31_i2c_config = { .iflg_rwc = true, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-i2c", (uintptr_t)&sun4i_a10_i2c_config }, - { "allwinner,sun6i-a31-i2c", (uintptr_t)&sun6i_a31_i2c_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-i2c", .data = &sun4i_a10_i2c_config }, + { .compat = "allwinner,sun6i-a31-i2c", .data = &sun6i_a31_i2c_config }, + + { 0 } }; CFATTACH_DECL_NEW(sunxi_twi, sizeof(struct gttwsi_softc), @@ -161,7 +162,7 @@ sunxi_twi_attach(device_t parent, device_t self, void *aux) return; } - conf = (void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; prop_dictionary_set_bool(device_properties(self), "iflg-rwc", conf->iflg_rwc); diff --git a/sys/arch/arm/sunxi/sunxi_usb3phy.c b/sys/arch/arm/sunxi/sunxi_usb3phy.c index 39906edf4f4e..130eb3affc8a 100644 --- a/sys/arch/arm/sunxi/sunxi_usb3phy.c +++ b/sys/arch/arm/sunxi/sunxi_usb3phy.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_usb3phy.c,v 1.1 2018/05/01 23:59:42 jmcneill Exp $ */ +/* $NetBSD: sunxi_usb3phy.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_usb3phy.c,v 1.1 2018/05/01 23:59:42 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_usb3phy.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -67,9 +67,10 @@ enum sunxi_usb3phy_type { USB3PHY_H6 = 1, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun50i-h6-usb3-phy", USB3PHY_H6 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun50i-h6-usb3-phy", .value = USB3PHY_H6 }, + + { 0 } }; struct sunxi_usb3phy { @@ -177,7 +178,7 @@ sunxi_usb3phy_attach(device_t parent, device_t self, void *aux) u_int n; sc->sc_dev = self; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get phy registers\n"); diff --git a/sys/arch/arm/sunxi/sunxi_usbphy.c b/sys/arch/arm/sunxi/sunxi_usbphy.c index 0248e05dd880..f35e16841dd2 100644 --- a/sys/arch/arm/sunxi/sunxi_usbphy.c +++ b/sys/arch/arm/sunxi/sunxi_usbphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_usbphy.c,v 1.12 2020/05/14 08:34:20 msaitoh Exp $ */ +/* $NetBSD: sunxi_usbphy.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.12 2020/05/14 08:34:20 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -84,16 +84,17 @@ enum sunxi_usbphy_type { USBPHY_H6, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-usb-phy", USBPHY_A10 }, - { "allwinner,sun5i-a13-usb-phy", USBPHY_A13 }, - { "allwinner,sun6i-a31-usb-phy", USBPHY_A31 }, - { "allwinner,sun7i-a20-usb-phy", USBPHY_A20 }, - { "allwinner,sun8i-a83t-usb-phy", USBPHY_A83T }, - { "allwinner,sun8i-h3-usb-phy", USBPHY_H3 }, - { "allwinner,sun50i-a64-usb-phy", USBPHY_A64 }, - { "allwinner,sun50i-h6-usb-phy", USBPHY_H6 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-usb-phy", .value = USBPHY_A10 }, + { .compat = "allwinner,sun5i-a13-usb-phy", .value = USBPHY_A13 }, + { .compat = "allwinner,sun6i-a31-usb-phy", .value = USBPHY_A31 }, + { .compat = "allwinner,sun7i-a20-usb-phy", .value = USBPHY_A20 }, + { .compat = "allwinner,sun8i-a83t-usb-phy", .value = USBPHY_A83T }, + { .compat = "allwinner,sun8i-h3-usb-phy", .value = USBPHY_H3 }, + { .compat = "allwinner,sun50i-a64-usb-phy", .value = USBPHY_A64 }, + { .compat = "allwinner,sun50i-h6-usb-phy", .value = USBPHY_H6 }, + + { 0 } }; #define SUNXI_MAXUSBPHY 4 @@ -353,7 +354,7 @@ sunxi_usbphy_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_bst = faa->faa_bst; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; if (fdtbus_get_reg_byname(phandle, "phy_ctrl", &addr, &size) != 0) { aprint_error(": couldn't get phy ctrl registers\n"); diff --git a/sys/arch/arm/sunxi/sunxi_wdt.c b/sys/arch/arm/sunxi/sunxi_wdt.c index 2cc012b7acdc..ccf330a200aa 100644 --- a/sys/arch/arm/sunxi/sunxi_wdt.c +++ b/sys/arch/arm/sunxi/sunxi_wdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_wdt.c,v 1.2 2017/10/07 16:44:24 jmcneill Exp $ */ +/* $NetBSD: sunxi_wdt.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_wdt.c,v 1.2 2017/10/07 16:44:24 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_wdt.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -80,10 +80,11 @@ enum sunxi_wdt_type { WDT_SUN6I, }; -static const struct of_compat_data compat_data[] = { - { "allwinner,sun4i-a10-wdt", WDT_SUN4I }, - { "allwinner,sun6i-a31-wdt", WDT_SUN6I }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "allwinner,sun4i-a10-wdt", .value = WDT_SUN4I }, + { .compat = "allwinner,sun6i-a31-wdt", .value = WDT_SUN6I }, + + { 0 } }; struct sunxi_wdt_softc { @@ -235,7 +236,7 @@ sunxi_wdt_attach(device_t parent, device_t self, void *aux) sc->sc_smw.smw_cookie = sc; sc->sc_smw.smw_period = SUNXI_WDT_PERIOD_DEFAULT; - type = of_search_compatible(phandle, compat_data)->data; + type = of_search_compatible(phandle, compat_data)->value; switch (type) { case WDT_SUN4I: sc->sc_smw.smw_setmode = sun4i_wdt_setmode; diff --git a/sys/arch/arm/ti/ti_dpll_clock.c b/sys/arch/arm/ti/ti_dpll_clock.c index 8e1b652298a1..204c4c981562 100644 --- a/sys/arch/arm/ti/ti_dpll_clock.c +++ b/sys/arch/arm/ti/ti_dpll_clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: ti_dpll_clock.c,v 1.3 2020/06/03 18:26:06 jmcneill Exp $ */ +/* $NetBSD: ti_dpll_clock.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_dpll_clock.c,v 1.3 2020/06/03 18:26:06 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_dpll_clock.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -102,11 +102,15 @@ static const struct clk_funcs omap3_dpll_core_clock_clk_funcs = { .get_parent = ti_dpll_clock_get_parent, }; -static const struct of_compat_data compat_data[] = { - { "ti,am3-dpll-clock", (uintptr_t)&am3_dpll_clock_clk_funcs }, - { "ti,omap3-dpll-clock", (uintptr_t)&omap3_dpll_clock_clk_funcs }, - { "ti,omap3-dpll-core-clock", (uintptr_t)&omap3_dpll_core_clock_clk_funcs }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "ti,am3-dpll-clock", + .data = &am3_dpll_clock_clk_funcs }, + { .compat = "ti,omap3-dpll-clock", + .data = &omap3_dpll_clock_clk_funcs }, + { .compat = "ti,omap3-dpll-core-clock", + .data = &omap3_dpll_core_clock_clk_funcs }, + + { 0 } }; enum { @@ -175,7 +179,7 @@ ti_dpll_clock_attach(device_t parent, device_t self, void *aux) } } - clkfuncs = (const void *)of_search_compatible(phandle, compat_data)->data; + clkfuncs = of_search_compatible(phandle, compat_data)->data; sc->sc_clkdom.name = device_xname(self); sc->sc_clkdom.funcs = clkfuncs; diff --git a/sys/arch/arm/ti/ti_gpio.c b/sys/arch/arm/ti/ti_gpio.c index 9c0f7c7b8112..7baeb2c2f227 100644 --- a/sys/arch/arm/ti/ti_gpio.c +++ b/sys/arch/arm/ti/ti_gpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: ti_gpio.c,v 1.6 2021/01/15 23:19:33 jmcneill Exp $ */ +/* $NetBSD: ti_gpio.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.6 2021/01/15 23:19:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -99,10 +99,11 @@ static const u_int ti_gpio_regmap[TI_NGPIO][GPIO_NREG] = { }, }; -static const struct of_compat_data compat_data[] = { - { "ti,omap3-gpio", TI_GPIO_OMAP3 }, - { "ti,omap4-gpio", TI_GPIO_OMAP4 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "ti,omap3-gpio", .value = TI_GPIO_OMAP3 }, + { .compat = "ti,omap4-gpio", .value = TI_GPIO_OMAP4 }, + + { 0 } }; struct ti_gpio_intr { @@ -512,7 +513,7 @@ ti_gpio_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't map registers\n"); return; } - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); sc->sc_modname = fdtbus_get_string(phandle, "ti,hwmods"); diff --git a/sys/arch/arm/ti/ti_iic.c b/sys/arch/arm/ti/ti_iic.c index ac008468dd5e..2dc407a8625d 100644 --- a/sys/arch/arm/ti/ti_iic.c +++ b/sys/arch/arm/ti/ti_iic.c @@ -1,4 +1,4 @@ -/* $NetBSD: ti_iic.c,v 1.9 2021/01/15 23:19:33 jmcneill Exp $ */ +/* $NetBSD: ti_iic.c,v 1.10 2021/01/18 02:35:49 thorpej Exp $ */ /* * Copyright (c) 2013 Manuel Bouyer. All rights reserved. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.9 2021/01/15 23:19:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.10 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -146,11 +146,12 @@ static const u_int ti_iic_regmap[TI_NTYPES][TI_NREGS] = { }, }; -static const struct of_compat_data compat_data[] = { - /* compatible type */ - { "ti,omap3-i2c", TI_IIC_OMAP3 }, - { "ti,omap4-i2c", TI_IIC_OMAP4 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + /* compatible type */ + { .compat = "ti,omap3-i2c", .value = TI_IIC_OMAP3 }, + { .compat = "ti,omap4-i2c", .value = TI_IIC_OMAP4 }, + + { 0 } }; /* operation in progress */ @@ -269,7 +270,7 @@ ti_iic_attach(device_t parent, device_t self, void *opaque) aprint_error(": couldn't map registers\n"); return; } - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_NET, 0, ti_iic_intr, sc, device_xname(self)); diff --git a/sys/arch/arm/ti/ti_omapintc.c b/sys/arch/arm/ti/ti_omapintc.c index 8cdca9f1ca76..58bd37b43bf5 100644 --- a/sys/arch/arm/ti/ti_omapintc.c +++ b/sys/arch/arm/ti/ti_omapintc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ti_omapintc.c,v 1.4 2021/01/15 00:38:23 jmcneill Exp $ */ +/* $NetBSD: ti_omapintc.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $ */ /* * Define the SDP2430 specific information and then include the generic OMAP * interrupt header. @@ -29,7 +29,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: ti_omapintc.c,v 1.4 2021/01/15 00:38:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_omapintc.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -57,11 +57,12 @@ __KERNEL_RCSID(0, "$NetBSD: ti_omapintc.c,v 1.4 2021/01/15 00:38:23 jmcneill Exp #define INTC_MAX_SOURCES 128 -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { /* compatible number of banks */ - { "ti,omap3-intc", 3 }, - { "ti,am33xx-intc", 4 }, - { NULL } + { .compat = "ti,omap3-intc", .value = 3 }, + { .compat = "ti,am33xx-intc", .value = 4 }, + + { 0 } }; #define INTC_READ(sc, g, o) \ @@ -249,7 +250,7 @@ omap2icu_attach(device_t parent, device_t self, void *aux) aprint_error(": couldn't map registers\n"); return; } - sc->sc_nbank = of_search_compatible(phandle, compat_data)->data; + sc->sc_nbank = of_search_compatible(phandle, compat_data)->value; sc->sc_enabled_irqs = kmem_zalloc(sizeof(*sc->sc_enabled_irqs) * sc->sc_nbank, KM_SLEEP); diff --git a/sys/arch/arm/ti/ti_omaptimer.c b/sys/arch/arm/ti/ti_omaptimer.c index 43bfee3a68a9..c58526ac86fe 100644 --- a/sys/arch/arm/ti/ti_omaptimer.c +++ b/sys/arch/arm/ti/ti_omaptimer.c @@ -1,7 +1,7 @@ -/* $NetBSD: ti_omaptimer.c,v 1.5 2021/01/15 23:19:33 jmcneill Exp $ */ +/* $NetBSD: ti_omaptimer.c,v 1.6 2021/01/18 02:35:49 thorpej Exp $ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_omaptimer.c,v 1.5 2021/01/15 23:19:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_omaptimer.c,v 1.6 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -61,11 +61,12 @@ static uint8_t omaptimer_regmap[_DM_NTIMER][_TIMER_NREG] = { }, }; -static const struct of_compat_data compat_data[] = { - { "ti,am335x-timer-1ms", DM_TIMER_AM335X }, - { "ti,am335x-timer", DM_TIMER_AM335X }, - { "ti,omap3430-timer", DM_TIMER_OMAP3430 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "ti,am335x-timer-1ms", .value = DM_TIMER_AM335X }, + { .compat = "ti,am335x-timer", .value = DM_TIMER_AM335X }, + { .compat = "ti,omap3430-timer", .value = DM_TIMER_OMAP3430 }, + + { 0 } }; struct omaptimer_softc { @@ -164,7 +165,7 @@ omaptimer_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = phandle; sc->sc_bst = faa->faa_bst; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) { device_printf(self, "unable to map bus space"); diff --git a/sys/arch/arm/ti/ti_sdhc.c b/sys/arch/arm/ti/ti_sdhc.c index 4c159d3ab976..e7ee49edaaef 100644 --- a/sys/arch/arm/ti/ti_sdhc.c +++ b/sys/arch/arm/ti/ti_sdhc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ti_sdhc.c,v 1.6 2021/01/15 23:19:33 jmcneill Exp $ */ +/* $NetBSD: ti_sdhc.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.6 2021/01/15 23:19:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ti_sdhc.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -85,12 +85,17 @@ static const struct ti_sdhc_config omap4_hsmmc_config = { .regoff = 0x100 }; -static const struct of_compat_data compat_data[] = { - { "ti,omap2-hsmmc", (uintptr_t)&omap2_hsmmc_config }, - { "ti,omap3-hsmmc", (uintptr_t)&omap2_hsmmc_config }, - { "ti,omap3-pre-es3-hsmmc", (uintptr_t)&omap3_pre_es3_hsmmc_config }, - { "ti,omap4-hsmmc", (uintptr_t)&omap4_hsmmc_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "ti,omap2-hsmmc", + .data = &omap2_hsmmc_config }, + { .compat = "ti,omap3-hsmmc", + .data = &omap2_hsmmc_config }, + { .compat = "ti,omap3-pre-es3-hsmmc", + .data = &omap3_pre_es3_hsmmc_config }, + { .compat = "ti,omap4-hsmmc", + .data = &omap4_hsmmc_config }, + + { 0 } }; enum { @@ -160,7 +165,7 @@ ti_sdhc_attach(device_t parent, device_t self, void *aux) bus_size_t size; u_int bus_width; - conf = (const void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; if (ti_prcm_enable_hwmod(phandle, 0) != 0) { aprint_error(": couldn't enable module\n"); diff --git a/sys/arch/mips/cavium/dev/octeon_cib.c b/sys/arch/mips/cavium/dev/octeon_cib.c index 53e77c3706be..e90774f27f58 100644 --- a/sys/arch/mips/cavium/dev/octeon_cib.c +++ b/sys/arch/mips/cavium/dev/octeon_cib.c @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_cib.c,v 1.2 2021/01/15 00:38:23 jmcneill Exp $ */ +/* $NetBSD: octeon_cib.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2020 Jared D. McNeill @@ -29,7 +29,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.2 2021/01/15 00:38:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -90,9 +90,10 @@ struct octeon_cib_softc { CFATTACH_DECL_NEW(octcib, sizeof(struct octeon_cib_softc), octeon_cib_match, octeon_cib_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "cavium,octeon-7130-cib", 1 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "cavium,octeon-7130-cib" }, + + { 0 } }; static int diff --git a/sys/arch/mips/cavium/dev/octeon_intc.c b/sys/arch/mips/cavium/dev/octeon_intc.c index 788a2161ab30..9e1df90c6231 100644 --- a/sys/arch/mips/cavium/dev/octeon_intc.c +++ b/sys/arch/mips/cavium/dev/octeon_intc.c @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_intc.c,v 1.2 2021/01/15 00:38:23 jmcneill Exp $ */ +/* $NetBSD: octeon_intc.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2020 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.2 2021/01/15 00:38:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -69,9 +69,10 @@ struct octeon_intc_softc { CFATTACH_DECL_NEW(octintc, sizeof(struct octeon_intc_softc), octeon_intc_match, octeon_intc_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "cavium,octeon-3860-ciu", OCTEON_INTC_CIU }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "cavium,octeon-3860-ciu", .value = OCTEON_INTC_CIU }, + + { 0 } }; static int @@ -92,7 +93,7 @@ octeon_intc_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = phandle; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; switch (sc->sc_type) { case OCTEON_INTC_CIU: diff --git a/sys/dev/fdt/amdccp_fdt.c b/sys/dev/fdt/amdccp_fdt.c index 661fea983f6a..eca55116dab5 100644 --- a/sys/dev/fdt/amdccp_fdt.c +++ b/sys/dev/fdt/amdccp_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: amdccp_fdt.c,v 1.2 2021/01/17 19:54:23 jmcneill Exp $ */ +/* $NetBSD: amdccp_fdt.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /* * Copyright (c) 2018 Jonathan A. Kollasch @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.2 2021/01/17 19:54:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -49,9 +49,10 @@ static void amdccp_fdt_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(amdccp_fdt, sizeof(struct amdccp_fdt_softc), amdccp_fdt_match, amdccp_fdt_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "amd,ccp-seattle-v1a", }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amd,ccp-seattle-v1a" }, + + { 0 } }; static int diff --git a/sys/dev/fdt/arasan_sdhc_fdt.c b/sys/dev/fdt/arasan_sdhc_fdt.c index 4a101540c74a..c212263502d2 100644 --- a/sys/dev/fdt/arasan_sdhc_fdt.c +++ b/sys/dev/fdt/arasan_sdhc_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.4 2021/01/15 20:50:49 ryo Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.4 2021/01/15 20:50:49 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.5 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -72,9 +72,11 @@ struct arasan_sdhc_softc { struct clk sc_clk_card; }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3399-sdhci-5.1", AS_TYPE_RK3399 }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3399-sdhci-5.1", + .value = AS_TYPE_RK3399 }, + + { 0 } }; static struct clk * @@ -262,7 +264,7 @@ arasan_sdhc_attach(device_t parent, device_t self, void *aux) return; } sc->sc_bsz = size; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; const uint32_t caps = bus_space_read_4(sc->sc_bst, sc->sc_bsh, SDHC_CAPABILITIES); if ((caps & (SDHC_ADMA2_SUPP|SDHC_64BIT_SYS_BUS)) == SDHC_ADMA2_SUPP) { diff --git a/sys/dev/fdt/connector_fdt.c b/sys/dev/fdt/connector_fdt.c index 3929e36bbc56..f68280a58e34 100644 --- a/sys/dev/fdt/connector_fdt.c +++ b/sys/dev/fdt/connector_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: connector_fdt.c,v 1.1 2018/04/03 12:40:20 bouyer Exp $ */ +/* $NetBSD: connector_fdt.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: connector_fdt.c,v 1.1 2018/04/03 12:40:20 bouyer Exp $"); +__KERNEL_RCSID(1, "$NetBSD: connector_fdt.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -69,12 +69,13 @@ struct fdt_connector_softc { CFATTACH_DECL_NEW(fdt_connector, sizeof(struct fdt_connector_softc), fdt_connector_match, fdt_connector_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - {"composite-video-connector", CON_TV}, - {"dvi-connector", CON_DVI}, - {"hdmi-connector", CON_HDMI}, - {"vga-connector", CON_VGA}, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "composite-video-connector", .value = CON_TV}, + { .compat = "dvi-connector", .value = CON_DVI}, + { .compat = "hdmi-connector", .value = CON_HDMI}, + { .compat = "vga-connector", .value = CON_VGA}, + + { 0 } }; static int @@ -94,7 +95,7 @@ fdt_connector_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = phandle; - sc->sc_type = of_search_compatible(phandle, compat_data)->data; + sc->sc_type = of_search_compatible(phandle, compat_data)->value; SLIST_INSERT_HEAD(&fdt_connectors, sc, sc_list); diff --git a/sys/dev/fdt/dwc2_fdt.c b/sys/dev/fdt/dwc2_fdt.c index 0ec6d923957e..1c4d4859b7a9 100644 --- a/sys/dev/fdt/dwc2_fdt.c +++ b/sys/dev/fdt/dwc2_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: dwc2_fdt.c,v 1.6 2021/01/15 22:35:39 jmcneill Exp $ */ +/* $NetBSD: dwc2_fdt.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc2_fdt.c,v 1.6 2021/01/15 22:35:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc2_fdt.c,v 1.7 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -82,12 +82,17 @@ static const struct dwc2_fdt_config dwc2_fdt_meson8b_config = { static const struct dwc2_fdt_config dwc2_fdt_generic_config = { }; -static const struct of_compat_data compat_data[] = { - { "amlogic,meson8b-usb", (uintptr_t)&dwc2_fdt_meson8b_config }, - { "amlogic,meson-gxbb-usb", (uintptr_t)&dwc2_fdt_meson8b_config }, - { "rockchip,rk3066-usb", (uintptr_t)&dwc2_fdt_rk3066_config }, - { "snps,dwc2", (uintptr_t)&dwc2_fdt_generic_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "amlogic,meson8b-usb", + .data = &dwc2_fdt_meson8b_config }, + { .compat = "amlogic,meson-gxbb-usb", + .data = &dwc2_fdt_meson8b_config }, + { .compat = "rockchip,rk3066-usb", + .data = &dwc2_fdt_rk3066_config }, + { .compat = "snps,dwc2", + .data = &dwc2_fdt_generic_config }, + + { 0 } }; CFATTACH_DECL_NEW(dwc2_fdt, sizeof(struct dwc2_fdt_softc), @@ -110,7 +115,7 @@ dwc2_fdt_attach(device_t parent, device_t self, void *aux) struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; const struct dwc2_fdt_config *conf = - (void *)of_search_compatible(phandle, compat_data)->data; + of_search_compatible(phandle, compat_data)->data; char intrstr[128]; struct fdtbus_phy *phy; struct clk *clk; diff --git a/sys/dev/fdt/dwcmmc_fdt.c b/sys/dev/fdt/dwcmmc_fdt.c index b4c3139b27af..8f47723acc36 100644 --- a/sys/dev/fdt/dwcmmc_fdt.c +++ b/sys/dev/fdt/dwcmmc_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.12 2021/01/15 20:50:49 ryo Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.12 2021/01/15 20:50:49 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.13 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -66,9 +66,10 @@ static const struct dwcmmc_fdt_config dwcmmc_rk3288_config = { .intr_cardmask = __BIT(24), }; -static const struct of_compat_data compat_data[] = { - { "rockchip,rk3288-dw-mshc", (uintptr_t)&dwcmmc_rk3288_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "rockchip,rk3288-dw-mshc", .data = &dwcmmc_rk3288_config }, + + { 0 } }; struct dwcmmc_fdt_softc { @@ -150,7 +151,7 @@ dwcmmc_fdt_attach(device_t parent, device_t self, void *aux) (uint64_t)addr, error); return; } - esc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data; + esc->sc_conf = of_search_compatible(phandle, compat_data)->data; if (of_getprop_uint32(phandle, "max-frequency", &sc->sc_clock_freq) != 0) sc->sc_clock_freq = UINT_MAX; diff --git a/sys/dev/fdt/i2cmux_fdt.c b/sys/dev/fdt/i2cmux_fdt.c index 966e47986330..48d654bd7131 100644 --- a/sys/dev/fdt/i2cmux_fdt.c +++ b/sys/dev/fdt/i2cmux_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: i2cmux_fdt.c,v 1.5 2021/01/17 19:54:23 jmcneill Exp $ */ +/* $NetBSD: i2cmux_fdt.c,v 1.6 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i2cmux_fdt.c,v 1.5 2021/01/17 19:54:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2cmux_fdt.c,v 1.6 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -236,12 +236,12 @@ static const struct iicmux_config iicmux_pinctrl_config = { /*****************************************************************************/ -static const struct of_compat_data compat_data[] = { +static const struct device_compatible_entry compat_data[] = { { .compat = "i2c-mux-gpio", - .data = (uintptr_t)&iicmux_gpio_config }, + .data = &iicmux_gpio_config }, { .compat = "i2c-mux-pinctrl", - .data = (uintptr_t)&iicmux_pinctrl_config }, + .data = &iicmux_pinctrl_config }, { NULL } }; @@ -262,8 +262,7 @@ iicmux_fdt_attach(device_t const parent, device_t const self, void * const aux) sc->sc_dev = self; sc->sc_phandle = faa->faa_phandle; - sc->sc_config = (const struct iicmux_config *) - of_search_compatible(sc->sc_phandle, compat_data)->data; + sc->sc_config = of_search_compatible(sc->sc_phandle, compat_data)->data; aprint_naive("\n"); aprint_normal(": %s I2C mux\n", sc->sc_config->desc); diff --git a/sys/dev/fdt/ns8250_uart.c b/sys/dev/fdt/ns8250_uart.c index 1ab08bcd24cf..c687035c0ec5 100644 --- a/sys/dev/fdt/ns8250_uart.c +++ b/sys/dev/fdt/ns8250_uart.c @@ -1,4 +1,4 @@ -/* $NetBSD: ns8250_uart.c,v 1.3 2021/01/15 22:35:39 jmcneill Exp $ */ +/* $NetBSD: ns8250_uart.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2017-2020 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: ns8250_uart.c,v 1.3 2021/01/15 22:35:39 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: ns8250_uart.c,v 1.4 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -77,14 +77,15 @@ static const struct ns8250_config octeon_config = { .enable = ns8250_octeon_enable, }; -static const struct of_compat_data compat_data[] = { - { "cavium,octeon-3860-uart", (uintptr_t)&octeon_config }, - { "ns8250", (uintptr_t)&ns8250_config }, - { "ns16450", (uintptr_t)&ns8250_config }, - { "ns16550a", (uintptr_t)&ns8250_config }, - { "ns16550", (uintptr_t)&ns8250_config }, - { "ns16750", (uintptr_t)&ns16750_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "cavium,octeon-3860-uart", .data = &octeon_config }, + { .compat = "ns8250", .data = &ns8250_config }, + { .compat = "ns16450", .data = &ns8250_config }, + { .compat = "ns16550a", .data = &ns8250_config }, + { .compat = "ns16550", .data = &ns8250_config }, + { .compat = "ns16750", .data = &ns16750_config }, + + { 0 } }; CFATTACH_DECL_NEW(ns8250_uart, sizeof(struct com_softc), @@ -115,7 +116,7 @@ ns8250_uart_attach(device_t parent, device_t self, void *aux) void *ih; const struct ns8250_config *config = - (void *)of_search_compatible(phandle, compat_data)->data; + of_search_compatible(phandle, compat_data)->data; if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) { aprint_error(": couldn't get registers\n"); @@ -196,7 +197,7 @@ ns8250_uart_console_consinit(struct fdt_attach_args *faa, u_int uart_freq) int speed; const struct ns8250_config *config = - (void *)of_search_compatible(phandle, compat_data)->data; + of_search_compatible(phandle, compat_data)->data; fdtbus_get_reg(phandle, 0, &addr, NULL); speed = fdtbus_get_stdout_speed(); diff --git a/sys/dev/fdt/panel_fdt.c b/sys/dev/fdt/panel_fdt.c index 550b70edb493..efff0b7f6cc2 100644 --- a/sys/dev/fdt/panel_fdt.c +++ b/sys/dev/fdt/panel_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: panel_fdt.c,v 1.2 2019/06/24 06:24:33 skrll Exp $ */ +/* $NetBSD: panel_fdt.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: panel_fdt.c,v 1.2 2019/06/24 06:24:33 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: panel_fdt.c,v 1.3 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -68,10 +68,11 @@ struct fdt_panel_softc { CFATTACH_DECL_NEW(fdt_panel, sizeof(struct fdt_panel_softc), fdt_panel_match, fdt_panel_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - {"panel-lvds", PANEL_LVDS}, - {"panel-dual-lvds", PANEL_DUAL_LVDS}, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "panel-lvds", .value = PANEL_LVDS}, + { .compat = "panel-dual-lvds", .value = PANEL_DUAL_LVDS}, + + { 0 } }; static int @@ -98,7 +99,7 @@ fdt_panel_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_phandle = phandle; sc->sc_panel.panel_type = - of_search_compatible(phandle, compat_data)->data; + of_search_compatible(phandle, compat_data)->value; if (of_getprop_uint32(phandle, "width-mm", &sc->sc_panel.panel_width) || of_getprop_uint32(phandle, "height-mm", &sc->sc_panel.panel_height)){ diff --git a/sys/dev/fdt/pinctrl_single.c b/sys/dev/fdt/pinctrl_single.c index 622b1c01c0c4..e680949a4248 100644 --- a/sys/dev/fdt/pinctrl_single.c +++ b/sys/dev/fdt/pinctrl_single.c @@ -1,4 +1,4 @@ -/* $NetBSD: pinctrl_single.c,v 1.1 2019/10/27 15:31:15 jmcneill Exp $ */ +/* $NetBSD: pinctrl_single.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.1 2019/10/27 15:31:15 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -50,10 +50,11 @@ static const struct pinctrl_single_config pinconf_config = { .flags = PINCTRL_FLAG_PINCONF }; -static const struct of_compat_data compat_data[] = { - { "pinctrl-single", (uintptr_t)&pinctrl_config }, - { "pinconf-single", (uintptr_t)&pinconf_config }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "pinctrl-single", .data = &pinctrl_config }, + { .compat = "pinconf-single", .data = &pinconf_config }, + + { 0 } }; struct pinctrl_single_softc { @@ -159,7 +160,7 @@ pinctrl_single_attach(device_t parent, device_t self, void *aux) return; } - conf = (const void *)of_search_compatible(phandle, compat_data)->data; + conf = of_search_compatible(phandle, compat_data)->data; sc->sc_dev = self; sc->sc_phandle = phandle; diff --git a/sys/dev/fdt/vmt_fdt.c b/sys/dev/fdt/vmt_fdt.c index 8924277c682f..8f5536b53aca 100644 --- a/sys/dev/fdt/vmt_fdt.c +++ b/sys/dev/fdt/vmt_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: vmt_fdt.c,v 1.1 2020/10/28 08:36:40 ryo Exp $ */ +/* $NetBSD: vmt_fdt.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $ */ /* * Copyright (c) 2020 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vmt_fdt.c,v 1.1 2020/10/28 08:36:40 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vmt_fdt.c,v 1.2 2021/01/18 02:35:49 thorpej Exp $"); #include #include @@ -43,9 +43,10 @@ static void vmt_fdt_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(vmt_fdt, sizeof(struct vmt_softc), vmt_fdt_match, vmt_fdt_attach, NULL, NULL); -static const struct of_compat_data compat_data[] = { - { "vmware", }, - { NULL } +static const struct device_compatible_entry compat_data[] = { + { .compat = "vmware" }, + + { 0 } }; static int diff --git a/sys/dev/ofw/ofw_subr.c b/sys/dev/ofw/ofw_subr.c index b88abf90ad5a..b4a934438aed 100644 --- a/sys/dev/ofw/ofw_subr.c +++ b/sys/dev/ofw/ofw_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_subr.c,v 1.41 2020/12/31 15:10:46 ryo Exp $ */ +/* $NetBSD: ofw_subr.c,v 1.42 2021/01/18 02:35:49 thorpej Exp $ */ /* * Copyright 1998 @@ -34,9 +34,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.41 2020/12/31 15:10:46 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.42 2021/01/18 02:35:49 thorpej Exp $"); #include +#include #include #include #include @@ -211,7 +212,8 @@ of_match_compatible(int phandle, const char * const *strings) * None. */ int -of_match_compat_data(int phandle, const struct of_compat_data *compat_data) +of_match_compat_data(int phandle, + const struct device_compatible_entry *compat_data) { for (; compat_data->compat != NULL; compat_data++) { const char *compat[] = { compat_data->compat, NULL }; @@ -243,8 +245,9 @@ of_match_compat_data(int phandle, const struct of_compat_data *compat_data) * Side Effects: * None. */ -const struct of_compat_data * -of_search_compatible(int phandle, const struct of_compat_data *compat_data) +const struct device_compatible_entry * +of_search_compatible(int phandle, + const struct device_compatible_entry *compat_data) { for (; compat_data->compat != NULL; compat_data++) { const char *compat[] = { compat_data->compat, NULL }; diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h index 9cbf6094fb0e..f662295305af 100644 --- a/sys/dev/ofw/openfirm.h +++ b/sys/dev/ofw/openfirm.h @@ -1,4 +1,4 @@ -/* $NetBSD: openfirm.h,v 1.40 2020/12/31 15:10:46 ryo Exp $ */ +/* $NetBSD: openfirm.h,v 1.41 2021/01/18 02:35:49 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -65,11 +65,6 @@ struct ofbus_attach_args { int oba_unit; }; -struct of_compat_data { - const char *compat; - uintptr_t data; -}; - /* * Functions and variables provided by machine-dependent code. */ @@ -108,11 +103,13 @@ int openfirmware(void *); /* * Functions and variables provided by machine-independent code. */ +struct device_compatible_entry; + int of_compatible(int, const char * const *); int of_match_compatible(int, const char * const *); -int of_match_compat_data(int, const struct of_compat_data *); -const struct of_compat_data * - of_search_compatible(int, const struct of_compat_data *); +int of_match_compat_data(int, const struct device_compatible_entry *); +const struct device_compatible_entry * + of_search_compatible(int, const struct device_compatible_entry *); int of_decode_int(const unsigned char *); int of_packagename(int, char *, int); int of_find_firstchild_byname(int, const char *);