From 31642defb5b3233700d202713f8a65d872d823c3 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 8 May 2015 03:38:26 +0000 Subject: [PATCH] Add initial board specific parts of novena support, tested by djm@ While novena has it's own board id it's u-boot does not set it. "setenv machid 10ad" in u-boot will set the novena board id (0x10ad/4269). --- sys/arch/armv7/armv7/armv7.c | 28 +++++++++++++++++++++++++++- sys/arch/armv7/armv7/armv7var.h | 3 ++- sys/arch/armv7/imx/imx_machdep.c | 7 ++++++- sys/arch/armv7/imx/imxenet.c | 15 ++++++++++++++- sys/arch/armv7/imx/imxesdhc.c | 15 ++++++++++++++- sys/arch/armv7/imx/imxgpio.c | 4 +++- 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/sys/arch/armv7/armv7/armv7.c b/sys/arch/armv7/armv7/armv7.c index 880319e1d91..cea98b8d125 100644 --- a/sys/arch/armv7/armv7/armv7.c +++ b/sys/arch/armv7/armv7/armv7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7.c,v 1.6 2015/05/07 01:55:43 jsg Exp $ */ +/* $OpenBSD: armv7.c,v 1.7 2015/05/08 03:38:26 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -175,6 +175,27 @@ struct board_dev utilite_devs[] = { { 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 }, @@ -412,6 +433,11 @@ armv7_attach(struct device *parent, struct device *self, void *aux) 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(); diff --git a/sys/arch/armv7/armv7/armv7var.h b/sys/arch/armv7/armv7/armv7var.h index f232506f29b..9d0414c264e 100644 --- a/sys/arch/armv7/armv7/armv7var.h +++ b/sys/arch/armv7/armv7/armv7var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7var.h,v 1.3 2015/03/29 03:24:17 jsg Exp $ */ +/* $OpenBSD: armv7var.h,v 1.4 2015/05/08 03:38:26 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -76,6 +76,7 @@ int armv7_submatch(struct device *, void *, void *); #define BOARD_ID_IMX6_SABRELITE 3769 #define BOARD_ID_IMX6_SABRESD 3980 #define BOARD_ID_SUN4I_A10 4104 +#define BOARD_ID_IMX6_NOVENA 4269 #define BOARD_ID_IMX6_UTILITE 4273 #define BOARD_ID_SUN7I_A20 4283 #define BOARD_ID_IMX6_WANDBOARD 4412 diff --git a/sys/arch/armv7/imx/imx_machdep.c b/sys/arch/armv7/imx/imx_machdep.c index 684c3a6bbd7..cfc67ceeb4b 100644 --- a/sys/arch/armv7/imx/imx_machdep.c +++ b/sys/arch/armv7/imx/imx_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imx_machdep.c,v 1.11 2015/03/29 03:24:17 jsg Exp $ */ +/* $OpenBSD: imx_machdep.c,v 1.12 2015/05/08 03:38:26 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -62,6 +62,7 @@ platform_init_cons(void) /* UART2 */ case BOARD_ID_IMX6_SABRELITE: case BOARD_ID_IMX6_UDOO: + case BOARD_ID_IMX6_NOVENA: paddr = 0x021e8000; break; /* UART4 */ @@ -121,6 +122,10 @@ platform_print_board_type(void) 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"); diff --git a/sys/arch/armv7/imx/imxenet.c b/sys/arch/armv7/imx/imxenet.c index 556b4609678..c61eeccb927 100644 --- a/sys/arch/armv7/imx/imxenet.c +++ b/sys/arch/armv7/imx/imxenet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxenet.c,v 1.12 2015/03/29 03:24:17 jsg Exp $ */ +/* $OpenBSD: imxenet.c,v 1.13 2015/05/08 03:38:26 jsg Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -147,6 +147,8 @@ #define ENET_WANDBOARD_PHY 1 #define ENET_PHYFLEX_PHY 3 #define ENET_PHYFLEX_PHY_RST (2*32+23) +#define ENET_NOVENA_PHY 7 +#define ENET_NOVENA_PHY_RST (2*32+23) #define HREAD4(sc, reg) \ (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))) @@ -273,6 +275,13 @@ imxenet_attach(struct device *parent, struct device *self, void *args) imxgpio_set_bit(ENET_UDOO_PHY_RST); delay(1000 * 100); break; + case BOARD_ID_IMX6_NOVENA: + imxgpio_clear_bit(ENET_NOVENA_PHY_RST); + imxgpio_set_dir(ENET_NOVENA_PHY_RST, IMXGPIO_DIR_OUT); + delay(1000 * 10); + imxgpio_set_bit(ENET_NOVENA_PHY_RST); + delay(100); + break; } /* reset the controller */ @@ -416,6 +425,9 @@ imxenet_chip_init(struct imxenet_softc *sc) case BOARD_ID_IMX6_UTILITE: phy = ENET_UTILITE_PHY; break; + case BOARD_ID_IMX6_NOVENA: + phy = ENET_NOVENA_PHY; + break; case BOARD_ID_IMX6_WANDBOARD: phy = ENET_WANDBOARD_PHY; break; @@ -453,6 +465,7 @@ imxenet_chip_init(struct imxenet_softc *sc) break; case BOARD_ID_IMX6_PHYFLEX: case BOARD_ID_IMX6_SABRELITE: /* Micrel KSZ9021 */ + case BOARD_ID_IMX6_NOVENA: /* Micrel KSZ9021 */ /* prefer master mode */ imxenet_miibus_writereg(dev, phy, 0x9, 0x1f00); diff --git a/sys/arch/armv7/imx/imxesdhc.c b/sys/arch/armv7/imx/imxesdhc.c index 17f57820153..533673cbd51 100644 --- a/sys/arch/armv7/imx/imxesdhc.c +++ b/sys/arch/armv7/imx/imxesdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxesdhc.c,v 1.6 2015/03/29 03:24:17 jsg Exp $ */ +/* $OpenBSD: imxesdhc.c,v 1.7 2015/05/08 03:38:26 jsg Exp $ */ /* * Copyright (c) 2009 Dale Rahn * Copyright (c) 2006 Uwe Stuehler @@ -507,6 +507,19 @@ imxesdhc_card_detect(sdmmc_chipset_handle_t sch) } imxgpio_set_dir(gpio, IMXGPIO_DIR_IN); return imxgpio_get_bit(gpio) ? 0 : 1; + case BOARD_ID_IMX6_NOVENA: + switch (sc->unit) { + case 2: + gpio = 0*32 + 4; + break; + /* no card detect for uSD */ + case 3: + return 1; + default: + return 0; + } + imxgpio_set_dir(gpio, IMXGPIO_DIR_IN); + return imxgpio_get_bit(gpio) ? 0 : 1; case BOARD_ID_IMX6_WANDBOARD: switch (sc->unit) { case 0: diff --git a/sys/arch/armv7/imx/imxgpio.c b/sys/arch/armv7/imx/imxgpio.c index 325d638fa85..fa1924edd72 100644 --- a/sys/arch/armv7/imx/imxgpio.c +++ b/sys/arch/armv7/imx/imxgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxgpio.c,v 1.4 2015/01/02 01:57:33 jsg Exp $ */ +/* $OpenBSD: imxgpio.c,v 1.5 2015/05/08 03:38:26 jsg Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2012-2013 Patrick Wildt @@ -103,6 +103,7 @@ imxgpio_match(struct device *parent, void *v, void *aux) switch (board_id) { case BOARD_ID_IMX6_CUBOXI: case BOARD_ID_IMX6_HUMMINGBOARD: + case BOARD_ID_IMX6_NOVENA: case BOARD_ID_IMX6_PHYFLEX: case BOARD_ID_IMX6_SABRELITE: case BOARD_ID_IMX6_UDOO: @@ -130,6 +131,7 @@ imxgpio_attach(struct device *parent, struct device *self, void *args) switch (board_id) { case BOARD_ID_IMX6_CUBOXI: case BOARD_ID_IMX6_HUMMINGBOARD: + case BOARD_ID_IMX6_NOVENA: case BOARD_ID_IMX6_PHYFLEX: case BOARD_ID_IMX6_SABRELITE: case BOARD_ID_IMX6_UDOO: -- 2.20.1