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.
This commit is contained in:
thorpej 2021-01-18 02:35:48 +00:00
parent 36204e72cf
commit 646c0f59ef
88 changed files with 821 additions and 657 deletions

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_soc.h" #include "opt_soc.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -71,24 +71,32 @@ struct meson_pinctrl_gpio_pin {
bool pin_actlo; bool pin_actlo;
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
#ifdef SOC_MESON8B #ifdef SOC_MESON8B
{ "amlogic,meson8b-aobus-pinctrl", (uintptr_t)&meson8b_aobus_pinctrl_config }, { .compat = "amlogic,meson8b-aobus-pinctrl",
{ "amlogic,meson8b-cbus-pinctrl", (uintptr_t)&meson8b_cbus_pinctrl_config }, .data = &meson8b_aobus_pinctrl_config },
{ .compat = "amlogic,meson8b-cbus-pinctrl",
.data = &meson8b_cbus_pinctrl_config },
#endif #endif
#ifdef SOC_MESONGXBB #ifdef SOC_MESONGXBB
{ "amlogic,meson-gxbb-aobus-pinctrl", (uintptr_t)&mesongxbb_aobus_pinctrl_config }, { .compat = "amlogic,meson-gxbb-aobus-pinctrl",
{ "amlogic,meson-gxbb-periphs-pinctrl", (uintptr_t)&mesongxbb_periphs_pinctrl_config }, .data = &mesongxbb_aobus_pinctrl_config },
{ .compat = "amlogic,meson-gxbb-periphs-pinctrl",
.data = &mesongxbb_periphs_pinctrl_config },
#endif #endif
#ifdef SOC_MESONGXL #ifdef SOC_MESONGXL
{ "amlogic,meson-gxl-aobus-pinctrl", (uintptr_t)&mesongxl_aobus_pinctrl_config }, { .compat = "amlogic,meson-gxl-aobus-pinctrl",
{ "amlogic,meson-gxl-periphs-pinctrl", (uintptr_t)&mesongxl_periphs_pinctrl_config }, .data = &mesongxl_aobus_pinctrl_config },
{ .compat = "amlogic,meson-gxl-periphs-pinctrl",
.data = &mesongxl_periphs_pinctrl_config },
#endif #endif
#ifdef SOC_MESONG12 #ifdef SOC_MESONG12
{ "amlogic,meson-g12a-aobus-pinctrl", (uintptr_t)&mesong12a_aobus_pinctrl_config }, { .compat = "amlogic,meson-g12a-aobus-pinctrl",
{ "amlogic,meson-g12a-periphs-pinctrl", (uintptr_t)&mesong12a_periphs_pinctrl_config }, .data = &mesong12a_aobus_pinctrl_config },
{ .compat = "amlogic,meson-g12a-periphs-pinctrl",
.data = &mesong12a_periphs_pinctrl_config },
#endif #endif
{ NULL, 0 } { 0 }
}; };
#define MUX_READ(sc, reg) \ #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_dev = self;
sc->sc_phandle = faa->faa_phandle; sc->sc_phandle = faa->faa_phandle;
sc->sc_bst = faa->faa_bst; 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); mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
if (meson_pinctrl_initres(sc) != 0) if (meson_pinctrl_initres(sc) != 0)

View File

@ -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 <ryo@nerv.org> * Copyright (c) 2021 Ryo Shimizu <ryo@nerv.org>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -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) \ #define PWM_WRITE_REG(sc, reg, val) \
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg) * 4, (val)) bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg) * 4, (val))
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,meson-g12a-ao-pwm-ab", 0 }, { .compat = "amlogic,meson-g12a-ao-pwm-ab" },
{ "amlogic,meson-g12a-ao-pwm-cd", 0 }, { .compat = "amlogic,meson-g12a-ao-pwm-cd" },
{ "amlogic,meson-g12a-ee-pwm", 0 }, { .compat = "amlogic,meson-g12a-ee-pwm" },
{ NULL }
{ 0 }
}; };
#define MESON_PWM_NCHAN 2 #define MESON_PWM_NCHAN 2

View File

@ -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 <ryo@nerv.org> * Copyright (c) 2021 Ryo Shimizu <ryo@nerv.org>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -87,10 +87,11 @@ static struct meson_thermal_config thermal_ddr_conf = {
.aosec_reg = 0xf0 .aosec_reg = 0xf0
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,g12a-cpu-thermal", (uintptr_t)&thermal_cpu_conf }, { .compat = "amlogic,g12a-cpu-thermal", .data = &thermal_cpu_conf },
{ "amlogic,g12a-ddr-thermal", (uintptr_t)&thermal_ddr_conf }, { .compat = "amlogic,g12a-ddr-thermal", .data = &thermal_ddr_conf },
{ NULL }
{ 0 }
}; };
struct meson_thermal_softc { struct meson_thermal_softc {
@ -98,7 +99,7 @@ struct meson_thermal_softc {
bus_space_tag_t sc_bst; bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh; bus_space_handle_t sc_bsh;
bus_space_handle_t sc_bsh_ao; 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_phandle;
int sc_ao_calib; 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_dev = self;
sc->sc_bst = faa->faa_bst; sc->sc_bst = faa->faa_bst;
sc->sc_phandle = phandle = faa->faa_phandle; 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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 <ryo@nerv.org> * Copyright (c) 2021 Ryo Shimizu <ryo@nerv.org>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -110,16 +110,17 @@ struct meson_usbctrl_config mesong12_conf = {
.num_phys = 3 .num_phys = 3
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,meson-g12a-usb-ctrl", (uintptr_t)&mesong12_conf }, { .compat = "amlogic,meson-g12a-usb-ctrl", .data = &mesong12_conf },
{ NULL }
{ 0 }
}; };
struct meson_usbctrl_softc { struct meson_usbctrl_softc {
device_t sc_dev; device_t sc_dev;
bus_space_tag_t sc_bst; bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh; bus_space_handle_t sc_bsh;
struct meson_usbctrl_config *sc_conf; const struct meson_usbctrl_config *sc_conf;
struct fdtbus_regulator *sc_supply; struct fdtbus_regulator *sc_supply;
int sc_phandle; int sc_phandle;
}; };
@ -267,7 +268,7 @@ meson_usbctrl_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_bst = faa->faa_bst; sc->sc_bst = faa->faa_bst;
sc->sc_phandle = phandle = faa->faa_phandle; 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -59,10 +59,13 @@ enum meson_usbphy_type {
USBPHY_MESON8B, USBPHY_MESON8B,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,meson8b-usb2-phy", USBPHY_MESON8B }, { .compat = "amlogic,meson8b-usb2-phy",
{ "amlogic,meson-gxbb-usb2-phy", USBPHY_MESON8B }, .value = USBPHY_MESON8B },
{ NULL } { .compat = "amlogic,meson-gxbb-usb2-phy",
.value = USBPHY_MESON8B },
{ 0 }
}; };
struct meson_usbphy_softc { 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_dev = self;
sc->sc_bst = faa->faa_bst; sc->sc_bst = faa->faa_bst;
sc->sc_phandle = phandle; 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -1489,10 +1489,11 @@ static const struct mesong12_clkc_config g12b_config = {
.nclks = __arraycount(mesong12b_clkc_clks), .nclks = __arraycount(mesong12b_clkc_clks),
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,g12a-clkc", (uintptr_t)&g12a_config }, { .compat = "amlogic,g12a-clkc", .data = &g12a_config },
{ "amlogic,g12b-clkc", (uintptr_t)&g12b_config }, { .compat = "amlogic,g12b-clkc", .data = &g12b_config },
{ NULL }
{ 0 }
}; };
CFATTACH_DECL_NEW(mesong12_clkc, sizeof(struct meson_clk_softc), 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; 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_clks = conf->clks;
sc->sc_nclks = conf->nclks; sc->sc_nclks = conf->nclks;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -267,11 +267,12 @@ enum {
MESONGX_MMC_V3 = 3, MESONGX_MMC_V3 = 3,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,meson-gx-mmc", MESONGX_MMC_V2 }, { .compat = "amlogic,meson-gx-mmc", .value = MESONGX_MMC_V2 },
{ "amlogic,meson-gxbb-mmc", MESONGX_MMC_V2 }, { .compat = "amlogic,meson-gxbb-mmc", .value = MESONGX_MMC_V2 },
{ "amlogic,meson-axg-mmc", MESONGX_MMC_V3 }, { .compat = "amlogic,meson-axg-mmc", .value = MESONGX_MMC_V3 },
{ NULL }
{ 0 }
}; };
static int static int
@ -292,7 +293,7 @@ mesongx_mmc_attach(device_t parent, device_t self, void *aux)
bus_addr_t addr; bus_addr_t addr;
bus_size_t size; 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -78,10 +78,11 @@ static const struct mesongxbb_clkc_config gxl_config = {
.name = "Meson GXL", .name = "Meson GXL",
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,gxbb-clkc", (uintptr_t)&gxbb_config }, { .compat = "amlogic,gxbb-clkc", .data = &gxbb_config },
{ "amlogic,gxl-clkc", (uintptr_t)&gxl_config }, { .compat = "amlogic,gxl-clkc", .data = &gxl_config },
{ NULL }
{ 0 }
}; };
CFATTACH_DECL_NEW(mesongxbb_clkc, sizeof(struct meson_clk_softc), 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); 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_naive("\n");
aprint_normal(": %s clock controller\n", conf->name); aprint_normal(": %s clock controller\n", conf->name);

View File

