directories. Move the device tables while here as was done in bitrig.
With these changes the only use of the board id defines is in the soc
directories.
Tested by matthieu and djm on imx and myself on omap and sunxi (qemu).
ok djm@, ok jasper@ on an earlier version
-/* $OpenBSD: armv7.c,v 1.8 2015/05/12 04:40:31 jsg Exp $ */
+/* $OpenBSD: armv7.c,v 1.9 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
#include <machine/bus.h>
#include <arm/armv7/armv7var.h>
#include <armv7/armv7/armv7var.h>
-#include <armv7/sunxi/sunxireg.h>
+
+#include "imx.h"
+#include "omap.h"
+#include "sunxi.h"
struct arm32_bus_dma_tag armv7_bus_dma_tag = {
0,
#define DEVNAME(sc) (sc)->sc_dv.dv_xname
-struct board_dev hummingboard_devs[] = {
- { "imxocotp", 0 },
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxuart", 0 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 1 },
- { "ehci", 0 },
- { "ehci", 1 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev phyflex_imx6_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 3 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 1 },
- { "imxesdhc", 2 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev sabrelite_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 1 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 2 },
- { "imxesdhc", 3 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev sabresd_devs[] = {
- { "imxocotp", 0 },
- { "imxccm", 0 },
- { "imxtemp", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxuart", 0 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 1 },
- { "imxesdhc", 2 },
- { "imxesdhc", 3 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev udoo_devs[] = {
- { "imxocotp", 0 },
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxuart", 1 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 2 },
- { "imxesdhc", 3 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev utilite_devs[] = {
- { "imxocotp", 0 },
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxuart", 3 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 2 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev novena_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 1 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxesdhc", 2 },
- { "imxesdhc", 3 },
- { "ehci", 0 },
- { "imxenet", 0 },
- { "ahci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev wandboard_devs[] = {
- { "imxccm", 0 },
- { "imxiomuxc", 0 },
- { "imxdog", 0 },
- { "imxocotp", 0 },
- { "imxuart", 0 },
- { "imxgpio", 0 },
- { "imxgpio", 1 },
- { "imxgpio", 2 },
- { "imxgpio", 3 },
- { "imxgpio", 4 },
- { "imxgpio", 5 },
- { "imxgpio", 6 },
- { "imxenet", 0 },
- { "imxesdhc", 2 },
- { "imxesdhc", 0 },
- { "ehci", 0 },
- { "ahci", 0 }, /* only on quad, afaik. */
- { NULL, 0 }
-};
-struct board_dev beagleboard_devs[] = {
- { "prcm", 0 },
- { "intc", 0 },
- { "gptimer", 0 },
- { "gptimer", 1 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { "ommmc", 0 }, /* HSMMC1 */
- { "com", 2 }, /* UART3 */
- { NULL, 0 }
-};
-
-struct board_dev beaglebone_devs[] = {
- { "prcm", 0 },
- { "sitaracm", 0 },
- { "intc", 0 },
- { "edma", 0 },
- { "dmtimer", 0 },
- { "dmtimer", 1 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "tiiic", 0 },
- { "tiiic", 1 },
- { "tiiic", 2 },
- { "ommmc", 0 }, /* HSMMC0 */
- { "ommmc", 1 }, /* HSMMC1 */
- { "com", 0 }, /* UART0 */
- { "cpsw", 0 },
- { NULL, 0 }
-};
-
-struct board_dev overo_devs[] = {
- { "prcm", 0 },
- { "intc", 0 },
- { "gptimer", 0 },
- { "gptimer", 1 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { "ommmc", 0 }, /* HSMMC1 */
- { "com", 2 }, /* UART3 */
- { NULL, 0 }
-};
-
-struct board_dev pandaboard_devs[] = {
- { "omapid", 0 },
- { "prcm", 0 },
- { "omdog", 0 },
- { "omgpio", 0 },
- { "omgpio", 1 },
- { "omgpio", 2 },
- { "omgpio", 3 },
- { "omgpio", 4 },
- { "omgpio", 5 },
- { "ommmc", 0 }, /* HSMMC1 */
- { "com", 2 }, /* UART3 */
- { "ehci", 0 },
- { NULL, 0 }
-};
-
-struct board_dev sun4i_devs[] = {
- { "sxipio", 0 },
- { "sxiccmu", 0 },
- { "a1xintc", 0 },
- { "sxitimer", 0 },
- { "sxitimer", 1 },
- { "sxitimer", 2 },
- { "sxidog", 0 },
- { "sxirtc", 0 },
- { "sxiuart", 0 },
- { "sxiuart", 1 },
- { "sxiuart", 2 },
- { "sxiuart", 3 },
- { "sxiuart", 4 },
- { "sxiuart", 5 },
- { "sxiuart", 6 },
- { "sxiuart", 7 },
- { "sxie", 0 },
- { "ahci", 0 },
- { "ehci", 0 },
- { "ehci", 1 },
-#if 0
- { "ohci", 0 },
- { "ohci", 1 },
-#endif
- { NULL, 0 }
-};
-
-struct board_dev sun7i_devs[] = {
- { "sxipio", 0 },
- { "sxiccmu", 0 },
- { "sxitimer", 0 },
- { "sxitimer", 1 },
- { "sxitimer", 2 },
- { "sxidog", 0 },
- { "sxirtc", 0 },
- { "sxiuart", 0 },
- { "sxiuart", 1 },
- { "sxiuart", 2 },
- { "sxiuart", 3 },
- { "sxiuart", 4 },
- { "sxiuart", 5 },
- { "sxiuart", 6 },
- { "sxiuart", 7 },
- { "sxie", 0 },
- { "ahci", 0 },
- { "ehci", 0 },
- { "ehci", 1 },
-#if 0
- { "ohci", 0 },
- { "ohci", 1 },
-#endif
- { NULL, 0 }
-};
-
/*
* We do direct configuration of devices on this SoC "bus", so we
* never call the child device's match function at all (it can be
return (1);
}
+extern char *hw_prod;
+
+struct board_dev * (*board_attach[])(void) = {
+#if NIMX > 0
+ imx_board_attach,
+#endif
+#if NOMAP > 0
+ omap_board_attach,
+#endif
+#if NSUNXI > 0
+ sunxi_board_attach,
+#endif
+};
+
void
armv7_attach(struct device *parent, struct device *self, void *aux)
{
struct armv7_softc *sc = (struct armv7_softc *)self;
struct board_dev *bd;
- uint32_t issunxi = 0;
- bus_space_handle_t ioh;
+ int i;
- switch (board_id) {
- case BOARD_ID_IMX6_CUBOXI:
- printf(": i.MX6 SolidRun CuBox-i\n");
- imx6_init();
- sc->sc_board_devs = hummingboard_devs;
- break;
- case BOARD_ID_IMX6_HUMMINGBOARD:
- printf(": i.MX6 SolidRun HummingBoard\n");
- imx6_init();
- sc->sc_board_devs = hummingboard_devs;
- break;
- case BOARD_ID_IMX6_PHYFLEX:
- printf(": PhyFLEX-i.MX6\n");
- imx6_init();
- sc->sc_board_devs = phyflex_imx6_devs;
- break;
- case BOARD_ID_IMX6_SABRELITE:
- printf(": i.MX6 SABRE Lite\n");
- imx6_init();
- sc->sc_board_devs = sabrelite_devs;
- break;
- case BOARD_ID_IMX6_SABRESD:
- printf(": i.MX6 SABRE SD\n");
- imx6_init();
- sc->sc_board_devs = sabresd_devs;
- break;
- case BOARD_ID_IMX6_UDOO:
- printf(": i.MX6 UDOO\n");
- imx6_init();
- sc->sc_board_devs = udoo_devs;
- break;
- case BOARD_ID_IMX6_UTILITE:
- printf(": i.MX6 Utilite\n");
- imx6_init();
- sc->sc_board_devs = utilite_devs;
- break;
- case BOARD_ID_IMX6_NOVENA:
- printf(": i.MX6 Novena\n");
- imx6_init();
- sc->sc_board_devs = novena_devs;
- break;
- case BOARD_ID_IMX6_WANDBOARD:
- printf(": i.MX6 Wandboard\n");
- imx6_init();
- sc->sc_board_devs = wandboard_devs;
- break;
- case BOARD_ID_OMAP3_BEAGLE:
- printf(": BeagleBoard\n");
- omap3_init();
- sc->sc_board_devs = beagleboard_devs;
- break;
- case BOARD_ID_AM335X_BEAGLEBONE:
- printf(": BeagleBone\n");
- am335x_init();
- sc->sc_board_devs = beaglebone_devs;
- break;
- case BOARD_ID_OMAP3_OVERO:
- printf(": Gumstix Overo\n");
- omap3_init();
- sc->sc_board_devs = overo_devs;
- break;
- case BOARD_ID_OMAP4_PANDA:
- printf(": PandaBoard\n");
- omap4_init();
- sc->sc_board_devs = pandaboard_devs;
- break;
- case BOARD_ID_SUN4I_A10:
- printf(": A1X\n");
- sxia1x_init();
- sc->sc_board_devs = sun4i_devs;
- issunxi = 1;
- break;
- case BOARD_ID_SUN7I_A20:
- printf(": A20\n");
- sxia20_init();
- sc->sc_board_devs = sun7i_devs;
- issunxi = 1;
- break;
- default:
- printf("\n");
- panic("%s: board type 0x%x unknown", __func__, board_id);
+ for (i = 0; i < nitems(board_attach); i++) {
+ sc->sc_board_devs = board_attach[i]();
+ if (sc->sc_board_devs != NULL)
+ break;
}
- if (issunxi) {
- /*
- * XXX think of a better place to do this, as there might
- * be need for access by other drivers later.
- */
- if (bus_space_map(&armv7_bs_tag, SYSCTRL_ADDR, SYSCTRL_SIZE, 0,
- &ioh))
- panic("sunxi_attach: bus_space_map failed!");
- /* map the part of SRAM dedicated to EMAC to EMAC */
- bus_space_write_4(&armv7_bs_tag, ioh, 4,
- bus_space_read_4(&armv7_bs_tag, ioh, 4) | (5 << 2));
- }
+ if (hw_prod)
+ printf(": %s\n", hw_prod);
+ else
+ printf(": UNKNOWN BOARD %u\n", board_id);
/* Directly configure on-board devices (dev* in config file). */
for (bd = sc->sc_board_devs; bd->name != NULL; bd++) {
-/* $OpenBSD: armv7_machdep.c,v 1.21 2015/05/12 04:31:10 jsg Exp $ */
+/* $OpenBSD: armv7_machdep.c,v 1.22 2015/05/15 15:35:43 jsg Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
if (boothowto & RB_KDB)
Debugger();
#endif
- platform_print_board_type();
+ printf("board type: %u\n", board_id);
/* We return the new stack pointer address */
return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
-/* $OpenBSD: armv7_machdep.h,v 1.1 2013/10/30 20:20:23 syl Exp $ */
+/* $OpenBSD: armv7_machdep.h,v 1.2 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
void platform_powerdown(void);
void platform_watchdog_reset(void);
void platform_init_cons(void);
-void platform_print_board_type(void);
+const char *platform_board_name(void);
void platform_bootconfig_dram(BootConfig *, psize_t *, psize_t *);
void platform_disable_l2_if_needed(void);
extern const char *platform_boot_name;
-/* $OpenBSD: armv7var.h,v 1.4 2015/05/08 03:38:26 jsg Exp $ */
+/* $OpenBSD: armv7var.h,v 1.5 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
int unit;
};
+struct armv7_board {
+ uint32_t board_id;
+ const char *name;
+ struct board_dev *devs;
+ void (*init)(void);
+};
+
/* Needed by omap, imx, sunxi */
struct armv7_softc {
struct device sc_dv;
void sxia1x_init(void);
void sxia20_init(void);
+struct board_dev *imx_board_attach(void);
+struct board_dev *omap_board_attach(void);
+struct board_dev *sunxi_board_attach(void);
+
#endif /* __ARMV7VAR_H__ */
-/* $OpenBSD: autoconf.c,v 1.1 2013/09/04 14:38:25 patrick Exp $ */
+/* $OpenBSD: autoconf.c,v 1.2 2015/05/15 15:35:43 jsg Exp $ */
/* $NetBSD: autoconf.c,v 1.2 2001/09/05 16:17:36 matt Exp $ */
/*
#include <machine/bootconfig.h>
#include <machine/intr.h>
+#include <armv7/armv7/armv7_machdep.h>
+
struct device *bootdv = NULL;
+extern char *hw_prod;
void dumpconf(void);
void
cpu_configure(void)
{
+ int len;
+ const char *name = platform_board_name();
+ if (name) {
+ len = strlen(name) + 1;
+ hw_prod = malloc(len, M_DEVBUF, M_NOWAIT);
+ if (hw_prod)
+ strlcpy(hw_prod, name, len);
+ }
+
softintr_init();
/*
-/* $OpenBSD: exynos.c,v 1.1 2015/01/26 02:48:24 bmercer Exp $ */
+/* $OpenBSD: exynos.c,v 1.2 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
// { "exesdhc", 3 },
{ NULL, 0 }
};
+
+struct armv7_board exynos_boards[] = {
+ {
+ BOARD_ID_EXYNOS5_CHROMEBOOK,
+ "Exynos 5 Chromebook",
+ chromebook_devs,
+ exynos5_init,
+ },
+ { 0, NULL, NULL, NULL },
+};
+
+struct board_dev *
+exynos_board_attach(void)
+{
+ int i;
+
+ for (i = 0; exynos_boards[i].name != NULL; i++) {
+ if (exynos_boards[i].board_id == board_id) {
+ exynos_boards[i].init();
+ return (exynos_boards[i].devs);
+ break;
+ }
+ }
+ return (NULL);
+}
+
+const char *
+exynos_board_name(void)
+{
+ int i;
+
+ for (i = 0; exynos_boards[i].name != NULL; i++) {
+ if (exynos_boards[i].board_id == board_id) {
+ return (exynos_boards[i].name);
+ break;
+ }
+ }
+ return (NULL);
+}
#include <armv7/armv7/armv7_machdep.h>
extern void exdog_reset(void);
+extern char *exynos_board_name(void);
extern int32_t agtimer_frequency;
extern int comcnspeed;
extern int comcnmode;
}
-static void
-exynos_platform_print_board_type(void)
+const char *
+platform_board_name(void)
{
- switch (board_id) {
- case BOARD_ID_EXYNOS5_CHROMEBOOK:
- agtimer_frequency = 24 * 1000 * 1000;
- printf("board type: Exynos 5 Chromebook\n");
- break;
- default:
- printf("board type %x unknown\n", board_id);
- }
+ return (exynos_board_name());
}
static void
-# $OpenBSD: files.imx,v 1.2 2013/11/06 19:03:07 syl Exp $
+# $OpenBSD: files.imx,v 1.3 2015/05/15 15:35:43 jsg Exp $
define imx {}
device imx: imx
attach imx at mainbus
-file arch/armv7/imx/imx_machdep.c imx
+file arch/armv7/imx/imx_machdep.c imx needs-flag
file arch/armv7/imx/imx.c imx
file arch/armv7/imx/imx6.c
-/* $OpenBSD: imx.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
+/* $OpenBSD: imx.c,v 1.4 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
NULL, "imx", DV_DULL
};
+struct board_dev hummingboard_devs[] = {
+ { "imxocotp", 0 },
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxuart", 0 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 1 },
+ { "ehci", 0 },
+ { "ehci", 1 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev phyflex_imx6_devs[] = {
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxocotp", 0 },
+ { "imxuart", 3 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 1 },
+ { "imxesdhc", 2 },
+ { "ehci", 0 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev sabrelite_devs[] = {
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxocotp", 0 },
+ { "imxuart", 1 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 2 },
+ { "imxesdhc", 3 },
+ { "ehci", 0 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev sabresd_devs[] = {
+ { "imxocotp", 0 },
+ { "imxccm", 0 },
+ { "imxtemp", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxuart", 0 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 1 },
+ { "imxesdhc", 2 },
+ { "imxesdhc", 3 },
+ { "ehci", 0 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev udoo_devs[] = {
+ { "imxocotp", 0 },
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxuart", 1 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 2 },
+ { "imxesdhc", 3 },
+ { "ehci", 0 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev utilite_devs[] = {
+ { "imxocotp", 0 },
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxuart", 3 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 2 },
+ { "ehci", 0 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev novena_devs[] = {
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxocotp", 0 },
+ { "imxuart", 1 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxesdhc", 2 },
+ { "imxesdhc", 3 },
+ { "ehci", 0 },
+ { "imxenet", 0 },
+ { "ahci", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev wandboard_devs[] = {
+ { "imxccm", 0 },
+ { "imxiomuxc", 0 },
+ { "imxdog", 0 },
+ { "imxocotp", 0 },
+ { "imxuart", 0 },
+ { "imxgpio", 0 },
+ { "imxgpio", 1 },
+ { "imxgpio", 2 },
+ { "imxgpio", 3 },
+ { "imxgpio", 4 },
+ { "imxgpio", 5 },
+ { "imxgpio", 6 },
+ { "imxenet", 0 },
+ { "imxesdhc", 2 },
+ { "imxesdhc", 0 },
+ { "ehci", 0 },
+ { "ahci", 0 }, /* only on quad, afaik. */
+ { NULL, 0 }
+};
+
+struct armv7_board imx_boards[] = {
+ {
+ BOARD_ID_IMX6_CUBOXI,
+ "SolidRun CuBox-i",
+ hummingboard_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_HUMMINGBOARD,
+ "SolidRun HummingBoard",
+ hummingboard_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_PHYFLEX,
+ "Phytec phyFLEX-i.MX6",
+ phyflex_imx6_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_SABRELITE,
+ "Freescale i.MX6 SABRE Lite",
+ sabrelite_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_SABRESD,
+ "Freescale i.MX6 SABRE SD",
+ sabresd_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_UDOO,
+ "Udoo i.MX6",
+ udoo_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_UTILITE,
+ "CompuLab Utilite",
+ utilite_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_NOVENA,
+ "Kosagi Novena",
+ novena_devs,
+ imx6_init,
+ },
+ {
+ BOARD_ID_IMX6_WANDBOARD,
+ "Wandboard i.MX6",
+ wandboard_devs,
+ imx6_init,
+ },
+ { 0, NULL, NULL, NULL },
+};
+
+struct board_dev *
+imx_board_attach(void)
+{
+ int i;
+
+ for (i = 0; imx_boards[i].name != NULL; i++) {
+ if (imx_boards[i].board_id == board_id) {
+ imx_boards[i].init();
+ return (imx_boards[i].devs);
+ break;
+ }
+ }
+ return (NULL);
+}
+
+const char *
+imx_board_name(void)
+{
+ int i;
+
+ for (i = 0; imx_boards[i].name != NULL; i++) {
+ if (imx_boards[i].board_id == board_id) {
+ return (imx_boards[i].name);
+ break;
+ }
+ }
+ return (NULL);
+}
-/* $OpenBSD: imx_machdep.c,v 1.12 2015/05/08 03:38:26 jsg Exp $ */
+/* $OpenBSD: imx_machdep.c,v 1.13 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
#include <armv7/armv7/armv7_machdep.h>
extern void imxdog_reset(void);
+extern char *imx_board_name(void);
extern int32_t amptimer_frequency;
extern int comcnspeed;
extern int comcnmode;
}
-void
-platform_print_board_type(void)
+const char *
+platform_board_name(void)
{
- switch (board_id) {
- case BOARD_ID_IMX6_CUBOXI:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: CuBox-i\n");
- break;
- case BOARD_ID_IMX6_HUMMINGBOARD:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: HummingBoard\n");
- break;
- case BOARD_ID_IMX6_PHYFLEX:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: phyFLEX-i.MX6\n");
- break;
- case BOARD_ID_IMX6_SABRELITE:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: SABRE Lite\n");
- break;
- case BOARD_ID_IMX6_SABRESD:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: SABRE SD\n");
- break;
- case BOARD_ID_IMX6_UDOO:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: UDOO\n");
- break;
- case BOARD_ID_IMX6_UTILITE:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: Utilite\n");
- break;
- case BOARD_ID_IMX6_NOVENA:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: Novena\n");
- break;
- case BOARD_ID_IMX6_WANDBOARD:
- amptimer_frequency = 396 * 1000 * 1000;
- printf("board type: Wandboard\n");
- break;
- default:
- printf("board type %x unknown\n", board_id);
- }
+ return (imx_board_name());
}
void
-# $OpenBSD: files.omap,v 1.6 2014/03/18 07:34:17 syl Exp $
+# $OpenBSD: files.omap,v 1.7 2015/05/15 15:35:43 jsg Exp $
define omap {}
device omap: omap
attach omap at mainbus
-file arch/armv7/omap/omap_machdep.c omap
+file arch/armv7/omap/omap_machdep.c omap needs-flag
file arch/armv7/omap/omap.c omap
file arch/armv7/omap/omap3.c
file arch/armv7/omap/omap4.c
-/* $OpenBSD: omap.c,v 1.4 2013/11/06 19:03:07 syl Exp $ */
+/* $OpenBSD: omap.c,v 1.5 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
NULL, "omap", DV_DULL
};
+struct board_dev beagleboard_devs[] = {
+ { "prcm", 0 },
+ { "intc", 0 },
+ { "gptimer", 0 },
+ { "gptimer", 1 },
+ { "omdog", 0 },
+ { "omgpio", 0 },
+ { "omgpio", 1 },
+ { "omgpio", 2 },
+ { "omgpio", 3 },
+ { "omgpio", 4 },
+ { "omgpio", 5 },
+ { "ommmc", 0 }, /* HSMMC1 */
+ { "com", 2 }, /* UART3 */
+ { NULL, 0 }
+};
+
+struct board_dev beaglebone_devs[] = {
+ { "prcm", 0 },
+ { "sitaracm", 0 },
+ { "intc", 0 },
+ { "edma", 0 },
+ { "dmtimer", 0 },
+ { "dmtimer", 1 },
+ { "omdog", 0 },
+ { "omgpio", 0 },
+ { "omgpio", 1 },
+ { "omgpio", 2 },
+ { "omgpio", 3 },
+ { "tiiic", 0 },
+ { "tiiic", 1 },
+ { "tiiic", 2 },
+ { "ommmc", 0 }, /* HSMMC0 */
+ { "ommmc", 1 }, /* HSMMC1 */
+ { "com", 0 }, /* UART0 */
+ { "cpsw", 0 },
+ { NULL, 0 }
+};
+
+struct board_dev overo_devs[] = {
+ { "prcm", 0 },
+ { "intc", 0 },
+ { "gptimer", 0 },
+ { "gptimer", 1 },
+ { "omdog", 0 },
+ { "omgpio", 0 },
+ { "omgpio", 1 },
+ { "omgpio", 2 },
+ { "omgpio", 3 },
+ { "omgpio", 4 },
+ { "omgpio", 5 },
+ { "ommmc", 0 }, /* HSMMC1 */
+ { "com", 2 }, /* UART3 */
+ { NULL, 0 }
+};
+
+struct board_dev pandaboard_devs[] = {
+ { "omapid", 0 },
+ { "prcm", 0 },
+ { "omdog", 0 },
+ { "omgpio", 0 },
+ { "omgpio", 1 },
+ { "omgpio", 2 },
+ { "omgpio", 3 },
+ { "omgpio", 4 },
+ { "omgpio", 5 },
+ { "ommmc", 0 }, /* HSMMC1 */
+ { "com", 2 }, /* UART3 */
+ { "ehci", 0 },
+ { NULL, 0 }
+};
+
+struct armv7_board omap_boards[] = {
+ {
+ BOARD_ID_OMAP3_BEAGLE,
+ "TI OMAP3 BeagleBoard",
+ beagleboard_devs,
+ omap3_init,
+ },
+ {
+ BOARD_ID_AM335X_BEAGLEBONE,
+ "TI AM335x BeagleBone",
+ beaglebone_devs,
+ am335x_init,
+ },
+ {
+ BOARD_ID_OMAP3_OVERO,
+ "Gumstix OMAP3 Overo",
+ overo_devs,
+ omap3_init,
+ },
+ {
+ BOARD_ID_OMAP4_PANDA,
+ "TI OMAP4 PandaBoard",
+ pandaboard_devs,
+ omap4_init,
+ },
+ { 0, NULL, NULL, NULL },
+};
+
+struct board_dev *
+omap_board_attach(void)
+{
+ int i;
+
+ for (i = 0; omap_boards[i].name != NULL; i++) {
+ if (omap_boards[i].board_id == board_id) {
+ omap_boards[i].init();
+ return (omap_boards[i].devs);
+ break;
+ }
+ }
+ return (NULL);
+}
+
+const char *
+omap_board_name(void)
+{
+ int i;
+
+ for (i = 0; omap_boards[i].name != NULL; i++) {
+ if (omap_boards[i].board_id == board_id) {
+ return (omap_boards[i].name);
+ break;
+ }
+ }
+ return (NULL);
+}
-/* $OpenBSD: omap_machdep.c,v 1.3 2015/01/22 14:33:01 krw Exp $ */
+/* $OpenBSD: omap_machdep.c,v 1.4 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
extern void omap4_smc_call(uint32_t, uint32_t);
extern void omdog_reset(void);
+extern char *omap_board_name(void);
extern int comcnspeed;
extern int comcnmode;
}
-void
-platform_print_board_type(void)
+const char *
+platform_board_name(void)
{
- switch (board_id) {
- case BOARD_ID_OMAP3_BEAGLE:
- printf("board type: beagle\n");
- break;
- case BOARD_ID_AM335X_BEAGLEBONE:
- printf("board type: beaglebone\n");
- break;
- case BOARD_ID_OMAP3_OVERO:
- printf("board type: overo\n");
- break;
- case BOARD_ID_OMAP4_PANDA:
- printf("board type: panda\n");
- break;
- default:
- printf("board type %x unknown", board_id);
- }
+ return (omap_board_name());
}
void
-# $OpenBSD: files.sunxi,v 1.2 2013/11/06 19:03:07 syl Exp $
+# $OpenBSD: files.sunxi,v 1.3 2015/05/15 15:35:43 jsg Exp $
define sunxi {}
device sunxi: sunxi
attach sunxi at mainbus
-file arch/armv7/sunxi/sunxi_machdep.c sunxi
+file arch/armv7/sunxi/sunxi_machdep.c sunxi needs-flag
file arch/armv7/sunxi/sunxi.c sunxi
file arch/armv7/sunxi/sun4i.c
file arch/armv7/sunxi/sun7i.c
-/* $OpenBSD: sunxi.c,v 1.3 2013/11/06 19:03:07 syl Exp $ */
+/* $OpenBSD: sunxi.c,v 1.4 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com>
*
#include <machine/bus.h>
+#include <arm/armv7/armv7var.h>
#include <armv7/armv7/armv7var.h>
+#include <armv7/sunxi/sunxireg.h>
struct cfattach sunxi_ca = {
sizeof(struct armv7_softc), armv7_match, armv7_attach
struct cfdriver sunxi_cd = {
NULL, "sunxi", DV_DULL
};
+
+struct board_dev sun4i_devs[] = {
+ { "sxipio", 0 },
+ { "sxiccmu", 0 },
+ { "a1xintc", 0 },
+ { "sxitimer", 0 },
+ { "sxitimer", 1 },
+ { "sxitimer", 2 },
+ { "sxidog", 0 },
+ { "sxirtc", 0 },
+ { "sxiuart", 0 },
+ { "sxiuart", 1 },
+ { "sxiuart", 2 },
+ { "sxiuart", 3 },
+ { "sxiuart", 4 },
+ { "sxiuart", 5 },
+ { "sxiuart", 6 },
+ { "sxiuart", 7 },
+ { "sxie", 0 },
+ { "ahci", 0 },
+ { "ehci", 0 },
+ { "ehci", 1 },
+#if 0
+ { "ohci", 0 },
+ { "ohci", 1 },
+#endif
+ { NULL, 0 }
+};
+
+struct board_dev sun7i_devs[] = {
+ { "sxipio", 0 },
+ { "sxiccmu", 0 },
+ { "sxitimer", 0 },
+ { "sxitimer", 1 },
+ { "sxitimer", 2 },
+ { "sxidog", 0 },
+ { "sxirtc", 0 },
+ { "sxiuart", 0 },
+ { "sxiuart", 1 },
+ { "sxiuart", 2 },
+ { "sxiuart", 3 },
+ { "sxiuart", 4 },
+ { "sxiuart", 5 },
+ { "sxiuart", 6 },
+ { "sxiuart", 7 },
+ { "sxie", 0 },
+ { "ahci", 0 },
+ { "ehci", 0 },
+ { "ehci", 1 },
+#if 0
+ { "ohci", 0 },
+ { "ohci", 1 },
+#endif
+ { NULL, 0 }
+};
+
+struct armv7_board sunxi_boards[] = {
+ {
+ BOARD_ID_SUN4I_A10,
+ "Allwinner A1x",
+ sun4i_devs,
+ sxia1x_init,
+ },
+ {
+ BOARD_ID_SUN7I_A20,
+ "Allwinner A20",
+ sun7i_devs,
+ sxia20_init,
+ },
+ { 0, NULL, NULL, NULL },
+};
+
+
+struct board_dev *
+sunxi_board_attach(void)
+{
+ struct board_dev *devs = NULL;
+ bus_space_handle_t ioh;
+ int i;
+
+ for (i = 0; sunxi_boards[i].name != NULL; i++) {
+ if (sunxi_boards[i].board_id == board_id) {
+ sunxi_boards[i].init();
+ devs = sunxi_boards[i].devs;
+ break;
+ }
+ }
+
+ if (devs) {
+ if (bus_space_map(&armv7_bs_tag, SYSCTRL_ADDR, SYSCTRL_SIZE, 0,
+ &ioh))
+ panic("sunxi_attach: bus_space_map failed!");
+ /* map the part of SRAM dedicated to EMAC to EMAC */
+ bus_space_write_4(&armv7_bs_tag, ioh, 4,
+ bus_space_read_4(&armv7_bs_tag, ioh, 4) | (5 << 2));
+ }
+
+ return (devs);
+}
+
+const char *
+sunxi_board_name(void)
+{
+ int i;
+
+ for (i = 0; sunxi_boards[i].name != NULL; i++) {
+ if (sunxi_boards[i].board_id == board_id) {
+ return (sunxi_boards[i].name);
+ break;
+ }
+ }
+ return (NULL);
+}
-/* $OpenBSD: sunxi_machdep.c,v 1.5 2015/01/22 14:33:01 krw Exp $ */
+/* $OpenBSD: sunxi_machdep.c,v 1.6 2015/05/15 15:35:43 jsg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
extern int sxiuartcnattach(bus_space_tag_t, bus_addr_t, int, long, tcflag_t);
extern void sxidog_reset(void);
+extern char *sunxi_board_name(void);
extern int comcnspeed;
extern int comcnmode;
}
-void
-platform_print_board_type(void)
+const char *
+platform_board_name(void)
{
-
+ return (sunxi_board_name());
}
void