From 30a044c523b8483c92a12e784185c588a2247794 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 20 May 2015 00:14:55 +0000 Subject: [PATCH] add per soc match functions instead of using armv7_match --- sys/arch/armv7/exynos/exynos.c | 33 ++++++++++++++------------------- sys/arch/armv7/imx/imx.c | 13 ++++++++++--- sys/arch/armv7/omap/omap.c | 17 ++++++++++++----- sys/arch/armv7/sunxi/sunxi.c | 15 +++++++++++---- 4 files changed, 47 insertions(+), 31 deletions(-) diff --git a/sys/arch/armv7/exynos/exynos.c b/sys/arch/armv7/exynos/exynos.c index 8b2e79849cd..f2dcf8c4762 100644 --- a/sys/arch/armv7/exynos/exynos.c +++ b/sys/arch/armv7/exynos/exynos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exynos.c,v 1.3 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: exynos.c,v 1.4 2015/05/20 00:14:55 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -24,24 +24,8 @@ #include -static int -exynos_match(struct device *parent, void *cfdata, void *aux) -{ - /* If we're running with fdt, do not attach. */ - /* XXX: Find a better way. */ - if (fdt_next_node(0)) - return (0); - - switch (board_id) - { - case BOARD_ID_EXYNOS5_CHROMEBOOK: - return (1); - } - - return (0); -} - -void exynos5_init(); +int exynos_match(struct device *, void *, void *); +void exynos5_init(); struct cfattach exynos_ca = { sizeof(struct armv7_softc), exynos_match, armv7_attach, NULL, @@ -120,3 +104,14 @@ exynos_board_name(void) } return (NULL); } + +int +exynos_match(struct device *parent, void *cfdata, void *aux) +{ + /* If we're running with fdt, do not attach. */ + /* XXX: Find a better way. */ + if (fdt_next_node(0)) + return (0); + + return (imx_board_devs() != NULL); +} diff --git a/sys/arch/armv7/imx/imx.c b/sys/arch/armv7/imx/imx.c index c75c956c028..6610e7fb66a 100644 --- a/sys/arch/armv7/imx/imx.c +++ b/sys/arch/armv7/imx/imx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imx.c,v 1.7 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: imx.c,v 1.8 2015/05/20 00:14:55 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -23,10 +23,11 @@ #include -void imx6_init(); +int imx_match(struct device *, void *, void *); +void imx6_init(); struct cfattach imx_ca = { - sizeof(struct armv7_softc), armv7_match, armv7_attach, NULL, + sizeof(struct armv7_softc), imx_match, armv7_attach, NULL, config_activate_children }; @@ -298,3 +299,9 @@ imx_board_name(void) } return (NULL); } + +int +imx_match(struct device *parent, void *cfdata, void *aux) +{ + return (imx_board_devs() != NULL); +} diff --git a/sys/arch/armv7/omap/omap.c b/sys/arch/armv7/omap/omap.c index 02b9a71d1a3..fc033935942 100644 --- a/sys/arch/armv7/omap/omap.c +++ b/sys/arch/armv7/omap/omap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omap.c,v 1.6 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: omap.c,v 1.7 2015/05/20 00:14:56 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * @@ -22,12 +22,13 @@ #include -void omap3_init(); -void omap4_init(); -void am335x_init(); +int omap_match(struct device *, void *, void *); +void omap3_init(); +void omap4_init(); +void am335x_init(); struct cfattach omap_ca = { - sizeof(struct armv7_softc), armv7_match, armv7_attach + sizeof(struct armv7_softc), omap_match, armv7_attach }; struct cfdriver omap_cd = { @@ -172,3 +173,9 @@ omap_board_name(void) } return (NULL); } + +int +omap_match(struct device *parent, void *cfdata, void *aux) +{ + return (omap_board_devs() != NULL); +} diff --git a/sys/arch/armv7/sunxi/sunxi.c b/sys/arch/armv7/sunxi/sunxi.c index 504214461f4..accd475a085 100644 --- a/sys/arch/armv7/sunxi/sunxi.c +++ b/sys/arch/armv7/sunxi/sunxi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunxi.c,v 1.5 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: sunxi.c,v 1.6 2015/05/20 00:14:56 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * @@ -24,11 +24,12 @@ #include #include -void sxia1x_init(); -void sxia20_init(); +int sunxi_match(struct device *, void *, void *); +void sxia1x_init(); +void sxia20_init(); struct cfattach sunxi_ca = { - sizeof(struct armv7_softc), armv7_match, armv7_attach + sizeof(struct armv7_softc), sunxi_match, armv7_attach }; struct cfdriver sunxi_cd = { @@ -155,3 +156,9 @@ sunxi_board_name(void) } return (NULL); } + +int +sunxi_match(struct device *parent, void *cfdata, void *aux) +{ + return (sunxi_board_devs() != NULL); +} -- 2.20.1