@ -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. * Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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" #include "bcmdmac.h"
@ -96,9 +96,9 @@ enum bcmemmc_type {
BCM2711_EMMC2, BCM2711_EMMC2,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "brcm,bcm2835-sdhci", BCM2835_SDHCI }, { .compat = "brcm,bcm2835-sdhci", .value = BCM2835_SDHCI },
{ "brcm,bcm2711-emmc2", BCM2711_EMMC2 }, { .compat = "brcm,bcm2711-emmc2", .value = BCM2711_EMMC2 },
{ NULL } { NULL }
}; };
@ -183,7 +183,8 @@ bcmemmc_attach(device_t parent, device_t self, void *aux)
aprint_normal_dev(self, "interrupting on %s\n", intrstr); aprint_normal_dev(self, "interrupting on %s\n", intrstr);
#if NBCMDMAC > 0 #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) if (type != BCM2835_SDHCI)
goto done; goto done;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
@ -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), CFATTACH_DECL_NEW(pcihost_fdt, sizeof(struct pcihost_softc),
pcihost_match, pcihost_attach, NULL, NULL); pcihost_match, pcihost_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "pci-host-cam-generic", PCIHOST_CAM }, { .compat = "pci-host-cam-generic", .value = PCIHOST_CAM },
{ "pci-host-ecam-generic", PCIHOST_ECAM }, { .compat = "pci-host-ecam-generic", .value = PCIHOST_ECAM },
{ NULL, 0 }
{ 0 }
}; };
static int 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); aprint_error(": couldn't map registers: %d\n", error);
return; 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 #ifdef __HAVE_PCI_MSI_MSIX
if (sc->sc_type == PCIHOST_ECAM) { if (sc->sc_type == PCIHOST_ECAM) {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -68,7 +68,7 @@ struct tegra_ahcisata_softc {
struct tegra_gpio_pin *sc_pin_power; struct tegra_gpio_pin *sc_pin_power;
struct tegra_ahcisata_data const struct tegra_ahcisata_data
*sc_tad; *sc_tad;
}; };
@ -102,10 +102,11 @@ struct tegra_ahcisata_data tegra210_ahcisata_data = {
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "nvidia,tegra124-ahci", (uintptr_t)&tegra124_ahcisata_data }, { .compat = "nvidia,tegra124-ahci", .data = &tegra124_ahcisata_data },
{ "nvidia,tegra210-ahci", (uintptr_t)&tegra210_ahcisata_data }, { .compat = "nvidia,tegra210-ahci", .data = &tegra210_ahcisata_data },
{ NULL },
{ 0 },
}; };
@ -169,8 +170,7 @@ tegra_ahcisata_attach(device_t parent, device_t self, void *aux)
return; return;
} }
uintptr_t data = of_search_compatible(faa->faa_phandle, compat_data)->data; sc->sc_tad = of_search_compatible(faa->faa_phandle, compat_data)->data;
sc->sc_tad = (struct tegra_ahcisata_data *)data;
if (sc->sc_tad->tad_type == TEGRA124) { if (sc->sc_tad->tad_type == TEGRA124) {
sc->sc_clk_cml1 = fdtbus_clock_get(phandle, "cml1"); sc->sc_clk_cml1 = fdtbus_clock_get(phandle, "cml1");
if (sc->sc_clk_cml1 == NULL) { if (sc->sc_clk_cml1 == NULL) {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -110,10 +110,11 @@ static const struct nvkm_device_tegra_func gk20a_platform_data = {
.iommu_bit = 34, .iommu_bit = 34,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "nvidia,gk20a", (uintptr_t)&gk20a_platform_data }, { .compat = "nvidia,gk20a", .data = &gk20a_platform_data },
{ "nvidia,gm20b", (uintptr_t)&gk20a_platform_data }, { .compat = "nvidia,gm20b", .data = &gk20a_platform_data },
{ NULL, 0 },
{ 0 }
}; };
static int 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 tegra_nouveau_softc * const sc = device_private(self);
struct fdt_attach_args * const faa = aux; struct fdt_attach_args * const faa = aux;
prop_dictionary_t prop = device_properties(self); 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); of_search_compatible(faa->faa_phandle, compat_data);
const struct nvkm_device_tegra_func *tegra_func __diagused = const struct nvkm_device_tegra_func *tegra_func __diagused = data->data;
(const void *)data->data;
int error; int error;
KASSERT(tegra_func != NULL); KASSERT(tegra_func != NULL);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2015-2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_tegra.h" #include "opt_tegra.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -75,11 +75,11 @@ struct tegra_pinmux_softc {
#define PINMUX_READ(sc, reg) \ #define PINMUX_READ(sc, reg) \
bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh[1], (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 #ifdef SOC_TEGRA210
{ "nvidia,tegra210-pinmux", (uintptr_t)&tegra210_pinmux_conf }, { .compat = "nvidia,tegra210-pinmux", .data = &tegra210_pinmux_conf },
#endif #endif
{ NULL } { 0 }
}; };
static const struct tegra_pinmux_pins * static const struct tegra_pinmux_pins *
@ -277,7 +277,7 @@ tegra_pinmux_attach(device_t parent, device_t self, void *aux)
return; 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_naive("\n");
aprint_normal(": Pinmux\n"); aprint_normal(": Pinmux\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -159,9 +159,11 @@ CFATTACH_DECL_NEW(tegra_soctherm, sizeof(struct tegra_soctherm_softc),
#define SENSOR_SET_CLEAR(sc, s, reg, set, clr) \ #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)) tegra_reg_set_clear((sc)->sc_bst, (sc)->sc_bsh, (s)->s_base + (reg), (set), (clr))
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "nvidia,tegra124-soctherm", (uintptr_t)&tegra124_soctherm_config }, { .compat = "nvidia,tegra124-soctherm",
{ NULL } .data = &tegra124_soctherm_config },
{ 0 }
}; };
static int static int
@ -213,7 +215,7 @@ tegra_soctherm_attach(device_t parent, device_t self, void *aux)
aprint_naive("\n"); aprint_naive("\n");
aprint_normal(": SOC_THERM\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) { if (sc->sc_config == NULL) {
aprint_error_dev(self, "unsupported SoC\n"); aprint_error_dev(self, "unsupported SoC\n");
return; return;

View File

@ -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 * Copyright (c) 2016 Jonathan A. Kollasch
@ -30,7 +30,7 @@
#include "opt_tegra.h" #include "opt_tegra.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -145,10 +145,11 @@ struct tegra_xhci_data tegra210_xhci_data = {
.txd_scale_ss_clock = false, .txd_scale_ss_clock = false,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "nvidia,tegra124-xusb", (uintptr_t)&tegra124_xhci_data }, { .compat = "nvidia,tegra124-xusb", .data = &tegra124_xhci_data },
{ "nvidia,tegra210-xusb", (uintptr_t)&tegra210_xhci_data }, { .compat = "nvidia,tegra210-xusb", .data = &tegra210_xhci_data },
{ NULL }
{ 0 }
}; };
struct fw_dma { struct fw_dma {
@ -170,7 +171,7 @@ struct tegra_xusb_softc {
struct fw_dma sc_fw_dma; struct fw_dma sc_fw_dma;
struct clk *sc_clk_ss_src; 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); 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; sc->sc_quirks = XHCI_DEFERRED_START;
psc->sc_phandle = faa->faa_phandle; psc->sc_phandle = faa->faa_phandle;
uintptr_t data = of_search_compatible(faa->faa_phandle, compat_data)->data; psc->sc_txd = of_search_compatible(faa->faa_phandle, compat_data)->data;
psc->sc_txd = (struct tegra_xhci_data *)data;
if (fdtbus_get_reg_byname(faa->faa_phandle, "hcd", &addr, &size) != 0) { if (fdtbus_get_reg_byname(faa->faa_phandle, "hcd", &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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. * Copyright (c) 2019 Genetec Corporation. All rights reserved.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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" #include "opt_fdt.h"
@ -49,11 +49,12 @@ struct enet_fdt_softc {
CFATTACH_DECL_NEW(enet_fdt, sizeof(struct enet_fdt_softc), CFATTACH_DECL_NEW(enet_fdt, sizeof(struct enet_fdt_softc),
enet_match, enet_attach, NULL, NULL); enet_match, enet_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
/* compatible imxtype */ /* compatible imxtype */
{ "fsl,imx6q-fec", 6 }, { .compat = "fsl,imx6q-fec", .value = 6 },
{ "fsl,imx6sx-fec", 7 }, { .compat = "fsl,imx6sx-fec", .value = 7 },
{ NULL }
{ 0 }
}; };
static int enet_init_clocks(struct enet_softc *); 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_ioh = bsh;
sc->sc_dmat = faa->faa_dmat; 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_unit = 0;
sc->sc_phyid = enet_phy_id(sc, phandle); sc->sc_phyid = enet_phy_id(sc, phandle);

View File

@ -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. * Copyright (c) 2019 Genetec Corporation. All rights reserved.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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_pci.h"
#include "opt_fdt.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), CFATTACH_DECL_NEW(imxpcie_fdt, sizeof(struct imxpcie_fdt_softc),
imx6_pcie_match, imx6_pcie_attach, NULL, NULL); imx6_pcie_match, imx6_pcie_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "fsl,imx6q-pcie", false }, { .compat = "fsl,imx6q-pcie", .value = false },
{ "fsl,imx6qp-pcie", true }, { .compat = "fsl,imx6qp-pcie", .value = true },
{ NULL }
{ 0 }
}; };
static int 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_read = imx6_pcie_gpr_read;
sc->sc_gpr_write = imx6_pcie_gpr_write; sc->sc_gpr_write = imx6_pcie_gpr_write;
sc->sc_reset = imx6_pcie_reset; 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) { if (fdtbus_get_reg_byname(phandle, "dbi", &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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. * Copyright (c) 2019 Genetec Corporation. All rights reserved.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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" #include "opt_imxspi.h"
@ -60,9 +60,10 @@ static const struct imx_spi_config imx6q_spi_config = {
.type = IMX51_ECSPI, .type = IMX51_ECSPI,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "fsl,imx6q-ecspi", (uintptr_t)&imx6q_spi_config }, { .compat = "fsl,imx6q-ecspi", .data = &imx6q_spi_config },
{ NULL }
{ 0 }
}; };
CFATTACH_DECL_NEW(imxspi_fdt, sizeof(struct imxspi_fdt_softc), 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_phandle = phandle;
sc->sc_iot = faa->faa_bst; 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_enhanced = config->enhanced;
sc->sc_type = config->type; sc->sc_type = config->type;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -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 int imx8mq_usbphy_match(device_t, cfdata_t, void *);
static void imx8mq_usbphy_attach(device_t, device_t, void *); static void imx8mq_usbphy_attach(device_t, device_t, void *);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "fsl,imx8mq-usb-phy", 0 }, { .compat = "fsl,imx8mq-usb-phy" },
{ NULL }
{ 0 }
}; };
struct imx8mq_usbphy_softc { struct imx8mq_usbphy_softc {

View File

@ -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. * Copyright (c) 2019 Genetec Corporation. All rights reserved.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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" #include "opt_fdt.h"
@ -84,10 +84,11 @@ static const struct imx6_sdhc_config imx7d_config = {
.flags = 0 .flags = 0
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "fsl,imx6q-usdhc", (uintptr_t)&imx6q_config }, { .compat = "fsl,imx6q-usdhc", .data = &imx6q_config },
{ "fsl,imx7d-usdhc", (uintptr_t)&imx7d_config }, { .compat = "fsl,imx7d-usdhc", .data = &imx7d_config },
{ NULL }
{ 0 }
}; };
static int 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"); 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_dev = self;
sc->sc_sdhc.sc_dmat = faa->faa_dmat; sc->sc_sdhc.sc_dmat = faa->faa_dmat;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -114,9 +114,10 @@ static const struct rk3328_iomux_conf rk3328_iomux_conf = {
.nbanks = __arraycount(rk3328_iomux_banks), .nbanks = __arraycount(rk3328_iomux_banks),
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3328-pinctrl", (uintptr_t)&rk3328_iomux_conf }, { .compat = "rockchip,rk3328-pinctrl", .data = &rk3328_iomux_conf },
{ NULL }
{ 0 }
}; };
struct rk3328_iomux_softc { 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"); aprint_error(": couldn't acquire grf syscon\n");
return; 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_naive("\n");
aprint_normal(": RK3328 IOMUX control\n"); aprint_normal(": RK3328 IOMUX control\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
//#define RK3399_IOMUX_DEBUG //#define RK3399_IOMUX_DEBUG
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -181,8 +181,8 @@ static const struct rk3399_iomux_conf rk3399_iomux_conf = {
.nbanks = __arraycount(rk3399_iomux_banks), .nbanks = __arraycount(rk3399_iomux_banks),
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3399-pinctrl", (uintptr_t)&rk3399_iomux_conf }, { .compat = "rockchip,rk3399-pinctrl", .data = &rk3399_iomux_conf },
{ NULL } { NULL }
}; };
@ -499,7 +499,7 @@ rk3399_iomux_attach(device_t parent, device_t self, void *aux)
aprint_error(": couldn't acquire pmu syscon\n"); aprint_error(": couldn't acquire pmu syscon\n");
return; 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_naive("\n");
aprint_normal(": RK3399 IOMUX control\n"); aprint_normal(": RK3399 IOMUX control\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -58,10 +58,11 @@ enum rk_gmac_type {
GMAC_RK3399 GMAC_RK3399
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3328-gmac", GMAC_RK3328 }, { .compat = "rockchip,rk3328-gmac", .value = GMAC_RK3328 },
{ "rockchip,rk3399-gmac", GMAC_RK3399 }, { .compat = "rockchip,rk3399-gmac", .value = GMAC_RK3399 },
{ NULL }
{ 0 }
}; };
struct rk_gmac_softc { struct rk_gmac_softc {
@ -363,7 +364,7 @@ rk_gmac_attach(device_t parent, device_t self, void *aux)
return; 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"); rk_sc->sc_syscon = fdtbus_syscon_acquire(phandle, "rockchip,grf");
if (rk_sc->sc_syscon == NULL) { if (rk_sc->sc_syscon == NULL) {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -117,12 +117,13 @@ static const struct rk_i2s_config rk3399_i2s_config = {
.oe_val = 0x7, .oe_val = 0x7,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3066-i2s", 0 }, { .compat = "rockchip,rk3066-i2s", },
{ "rockchip,rk3188-i2s", 0 }, { .compat = "rockchip,rk3188-i2s", },
{ "rockchip,rk3288-i2s", 0 }, { .compat = "rockchip,rk3288-i2s", },
{ "rockchip,rk3399-i2s", (uintptr_t)&rk3399_i2s_config }, { .compat = "rockchip,rk3399-i2s", .data = &rk3399_i2s_config },
{ NULL }
{ 0 }
}; };
struct rk_i2s_softc; 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_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); 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) { if (sc->sc_conf != NULL && sc->sc_conf->oe_mask != 0) {
sc->sc_grf = fdtbus_syscon_acquire(phandle, "rockchip,grf"); sc->sc_grf = fdtbus_syscon_acquire(phandle, "rockchip,grf");
if (sc->sc_grf == NULL) { if (sc->sc_grf == NULL) {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -63,9 +63,10 @@ enum rk_pwm_type {
PWM_RK3288 = 1, PWM_RK3288 = 1,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3288-pwm", PWM_RK3288 }, { .compat = "rockchip,rk3288-pwm", .value = PWM_RK3288 },
{ NULL }
{ 0 }
}; };
struct rk_pwm_softc { struct rk_pwm_softc {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -68,10 +68,11 @@ enum rk_usb_type {
USB_RK3399, USB_RK3399,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3328-usb2phy", USB_RK3328 }, { .compat = "rockchip,rk3328-usb2phy", .value = USB_RK3328 },
{ "rockchip,rk3399-usb2phy", USB_RK3399 }, { .compat = "rockchip,rk3399-usb2phy", .value = USB_RK3399 },
{ NULL }
{ 0 }
}; };
struct rk_usb_clk { 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_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)); sc->sc_syscon = fdtbus_syscon_lookup(OF_parent(phandle));
if (sc->sc_syscon == NULL) { if (sc->sc_syscon == NULL) {
aprint_error(": couldn't get grf syscon\n"); aprint_error(": couldn't get grf syscon\n");

View File

@ -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. * Copyright (c) 2020 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/types.h> #include <sys/types.h>
@ -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), CFATTACH_DECL_NEW(rk_v1crypto, sizeof(struct rk_v1crypto_softc),
rk_v1crypto_match, rk_v1crypto_attach, NULL, NULL); rk_v1crypto_match, rk_v1crypto_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"rockchip,rk3288-crypto", 0}, { .compat = "rockchip,rk3288-crypto" },
{NULL}
{ 0 }
}; };
static int static int

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -140,7 +140,7 @@ struct rk_vop_softc {
struct fdt_device_ports sc_ports; 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) #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, .set_polarity = rk3399_vop_set_polarity,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3399-vop-big", (uintptr_t)&rk3399_vop_big_config }, { .compat = "rockchip,rk3399-vop-big",
{ "rockchip,rk3399-vop-lit", (uintptr_t)&rk3399_vop_lit_config }, .data = &rk3399_vop_big_config },
{ NULL } { .compat = "rockchip,rk3399-vop-lit",
.data = &rk3399_vop_lit_config },
{ 0 }
}; };
static int 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; uint64_t paddr = (uint64_t)sfb->obj->dmamap->dm_segs[0].ds_addr;
paddr += y * sfb->base.pitches[0]; paddr += y * sfb->base.pitches[0];
paddr += x * drm_format_plane_cpp(sfb->base.pixel_format, 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; return;
} }
sc->sc_phandle = faa->faa_phandle; 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_naive("\n");
aprint_normal(": %s\n", sc->sc_conf->descr); aprint_normal(": %s\n", sc->sc_conf->descr);

View File

@ -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. * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
#include "gpio.h" #include "gpio.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -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. * the '-', or the four character string if the dash is not present.
*/ */
struct exynos_gpio_bank * 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; struct exynos_gpio_bank *bank;

View File

@ -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. * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
#include "gpio.h" #include "gpio.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -73,10 +73,13 @@ CFATTACH_DECL_NEW(exynos_pinctrl, sizeof(struct exynos_pinctrl_softc),
exynos_pinctrl_match, exynos_pinctrl_attach, NULL, NULL); exynos_pinctrl_match, exynos_pinctrl_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "samsung,exynos5410-pinctrl", (uintptr_t)&exynos5410_pinctrl_banks }, { .compat = "samsung,exynos5410-pinctrl",
{ "samsung,exynos5420-pinctrl", (uintptr_t)&exynos5420_pinctrl_banks }, .data = &exynos5410_pinctrl_banks },
{ NULL } { .compat = "samsung,exynos5420-pinctrl",
.data = &exynos5420_pinctrl_banks },
{ 0 }
}; };
static int static int
@ -107,7 +110,7 @@ exynos_pinctrl_attach(device_t parent, device_t self, void *aux)
self->dv_private = sc; self->dv_private = sc;
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_bst = faa->faa_bst; 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); error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh);
if (error) { if (error) {
@ -162,7 +165,7 @@ static int
exynos_do_config(struct exynos_pinctrl_config *pc) exynos_do_config(struct exynos_pinctrl_config *pc)
{ {
struct exynos_gpio_pin_cfg *gc = &pc->pc_pincfg; 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; struct exynos_gpio_bank *bank;
const char *pins; const char *pins;
int pin; int pin;

View File

@ -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. * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc.
@ -36,5 +36,5 @@ struct exynos_pinctrl_softc {
bus_space_tag_t sc_bst; bus_space_tag_t sc_bst;
bus_space_handle_t sc_bsh; bus_space_handle_t sc_bsh;
struct exynos_pinctrl_banks *sc_epb; const struct exynos_pinctrl_banks *sc_epb;
}; };

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
@ -35,7 +35,7 @@
#include "ukbd.h" #include "ukbd.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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; return ret;
} }
static struct of_compat_data mp_compat_data[] = { static struct device_compatible_entry mp_compat_data[] = {
{ "samsung,exynos5800", (uintptr_t)exynos5800_mpstart }, { .compat = "samsung,exynos5800", .data = exynos5800_mpstart },
{ NULL }
{ 0 }
}; };
static int static int
@ -207,9 +208,10 @@ exynos_platform_mpstart(void)
int (*mp_start)(void) = NULL; 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) if (cd)
mp_start = (int (*)(void))cd->data; mp_start = cd->data;
if (mp_start) if (mp_start)
return mp_start(); return mp_start();
@ -337,8 +339,9 @@ exynos5_platform_bootstrap(void)
exynos_bootstrap(5); exynos_bootstrap(5);
#if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER) #if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data); const struct device_compatible_entry *cd =
if (cd && cd->data == (uintptr_t)exynos5800_mpstart) { of_search_compatible(OF_finddevice("/"), mp_compat_data);
if (cd && cd->data == exynos5800_mpstart) {
void *fdt_data = __UNCONST(fdtbus_get_data()); void *fdt_data = __UNCONST(fdtbus_get_data());
int cpu_off, cpus_off, len; int cpu_off, cpus_off, len;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -89,9 +89,10 @@ enum {
NPHY_ID NPHY_ID
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "samsung,exynos5420-usbdrd-phy", 0 }, { .compat = "samsung,exynos5420-usbdrd-phy" },
{ NULL }
{ 0 }
}; };
struct exynos_usbdrdphy_softc; struct exynos_usbdrdphy_softc;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -66,9 +66,10 @@ enum {
static int exynos_usbphy_match(device_t, cfdata_t, void *); static int exynos_usbphy_match(device_t, cfdata_t, void *);
static void exynos_usbphy_attach(device_t, device_t, void *); static void exynos_usbphy_attach(device_t, device_t, void *);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "samsung,exynos5250-usb2-phy", 0 }, { .compat = "samsung,exynos5250-usb2-phy" },
{ NULL }
{ 0 }
}; };
struct exynos_usbphy_softc; struct exynos_usbphy_softc;

View File

@ -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. * 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 exynos5410_pinctrl_banks;
extern struct exynos_pinctrl_banks exynos5420_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 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_acquire(const struct exynos_gpio_pinset *);
extern void exynos_gpio_pinset_release(const struct exynos_gpio_pinset *); extern void exynos_gpio_pinset_release(const struct exynos_gpio_pinset *);

View File

@ -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. * Copyright (c) 2020 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -321,13 +321,14 @@ struct desops ave32ops = {
oinit_rdes, oinit_rdes,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "socionext,unifier-ld20-ave4", 64 }, { .compat = "socionext,unifier-ld20-ave4", .value = 64 },
{ "socionext,unifier-pro4-ave4", 32 }, { .compat = "socionext,unifier-pro4-ave4", .value = 32 },
{ "socionext,unifier-pxs2-ave4", 32 }, { .compat = "socionext,unifier-pxs2-ave4", .value = 32 },
{ "socionext,unifier-ld11-ave4", 32 }, { .compat = "socionext,unifier-ld11-ave4", .value = 32 },
{ "socionext,unifier-pxs3-ave4", 32 }, { .compat = "socionext,unifier-pxs3-ave4", .value = 32 },
{ NULL }
{ 0 }
}; };
static int static int
@ -382,7 +383,7 @@ ave_fdt_attach(device_t parent, device_t self, void *aux)
hwimp = CSR_READ(sc, AVEID); hwimp = CSR_READ(sc, AVEID);
hwver = CSR_READ(sc, AVEHWVER); 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"); phy_mode = fdtbus_get_string(phandle, "phy-mode");
if (phy_mode == NULL) if (phy_mode == NULL)

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -93,10 +93,11 @@ enum sun4i_a10_ccu_type {
CCU_A20, CCU_A20,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-ccu", CCU_A10 }, { .compat = "allwinner,sun4i-a10-ccu", .value = CCU_A10 },
{ "allwinner,sun7i-a20-ccu", CCU_A20 }, { .compat = "allwinner,sun7i-a20-ccu", .value = CCU_A20 },
{ NULL }
{ 0 }
}; };
CFATTACH_DECL_NEW(sunxi_a10_ccu, sizeof(struct sunxi_ccu_softc), 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"); 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) { switch (type) {
case CCU_A10: case CCU_A10:

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_ddb.h" #include "opt_ddb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -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_DST_WAIT_CLK_CYC) | \
__SHIFTIN(2, DDMA_PARA_SRC_WAIT_CLK_CYC)) __SHIFTIN(2, DDMA_PARA_SRC_WAIT_CLK_CYC))
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-dma", 1 }, { .compat = "allwinner,sun4i-a10-dma" },
{ NULL }
{ 0 }
}; };
struct sun4idma_channel { struct sun4idma_channel {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_ddb.h" #include "opt_ddb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -151,12 +151,17 @@ static const struct sun6idma_config sun50i_a64_dma_config = {
.widths = WIDTHS_1_2_4_8, .widths = WIDTHS_1_2_4_8,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun6i-a31-dma", (uintptr_t)&sun6i_a31_dma_config }, { .compat = "allwinner,sun6i-a31-dma",
{ "allwinner,sun8i-a83t-dma", (uintptr_t)&sun8i_a83t_dma_config }, .data = &sun6i_a31_dma_config },
{ "allwinner,sun8i-h3-dma", (uintptr_t)&sun8i_h3_dma_config }, { .compat = "allwinner,sun8i-a83t-dma",
{ "allwinner,sun50i-a64-dma", (uintptr_t)&sun50i_a64_dma_config }, .data = &sun8i_a83t_dma_config },
{ NULL } { .compat = "allwinner,sun8i-h3-dma",
.data = &sun8i_h3_dma_config },
{ .compat = "allwinner,sun50i-a64-dma",
.data = &sun50i_a64_dma_config },
{ 0 }
}; };
struct sun6idma_channel { struct sun6idma_channel {
@ -459,7 +464,7 @@ sun6idma_attach(device_t parent, device_t self, void *aux)
return; 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_burst_mask = conf->burst_mask;
sc->sc_nchan = conf->num_channels; sc->sc_nchan = conf->num_channels;

View File

@ -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. * Copyright (c) 2019 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -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), CFATTACH_DECL_NEW(sun8i_crypto, sizeof(struct sun8i_crypto_softc),
sun8i_crypto_match, sun8i_crypto_attach, NULL, NULL); sun8i_crypto_match, sun8i_crypto_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun50i-a64-crypto", 0}, { .compat = "allwinner,sun50i-a64-crypto" },
{NULL}
{ 0 }
}; };
static int static int

View File

@ -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. * Copyright (c) 2017,2018 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -85,9 +85,10 @@ struct sunxi_can_softc {
#define sc_timings sc_cansc.csc_timings #define sc_timings sc_cansc.csc_timings
#define sc_linkmodes sc_cansc.csc_linkmodes #define sc_linkmodes sc_cansc.csc_linkmodes
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun4i-a10-can", 0}, { .compat = "allwinner,sun4i-a10-can" },
{NULL}
{ 0 }
}; };
static int sunxi_can_match(device_t, cfdata_t, void *); static int sunxi_can_match(device_t, cfdata_t, void *);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_ddb.h" #include "opt_ddb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -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_DAC_CNT(_sc) ((_sc)->sc_cfg->DAC_CNT)
#define AC_ADC_CNT(_sc) ((_sc)->sc_cfg->ADC_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, A10_CODEC_COMPATDATA,
A31_CODEC_COMPATDATA, A31_CODEC_COMPATDATA,
H3_CODEC_COMPATDATA, H3_CODEC_COMPATDATA,
{ NULL }
{ 0 }
}; };
#define CODEC_READ(sc, reg) \ #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; sc->sc_dmat = faa->faa_dmat;
LIST_INIT(&sc->sc_dmalist); 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_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -100,7 +100,7 @@ struct sunxi_codec_softc {
int sc_phandle; int sc_phandle;
bus_addr_t sc_baseaddr; bus_addr_t sc_baseaddr;
struct sunxi_codec_conf *sc_cfg; const struct sunxi_codec_conf *sc_cfg;
void *sc_codec_priv; void *sc_codec_priv;
struct fdtbus_gpio_pin *sc_pin_pa; struct fdtbus_gpio_pin *sc_pin_pa;
@ -118,19 +118,23 @@ struct sunxi_codec_softc {
#if NH3_CODEC > 0 #if NH3_CODEC > 0
extern const struct sunxi_codec_conf sun8i_h3_codecconf; extern const struct sunxi_codec_conf sun8i_h3_codecconf;
#define H3_CODEC_COMPATDATA \ #define H3_CODEC_COMPATDATA \
{ "allwinner,sun8i-h3-codec", (uintptr_t)&sun8i_h3_codecconf } { .compat = "allwinner,sun8i-h3-codec", \
.data = &sun8i_h3_codecconf }
#else #else
#define H3_CODEC_COMPATDATA #define H3_CODEC_COMPATDATA
#endif #endif
extern const struct sunxi_codec_conf sun4i_a10_codecconf; extern const struct sunxi_codec_conf sun4i_a10_codecconf;
#define A10_CODEC_COMPATDATA \ #define A10_CODEC_COMPATDATA \
{ "allwinner,sun4i-a10-codec", (uintptr_t)&sun4i_a10_codecconf }, \ { .compat = "allwinner,sun4i-a10-codec", \
{ "allwinner,sun7i-a20-codec", (uintptr_t)&sun4i_a10_codecconf } .data = &sun4i_a10_codecconf }, \
{ .compat = "allwinner,sun7i-a20-codec", \
.data = &sun4i_a10_codecconf }
extern const struct sunxi_codec_conf sun6i_a31_codecconf; extern const struct sunxi_codec_conf sun6i_a31_codecconf;
#define A31_CODEC_COMPATDATA \ #define A31_CODEC_COMPATDATA \
{ "allwinner,sun6i-a31-codec", (uintptr_t)&sun6i_a31_codecconf } { .compat = "allwinner,sun6i-a31-codec", \
.data = &sun6i_a31_codecconf }
#endif /* !_ARM_SUNXI_CODEC_H */ #endif /* !_ARM_SUNXI_CODEC_H */

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -97,11 +97,15 @@ static const struct sunxi_de2_ccu_config sun50i_a64_de2_config = {
.nclks = __arraycount(sun8i_h3_de2_ccu_clks), .nclks = __arraycount(sun8i_h3_de2_ccu_clks),
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun8i-h3-de2-clk", (uintptr_t)&sun8i_h3_de2_config }, { .compat = "allwinner,sun8i-h3-de2-clk",
{ "allwinner,sun50i-a64-de2-clk", (uintptr_t)&sun50i_a64_de2_config }, .data = &sun8i_h3_de2_config },
{ "allwinner,sun50i-h5-de2-clk", (uintptr_t)&sun50i_a64_de2_config }, { .compat = "allwinner,sun50i-a64-de2-clk",
{ NULL } .data = &sun50i_a64_de2_config },
{ .compat = "allwinner,sun50i-h5-de2-clk",
.data = &sun50i_a64_de2_config },
{ 0 }
}; };
static int static int
@ -126,7 +130,7 @@ sunxi_de2_ccu_attach(device_t parent, device_t self, void *aux)
sc->sc_phandle = phandle; sc->sc_phandle = phandle;
sc->sc_bst = faa->faa_bst; 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_resets = conf->resets;
sc->sc_nresets = conf->nresets; sc->sc_nresets = conf->nresets;

View File

@ -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 <bouyer@antioche.eu.org> * Copyright (c) 2018 Manuel Bouyer <bouyer@antioche.eu.org>
@ -38,7 +38,7 @@
#define SUNXI_DEBE_CURMAX 64 #define SUNXI_DEBE_CURMAX 64
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -101,10 +101,11 @@ struct sunxi_debe_softc {
#define DEBE_WRITE(sc, reg, val) \ #define DEBE_WRITE(sc, reg, val) \
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun4i-a10-display-backend", DEBE_A10}, { .compat = "allwinner,sun4i-a10-display-backend", .value = DEBE_A10 },
{"allwinner,sun7i-a20-display-backend", DEBE_A10}, { .compat = "allwinner,sun7i-a20-display-backend", .value = DEBE_A10 },
{NULL}
{ 0 }
}; };
struct sunxifb_attach_args { struct sunxifb_attach_args {
@ -188,7 +189,8 @@ sunxi_debe_attach(device_t parent, device_t self, void *aux)
return; 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_naive("\n");
aprint_normal(": Display Engine Backend (%s)\n", aprint_normal(": Display Engine Backend (%s)\n",

View File

@ -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. * Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -51,10 +51,11 @@ struct sunxi_dep_softc {
int sc_phandle; int sc_phandle;
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun4i-a10-display-engine", 0}, { .compat = "allwinner,sun4i-a10-display-engine" },
{"allwinner,sun7i-a20-display-engine", 0}, { .compat = "allwinner,sun7i-a20-display-engine" },
{NULL}
{ 0 }
}; };
static const char *fb_compat[] = { static const char *fb_compat[] = {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2016-2017 Jared McNeill <jmcneill@invisible.ca>
@ -33,7 +33,7 @@
#include "opt_net_mpsafe.h" #include "opt_net_mpsafe.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -131,12 +131,13 @@ enum sunxi_emac_type {
EMAC_H6, EMAC_H6,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun8i-a83t-emac", EMAC_A83T }, { .compat = "allwinner,sun8i-a83t-emac", .value = EMAC_A83T },
{ "allwinner,sun8i-h3-emac", EMAC_H3 }, { .compat = "allwinner,sun8i-h3-emac", .value = EMAC_H3 },
{ "allwinner,sun50i-a64-emac", EMAC_A64 }, { .compat = "allwinner,sun50i-a64-emac", .value = EMAC_A64 },
{ "allwinner,sun50i-h6-emac", EMAC_H6 }, { .compat = "allwinner,sun50i-h6-emac", .value = EMAC_H6 },
{ NULL }
{ 0 }
}; };
struct sunxi_emac_bufmap { struct sunxi_emac_bufmap {
@ -1373,7 +1374,7 @@ sunxi_emac_attach(device_t parent, device_t self, void *aux)
sc->phandle = phandle; sc->phandle = phandle;
sc->bst = faa->faa_bst; sc->bst = faa->faa_bst;
sc->dmat = faa->faa_dmat; 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); sc->phy_id = sunxi_emac_get_phyid(sc);
aprint_naive("\n"); aprint_naive("\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_soc.h" #include "opt_soc.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -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_CONFIG(bank) (0x300 + 0x4 * (bank))
#define SUNXI_GPIO_GRP_IO_BIAS_CONFIGMASK 0xf #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 #ifdef SOC_SUN4I_A10
{ "allwinner,sun4i-a10-pinctrl", (uintptr_t)&sun4i_a10_padconf }, { .compat = "allwinner,sun4i-a10-pinctrl",
.data = &sun4i_a10_padconf },
#endif #endif
#ifdef SOC_SUN5I_A13 #ifdef SOC_SUN5I_A13
{ "allwinner,sun5i-a13-pinctrl", (uintptr_t)&sun5i_a13_padconf }, { .compat = "allwinner,sun5i-a13-pinctrl",
{ "nextthing,gr8-pinctrl", (uintptr_t)&sun5i_a13_padconf }, .data = &sun5i_a13_padconf },
{ .compat = "nextthing,gr8-pinctrl",
.data = &sun5i_a13_padconf },
#endif #endif
#ifdef SOC_SUN6I_A31 #ifdef SOC_SUN6I_A31
{ "allwinner,sun6i-a31-pinctrl", (uintptr_t)&sun6i_a31_padconf }, { .compat = "allwinner,sun6i-a31-pinctrl",
{ "allwinner,sun6i-a31-r-pinctrl", (uintptr_t)&sun6i_a31_r_padconf }, .data = &sun6i_a31_padconf },
{ .compat = "allwinner,sun6i-a31-r-pinctrl",
.data = &sun6i_a31_r_padconf },
#endif #endif
#ifdef SOC_SUN7I_A20 #ifdef SOC_SUN7I_A20
{ "allwinner,sun7i-a20-pinctrl", (uintptr_t)&sun7i_a20_padconf }, { .compat = "allwinner,sun7i-a20-pinctrl",
.data = &sun7i_a20_padconf },
#endif #endif
#ifdef SOC_SUN8I_A83T #ifdef SOC_SUN8I_A83T
{ "allwinner,sun8i-a83t-pinctrl", (uintptr_t)&sun8i_a83t_padconf }, { .compat = "allwinner,sun8i-a83t-pinctrl",
{ "allwinner,sun8i-a83t-r-pinctrl", (uintptr_t)&sun8i_a83t_r_padconf }, .data = &sun8i_a83t_padconf },
{ .compat = "allwinner,sun8i-a83t-r-pinctrl",
.data = &sun8i_a83t_r_padconf },
#endif #endif
#ifdef SOC_SUN8I_H3 #ifdef SOC_SUN8I_H3
{ "allwinner,sun8i-h3-pinctrl", (uintptr_t)&sun8i_h3_padconf }, { .compat = "allwinner,sun8i-h3-pinctrl",
{ "allwinner,sun8i-h3-r-pinctrl", (uintptr_t)&sun8i_h3_r_padconf }, .data = &sun8i_h3_padconf },
{ .compat = "allwinner,sun8i-h3-r-pinctrl",
.data = &sun8i_h3_r_padconf },
#endif #endif
#ifdef SOC_SUN9I_A80 #ifdef SOC_SUN9I_A80
{ "allwinner,sun9i-a80-pinctrl", (uintptr_t)&sun9i_a80_padconf }, { .compat = "allwinner,sun9i-a80-pinctrl",
{ "allwinner,sun9i-a80-r-pinctrl", (uintptr_t)&sun9i_a80_r_padconf }, .data = &sun9i_a80_padconf },
{ .compat = "allwinner,sun9i-a80-r-pinctrl",
.data = &sun9i_a80_r_padconf },
#endif #endif
#ifdef SOC_SUN50I_A64 #ifdef SOC_SUN50I_A64
{ "allwinner,sun50i-a64-pinctrl", (uintptr_t)&sun50i_a64_padconf }, { .compat = "allwinner,sun50i-a64-pinctrl",
{ "allwinner,sun50i-a64-r-pinctrl", (uintptr_t)&sun50i_a64_r_padconf }, .data = &sun50i_a64_padconf },
{ .compat = "allwinner,sun50i-a64-r-pinctrl",
.data = &sun50i_a64_r_padconf },
#endif #endif
#ifdef SOC_SUN50I_H5 #ifdef SOC_SUN50I_H5
{ "allwinner,sun50i-h5-pinctrl", (uintptr_t)&sun8i_h3_padconf }, { .compat = "allwinner,sun50i-h5-pinctrl",
{ "allwinner,sun50i-h5-r-pinctrl", (uintptr_t)&sun8i_h3_r_padconf }, .data = &sun8i_h3_padconf },
{ .compat = "allwinner,sun50i-h5-r-pinctrl",
.data = &sun8i_h3_r_padconf },
#endif #endif
#ifdef SOC_SUN50I_H6 #ifdef SOC_SUN50I_H6
{ "allwinner,sun50i-h6-pinctrl", (uintptr_t)&sun50i_h6_padconf }, { .compat = "allwinner,sun50i-h6-pinctrl",
{ "allwinner,sun50i-h6-r-pinctrl", (uintptr_t)&sun50i_h6_r_padconf }, .data = &sun50i_h6_padconf },
{ .compat = "allwinner,sun50i-h6-r-pinctrl",
.data = &sun50i_h6_r_padconf },
#endif #endif
{ NULL }
{ 0 }
}; };
struct sunxi_gpio_eint { struct sunxi_gpio_eint {
@ -1003,7 +1022,7 @@ sunxi_gpio_attach(device_t parent, device_t self, void *aux)
return; return;
} }
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); 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_naive("\n");
aprint_normal(": PIO\n"); aprint_normal(": PIO\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014 Jared D. McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_ddb.h" #include "opt_ddb.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -105,10 +105,11 @@ struct sunxi_hdmi_softc {
#define HDMI_1_3_P(sc) ((sc)->sc_ver == 0x00010003) #define HDMI_1_3_P(sc) ((sc)->sc_ver == 0x00010003)
#define HDMI_1_4_P(sc) ((sc)->sc_ver == 0x00010004) #define HDMI_1_4_P(sc) ((sc)->sc_ver == 0x00010004)
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun4i-a10-hdmi", HDMI_A10}, { .compat = "allwinner,sun4i-a10-hdmi", .value = HDMI_A10},
{"allwinner,sun7i-a20-hdmi", HDMI_A10}, { .compat = "allwinner,sun7i-a20-hdmi", .value = HDMI_A10},
{NULL}
{ 0 }
}; };
static int sunxi_hdmi_match(device_t, cfdata_t, void *); 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_phandle = phandle;
sc->sc_bst = faa->faa_bst; 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); aprint_error(": couldn't get registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -115,10 +115,13 @@ static const struct sunxi_hdmiphy_data sun8i_h3_hdmiphy_data = {
.config = sun8i_h3_hdmiphy_config, .config = sun8i_h3_hdmiphy_config,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun8i-h3-hdmi-phy", (uintptr_t)&sun8i_h3_hdmiphy_data }, { .compat = "allwinner,sun8i-h3-hdmi-phy",
{ "allwinner,sun50i-a64-hdmi-phy", (uintptr_t)&sun8i_h3_hdmiphy_data }, .data = &sun8i_h3_hdmiphy_data },
{ NULL } { .compat = "allwinner,sun50i-a64-hdmi-phy",
.data = &sun8i_h3_hdmiphy_data },
{ 0 }
}; };
struct sunxi_hdmiphy_softc { 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_dev = self;
sc->sc_bst = faa->faa_bst; 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) { if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
aprint_error(": couldn't map registers\n"); aprint_error(": couldn't map registers\n");
return; return;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -139,13 +139,13 @@ static const struct sunxi_i2s_config sun8i_h3_config = {
.rxchmap = 0x58, .rxchmap = 0x58,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun50i-a64-codec-i2s", { .compat = "allwinner,sun50i-a64-codec-i2s",
(uintptr_t)&sun50i_a64_codec_config }, .data = &sun50i_a64_codec_config },
{ "allwinner,sun8i-h3-i2s", { .compat = "allwinner,sun8i-h3-i2s",
(uintptr_t)&sun8i_h3_config }, .data = &sun8i_h3_config },
{ NULL } { 0 }
}; };
struct sunxi_i2s_softc; struct sunxi_i2s_softc;
@ -186,7 +186,7 @@ struct sunxi_i2s_softc {
bus_addr_t sc_baseaddr; bus_addr_t sc_baseaddr;
struct clk *sc_clk; struct clk *sc_clk;
struct sunxi_i2s_config *sc_cfg; const struct sunxi_i2s_config *sc_cfg;
LIST_HEAD(, sunxi_i2s_dma) sc_dmalist; 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; sc->sc_dmat = faa->faa_dmat;
LIST_INIT(&sc->sc_dmalist); 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_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -106,11 +106,12 @@ enum tcon_type {
TYPE_TCON1, TYPE_TCON1,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun8i-h3-tcon-tv", TYPE_TCON1 }, { .compat = "allwinner,sun8i-h3-tcon-tv", .value = TYPE_TCON1 },
{ "allwinner,sun50i-a64-tcon-lcd", TYPE_TCON0 }, { .compat = "allwinner,sun50i-a64-tcon-lcd", .value = TYPE_TCON0 },
{ "allwinner,sun50i-a64-tcon-tv", TYPE_TCON1 }, { .compat = "allwinner,sun50i-a64-tcon-tv", .value = TYPE_TCON1 },
{ NULL }
{ 0 }
}; };
struct sunxi_lcdc_softc; struct sunxi_lcdc_softc;
@ -512,7 +513,7 @@ sunxi_lcdc_attach(device_t parent, device_t self, void *aux)
return; return;
} }
sc->sc_phandle = faa->faa_phandle; 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[0] = fdtbus_clock_get(phandle, "tcon-ch0");
sc->sc_clk_ch[1] = fdtbus_clock_get(phandle, "tcon-ch1"); sc->sc_clk_ch[1] = fdtbus_clock_get(phandle, "tcon-ch1");

View File

@ -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 * Copyright (c) 2016, 2018 Manuel Bouyer
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -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 void sunxi_lradc_print_levels(struct sunxi_lradc_softc *, int);
static bool sunxi_lradc_register_switches(struct sunxi_lradc_softc *, int); static bool sunxi_lradc_register_switches(struct sunxi_lradc_softc *, int);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun4i-a10-lradc-keys", 0}, { .compat = "allwinner,sun4i-a10-lradc-keys" },
{NULL}
{ 0 }
}; };

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -198,11 +198,15 @@ struct sunxi_mixer_compat_data mixer1_data = {
.mixer_index = 1, .mixer_index = 1,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun8i-h3-de2-mixer-0", (uintptr_t)&mixer0_data }, { .compat = "allwinner,sun8i-h3-de2-mixer-0",
{ "allwinner,sun50i-a64-de2-mixer-0", (uintptr_t)&mixer0_data }, .data = &mixer0_data },
{ "allwinner,sun50i-a64-de2-mixer-1", (uintptr_t)&mixer1_data }, { .compat = "allwinner,sun50i-a64-de2-mixer-0",
{ NULL } .data = &mixer0_data },
{ .compat = "allwinner,sun50i-a64-de2-mixer-1",
.data = &mixer1_data },
{ 0 }
}; };
struct sunxi_mixer_softc; struct sunxi_mixer_softc;
@ -1256,7 +1260,7 @@ sunxi_mixer_attach(device_t parent, device_t self, void *aux)
struct fdt_endpoint *out_ep; struct fdt_endpoint *out_ep;
const int phandle = faa->faa_phandle; const int phandle = faa->faa_phandle;
const struct sunxi_mixer_compat_data * const cd = 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 clk *clk_bus, *clk_mod;
struct fdtbus_reset *rst; struct fdtbus_reset *rst;
bus_addr_t addr; bus_addr_t addr;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_sunximmc.h" #include "opt_sunximmc.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -162,7 +162,7 @@ struct sunxi_mmc_softc {
device_t sc_sdmmc_dev; 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]; bus_dma_segment_t sc_idma_segs[1];
int sc_idma_nsegs; int sc_idma_nsegs;
@ -279,16 +279,26 @@ static const struct sunxi_mmc_config sun50i_h6_emmc_config = {
.flags = SUNXI_MMC_FLAG_CALIB_REG, .flags = SUNXI_MMC_FLAG_CALIB_REG,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-mmc", (uintptr_t)&sun4i_a10_mmc_config }, { .compat = "allwinner,sun4i-a10-mmc",
{ "allwinner,sun5i-a13-mmc", (uintptr_t)&sun5i_a13_mmc_config }, .data = &sun4i_a10_mmc_config },
{ "allwinner,sun7i-a20-mmc", (uintptr_t)&sun7i_a20_mmc_config }, { .compat = "allwinner,sun5i-a13-mmc",
{ "allwinner,sun8i-a83t-emmc", (uintptr_t)&sun8i_a83t_emmc_config }, .data = &sun5i_a13_mmc_config },
{ "allwinner,sun9i-a80-mmc", (uintptr_t)&sun9i_a80_mmc_config }, { .compat = "allwinner,sun7i-a20-mmc",
{ "allwinner,sun50i-a64-mmc", (uintptr_t)&sun50i_a64_mmc_config }, .data = &sun7i_a20_mmc_config },
{ "allwinner,sun50i-a64-emmc", (uintptr_t)&sun50i_a64_emmc_config }, { .compat = "allwinner,sun8i-a83t-emmc",
{ "allwinner,sun50i-h6-mmc", (uintptr_t)&sun50i_h6_mmc_config }, .data = &sun8i_a83t_emmc_config },
{ "allwinner,sun50i-h6-emmc", (uintptr_t)&sun50i_h6_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 } { NULL }
}; };
@ -349,7 +359,7 @@ sunxi_mmc_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_phandle = phandle; 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_bst = faa->faa_bst;
sc->sc_dmat = faa->faa_dmat; sc->sc_dmat = faa->faa_dmat;
mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_BIO); mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_BIO);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -60,12 +60,13 @@ struct sunxi_musb_softc {
CFATTACH_DECL_NEW(sunxi_musb, sizeof(struct sunxi_musb_softc), CFATTACH_DECL_NEW(sunxi_musb, sizeof(struct sunxi_musb_softc),
sunxi_musb_match, sunxi_musb_attach, NULL, NULL); sunxi_musb_match, sunxi_musb_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-musb", 5 }, { .compat = "allwinner,sun4i-a10-musb", .value = 5 },
{ "allwinner,sun6i-a13-musb", 5 }, { .compat = "allwinner,sun6i-a13-musb", .value = 5 },
{ "allwinner,sun8i-h3-musb", 4 }, { .compat = "allwinner,sun8i-h3-musb", .value = 4 },
{ "allwinner,sun8i-a33-musb", 5 }, { .compat = "allwinner,sun8i-a33-musb", .value = 5 },
{ NULL }
{ 0 }
}; };
#define REMAPFLAG 0x8000 #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 = sunxi_musb_poll;
sc->sc_intr_poll_arg = sc; sc->sc_intr_poll_arg = sc;
sc->sc_mode = MOTG_MODE_HOST; 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; sc->sc_ep_fifosize = 512;
aprint_naive("\n"); aprint_naive("\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#define _INTR_PRIVATE #define _INTR_PRIVATE
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -88,11 +88,15 @@ static const struct sunxi_nmi_config sun9i_a80_nmi_config = {
.enable_reg = 0x08, .enable_reg = 0x08,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun7i-a20-sc-nmi", (uintptr_t)&sun7i_a20_sc_nmi_config }, { .compat = "allwinner,sun7i-a20-sc-nmi",
{ "allwinner,sun6i-a31-r-intc", (uintptr_t)&sun6i_a31_r_intc_config }, .data = &sun7i_a20_sc_nmi_config },
{ "allwinner,sun9i-a80-nmi", (uintptr_t)&sun9i_a80_nmi_config }, { .compat = "allwinner,sun6i-a31-r-intc",
{ NULL } .data = &sun6i_a31_r_intc_config },
{ .compat = "allwinner,sun9i-a80-nmi",
.data = &sun9i_a80_nmi_config },
{ 0 }
}; };
struct sunxi_nmi_softc { 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_dev = self;
sc->sc_phandle = phandle; 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_bst = faa->faa_bst;
if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) { if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
aprint_error(": couldn't map registers\n"); aprint_error(": couldn't map registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -58,9 +58,10 @@ enum sunxi_pwm_type {
PWM_A64 = 1, PWM_A64 = 1,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun50i-a64-pwm", PWM_A64 }, { .compat = "allwinner,sun50i-a64-pwm", .value = PWM_A64 },
{ NULL }
{ 0 }
}; };
struct sunxi_pwm_softc { struct sunxi_pwm_softc {

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -49,10 +49,11 @@ enum sunxi_rsb_type {
SUNXI_RSB, SUNXI_RSB,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun6i-a31-p2wi", SUNXI_P2WI }, { .compat = "allwinner,sun6i-a31-p2wi", .value = SUNXI_P2WI },
{ "allwinner,sun8i-a23-rsb", SUNXI_RSB }, { .compat = "allwinner,sun8i-a23-rsb", .value = SUNXI_RSB },
{ NULL }
{ 0 }
}; };
#define RSB_ADDR_PMIC_PRIMARY 0x3a3 #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_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; sc->sc_bst = faa->faa_bst;
if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) { if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
aprint_error(": couldn't map registers\n"); aprint_error(": couldn't map registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -241,17 +241,27 @@ static const struct sunxi_rtc_config sun50i_h6_rtc_config = {
.flags = SUNXI_RTC_F_HAS_VAR_PRESCALER, .flags = SUNXI_RTC_F_HAS_VAR_PRESCALER,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-rtc", (uintptr_t)&sun4i_rtc_config }, { .compat = "allwinner,sun4i-a10-rtc",
{ "allwinner,sun6i-a31-rtc", (uintptr_t)&sun6i_a31_rtc_config }, .data = &sun4i_rtc_config },
{ "allwinner,sun7i-a20-rtc", (uintptr_t)&sun7i_rtc_config }, { .compat = "allwinner,sun6i-a31-rtc",
{ "allwinner,sun8i-a23-rtc", (uintptr_t)&sun8i_a23_rtc_config }, .data = &sun6i_a31_rtc_config },
{ "allwinner,sun8i-r40-rtc", (uintptr_t)&sun8i_r40_rtc_config }, { .compat = "allwinner,sun7i-a20-rtc",
{ "allwinner,sun8i-v3-rtc", (uintptr_t)&sun8i_v3_rtc_config }, .data = &sun7i_rtc_config },
{ "allwinner,sun8i-h3-rtc", (uintptr_t)&sun8i_h3_rtc_config }, { .compat = "allwinner,sun8i-a23-rtc",
{ "allwinner,sun50i-h5-rtc", (uintptr_t)&sun8i_h3_rtc_config }, .data = &sun8i_a23_rtc_config },
{ "allwinner,sun50i-h6-rtc", (uintptr_t)&sun50i_h6_rtc_config }, { .compat = "allwinner,sun8i-r40-rtc",
{ NULL } .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 #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"); aprint_error(": couldn't map registers\n");
return; 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_naive("\n");
aprint_normal(": RTC\n"); aprint_normal(": RTC\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -54,13 +54,14 @@ static const struct sunxi_sid_config sun8i_h3_sid_config = {
.efuse_offset = 0x200, .efuse_offset = 0x200,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-sid", (uintptr_t)&sun4i_a10_sid_config }, { .compat = "allwinner,sun4i-a10-sid", .data = &sun4i_a10_sid_config },
{ "allwinner,sun7i-a20-sid", (uintptr_t)&sun4i_a10_sid_config }, { .compat = "allwinner,sun7i-a20-sid", .data = &sun4i_a10_sid_config },
{ "allwinner,sun8i-h3-sid", (uintptr_t)&sun8i_h3_sid_config }, { .compat = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_sid_config },
{ "allwinner,sun8i-a83t-sid", (uintptr_t)&sun8i_h3_sid_config }, { .compat = "allwinner,sun8i-a83t-sid", .data = &sun8i_h3_sid_config },
{ "allwinner,sun50i-a64-sid", (uintptr_t)&sun8i_h3_sid_config }, { .compat = "allwinner,sun50i-a64-sid", .data = &sun8i_h3_sid_config },
{ NULL }
{ 0 }
}; };
struct sunxi_sid_softc { 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"); aprint_error(": couldn't map registers\n");
return; 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_naive("\n");
aprint_normal(": Security ID EFUSE\n"); aprint_normal(": Security ID EFUSE\n");

View File

@ -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 <bouyer@antioche.eu.org> * Copyright (c) 2018 Manuel Bouyer <bouyer@antioche.eu.org>
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -93,10 +93,11 @@ void sunxi_tcon_dump_regs(int);
#define TCON_WRITE(sc, reg, val) \ #define TCON_WRITE(sc, reg, val) \
bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"allwinner,sun4i-a10-tcon", TCON_A10}, { .compat = "allwinner,sun4i-a10-tcon", .value = TCON_A10},
{"allwinner,sun7i-a20-tcon", TCON_A10}, { .compat = "allwinner,sun7i-a20-tcon", .value = TCON_A10},
{NULL}
{ 0 }
}; };
static int sunxi_tcon_match(device_t, cfdata_t, void *); 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_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_naive("\n");
aprint_normal(": LCD/TV timing controller (%s)\n", aprint_normal(": LCD/TV timing controller (%s)\n",

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2016-2017 Jared McNeill <jmcneill@invisible.ca>
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -305,12 +305,13 @@ static const struct sunxi_thermal_config h5_config = {
.to_reg = h5_to_reg, .to_reg = h5_to_reg,
}; };
static struct of_compat_data compat_data[] = { static struct device_compatible_entry compat_data[] = {
{ "allwinner,sun8i-a83t-ts", (uintptr_t)&a83t_config }, { .compat = "allwinner,sun8i-a83t-ts", .data = &a83t_config },
{ "allwinner,sun8i-h3-ts", (uintptr_t)&h3_config }, { .compat = "allwinner,sun8i-h3-ts", .data = &h3_config },
{ "allwinner,sun50i-a64-ts", (uintptr_t)&a64_config }, { .compat = "allwinner,sun50i-a64-ts", .data = &a64_config },
{ "allwinner,sun50i-h5-ts", (uintptr_t)&h5_config }, { .compat = "allwinner,sun50i-h5-ts", .data = &h5_config },
{ NULL, (uintptr_t)NULL }
{ 0 }
}; };
struct sunxi_thermal_softc { struct sunxi_thermal_softc {
@ -318,7 +319,7 @@ struct sunxi_thermal_softc {
int phandle; int phandle;
bus_space_tag_t bst; bus_space_tag_t bst;
bus_space_handle_t bsh; bus_space_handle_t bsh;
struct sunxi_thermal_config *conf; const struct sunxi_thermal_config *conf;
kmutex_t lock; kmutex_t lock;
callout_t tick; callout_t tick;
@ -567,7 +568,7 @@ sunxi_thermal_attach(device_t parent, device_t self, void *aux)
sc->dev = self; sc->dev = self;
sc->phandle = phandle; sc->phandle = phandle;
sc->bst = faa->faa_bst; 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) { if (bus_space_map(sc->bst, addr, size, 0, &sc->bsh) != 0) {
aprint_error(": couldn't map registers\n"); aprint_error(": couldn't map registers\n");
return; return;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -131,11 +131,12 @@ static const struct sunxi_ts_config sun6i_a31_ts_config = {
.tp_mode_en_mask = TP_CTRL1_TP_DUAL_EN, .tp_mode_en_mask = TP_CTRL1_TP_DUAL_EN,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-ts", (uintptr_t)&sun4i_a10_ts_config }, { .compat = "allwinner,sun4i-a10-ts", .data = &sun4i_a10_ts_config },
{ "allwinner,sun5i-a13-ts", (uintptr_t)&sun5i_a13_ts_config }, { .compat = "allwinner,sun5i-a13-ts", .data = &sun5i_a13_ts_config },
{ "allwinner,sun6i-a31-ts", (uintptr_t)&sun6i_a31_ts_config }, { .compat = "allwinner,sun6i-a31-ts", .data = &sun6i_a31_ts_config },
{ NULL }
{ 0 }
}; };
static struct wsmouse_calibcoords sunxi_ts_default_calib = { 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"); aprint_error(": couldn't map registers\n");
return; 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_attached = of_getprop_bool(phandle, "allwinner,ts-attached");
sc->sc_ts_inverted_x = of_getprop_bool(phandle, sc->sc_ts_inverted_x = of_getprop_bool(phandle,

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -72,10 +72,11 @@ static const struct sunxi_twi_config sun6i_a31_i2c_config = {
.iflg_rwc = true, .iflg_rwc = true,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-i2c", (uintptr_t)&sun4i_a10_i2c_config }, { .compat = "allwinner,sun4i-a10-i2c", .data = &sun4i_a10_i2c_config },
{ "allwinner,sun6i-a31-i2c", (uintptr_t)&sun6i_a31_i2c_config }, { .compat = "allwinner,sun6i-a31-i2c", .data = &sun6i_a31_i2c_config },
{ NULL }
{ 0 }
}; };
CFATTACH_DECL_NEW(sunxi_twi, sizeof(struct gttwsi_softc), 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; 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", prop_dictionary_set_bool(device_properties(self), "iflg-rwc",
conf->iflg_rwc); conf->iflg_rwc);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -67,9 +67,10 @@ enum sunxi_usb3phy_type {
USB3PHY_H6 = 1, USB3PHY_H6 = 1,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun50i-h6-usb3-phy", USB3PHY_H6 }, { .compat = "allwinner,sun50i-h6-usb3-phy", .value = USB3PHY_H6 },
{ NULL }
{ 0 }
}; };
struct sunxi_usb3phy { struct sunxi_usb3phy {
@ -177,7 +178,7 @@ sunxi_usb3phy_attach(device_t parent, device_t self, void *aux)
u_int n; u_int n;
sc->sc_dev = self; 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get phy registers\n"); aprint_error(": couldn't get phy registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -84,16 +84,17 @@ enum sunxi_usbphy_type {
USBPHY_H6, USBPHY_H6,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-usb-phy", USBPHY_A10 }, { .compat = "allwinner,sun4i-a10-usb-phy", .value = USBPHY_A10 },
{ "allwinner,sun5i-a13-usb-phy", USBPHY_A13 }, { .compat = "allwinner,sun5i-a13-usb-phy", .value = USBPHY_A13 },
{ "allwinner,sun6i-a31-usb-phy", USBPHY_A31 }, { .compat = "allwinner,sun6i-a31-usb-phy", .value = USBPHY_A31 },
{ "allwinner,sun7i-a20-usb-phy", USBPHY_A20 }, { .compat = "allwinner,sun7i-a20-usb-phy", .value = USBPHY_A20 },
{ "allwinner,sun8i-a83t-usb-phy", USBPHY_A83T }, { .compat = "allwinner,sun8i-a83t-usb-phy", .value = USBPHY_A83T },
{ "allwinner,sun8i-h3-usb-phy", USBPHY_H3 }, { .compat = "allwinner,sun8i-h3-usb-phy", .value = USBPHY_H3 },
{ "allwinner,sun50i-a64-usb-phy", USBPHY_A64 }, { .compat = "allwinner,sun50i-a64-usb-phy", .value = USBPHY_A64 },
{ "allwinner,sun50i-h6-usb-phy", USBPHY_H6 }, { .compat = "allwinner,sun50i-h6-usb-phy", .value = USBPHY_H6 },
{ NULL }
{ 0 }
}; };
#define SUNXI_MAXUSBPHY 4 #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_dev = self;
sc->sc_bst = faa->faa_bst; 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) { if (fdtbus_get_reg_byname(phandle, "phy_ctrl", &addr, &size) != 0) {
aprint_error(": couldn't get phy ctrl registers\n"); aprint_error(": couldn't get phy ctrl registers\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -80,10 +80,11 @@ enum sunxi_wdt_type {
WDT_SUN6I, WDT_SUN6I,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "allwinner,sun4i-a10-wdt", WDT_SUN4I }, { .compat = "allwinner,sun4i-a10-wdt", .value = WDT_SUN4I },
{ "allwinner,sun6i-a31-wdt", WDT_SUN6I }, { .compat = "allwinner,sun6i-a31-wdt", .value = WDT_SUN6I },
{ NULL }
{ 0 }
}; };
struct sunxi_wdt_softc { 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_cookie = sc;
sc->sc_smw.smw_period = SUNXI_WDT_PERIOD_DEFAULT; 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) { switch (type) {
case WDT_SUN4I: case WDT_SUN4I:
sc->sc_smw.smw_setmode = sun4i_wdt_setmode; sc->sc_smw.smw_setmode = sun4i_wdt_setmode;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -102,11 +102,15 @@ static const struct clk_funcs omap3_dpll_core_clock_clk_funcs = {
.get_parent = ti_dpll_clock_get_parent, .get_parent = ti_dpll_clock_get_parent,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "ti,am3-dpll-clock", (uintptr_t)&am3_dpll_clock_clk_funcs }, { .compat = "ti,am3-dpll-clock",
{ "ti,omap3-dpll-clock", (uintptr_t)&omap3_dpll_clock_clk_funcs }, .data = &am3_dpll_clock_clk_funcs },
{ "ti,omap3-dpll-core-clock", (uintptr_t)&omap3_dpll_core_clock_clk_funcs }, { .compat = "ti,omap3-dpll-clock",
{ NULL } .data = &omap3_dpll_clock_clk_funcs },
{ .compat = "ti,omap3-dpll-core-clock",
.data = &omap3_dpll_core_clock_clk_funcs },
{ 0 }
}; };
enum { 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.name = device_xname(self);
sc->sc_clkdom.funcs = clkfuncs; sc->sc_clkdom.funcs = clkfuncs;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -99,10 +99,11 @@ static const u_int ti_gpio_regmap[TI_NGPIO][GPIO_NREG] = {
}, },
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "ti,omap3-gpio", TI_GPIO_OMAP3 }, { .compat = "ti,omap3-gpio", .value = TI_GPIO_OMAP3 },
{ "ti,omap4-gpio", TI_GPIO_OMAP4 }, { .compat = "ti,omap4-gpio", .value = TI_GPIO_OMAP4 },
{ NULL }
{ 0 }
}; };
struct ti_gpio_intr { 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"); aprint_error(": couldn't map registers\n");
return; 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); mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
sc->sc_modname = fdtbus_get_string(phandle, "ti,hwmods"); sc->sc_modname = fdtbus_get_string(phandle, "ti,hwmods");

View File

@ -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. * Copyright (c) 2013 Manuel Bouyer. All rights reserved.
@ -50,7 +50,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -146,11 +146,12 @@ static const u_int ti_iic_regmap[TI_NTYPES][TI_NREGS] = {
}, },
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
/* compatible type */ /* compatible type */
{ "ti,omap3-i2c", TI_IIC_OMAP3 }, { .compat = "ti,omap3-i2c", .value = TI_IIC_OMAP3 },
{ "ti,omap4-i2c", TI_IIC_OMAP4 }, { .compat = "ti,omap4-i2c", .value = TI_IIC_OMAP4 },
{ NULL }
{ 0 }
}; };
/* operation in progress */ /* 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"); aprint_error(": couldn't map registers\n");
return; 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, sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_NET, 0,
ti_iic_intr, sc, device_xname(self)); ti_iic_intr, sc, device_xname(self));

View File

@ -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 * Define the SDP2430 specific information and then include the generic OMAP
* interrupt header. * interrupt header.
@ -29,7 +29,7 @@
#define _INTR_PRIVATE #define _INTR_PRIVATE
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/evcnt.h> #include <sys/evcnt.h>
@ -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 #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 */ /* compatible number of banks */
{ "ti,omap3-intc", 3 }, { .compat = "ti,omap3-intc", .value = 3 },
{ "ti,am33xx-intc", 4 }, { .compat = "ti,am33xx-intc", .value = 4 },
{ NULL }
{ 0 }
}; };
#define INTC_READ(sc, g, o) \ #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"); aprint_error(": couldn't map registers\n");
return; 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 = sc->sc_enabled_irqs =
kmem_zalloc(sizeof(*sc->sc_enabled_irqs) * sc->sc_nbank, KM_SLEEP); kmem_zalloc(sizeof(*sc->sc_enabled_irqs) * sc->sc_nbank, KM_SLEEP);

View File

@ -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 <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -61,11 +61,12 @@ static uint8_t omaptimer_regmap[_DM_NTIMER][_TIMER_NREG] = {
}, },
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "ti,am335x-timer-1ms", DM_TIMER_AM335X }, { .compat = "ti,am335x-timer-1ms", .value = DM_TIMER_AM335X },
{ "ti,am335x-timer", DM_TIMER_AM335X }, { .compat = "ti,am335x-timer", .value = DM_TIMER_AM335X },
{ "ti,omap3430-timer", DM_TIMER_OMAP3430 }, { .compat = "ti,omap3430-timer", .value = DM_TIMER_OMAP3430 },
{ NULL }
{ 0 }
}; };
struct omaptimer_softc { struct omaptimer_softc {
@ -164,7 +165,7 @@ omaptimer_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_phandle = phandle; sc->sc_phandle = phandle;
sc->sc_bst = faa->faa_bst; 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) { if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
device_printf(self, "unable to map bus space"); device_printf(self, "unable to map bus space");

View File

@ -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. * Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -29,7 +29,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -85,12 +85,17 @@ static const struct ti_sdhc_config omap4_hsmmc_config = {
.regoff = 0x100 .regoff = 0x100
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "ti,omap2-hsmmc", (uintptr_t)&omap2_hsmmc_config }, { .compat = "ti,omap2-hsmmc",
{ "ti,omap3-hsmmc", (uintptr_t)&omap2_hsmmc_config }, .data = &omap2_hsmmc_config },
{ "ti,omap3-pre-es3-hsmmc", (uintptr_t)&omap3_pre_es3_hsmmc_config }, { .compat = "ti,omap3-hsmmc",
{ "ti,omap4-hsmmc", (uintptr_t)&omap4_hsmmc_config }, .data = &omap2_hsmmc_config },
{ NULL } { .compat = "ti,omap3-pre-es3-hsmmc",
.data = &omap3_pre_es3_hsmmc_config },
{ .compat = "ti,omap4-hsmmc",
.data = &omap4_hsmmc_config },
{ 0 }
}; };
enum { enum {
@ -160,7 +165,7 @@ ti_sdhc_attach(device_t parent, device_t self, void *aux)
bus_size_t size; bus_size_t size;
u_int bus_width; 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) { if (ti_prcm_enable_hwmod(phandle, 0) != 0) {
aprint_error(": couldn't enable module\n"); aprint_error(": couldn't enable module\n");

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2020 Jared D. McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -90,9 +90,10 @@ struct octeon_cib_softc {
CFATTACH_DECL_NEW(octcib, sizeof(struct octeon_cib_softc), CFATTACH_DECL_NEW(octcib, sizeof(struct octeon_cib_softc),
octeon_cib_match, octeon_cib_attach, NULL, NULL); octeon_cib_match, octeon_cib_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "cavium,octeon-7130-cib", 1 }, { .compat = "cavium,octeon-7130-cib" },
{ NULL }
{ 0 }
}; };
static int static int

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2020 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -69,9 +69,10 @@ struct octeon_intc_softc {
CFATTACH_DECL_NEW(octintc, sizeof(struct octeon_intc_softc), CFATTACH_DECL_NEW(octintc, sizeof(struct octeon_intc_softc),
octeon_intc_match, octeon_intc_attach, NULL, NULL); octeon_intc_match, octeon_intc_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "cavium,octeon-3860-ciu", OCTEON_INTC_CIU }, { .compat = "cavium,octeon-3860-ciu", .value = OCTEON_INTC_CIU },
{ NULL }
{ 0 }
}; };
static int static int
@ -92,7 +93,7 @@ octeon_intc_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_phandle = phandle; 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) { switch (sc->sc_type) {
case OCTEON_INTC_CIU: case OCTEON_INTC_CIU:

View File

@ -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 * Copyright (c) 2018 Jonathan A. Kollasch
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -49,9 +49,10 @@ static void amdccp_fdt_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(amdccp_fdt, sizeof(struct amdccp_fdt_softc), CFATTACH_DECL_NEW(amdccp_fdt, sizeof(struct amdccp_fdt_softc),
amdccp_fdt_match, amdccp_fdt_attach, NULL, NULL); amdccp_fdt_match, amdccp_fdt_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amd,ccp-seattle-v1a", }, { .compat = "amd,ccp-seattle-v1a" },
{ NULL }
{ 0 }
}; };
static int static int

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -72,9 +72,11 @@ struct arasan_sdhc_softc {
struct clk sc_clk_card; struct clk sc_clk_card;
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3399-sdhci-5.1", AS_TYPE_RK3399 }, { .compat = "rockchip,rk3399-sdhci-5.1",
{ NULL } .value = AS_TYPE_RK3399 },
{ 0 }
}; };
static struct clk * static struct clk *
@ -262,7 +264,7 @@ arasan_sdhc_attach(device_t parent, device_t self, void *aux)
return; return;
} }
sc->sc_bsz = size; 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); 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) { if ((caps & (SDHC_ADMA2_SUPP|SDHC_64BIT_SYS_BUS)) == SDHC_ADMA2_SUPP) {

View File

@ -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. * Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -69,12 +69,13 @@ struct fdt_connector_softc {
CFATTACH_DECL_NEW(fdt_connector, sizeof(struct fdt_connector_softc), CFATTACH_DECL_NEW(fdt_connector, sizeof(struct fdt_connector_softc),
fdt_connector_match, fdt_connector_attach, NULL, NULL); fdt_connector_match, fdt_connector_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"composite-video-connector", CON_TV}, { .compat = "composite-video-connector", .value = CON_TV},
{"dvi-connector", CON_DVI}, { .compat = "dvi-connector", .value = CON_DVI},
{"hdmi-connector", CON_HDMI}, { .compat = "hdmi-connector", .value = CON_HDMI},
{"vga-connector", CON_VGA}, { .compat = "vga-connector", .value = CON_VGA},
{ NULL }
{ 0 }
}; };
static int static int
@ -94,7 +95,7 @@ fdt_connector_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_phandle = phandle; 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); SLIST_INSERT_HEAD(&fdt_connectors, sc, sc_list);

View File

@ -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. * Copyright (c) 2013 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -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 dwc2_fdt_config dwc2_fdt_generic_config = {
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "amlogic,meson8b-usb", (uintptr_t)&dwc2_fdt_meson8b_config }, { .compat = "amlogic,meson8b-usb",
{ "amlogic,meson-gxbb-usb", (uintptr_t)&dwc2_fdt_meson8b_config }, .data = &dwc2_fdt_meson8b_config },
{ "rockchip,rk3066-usb", (uintptr_t)&dwc2_fdt_rk3066_config }, { .compat = "amlogic,meson-gxbb-usb",
{ "snps,dwc2", (uintptr_t)&dwc2_fdt_generic_config }, .data = &dwc2_fdt_meson8b_config },
{ NULL } { .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), 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; struct fdt_attach_args * const faa = aux;
const int phandle = faa->faa_phandle; const int phandle = faa->faa_phandle;
const struct dwc2_fdt_config *conf = const struct dwc2_fdt_config *conf =
(void *)of_search_compatible(phandle, compat_data)->data; of_search_compatible(phandle, compat_data)->data;
char intrstr[128]; char intrstr[128];
struct fdtbus_phy *phy; struct fdtbus_phy *phy;
struct clk *clk; struct clk *clk;

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2015-2018 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -66,9 +66,10 @@ static const struct dwcmmc_fdt_config dwcmmc_rk3288_config = {
.intr_cardmask = __BIT(24), .intr_cardmask = __BIT(24),
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "rockchip,rk3288-dw-mshc", (uintptr_t)&dwcmmc_rk3288_config }, { .compat = "rockchip,rk3288-dw-mshc", .data = &dwcmmc_rk3288_config },
{ NULL }
{ 0 }
}; };
struct dwcmmc_fdt_softc { struct dwcmmc_fdt_softc {
@ -150,7 +151,7 @@ dwcmmc_fdt_attach(device_t parent, device_t self, void *aux)
(uint64_t)addr, error); (uint64_t)addr, error);
return; 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) if (of_getprop_uint32(phandle, "max-frequency", &sc->sc_clock_freq) != 0)
sc->sc_clock_freq = UINT_MAX; sc->sc_clock_freq = UINT_MAX;

View File

@ -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. * Copyright (c) 2020 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/types.h> #include <sys/types.h>
#include <sys/device.h> #include <sys/device.h>
@ -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", { .compat = "i2c-mux-gpio",
.data = (uintptr_t)&iicmux_gpio_config }, .data = &iicmux_gpio_config },
{ .compat = "i2c-mux-pinctrl", { .compat = "i2c-mux-pinctrl",
.data = (uintptr_t)&iicmux_pinctrl_config }, .data = &iicmux_pinctrl_config },
{ NULL } { 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_dev = self;
sc->sc_phandle = faa->faa_phandle; sc->sc_phandle = faa->faa_phandle;
sc->sc_config = (const struct iicmux_config *) sc->sc_config = of_search_compatible(sc->sc_phandle, compat_data)->data;
of_search_compatible(sc->sc_phandle, compat_data)->data;
aprint_naive("\n"); aprint_naive("\n");
aprint_normal(": %s I2C mux\n", sc->sc_config->desc); aprint_normal(": %s I2C mux\n", sc->sc_config->desc);

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2017-2020 Jared McNeill <jmcneill@invisible.ca>
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -77,14 +77,15 @@ static const struct ns8250_config octeon_config = {
.enable = ns8250_octeon_enable, .enable = ns8250_octeon_enable,
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "cavium,octeon-3860-uart", (uintptr_t)&octeon_config }, { .compat = "cavium,octeon-3860-uart", .data = &octeon_config },
{ "ns8250", (uintptr_t)&ns8250_config }, { .compat = "ns8250", .data = &ns8250_config },
{ "ns16450", (uintptr_t)&ns8250_config }, { .compat = "ns16450", .data = &ns8250_config },
{ "ns16550a", (uintptr_t)&ns8250_config }, { .compat = "ns16550a", .data = &ns8250_config },
{ "ns16550", (uintptr_t)&ns8250_config }, { .compat = "ns16550", .data = &ns8250_config },
{ "ns16750", (uintptr_t)&ns16750_config }, { .compat = "ns16750", .data = &ns16750_config },
{ NULL }
{ 0 }
}; };
CFATTACH_DECL_NEW(ns8250_uart, sizeof(struct com_softc), 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; void *ih;
const struct ns8250_config *config = 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) { if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n"); 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; int speed;
const struct ns8250_config *config = 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); fdtbus_get_reg(phandle, 0, &addr, NULL);
speed = fdtbus_get_stdout_speed(); speed = fdtbus_get_stdout_speed();

View File

@ -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. * Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -68,10 +68,11 @@ struct fdt_panel_softc {
CFATTACH_DECL_NEW(fdt_panel, sizeof(struct fdt_panel_softc), CFATTACH_DECL_NEW(fdt_panel, sizeof(struct fdt_panel_softc),
fdt_panel_match, fdt_panel_attach, NULL, NULL); fdt_panel_match, fdt_panel_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{"panel-lvds", PANEL_LVDS}, { .compat = "panel-lvds", .value = PANEL_LVDS},
{"panel-dual-lvds", PANEL_DUAL_LVDS}, { .compat = "panel-dual-lvds", .value = PANEL_DUAL_LVDS},
{ NULL }
{ 0 }
}; };
static int static int
@ -98,7 +99,7 @@ fdt_panel_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self; sc->sc_dev = self;
sc->sc_phandle = phandle; sc->sc_phandle = phandle;
sc->sc_panel.panel_type = 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) || if (of_getprop_uint32(phandle, "width-mm", &sc->sc_panel.panel_width) ||
of_getprop_uint32(phandle, "height-mm", &sc->sc_panel.panel_height)){ of_getprop_uint32(phandle, "height-mm", &sc->sc_panel.panel_height)){

View File

@ -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 <jmcneill@invisible.ca> * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/bus.h> #include <sys/bus.h>
@ -50,10 +50,11 @@ static const struct pinctrl_single_config pinconf_config = {
.flags = PINCTRL_FLAG_PINCONF .flags = PINCTRL_FLAG_PINCONF
}; };
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "pinctrl-single", (uintptr_t)&pinctrl_config }, { .compat = "pinctrl-single", .data = &pinctrl_config },
{ "pinconf-single", (uintptr_t)&pinconf_config }, { .compat = "pinconf-single", .data = &pinconf_config },
{ NULL }
{ 0 }
}; };
struct pinctrl_single_softc { struct pinctrl_single_softc {
@ -159,7 +160,7 @@ pinctrl_single_attach(device_t parent, device_t self, void *aux)
return; 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_dev = self;
sc->sc_phandle = phandle; sc->sc_phandle = phandle;

View File

@ -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 <ryo@nerv.org> * Copyright (c) 2020 Ryo Shimizu <ryo@nerv.org>
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -43,9 +43,10 @@ static void vmt_fdt_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(vmt_fdt, sizeof(struct vmt_softc), CFATTACH_DECL_NEW(vmt_fdt, sizeof(struct vmt_softc),
vmt_fdt_match, vmt_fdt_attach, NULL, NULL); vmt_fdt_match, vmt_fdt_attach, NULL, NULL);
static const struct of_compat_data compat_data[] = { static const struct device_compatible_entry compat_data[] = {
{ "vmware", }, { .compat = "vmware" },
{ NULL }
{ 0 }
}; };
static int static int

View File

@ -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 * Copyright 1998
@ -34,9 +34,10 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <dev/ofw/openfirm.h> #include <dev/ofw/openfirm.h>
@ -211,7 +212,8 @@ of_match_compatible(int phandle, const char * const *strings)
* None. * None.
*/ */
int 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++) { for (; compat_data->compat != NULL; compat_data++) {
const char *compat[] = { compat_data->compat, NULL }; 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: * Side Effects:
* None. * None.
*/ */
const struct of_compat_data * const struct device_compatible_entry *
of_search_compatible(int phandle, const struct of_compat_data *compat_data) of_search_compatible(int phandle,
const struct device_compatible_entry *compat_data)
{ {
for (; compat_data->compat != NULL; compat_data++) { for (; compat_data->compat != NULL; compat_data++) {
const char *compat[] = { compat_data->compat, NULL }; const char *compat[] = { compat_data->compat, NULL };

View File

@ -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. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -65,11 +65,6 @@ struct ofbus_attach_args {
int oba_unit; int oba_unit;
}; };
struct of_compat_data {
const char *compat;
uintptr_t data;
};
/* /*
* Functions and variables provided by machine-dependent code. * Functions and variables provided by machine-dependent code.
*/ */
@ -108,11 +103,13 @@ int openfirmware(void *);
/* /*
* Functions and variables provided by machine-independent code. * Functions and variables provided by machine-independent code.
*/ */
struct device_compatible_entry;
int of_compatible(int, const char * const *); int of_compatible(int, const char * const *);
int of_match_compatible(int, const char * const *); int of_match_compatible(int, const char * const *);
int of_match_compat_data(int, const struct of_compat_data *); int of_match_compat_data(int, const struct device_compatible_entry *);
const struct of_compat_data * const struct device_compatible_entry *
of_search_compatible(int, const struct of_compat_data *); of_search_compatible(int, const struct device_compatible_entry *);
int of_decode_int(const unsigned char *); int of_decode_int(const unsigned char *);
int of_packagename(int, char *, int); int of_packagename(int, char *, int);
int of_find_firstchild_byname(int, const char *); int of_find_firstchild_byname(int, const char *);