CVS commit: src/sys/arch/arm/imx

2020-06-08 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Jun  8 07:48:58 UTC 2020

Modified Files:
src/sys/arch/arm/imx: imx6_ccm.c

Log Message:
Fix wrong divider setting.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/imx/imx6_ccm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.17 src/sys/arch/arm/imx/imx6_ccm.c:1.18
--- src/sys/arch/arm/imx/imx6_ccm.c:1.17	Fri Jun  5 02:30:54 2020
+++ src/sys/arch/arm/imx/imx6_ccm.c	Mon Jun  8 07:48:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.17 2020/06/05 02:30:54 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.18 2020/06/08 07:48:57 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.17 2020/06/05 02:30:54 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.18 2020/06/08 07:48:57 hkenken Exp $");
 
 #include "opt_cputypes.h"
 
@@ -1295,7 +1295,7 @@ imxccm_clk_set_rate_div(struct imxccm_so
 	KASSERT(parent != NULL);
 
 	u_int rate_parent = imxccm_clk_get_rate(sc, >base);
-	u_int divider = rate_parent / rate;
+	u_int divider = uimax(1, rate_parent / rate);
 
 	bus_space_handle_t ioh;
 	if (div->base == IMX6_CLK_REG_CCM_ANALOG)



CVS commit: src/sys/arch/arm/imx

2020-06-04 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jun  5 02:30:54 UTC 2020

Modified Files:
src/sys/arch/arm/imx: imx6_ccm.c

Log Message:
Fix indent.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/imx/imx6_ccm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.16 src/sys/arch/arm/imx/imx6_ccm.c:1.17
--- src/sys/arch/arm/imx/imx6_ccm.c:1.16	Fri Jun  5 02:28:10 2020
+++ src/sys/arch/arm/imx/imx6_ccm.c	Fri Jun  5 02:30:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.16 2020/06/05 02:28:10 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.17 2020/06/05 02:30:54 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.16 2020/06/05 02:28:10 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.17 2020/06/05 02:30:54 hkenken Exp $");
 
 #include "opt_cputypes.h"
 
@@ -1286,43 +1286,43 @@ static int
 imxccm_clk_set_rate_div(struct imxccm_softc *sc,
 struct imx6_clk *iclk, u_int rate)
 {
-struct imx6_clk_div *div = >clk.div;
-struct imx6_clk *parent;
+	struct imx6_clk_div *div = >clk.div;
+	struct imx6_clk *parent;
+
+	KASSERT(iclk->type == IMX6_CLK_DIV);
 
-KASSERT(iclk->type == IMX6_CLK_DIV);
+	parent = imx6_clk_find(iclk->parent);
+	KASSERT(parent != NULL);
 
-parent = imx6_clk_find(iclk->parent);
-KASSERT(parent != NULL);
+	u_int rate_parent = imxccm_clk_get_rate(sc, >base);
+	u_int divider = rate_parent / rate;
 
-u_int rate_parent = imxccm_clk_get_rate(sc, >base);
-u_int divider = rate_parent / rate;
-
-bus_space_handle_t ioh;
-if (div->base == IMX6_CLK_REG_CCM_ANALOG)
-ioh = sc->sc_ioh_analog;
-else
-ioh = sc->sc_ioh;
-
-uint32_t v = bus_space_read_4(sc->sc_iot, ioh, div->reg);
-v &= ~div->mask;
-if (div->type == IMX6_CLK_DIV_TABLE) {
-int n = -1;
-
-KASSERT(div->tbl != NULL);
-for (int i = 0; div->tbl[i] != 0; i++)
-if (div->tbl[i] == divider)
-n = i;
-
-if (n >= 0)
-v |= __SHIFTIN(n, div->mask);
-else
-return EINVAL;
-} else {
-v |= __SHIFTIN(divider - 1, div->mask);
-}
-bus_space_write_4(sc->sc_iot, ioh, div->reg, v);
+	bus_space_handle_t ioh;
+	if (div->base == IMX6_CLK_REG_CCM_ANALOG)
+		ioh = sc->sc_ioh_analog;
+	else
+		ioh = sc->sc_ioh;
 
-return 0;
+	uint32_t v = bus_space_read_4(sc->sc_iot, ioh, div->reg);
+	v &= ~div->mask;
+	if (div->type == IMX6_CLK_DIV_TABLE) {
+		int n = -1;
+
+		KASSERT(div->tbl != NULL);
+		for (int i = 0; div->tbl[i] != 0; i++)
+			if (div->tbl[i] == divider)
+n = i;
+
+		if (n >= 0)
+			v |= __SHIFTIN(n, div->mask);
+		else
+			return EINVAL;
+	} else {
+		v |= __SHIFTIN(divider - 1, div->mask);
+	}
+	bus_space_write_4(sc->sc_iot, ioh, div->reg, v);
+
+	return 0;
 }
 
 /*



CVS commit: src/sys/arch/arm/imx

2020-06-04 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jun  5 02:28:10 UTC 2020

Modified Files:
src/sys/arch/arm/imx: imx6_ccm.c

Log Message:
Fix KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/imx/imx6_ccm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.15 src/sys/arch/arm/imx/imx6_ccm.c:1.16
--- src/sys/arch/arm/imx/imx6_ccm.c:1.15	Tue Nov 12 04:32:36 2019
+++ src/sys/arch/arm/imx/imx6_ccm.c	Fri Jun  5 02:28:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.15 2019/11/12 04:32:36 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.16 2020/06/05 02:28:10 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.15 2019/11/12 04:32:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.16 2020/06/05 02:28:10 hkenken Exp $");
 
 #include "opt_cputypes.h"
 
@@ -1297,8 +1297,6 @@ imxccm_clk_set_rate_div(struct imxccm_so
 u_int rate_parent = imxccm_clk_get_rate(sc, >base);
 u_int divider = rate_parent / rate;
 
-KASSERT(div->tbl != NULL);
-
 bus_space_handle_t ioh;
 if (div->base == IMX6_CLK_REG_CCM_ANALOG)
 ioh = sc->sc_ioh_analog;
@@ -1309,6 +1307,8 @@ imxccm_clk_set_rate_div(struct imxccm_so
 v &= ~div->mask;
 if (div->type == IMX6_CLK_DIV_TABLE) {
 int n = -1;
+
+KASSERT(div->tbl != NULL);
 for (int i = 0; div->tbl[i] != 0; i++)
 if (div->tbl[i] == divider)
 n = i;



CVS commit: src/sys

2020-05-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed May 20 09:18:25 UTC 2020

Modified Files:
src/sys/arch/arm/imx: imxuart.c
src/sys/arch/arm/imx/fdt: files.imx6 imx6_spi.c
src/sys/arch/evbarm/conf: GENERIC files.generic
src/sys/conf: files
Added Files:
src/sys/arch/arm/imx/fdt: imx6_dwhdmi.c imx6_pwm.c
Removed Files:
src/sys/arch/evbarm/conf: IMX files.imx mk.imx std.imx

Log Message:
i.MX support merged into GENERIC kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/imxuart.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/fdt/imx6_dwhdmi.c \
src/sys/arch/arm/imx/fdt/imx6_pwm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/fdt/imx6_spi.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/evbarm/conf/GENERIC
cvs rdiff -u -r1.6 -r0 src/sys/arch/evbarm/conf/IMX
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/files.generic
cvs rdiff -u -r1.2 -r0 src/sys/arch/evbarm/conf/files.imx
cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/conf/mk.imx \
src/sys/arch/evbarm/conf/std.imx
cvs rdiff -u -r1.1266 -r1.1267 src/sys/conf/files

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxuart.c
diff -u src/sys/arch/arm/imx/imxuart.c:1.24 src/sys/arch/arm/imx/imxuart.c:1.25
--- src/sys/arch/arm/imx/imxuart.c:1.24	Wed Jan 15 01:09:56 2020
+++ src/sys/arch/arm/imx/imxuart.c	Wed May 20 09:18:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.24 2020/01/15 01:09:56 jmcneill Exp $ */
+/* $NetBSD: imxuart.c,v 1.25 2020/05/20 09:18:25 hkenken Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.24 2020/01/15 01:09:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.25 2020/05/20 09:18:25 hkenken Exp $");
 
 #include "opt_imxuart.h"
 #include "opt_ddb.h"
@@ -2083,8 +2083,6 @@ imxuart_load_pendings(struct imxuart_sof
 	sc->sc_pending = 0;
 }
 
-#if defined(IMXUARTCONSOLE) || defined(KGDB)
-
 /*
  * The following functions are polled getc and putc routines, shared
  * by the console and kgdb glue.
@@ -2171,7 +2169,6 @@ imxuart_common_putc(dev_t dev, struct im
 
 	splx(s);
 }
-#endif /* defined(IMXUARTCONSOLE) || defined(KGDB) */
 
 /*
  * Initialize UART
@@ -2236,7 +2233,6 @@ imxuart_init(struct imxuart_regs *regsp,
 }
 
 
-#ifdef	IMXUARTCONSOLE
 /*
  * Following are all routines needed for UART to act as console
  */
@@ -2295,8 +2291,6 @@ imxucnpollc(dev_t dev, int on)
 	imxuart_readahead_out = 0;
 }
 
-#endif	/* IMXUARTCONSOLE */
-
 #ifdef KGDB
 int
 imxuart_kgdb_attach(bus_space_tag_t iot, paddr_t iobase, u_int rate,

Index: src/sys/arch/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.8 src/sys/arch/arm/imx/fdt/files.imx6:1.9
--- src/sys/arch/arm/imx/fdt/files.imx6:1.8	Wed Jan 15 01:09:56 2020
+++ src/sys/arch/arm/imx/fdt/files.imx6	Wed May 20 09:18:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.8 2020/01/15 01:09:56 jmcneill Exp $
+#	$NetBSD: files.imx6,v 1.9 2020/05/20 09:18:25 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -10,12 +10,11 @@ defflag	opt_soc.h			SOC_IMX
 defflag	opt_soc.h			SOC_IMX6QDL: SOC_IMX
 
 # Clock
-device	imxccm : clk
+device	imxccm: clk
 attach	imxccm at fdt
 file	arch/arm/imx/imx6_ccm.c		imxccm
 file	arch/arm/imx/fdt/imx6_clk.c	imxccm
 
-
 # Common FDT clock framework
 define	imx_ccm
 file	arch/arm/imx/fdt/imx_ccm.c		imx_ccm
@@ -51,7 +50,7 @@ file	arch/arm/imx/imxgpio.c		imxgpio		ne
 file	arch/arm/imx/fdt/imx6_gpio.c	imxgpio
 
 # UART
-device	imxuart { } : bus_space_generic
+device	imxuart: tty
 attach	imxuart at fdt with imx6_com
 file	arch/arm/imx/imxuart.c		imxuart	needs-flag
 file	arch/arm/imx/fdt/imx6_com.c	imx6_com needs-flag
@@ -84,7 +83,6 @@ device	imx8mqusbphy
 attach	imx8mqusbphy at fdt
 file	arch/arm/imx/fdt/imx8mq_usbphy.c	imx8mqusbphy
 
-
 # SDMMC
 attach	sdhc at fdt with imx6_sdhc
 file	arch/arm/imx/fdt/imx6_sdhc.c	imx6_sdhc
@@ -102,9 +100,18 @@ file	arch/arm/imx/imxi2c.c			imxi2c
 file	arch/arm/imx/fdt/imx6_i2c.c		imxi2c
 
 # SPI bus controller
-device  imxspi : spibus
+device  imxspi: spibus
 attach	imxspi at fdt with imxspi_fdt
-filearch/arm/imx/imxspi.c			imxspi
+file	arch/arm/imx/imxspi.c			imxspi
 file	arch/arm/imx/fdt/imx6_spi.c		imxspi_fdt
 defparam opt_imxspi.h   	IMXSPINSLAVES
 
+# PWM
+device	imxpwm: pwm
+attach	imxpwm at fdt with imxpwm_fdt
+file	arch/arm/imx/imxpwm.c			imxpwm
+file	arch/arm/imx/fdt/imx6_pwm.c		imxpwm_fdt
+
+# HDMI TX (Designware based)
+attach	dwhdmi at fdt with imx6_dwhdmi
+file	arch/arm/imx/fdt/imx6_dwhdmi.c		imx6_dwhdmi

Index: src/sys/arch/arm/imx/fdt/imx6_spi.c
diff -u src/sys/arch/arm/imx/fdt/imx6_spi.c:1.3 src/sys/arch/arm/imx/fdt/imx6_spi.c:1.4
--- src/sys/arch/arm/imx/fdt/imx6_spi.c:1.3	Tue Dec  3 

CVS commit: src/sys/dev/fdt

2020-05-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed May 20 05:24:35 UTC 2020

Modified Files:
src/sys/dev/fdt: pwm_backlight.c

Log Message:
Modified debug message.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/pwm_backlight.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/fdt/pwm_backlight.c
diff -u src/sys/dev/fdt/pwm_backlight.c:1.7 src/sys/dev/fdt/pwm_backlight.c:1.8
--- src/sys/dev/fdt/pwm_backlight.c:1.7	Wed Jan 22 07:29:23 2020
+++ src/sys/dev/fdt/pwm_backlight.c	Wed May 20 05:24:35 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pwm_backlight.c,v 1.7 2020/01/22 07:29:23 mrg Exp $ */
+/* $NetBSD: pwm_backlight.c,v 1.8 2020/05/20 05:24:35 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.7 2020/01/22 07:29:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.8 2020/05/20 05:24:35 hkenken Exp $");
 
 #include 
 #include 
@@ -146,7 +146,9 @@ pwm_backlight_set(struct pwm_backlight_s
 	if (index >= sc->sc_nlevels)
 		return;
 
-	aprint_debug_dev(sc->sc_dev, "set duty cycle to %u%%\n", sc->sc_levels[index]);
+	KASSERT(sc->sc_levels[sc->sc_nlevels - 1] != 0);
+	aprint_debug_dev(sc->sc_dev, "set duty cycle to %u%%\n",
+	(100 * sc->sc_levels[index]) / sc->sc_levels[sc->sc_nlevels - 1]);
 
 	pwm_disable(sc->sc_pwm);
 	pwm_get_config(sc->sc_pwm, );



CVS commit: src/sys/arch

2020-05-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed May 20 05:10:42 UTC 2020

Modified Files:
src/sys/arch/arm/imx: files.imx51 imx51_pwm.c imxpwm.c imxpwmreg.h
imxpwmvar.h
src/sys/arch/evbarm/netwalker: netwalker_backlight.c

Log Message:
Use kernel API of PWM subsystems for i.MX PWM driver.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_pwm.c \
src/sys/arch/arm/imx/imxpwm.c src/sys/arch/arm/imx/imxpwmreg.h \
src/sys/arch/arm/imx/imxpwmvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/netwalker/netwalker_backlight.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.20 src/sys/arch/arm/imx/files.imx51:1.21
--- src/sys/arch/arm/imx/files.imx51:1.20	Sat Oct 12 06:46:13 2019
+++ src/sys/arch/arm/imx/files.imx51	Wed May 20 05:10:42 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.20 2019/10/12 06:46:13 skrll Exp $
+#	$NetBSD: files.imx51,v 1.21 2020/05/20 05:10:42 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -137,6 +137,6 @@ defparam opt_imxspi.hIMXSPI_DEBUG
 # file	arch/arm/imx/imx51_i2s.c		imxi2s needs-flag
 
 # PWM controller
-device	imxpwm
+device	imxpwm: pwm
 file	arch/arm/imx/imxpwm.c			imxpwm
 file	arch/arm/imx/imx51_pwm.c		imxpwm

Index: src/sys/arch/arm/imx/imx51_pwm.c
diff -u src/sys/arch/arm/imx/imx51_pwm.c:1.1 src/sys/arch/arm/imx/imx51_pwm.c:1.2
--- src/sys/arch/arm/imx/imx51_pwm.c:1.1	Tue May  6 11:22:53 2014
+++ src/sys/arch/arm/imx/imx51_pwm.c	Wed May 20 05:10:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_pwm.c,v 1.1 2014/05/06 11:22:53 hkenken Exp $	*/
+/*	$NetBSD: imx51_pwm.c,v 1.2 2020/05/20 05:10:42 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx51_pwm.c,v 1.1 2014/05/06 11:22:53 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_pwm.c,v 1.2 2020/05/20 05:10:42 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -62,10 +62,16 @@ imxpwm_attach(struct imxpwm_softc *sc, v
 
 	if (aa->aa_size == AXICF_SIZE_DEFAULT)
 		aa->aa_size = PWM_SIZE;
+
 	sc->sc_iot = aa->aa_iot;
 	sc->sc_intr = aa->aa_irq;
 	sc->sc_freq = imx51_get_clock(IMX51CLK_IPG_CLK_ROOT);
+
 	if (bus_space_map(aa->aa_iot, aa->aa_addr, aa->aa_size, 0, >sc_ioh))
 		panic("%s: couldn't map", device_xname(sc->sc_dev));
+
+	sc->sc_ih = intr_establish(sc->sc_intr, IPL_BIO, IST_LEVEL,
+	imxpwm_intr, sc);
+
 	imxpwm_attach_common(sc);
 }
Index: src/sys/arch/arm/imx/imxpwm.c
diff -u src/sys/arch/arm/imx/imxpwm.c:1.1 src/sys/arch/arm/imx/imxpwm.c:1.2
--- src/sys/arch/arm/imx/imxpwm.c:1.1	Tue May  6 11:22:53 2014
+++ src/sys/arch/arm/imx/imxpwm.c	Wed May 20 05:10:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxpwm.c,v 1.1 2014/05/06 11:22:53 hkenken Exp $	*/
+/*	$NetBSD: imxpwm.c,v 1.2 2020/05/20 05:10:42 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -27,88 +27,155 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxpwm.c,v 1.1 2014/05/06 11:22:53 hkenken Exp $");
-
-#include "opt_imx.h"
-#include "locators.h"
+__KERNEL_RCSID(0, "$NetBSD: imxpwm.c,v 1.2 2020/05/20 05:10:42 hkenken Exp $");
 
 #include 
 #include 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
-static inline uint32_t
-imxpwm_read(struct imxpwm_softc *sc, bus_size_t o)
-{
-	return bus_space_read_4(sc->sc_iot, sc->sc_ioh, o);
-}
+#include 
 
-static inline void
-imxpwm_write(struct imxpwm_softc *sc, bus_size_t o, uint32_t v)
-{
-	bus_space_write_4(sc->sc_iot, sc->sc_ioh, o, v);
-}
+#define	PWM_READ(sc, reg)		\
+	bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))
+#define	PWM_WRITE(sc, reg, val)		\
+	bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
 
-static int
+int
 imxpwm_intr(void *arg)
 {
 	struct imxpwm_softc *sc = arg;
-	uint32_t sts = imxpwm_read(sc, PWM_SR);
 
-	imxpwm_write(sc, PWM_SR, sts);
+	uint32_t sts = PWM_READ(sc, PWM_SR);
 
-	if ((sts & SR_ROV) && (sc->sc_handler != NULL))
-		sc->sc_handler(sc->sc_cookie);
+	if (sts & PWM_SR_ROV) {
+		if (sc->sc_handler != NULL)
+			sc->sc_handler(sc->sc_cookie);
+	}
+
+	PWM_WRITE(sc, PWM_SR, sts);
 
 	return 1;
 }
 
-void
-imxpwm_attach_common(struct imxpwm_softc *sc)
+static int
+imxpwm_enable(pwm_tag_t pwm, bool enable)
 {
-	uint32_t reg;
-	int div;
+	struct imxpwm_softc * const sc = device_private(pwm->pwm_dev);
+	uint32_t cr, ocr;
 
-	if (sc->sc_handler != NULL) {
-		sc->sc_ih = intr_establish(sc->sc_intr, IPL_BIO, IST_LEVEL,
-		imxpwm_intr, sc);
+	ocr = cr = PWM_READ(sc, PWM_CR);
+	if (enable)
+		cr |= PWM_CR_EN;
+	else
+		cr &= ~PWM_CR_EN;
 
-		reg = IR_RIE;
-		imxpwm_write(sc, PWM_IR, reg);
-	}
+	if (cr != ocr)
+		PWM_WRITE(sc, PWM_CR, cr);
 
-	if (sc->sc_hz <= 0)
-		sc->sc_hz = 

CVS commit: src/sys/arch/arm/imx/fdt

2019-12-04 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Dec  5 00:31:14 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_pcie.c

Log Message:
Remove unnecessary code.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/fdt/imx6_pcie.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/fdt/imx6_pcie.c
diff -u src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.5 src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.6
--- src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.5	Wed Oct 16 11:16:30 2019
+++ src/sys/arch/arm/imx/fdt/imx6_pcie.c	Thu Dec  5 00:31:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.5 2019/10/16 11:16:30 hkenken Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.6 2019/12/05 00:31:14 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.5 2019/10/16 11:16:30 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.6 2019/12/05 00:31:14 hkenken Exp $");
 
 #include "opt_pci.h"
 #include "opt_fdt.h"
@@ -204,10 +204,6 @@ imx6_pcie_attach(device_t parent, device
 		sc->sc_clk_pcie_ext_src = NULL;
 	}
 
-
-	TAILQ_INIT(>sc_intrs);
-	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM);
-
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error_dev(self, "failed to decode interrupt\n");
 		return;



CVS commit: src/sys/arch/arm/imx/fdt

2019-12-03 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Dec  3 10:32:53 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_spi.c

Log Message:
Remove FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_spi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/fdt/imx6_spi.c
diff -u src/sys/arch/arm/imx/fdt/imx6_spi.c:1.2 src/sys/arch/arm/imx/fdt/imx6_spi.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_spi.c:1.2	Fri Sep 27 02:59:21 2019
+++ src/sys/arch/arm/imx/fdt/imx6_spi.c	Tue Dec  3 10:32:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_spi.c,v 1.2 2019/09/27 02:59:21 hkenken Exp $	*/
+/*	$NetBSD: imx6_spi.c,v 1.3 2019/12/03 10:32:53 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_spi.c,v 1.2 2019/09/27 02:59:21 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_spi.c,v 1.3 2019/12/03 10:32:53 hkenken Exp $");
 
 #include "opt_imxspi.h"
 
@@ -157,7 +157,7 @@ imxspi_attach(device_t parent, device_t 
 	}
 
 	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_VM,
-	FDT_INTR_MPSAFE, imxspi_intr, >sc_imxspi);
+	0, imxspi_intr, >sc_imxspi);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
 		intrstr);



CVS commit: src/sys/arch/arm

2018-06-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 08:03:55 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: pl310.c
src/sys/arch/arm/fdt: files.fdt
Added Files:
src/sys/arch/arm/fdt: l2cc_fdt.c

Log Message:
Add l2cc support.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/cortex/pl310.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/l2cc_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/pl310.c
diff -u src/sys/arch/arm/cortex/pl310.c:1.17 src/sys/arch/arm/cortex/pl310.c:1.18
--- src/sys/arch/arm/cortex/pl310.c:1.17	Fri Feb 27 20:40:09 2015
+++ src/sys/arch/arm/cortex/pl310.c	Wed Jun 20 08:03:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pl310.c,v 1.17 2015/02/27 20:40:09 jmcneill Exp $	*/
+/*	$NetBSD: pl310.c,v 1.18 2018/06/20 08:03:55 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.17 2015/02/27 20:40:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.18 2018/06/20 08:03:55 hkenken Exp $");
 
 #include 
 #include 
@@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.
 static int arml2cc_match(device_t, cfdata_t, void *);
 static void arml2cc_attach(device_t, device_t, void *);
 
-#define	L2CC_BASE	0x2000
 #define	L2CC_SIZE	0x1000
 
 struct arml2cc_softc {
@@ -150,7 +149,7 @@ arml2cc_attach(device_t parent, device_t
 			aprint_normal(": not configured\n");
 			return;
 		}
-		off = L2CC_BASE;
+		off = mpcaa->mpcaa_off1;
 	}
 
 	arml2cc_sc = sc;

Index: src/sys/arch/arm/fdt/files.fdt
diff -u src/sys/arch/arm/fdt/files.fdt:1.16 src/sys/arch/arm/fdt/files.fdt:1.17
--- src/sys/arch/arm/fdt/files.fdt:1.16	Tue Jun  5 08:03:28 2018
+++ src/sys/arch/arm/fdt/files.fdt	Wed Jun 20 08:03:55 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.16 2018/06/05 08:03:28 hkenken Exp $
+# $NetBSD: files.fdt,v 1.17 2018/06/20 08:03:55 hkenken Exp $
 
 include	"dev/pckbport/files.pckbport"
 
@@ -25,6 +25,10 @@ device  gic: mpcorebus
 attach  gic at fdt with gic_fdt
 filearch/arm/fdt/gic_fdt.c 	gic_fdt
 
+device  l2cc: mpcorebus
+attach  l2cc at fdt with l2cc_fdt
+filearch/arm/fdt/l2cc_fdt.c 	l2cc_fdt
+
 attach	plcom at fdt with plcom_fdt
 file	arch/arm/fdt/plcom_fdt.c		plcom_fdt
 

Added files:

Index: src/sys/arch/arm/fdt/l2cc_fdt.c
diff -u /dev/null src/sys/arch/arm/fdt/l2cc_fdt.c:1.1
--- /dev/null	Wed Jun 20 08:03:55 2018
+++ src/sys/arch/arm/fdt/l2cc_fdt.c	Wed Jun 20 08:03:55 2018
@@ -0,0 +1,88 @@
+/*	$NetBSD: l2cc_fdt.c,v 1.1 2018/06/20 08:03:55 hkenken Exp $	*/
+/*
+ * Copyright (c) 2018  Genetec Corporation.  All rights reserved.
+ * Written by Hashimoto Kenichi for Genetec Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: l2cc_fdt.c,v 1.1 2018/06/20 08:03:55 hkenken Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+static int l2cc_fdt_match(device_t, cfdata_t, void *);
+static void l2cc_fdt_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(l2cc_fdt, 0, l2cc_fdt_match, l2cc_fdt_attach, NULL, NULL);
+
+static int
+l2cc_fdt_match(device_t parent, cfdata_t cf, void *aux)
+{
+	const char * const compatible[] = {
+		"arm,pl310-cache",
+		NULL
+	};
+	struct fdt_attach_args * const faa = aux;
+
+	return of_compatible(faa->faa_phandle, compatible) >= 0;
+}
+
+static void
+l2cc_fdt_attach(device_t parent, device_t self, void *aux)
+{
+	struct fdt_attach_args * const faa = aux;
+	const 

CVS commit: src/sys/arch/arm/imx

2018-06-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 07:08:35 UTC 2018

Modified Files:
src/sys/arch/arm/imx: imxuart.c

Log Message:
Move intr_establish() before imxuart_attach_subr().


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/imx/imxuart.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxuart.c
diff -u src/sys/arch/arm/imx/imxuart.c:1.20 src/sys/arch/arm/imx/imxuart.c:1.21
--- src/sys/arch/arm/imx/imxuart.c:1.20	Fri Sep  8 05:29:12 2017
+++ src/sys/arch/arm/imx/imxuart.c	Wed Jun 20 07:08:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.20 2017/09/08 05:29:12 hkenken Exp $ */
+/* $NetBSD: imxuart.c,v 1.21 2018/06/20 07:08:35 hkenken Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.20 2017/09/08 05:29:12 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.21 2018/06/20 07:08:35 hkenken Exp $");
 
 #include "opt_imxuart.h"
 #include "opt_ddb.h"
@@ -306,6 +306,13 @@ imxuart_attach_common(device_t parent, d
 	}
 	regsp->ur_ioh = ioh;
 
+	sc->sc_ih = intr_establish(sc->sc_intr, IPL_SERIAL, IST_LEVEL,
+	imxuintr, sc);
+	if (sc->sc_ih == NULL) {
+		aprint_error_dev(sc->sc_dev, "intr_establish failed\n");
+		return;
+	}
+
 	imxuart_attach_subr(sc);
 }
 
@@ -377,11 +384,6 @@ imxuart_attach_subr(struct imxuart_softc
 		}
 	}
 
-	sc->sc_ih = intr_establish(sc->sc_intr, IPL_SERIAL, IST_LEVEL,
-	imxuintr, sc);
-	if (sc->sc_ih == NULL)
-		aprint_error_dev(sc->sc_dev, "intr_establish failed\n");
-
 #ifdef KGDB
 	/*
 	 * Allow kgdb to "take over" this port.  If this is



CVS commit: src/sys/arch

2018-06-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 07:05:37 UTC 2018

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx6_ccm.c imx6_ccmreg.h imx6_reg.h
src/sys/arch/evbarm/nitrogen6: nitrogen6_usb.c

Log Message:
Modified CCM register defines.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx6_ccmreg.h \
src/sys/arch/arm/imx/imx6_reg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/nitrogen6/nitrogen6_usb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.13 src/sys/arch/arm/imx/files.imx6:1.14
--- src/sys/arch/arm/imx/files.imx6:1.13	Sat Mar 17 18:34:09 2018
+++ src/sys/arch/arm/imx/files.imx6	Wed Jun 20 07:05:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.13 2018/03/17 18:34:09 ryo Exp $
+#	$NetBSD: files.imx6,v 1.14 2018/06/20 07:05:37 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -36,6 +36,8 @@ device	imxccm
 attach	imxccm at axi
 file	arch/arm/imx/imx6_ccm.c			imxccm	needs-flag
 defflag opt_imx6clk.hIMXCCMDEBUG
+defparam opt_imx6clk.hIMX6_OSC_FREQ
+defparam opt_imx6clk.hIMX6_CKIL_FREQ
 
 # iMX6 Enhanced Periodic Interrupt Timer
 device	imxclock

Index: src/sys/arch/arm/imx/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.8 src/sys/arch/arm/imx/imx6_ccm.c:1.9
--- src/sys/arch/arm/imx/imx6_ccm.c:1.8	Wed May 23 10:42:05 2018
+++ src/sys/arch/arm/imx/imx6_ccm.c	Wed Jun 20 07:05:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.8 2018/05/23 10:42:05 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.9 2018/06/20 07:05:37 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.8 2018/05/23 10:42:05 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.9 2018/06/20 07:05:37 hkenken Exp $");
 
 #include "opt_imx.h"
 #include "opt_imx6clk.h"
@@ -556,7 +556,7 @@ imx6_get_clock(enum imx6_clock_id clk)
 		break;
 	case IMX6CLK_PLL7:
 		v = imx6_ccm_analog_read(CCM_ANALOG_PLL_USB2);
-		freq = IMX6_OSC_FREQ * ((v & CCM_ANALOG_PLL_USBn_DIV_SELECT) ? 22 : 20);
+		freq = IMX6_OSC_FREQ * ((v & CCM_ANALOG_PLL_DIV_SELECT) ? 22 : 20);
 		break;
 
 #if 0
@@ -899,7 +899,7 @@ imx6_pll_power(uint32_t pllreg, int on, 
 		v = imx6_ccm_analog_read(pllreg);
 		if (on) {
 			v |= en;
-			v &= ~CCM_ANALOG_PLL_USBn_BYPASS;
+			v &= ~CCM_ANALOG_PLL_BYPASS;
 		} else {
 			v &= ~en;
 		}

Index: src/sys/arch/arm/imx/imx6_ccmreg.h
diff -u src/sys/arch/arm/imx/imx6_ccmreg.h:1.7 src/sys/arch/arm/imx/imx6_ccmreg.h:1.8
--- src/sys/arch/arm/imx/imx6_ccmreg.h:1.7	Wed May 23 10:42:05 2018
+++ src/sys/arch/arm/imx/imx6_ccmreg.h	Wed Jun 20 07:05:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccmreg.h,v 1.7 2018/05/23 10:42:05 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccmreg.h,v 1.8 2018/06/20 07:05:37 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -44,6 +44,9 @@
 #ifndef IMX6_OSC_FREQ
 #define IMX6_OSC_FREQ	(24 * 1000 * 1000)	/* 24MHz */
 #endif
+#ifndef IMX6_CKIL_FREQ
+#define IMX6_CKIL_FREQ	32768
+#endif
 
 #define CCM_CCR	0x
 #define  CCM_CCR_RBC_EN__BIT(27)
@@ -292,6 +295,9 @@
 #define  CCM_CCGR6_USBOH3_CLK_ENABLE		__BITS(1, 0)
 
 #define CCM_ANALOG_PLL_ARM			0x	/* = 020c8000 */
+#define CCM_ANALOG_PLL_ARM_SET			0x0004
+#define CCM_ANALOG_PLL_ARM_CLR			0x0008
+#define CCM_ANALOG_PLL_ARM_TOG			0x000c
 #define  CCM_ANALOG_PLL_ARM_LOCK		__BIT(31)
 #define  CCM_ANALOG_PLL_ARM_PLL_SEL		__BIT(19)
 #define  CCM_ANALOG_PLL_ARM_LVDS_24MHZ_SEL	__BIT(18)
@@ -302,10 +308,13 @@
 #define  CCM_ANALOG_PLL_ARM_POWERDOWN		__BIT(12)
 #define  CCM_ANALOG_PLL_ARM_DIV_SELECT		__BITS(6, 0)
 
-#define CCM_ANALOG_PLL_ARM_SET			0x0004
-#define CCM_ANALOG_PLL_ARM_CLR			0x0008
-#define CCM_ANALOG_PLL_ARM_TOG			0x000c
-#define  CCM_ANALOG_PLL_ARM_DIV_SELECT		__BITS(6, 0)
+#define  CCM_ANALOG_PLL_LOCK			__BIT(31)
+#define  CCM_ANALOG_PLL_BYPASS			__BIT(16)
+#define  CCM_ANALOG_PLL_BYPASS_CLK_SRC		__BITS(15, 14)
+#define  CCM_ANALOG_PLL_ENABLE			__BIT(13)
+#define  CCM_ANALOG_PLL_POWER			__BIT(12)
+#define  CCM_ANALOG_PLL_EN_USB_CLK		__BIT(6)
+#define  CCM_ANALOG_PLL_DIV_SELECT		__BITS(1, 0)
 
 #define CCM_ANALOG_PLL_USB1			0x0010
 #define CCM_ANALOG_PLL_USB1_SET			0x0014
@@ -331,14 +340,6 @@
 #define  CCM_ANALOG_PLL_USB2_EN_USB_CLK		__BIT(6)
 #define  CCM_ANALOG_PLL_USB2_DIV_SELECT		__BITS(1, 0)
 
-#define  CCM_ANALOG_PLL_USBn_LOCK		__BIT(31)
-#define  CCM_ANALOG_PLL_USBn_BYPASS		__BIT(16)
-#define  CCM_ANALOG_PLL_USBn_BYPASS_CLK_SRC	__BITS(15, 14)
-#define  CCM_ANALOG_PLL_USBn_ENABLE		__BIT(13)
-#define  CCM_ANALOG_PLL_USBn_POWER		__BIT(12)
-#define  CCM_ANALOG_PLL_USBn_EN_USB_CLK		__BIT(6)

CVS commit: src/sys/arch/arm/imx

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:59:22 UTC 2018

Modified Files:
src/sys/arch/arm/imx: imx6_board.c

Log Message:
Rename a9tmr to arma9tmr.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_board.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_board.c
diff -u src/sys/arch/arm/imx/imx6_board.c:1.9 src/sys/arch/arm/imx/imx6_board.c:1.10
--- src/sys/arch/arm/imx/imx6_board.c:1.9	Thu Nov  9 05:57:23 2017
+++ src/sys/arch/arm/imx/imx6_board.c	Wed Jun 20 05:59:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_board.c,v 1.9 2017/11/09 05:57:23 hkenken Exp $	*/
+/*	$NetBSD: imx6_board.c,v 1.10 2018/06/20 05:59:22 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.9 2017/11/09 05:57:23 hkenken Exp $");
+__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.10 2018/06/20 05:59:22 hkenken Exp $");
 
 #include "opt_imx.h"
 #include "arml2cc.h"
@@ -219,7 +219,8 @@ imx6_device_register(device_t self, void
 	 * We need to tell the A9 Global/Watchdog Timer
 	 * what frequency it runs at.
 	 */
-	if (device_is_a(self, "a9tmr") || device_is_a(self, "a9wdt")) {
+	if (device_is_a(self, "arma9tmr") ||
+	device_is_a(self, "a9wdt")) {
 		prop_dictionary_set_uint32(dict, "frequency",
 		   imx6_armrootclk() / IMX6_PERIPHCLK_N);
 		return;



CVS commit: src/sys/arch/arm/imx

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:53:19 UTC 2018

Modified Files:
src/sys/arch/arm/imx: imx6_ahcisata.c

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx6_ahcisata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.7 src/sys/arch/arm/imx/imx6_ahcisata.c:1.8
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.7	Wed May 23 10:42:05 2018
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Wed Jun 20 05:53:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.7 2018/05/23 10:42:05 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.8 2018/06/20 05:53:19 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.7 2018/05/23 10:42:05 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.8 2018/06/20 05:53:19 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -59,7 +59,7 @@ static int imx6_ahcisata_match(device_t,
 static void imx6_ahcisata_attach(device_t, device_t, void *);
 static int imx6_ahcisata_detach(device_t, int);
 
-static int ixm6_ahcisata_init(struct imx_ahci_softc *);
+static int imx6_ahcisata_init(struct imx_ahci_softc *);
 static int imx6_ahcisata_phy_ctrl(struct imx_ahci_softc *, uint32_t, int);
 static int imx6_ahcisata_phy_addr(struct imx_ahci_softc *, uint32_t);
 static int imx6_ahcisata_phy_write(struct imx_ahci_softc *, uint32_t, uint16_t);
@@ -114,7 +114,7 @@ imx6_ahcisata_attach(device_t parent, de
 		return;
 	}
 
-	if (ixm6_ahcisata_init(sc) != 0) {
+	if (imx6_ahcisata_init(sc) != 0) {
 		aprint_error_dev(self, "couldn't init ahci\n");
 		return;
 	}
@@ -257,7 +257,7 @@ imx6_ahcisata_phy_read(struct imx_ahci_s
 }
 
 static int
-ixm6_ahcisata_init(struct imx_ahci_softc *sc)
+imx6_ahcisata_init(struct imx_ahci_softc *sc)
 {
 	uint32_t v;
 	int timeout, pllstat;



CVS commit: src/sys/arch/arm/fdt

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:50:09 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Support Cortex-A9 (addr_d > addr_c).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/fdt/gic_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.9 src/sys/arch/arm/fdt/gic_fdt.c:1.10
--- src/sys/arch/arm/fdt/gic_fdt.c:1.9	Wed Jun  6 19:49:51 2018
+++ src/sys/arch/arm/fdt/gic_fdt.c	Wed Jun 20 05:50:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.9 2018/06/06 19:49:51 jakllsch Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.10 2018/06/20 05:50:09 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.9 2018/06/06 19:49:51 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.10 2018/06/20 05:50:09 hkenken Exp $");
 
 #include 
 #include 
@@ -140,8 +140,9 @@ gic_fdt_attach(device_t parent, device_t
 		return;
 	}
 
-	const bus_addr_t addr = addr_d;
-	const bus_size_t size = (addr_c + size_c) - addr_d;
+	const bus_addr_t addr = min(addr_d, addr_c);
+	const bus_size_t end = max(addr_d + size_d, addr_c + size_c);
+	const bus_size_t size = end - addr;
 
 	error = bus_space_map(faa->faa_bst, addr, size, 0, );
 	if (error) {
@@ -153,8 +154,8 @@ gic_fdt_attach(device_t parent, device_t
 		.mpcaa_name = "armgic",
 		.mpcaa_memt = faa->faa_bst,
 		.mpcaa_memh = bsh,
-		.mpcaa_off1 = 0,
-		.mpcaa_off2 = addr_c - addr_d
+		.mpcaa_off1 = addr_d - addr,
+		.mpcaa_off2 = addr_c - addr,
 	};
 
 	config_found(self, , NULL);



CVS commit: src/sys/arch/arm/cortex

2018-06-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jun 20 05:01:40 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: a9tmr.c a9tmr_var.h

Log Message:
Use mpcaa_off1 parameter for mapping subregion.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/cortex/a9tmr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/cortex/a9tmr_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/a9tmr.c
diff -u src/sys/arch/arm/cortex/a9tmr.c:1.15 src/sys/arch/arm/cortex/a9tmr.c:1.16
--- src/sys/arch/arm/cortex/a9tmr.c:1.15	Tue Jun  5 08:03:28 2018
+++ src/sys/arch/arm/cortex/a9tmr.c	Wed Jun 20 05:01:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9tmr.c,v 1.15 2018/06/05 08:03:28 hkenken Exp $	*/
+/*	$NetBSD: a9tmr.c,v 1.16 2018/06/20 05:01:39 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.15 2018/06/05 08:03:28 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.16 2018/06/20 05:01:39 hkenken Exp $");
 
 #include 
 #include 
@@ -147,12 +147,8 @@ a9tmr_attach(device_t parent, device_t s
 	evcnt_attach_dynamic(>sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "missing interrupts");
 
-	bus_space_subregion(sc->sc_memt, sc->sc_memh, 
-	TMR_GLOBAL_BASE, TMR_GLOBAL_SIZE, >sc_global_memh);
-	bus_space_subregion(sc->sc_memt, sc->sc_memh, 
-	TMR_PRIVATE_BASE, TMR_PRIVATE_SIZE, >sc_private_memh);
-	bus_space_subregion(sc->sc_memt, sc->sc_memh, 
-	TMR_WDOG_BASE, TMR_WDOG_SIZE, >sc_wdog_memh);
+	bus_space_subregion(sc->sc_memt, sc->sc_memh,
+	mpcaa->mpcaa_off1, TMR_GLOBAL_SIZE, >sc_global_memh);
 
 	if (mpcaa->mpcaa_irq != -1) {
 		sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK,

Index: src/sys/arch/arm/cortex/a9tmr_var.h
diff -u src/sys/arch/arm/cortex/a9tmr_var.h:1.5 src/sys/arch/arm/cortex/a9tmr_var.h:1.6
--- src/sys/arch/arm/cortex/a9tmr_var.h:1.5	Tue Jun  5 08:03:28 2018
+++ src/sys/arch/arm/cortex/a9tmr_var.h	Wed Jun 20 05:01:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr_var.h,v 1.5 2018/06/05 08:03:28 hkenken Exp $ */
+/* $NetBSD: a9tmr_var.h,v 1.6 2018/06/20 05:01:39 hkenken Exp $ */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,8 +36,6 @@ struct a9tmr_softc {
 	bus_space_tag_t sc_memt;
 	bus_space_handle_t sc_memh;
 	bus_space_handle_t sc_global_memh;
-	bus_space_handle_t sc_private_memh;
-	bus_space_handle_t sc_wdog_memh;
 	struct evcnt sc_ev_missing_ticks;
 	uint32_t sc_freq;
 	u_long sc_autoinc;



CVS commit: src/sys

2018-06-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jun  5 08:03:29 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_board.c
src/sys/arch/arm/cortex: a9tmr.c a9tmr_var.h armperiph.c files.cortex
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/arm/zynq: zynq7000_board.c
src/sys/arch/evbarm/amlogic: amlogic_machdep.c
src/sys/arch/evbarm/beagle: beagle_machdep.c
src/sys/arch/evbarm/conf: BCM5301X BCM56340 CUBOX-I DUOVERO GOLDENGATE
HUMMINGBOARD NITROGEN6X ODROID-C1 PANDABOARD PARALLELLA ZEDBOARD
src/sys/arch/evbarm/gumstix: gumstix_machdep.c
src/sys/dev: DEVNAMES
Added Files:
src/sys/arch/arm/fdt: a9tmr_fdt.c

Log Message:
Rename ARM A9 Global Timer driver name to support fdt.

- Rename a9tmr to arma9tmr.
- Add a9tmr_fdt.c based gtmr_fdt.c.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/broadcom/bcm53xx_board.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/cortex/a9tmr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/cortex/a9tmr_var.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/cortex/armperiph.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/a9tmr_fdt.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/zynq/zynq7000_board.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/amlogic/amlogic_machdep.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbarm/conf/BCM5301X
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/BCM56340 \
src/sys/arch/evbarm/conf/NITROGEN6X
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/conf/CUBOX-I
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/DUOVERO
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/conf/GOLDENGATE
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/HUMMINGBOARD \
src/sys/arch/evbarm/conf/PARALLELLA src/sys/arch/evbarm/conf/ZEDBOARD
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/conf/ODROID-C1
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/PANDABOARD
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.310 -r1.311 src/sys/dev/DEVNAMES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/broadcom/bcm53xx_board.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_board.c:1.23 src/sys/arch/arm/broadcom/bcm53xx_board.c:1.24
--- src/sys/arch/arm/broadcom/bcm53xx_board.c:1.23	Thu Oct 20 09:53:07 2016
+++ src/sys/arch/arm/broadcom/bcm53xx_board.c	Tue Jun  5 08:03:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_board.c,v 1.23 2016/10/20 09:53:07 skrll Exp $	*/
+/*	$NetBSD: bcm53xx_board.c,v 1.24 2018/06/05 08:03:28 hkenken Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.23 2016/10/20 09:53:07 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_board.c,v 1.24 2018/06/05 08:03:28 hkenken Exp $");
 
 #include 
 #include 
@@ -615,7 +615,7 @@ bcm53xx_device_register(device_t self, v
 	 * We need to tell the A9 Global/Watchdog Timer
 	 * what frequency it runs at.
 	 */
-	if (device_is_a(self, "a9tmr") || device_is_a(self, "a9wdt")) {
+	if (device_is_a(self, "arma9tmr") || device_is_a(self, "a9wdt")) {
 		/*
 		 * This clock always runs at (arm_clk div 2) and only goes
 		 * to timers that are part of the A9 MP core subsystem.

Index: src/sys/arch/arm/cortex/a9tmr.c
diff -u src/sys/arch/arm/cortex/a9tmr.c:1.14 src/sys/arch/arm/cortex/a9tmr.c:1.15
--- src/sys/arch/arm/cortex/a9tmr.c:1.14	Fri Jul 24 05:20:01 2015
+++ src/sys/arch/arm/cortex/a9tmr.c	Tue Jun  5 08:03:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9tmr.c,v 1.14 2015/07/24 05:20:01 ryo Exp $	*/
+/*	$NetBSD: a9tmr.c,v 1.15 2018/06/05 08:03:28 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.14 2015/07/24 05:20:01 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.15 2018/06/05 08:03:28 hkenken Exp $");
 
 #include 
 #include 
@@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.
 static int a9tmr_match(device_t, cfdata_t, void *);
 static void a9tmr_attach(device_t, device_t, void *);
 
-static int clockhandler(void *);
-
 static u_int a9tmr_get_timecount(struct timecounter *);
 
 static struct a9tmr_softc a9tmr_sc;
@@ -69,7 +67,7 @@ static struct timecounter a9tmr_timecoun
 	.tc_next = NULL,
 };
 
-CFATTACH_DECL_NEW(a9tmr, 0, a9tmr_match, a9tmr_attach, NULL, NULL);
+CFATTACH_DECL_NEW(arma9tmr, 0, a9tmr_match, a9tmr_attach, NULL, NULL);
 
 static inline uint32_t
 a9tmr_global_read(struct a9tmr_softc *sc, bus_size_t o)
@@ -126,7 +124,10 @@ a9tmr_attach(device_t parent, device_t s
 	 * This runs at the ARM PERIPHCLOCK which should be 1/2 of the CPU clock.
 	 * 

CVS commit: src/sys/arch/arm/imx

2018-05-23 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed May 23 10:42:05 UTC 2018

Modified Files:
src/sys/arch/arm/imx: imx6_ahcisata.c imx6_ccm.c imx6_ccmreg.h
imx6_pcie.c imx6_usb.c imx6_usdhc.c

Log Message:
Modified CCM register defines.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_ahcisata.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_pcie.c \
src/sys/arch/arm/imx/imx6_usdhc.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_usb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.6 src/sys/arch/arm/imx/imx6_ahcisata.c:1.7
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.6	Thu Nov  9 05:57:23 2017
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Wed May 23 10:42:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.6 2017/11/09 05:57:23 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.7 2018/05/23 10:42:05 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.6 2017/11/09 05:57:23 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.7 2018/05/23 10:42:05 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -264,7 +264,7 @@ ixm6_ahcisata_init(struct imx_ahci_softc
 
 	/* AHCISATA clock enable */
 	v = imx6_ccm_read(CCM_CCGR5);
-	imx6_ccm_write(CCM_CCGR5, v | CCM_CCGR5_100M_CLK_ENABLE(3));
+	imx6_ccm_write(CCM_CCGR5, v | __SHIFTIN(3, CCM_CCGR5_SATA_CLK_ENABLE));
 
 	/* PLL power up */
 	if (imx6_pll_power(CCM_ANALOG_PLL_ENET, 1,
Index: src/sys/arch/arm/imx/imx6_ccmreg.h
diff -u src/sys/arch/arm/imx/imx6_ccmreg.h:1.6 src/sys/arch/arm/imx/imx6_ccmreg.h:1.7
--- src/sys/arch/arm/imx/imx6_ccmreg.h:1.6	Thu Nov  9 05:57:23 2017
+++ src/sys/arch/arm/imx/imx6_ccmreg.h	Wed May 23 10:42:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccmreg.h,v 1.6 2017/11/09 05:57:23 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccmreg.h,v 1.7 2018/05/23 10:42:05 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -163,7 +163,6 @@
 #define  CCM_CHSCCDR_IPU1_DI0_PODF		__BITS(5, 3)
 #define  CCM_CHSCCDR_IPU1_DI0_CLK_SEL		__BITS(2, 0)
 
-
 #define CCM_CSCDR20x0038
 #define  CCM_CSCDR2_ECSPI_CLK_PODF		__BITS(24, 19)
 #define  CCM_CSCDR2_IPU2_DI1_PRE_CLK_SEL	__BITS(17, 15)
@@ -189,65 +188,108 @@
 #define  CCM_CSCDR3_IPU1_HSP_CLK_SEL		__BITS(10, 9)
 
 #define CCM_CCOSR0x0060
-#define  CCM_CCOSR_CLKO2_EN	__BIT(24)
-#define  CCM_CCOSR_CLKO2_DIV	__BITS(23, 21)
-#define  CCM_CCOSR_CLKO2_SEL	__BITS(20, 16)
-#define  CCM_CCOSR_CLK_OUT_SEL	__BIT(8)
-#define  CCM_CCOSR_CLKO1_EN	__BIT(7)
-#define  CCM_CCOSR_CLKO1_DIV	__BITS(6, 4)
-#define  CCM_CCOSR_CLKO1_SEL	__BITS(3, 0)
-
-#define CCM_CCGR2		0x0070
-#define  CCM_CCGR2_IPSYNC_VDOA_IPG_CLK_ENABLE(n)		__SHIFTIN(n, __BITS(27, 26))
-#define  CCM_CCGR2_IPSYNC_IP2APB_TZASC2_IPG_CLK_ENABLE(n)   __SHIFTIN(n, __BITS(25, 24))
-#define  CCM_CCGR2_IPSYNC_IP2APB_TZASC1_IPG_CLK_ENABLE(n)   __SHIFTIN(n, __BITS(23, 22))
-#define  CCM_CCGR2_IPMUX3_CLK_ENABLE(n)__SHIFTIN(n, __BITS(21, 20))
-#define  CCM_CCGR2_IPMUX2_CLK_ENABLE(n)__SHIFTIN(n, __BITS(19, 18))
-#define  CCM_CCGR2_IPMUX1_CLK_ENABLE(n)__SHIFTIN(n, __BITS(17, 16))
-#define  CCM_CCGR2_IOMUX_IPT_CLK_IO_CLK_ENABLE(n)		__SHIFTIN(n, __BITS(15, 14))
-#define  CCM_CCGR2_IIM_CLK_ENABLE(n)__SHIFTIN(n, __BITS(13, 12))
-#define  CCM_CCGR2_I2C3_SERIAL_CLK_ENABLE(n)			__SHIFTIN(n, __BITS(11, 10))
-#define  CCM_CCGR2_I2C2_SERIAL_CLK_ENABLE(n)			__SHIFTIN(n, __BITS(9, 8))
-#define  CCM_CCGR2_I2C1_SERIAL_CLK_ENABLE(n)			__SHIFTIN(n, __BITS(7, 6))
-#define  CCM_CCGR2_HDMI_TX_ISFRCLK_ENABLE(n)			__SHIFTIN(n, __BITS(5, 4))
-#define  CCM_CCGR2_HDMI_TX_IAHBCLK_ENABLE(n)			__SHIFTIN(n, __BITS(1, 0))
-#define CCM_CCGR4	0x0078
-#define  CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_CLK_ENABLE(N)		__SHIFTIN(n, __BITS(31, 30))
-#define  CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_CLK_ENABLE(n) 	__SHIFTIN(n, __BITS(29, 28))
-#define  CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_CLK_ENABLE(n)		__SHIFTIN(n, __BITS(27, 26))
-#define  CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_CLK_ENABLE(n)		__SHIFTIN(n, __BITS(25, 24))
-#define  CCM_CCGR4_PWM4_CLK_ENABLE(n)	__SHIFTIN(n, __BITS(23, 22))
-#define  CCM_CCGR4_PWM3_CLK_ENABLE(n)	__SHIFTIN(n, __BITS(21, 20))
-#define  CCM_CCGR4_PWM2_CLK_ENABLE(n)	__SHIFTIN(n, __BITS(19, 18))
-#define  CCM_CCGR4_PWM1_CLK_ENABLE(n)	__SHIFTIN(n, __BITS(17, 16))
-#define  CCM_CCGR4_PL301_MX6QPER2_MAINCLK_ENABLE(n)			__SHIFTIN(n, __BITS(15, 14))
-#define  CCM_CCGR4_PL301_MX6QPER1_BCHCLK_ENABLE(n)			__SHIFTIN(n, __BITS(13, 12))
-#define  CCM_CCGR4_CG5_ENABLE(n)	__SHIFTIN(n, __BITS(11, 10))
-#define  

CVS commit: src/sys/arch

2017-11-08 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov  9 05:57:23 UTC 2017

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx6_ahcisata.c imx6_axi.c
imx6_board.c imx6_ccm.c imx6_ccmreg.h imx6_ccmvar.h imx6_pcie.c
imx6_reg.h
src/sys/arch/evbarm/conf: CUBOX-I HUMMINGBOARD IMX6UL-STARTER
NITROGEN6X
src/sys/arch/evbarm/nitrogen6: nitrogen6_usb.c
Added Files:
src/sys/arch/arm/imx: imx6_usbphy.c imx6_usbphyreg.h

Log Message:
- Add imxusbphy driver for i.MX6.
- Clean up CCM (Clock driver).
  Add imx6_ccm_analog_read/write() functions.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_ahcisata.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_axi.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_ccm.c \
src/sys/arch/arm/imx/imx6_reg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_ccmvar.h \
src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx6_usbphy.c \
src/sys/arch/arm/imx/imx6_usbphyreg.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/CUBOX-I
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/HUMMINGBOARD
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/IMX6UL-STARTER
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/NITROGEN6X
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/nitrogen6/nitrogen6_usb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.11 src/sys/arch/arm/imx/files.imx6:1.12
--- src/sys/arch/arm/imx/files.imx6:1.11	Fri Sep  8 05:29:12 2017
+++ src/sys/arch/arm/imx/files.imx6	Thu Nov  9 05:57:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.11 2017/09/08 05:29:12 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.12 2017/11/09 05:57:23 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -90,6 +90,11 @@ file	arch/arm/imx/if_enet_imx6.c		enet
 device	imxusbc { unit, irq } : bus_dma_generic
 file	arch/arm/imx/imx6_usb.c			imxusbc
 
+# USB Phy
+device	imxusbphy
+attach	imxusbphy at axi
+file	arch/arm/imx/imx6_usbphy.c		imxusbphy
+
 attach	ehci at imxusbc with imxehci
 file	arch/arm/imx/imxusb.c			imxehci
 

Index: src/sys/arch/arm/imx/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.5 src/sys/arch/arm/imx/imx6_ahcisata.c:1.6
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.5	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Thu Nov  9 05:57:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.5 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.6 2017/11/09 05:57:23 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.5 2017/06/09 18:14:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.6 2017/11/09 05:57:23 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -273,9 +273,9 @@ ixm6_ahcisata_init(struct imx_ahci_softc
 		"couldn't enable CCM_ANALOG_PLL_ENET\n");
 		return -1;
 	}
-	v = imx6_ccm_read(CCM_ANALOG_PLL_ENET);
+	v = imx6_ccm_analog_read(CCM_ANALOG_PLL_ENET);
 	v |= CCM_ANALOG_PLL_ENET_ENABLE_100M;
-	imx6_ccm_write(CCM_ANALOG_PLL_ENET, v);
+	imx6_ccm_analog_write(CCM_ANALOG_PLL_ENET, v);
 
 	v = iomux_read(IOMUX_GPR13);
 	/* clear */
Index: src/sys/arch/arm/imx/imx6_ccmreg.h
diff -u src/sys/arch/arm/imx/imx6_ccmreg.h:1.5 src/sys/arch/arm/imx/imx6_ccmreg.h:1.6
--- src/sys/arch/arm/imx/imx6_ccmreg.h:1.5	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/imx6_ccmreg.h	Thu Nov  9 05:57:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccmreg.h,v 1.5 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: imx6_ccmreg.h,v 1.6 2017/11/09 05:57:23 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -45,14 +45,29 @@
 #define IMX6_OSC_FREQ	(24 * 1000 * 1000)	/* 24MHz */
 #endif
 
-#define IMX6_CCM_SIZE0x8000
-		/* 0x = 0x020c4000 */
 #define CCM_CCR	0x
+#define  CCM_CCR_RBC_EN__BIT(27)
+#define  CCM_CCR_REG_BYPASS_COUNT		__BITS(26, 21)
+#define  CCM_CCR_WB_COUNT			__BITS(18, 16)
+#define  CCM_CCR_COSC_EN			__BIT(12)
+#define  CCM_CCR_OSCNT__BITS(7, 0)
+
 #define CCM_CCDR0x0004
 #define CCM_CSR	0x0008
 #define CCM_CCSR0x000c
+#define  CCM_CCSR_PLL3_PFD1_DIS_MASK		__BIT(15)
+#define  CCM_CCSR_PLL3_PFD0_DIS_MASK		__BIT(14)
+#define  CCM_CCSR_PLL3_PFD3_DIS_MASK		__BIT(13)
+#define  CCM_CCSR_PLL3_PFD2_DIS_MASK		__BIT(12)
+#define  CCM_CCSR_PLL2_PFD1_594M_DIS_MASK	__BIT(11)
+#define  CCM_CCSR_PLL2_PFD0_DIS_MASK		__BIT(10)
+#define  CCM_CCSR_PLL2_PFD2_DIS_MASK		__BIT(9)
+#define  CCM_CCSR_STEP_SEL			__BIT(8)
+#define  CCM_CCSR_PLL1_SW_CLK_SEL		__BIT(2)
+#define  

CVS commit: src/sys/arch/arm/imx

2017-10-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Oct 24 09:11:51 UTC 2017

Modified Files:
src/sys/arch/arm/imx: imx6_pcie.c

Log Message:
Added link up status check for valid pci device confirm.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_pcie.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_pcie.c
diff -u src/sys/arch/arm/imx/imx6_pcie.c:1.3 src/sys/arch/arm/imx/imx6_pcie.c:1.4
--- src/sys/arch/arm/imx/imx6_pcie.c:1.3	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/imx6_pcie.c	Tue Oct 24 09:11:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.3 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.4 2017/10/24 09:11:51 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.3 2017/06/09 18:14:59 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.4 2017/10/24 09:11:51 hkenken Exp $");
 
 #include "opt_pci.h"
 
@@ -142,6 +142,23 @@ static void imx6pcie_intr_disestablish(v
 CFATTACH_DECL_NEW(imxpcie, sizeof(struct imx6pcie_softc),
 imx6pcie_match, imx6pcie_attach, NULL, NULL);
 
+static int
+imx6pcie_linkup_status(struct imx6pcie_softc *sc)
+{
+	return PCIE_READ(sc, PCIE_PL_DEBUG1) & PCIE_PL_DEBUG1_XMLH_LINK_UP;
+}
+
+static int
+imx6pcie_valid_device(struct imx6pcie_softc *sc, int bus, int dev)
+{
+	if (bus != 0 && !imx6pcie_linkup_status(sc))
+		return 0;
+	if (bus <= 1 && dev > 0)
+		return 0;
+
+	return 1;
+}
+
 static void
 imx6pcie_clock_enable(struct imx6pcie_softc *sc)
 {
@@ -392,14 +409,11 @@ static int
 imx6pcie_wait_for_link(struct imx6pcie_softc *sc)
 {
 	uint32_t ltssm, valid, v;
-	uint32_t linkup;
 	int retry;
 
 #define LINKUP_RETRY	200
 	for (retry = LINKUP_RETRY; retry > 0; --retry) {
-		linkup = PCIE_READ(sc, PCIE_PL_DEBUG1);
-		if ((linkup & PCIE_PL_DEBUG1_XMLH_LINK_UP) &&
-		!(linkup & PCIE_PL_DEBUG1_XMLH_LINK_IN_TRAINING)) {
+		if (!imx6pcie_linkup_status(sc)) {
 			delay(100);
 			continue;
 		}
@@ -425,8 +439,7 @@ imx6pcie_wait_for_link(struct imx6pcie_s
 			imx6pcie_phy_write(sc, PCIE_PHY_RX_OVRD_IN_LO, v);
 		}
 
-		if (linkup)
-			return 0;
+		return 0;
 	}
 
 	aprint_error_dev(sc->sc_dev, "Link Up failed.\n");
@@ -686,11 +699,13 @@ imx6pcie_setup(struct imx6pcie_softc * c
 	v = PCIE_READ(sc, PCI_COMMAND_STATUS_REG);
 	v |= PCI_COMMAND_IO_ENABLE |
 	PCI_COMMAND_MEM_ENABLE |
-	PCI_COMMAND_MASTER_ENABLE;
+	PCI_COMMAND_MASTER_ENABLE |
+	PCI_COMMAND_SERR_ENABLE;
 	PCIE_WRITE(sc, PCI_COMMAND_STATUS_REG, v);
 
 	PCIE_WRITE(sc, PCI_CLASS_REG,
-	PCI_CLASS_CODE(PCI_CLASS_BRIDGE, PCI_SUBCLASS_BRIDGE_PCI, PCI_INTERFACE_BRIDGE_PCI_PCI));
+	PCI_CLASS_CODE(PCI_CLASS_BRIDGE,
+		PCI_SUBCLASS_BRIDGE_PCI, PCI_INTERFACE_BRIDGE_PCI_PCI));
 
 	PCIE_WRITE(sc, PCIE_PL_IATUVR, 0);
 
@@ -785,7 +800,7 @@ imx6pcie_conf_read(void *v, pcitag_t tag
 
 	if ((unsigned int)offset >= PCI_EXTCONF_SIZE)
 		return ret;
-	if (b <= 1 && d > 0)
+	if (!imx6pcie_valid_device(sc, b, d))
 		return ret;
 
 	PCIE_WRITE(sc, PCIE_PL_IATUVR, 0);
@@ -832,7 +847,7 @@ imx6pcie_conf_write(void *v, pcitag_t ta
 
 	if ((unsigned int)offset >= PCI_EXTCONF_SIZE)
 		return;
-	if (b <= 1 && d > 0)
+	if (!imx6pcie_valid_device(sc, b, d))
 		return;
 
 	PCIE_WRITE(sc, PCIE_PL_IATUVR, 0);



CVS commit: src/sys/arch

2017-09-07 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Sep  8 05:29:12 UTC 2017

Modified Files:
src/sys/arch/arm/imx: files.imx31 files.imx51 files.imx6 files.imx7
imx31_uart.c imx51_uart.c imx6_uart.c imx7_uart.c imxuart.c
imxuartvar.h
src/sys/arch/evbarm/imx7: imx7_machdep.c
src/sys/arch/evbarm/kobo: kobo_machdep.c
src/sys/arch/evbarm/netwalker: netwalker_machdep.c
src/sys/arch/evbarm/nitrogen6: nitrogen6_machdep.c

Log Message:
- Move CFATTACH_DECL_NEW() from common uart driver.
- Rename : imxuart_cons_attach() -> imxuart_cnattach()


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/files.imx31
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/files.imx7
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx31_uart.c \
src/sys/arch/arm/imx/imx6_uart.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx51_uart.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx7_uart.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/imx/imxuart.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imxuartvar.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/imx7/imx7_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/kobo/kobo_machdep.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/netwalker/netwalker_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx31
diff -u src/sys/arch/arm/imx/files.imx31:1.7 src/sys/arch/arm/imx/files.imx31:1.8
--- src/sys/arch/arm/imx/files.imx31:1.7	Fri Mar 11 03:16:13 2011
+++ src/sys/arch/arm/imx/files.imx31	Fri Sep  8 05:29:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx31,v 1.7 2011/03/11 03:16:13 bsh Exp $
+#	$NetBSD: files.imx31,v 1.8 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX31
 #
@@ -62,9 +62,9 @@ defparam opt_imx31clk.h IMX31_IPGCLK_FRE
 
 # iMX UART
 device	imxuart
-attach	imxuart at aips
+attach	imxuart at aips with imx31_uart
 file	arch/arm/imx/imxuart.c			imxuart	needs-flag
-file	arch/arm/imx/imx31_uart.c		imxuart
+file	arch/arm/imx/imx31_uart.c		imx31_uart
 defflag	opt_imxuart.hIMXUARTCONSOLE
 
 attach	ehci at ahb with ehci_ahb : bus_dma_generic

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.16 src/sys/arch/arm/imx/files.imx51:1.17
--- src/sys/arch/arm/imx/files.imx51:1.16	Fri Aug 18 21:45:25 2017
+++ src/sys/arch/arm/imx/files.imx51	Fri Sep  8 05:29:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.16 2017/08/18 21:45:25 jakllsch Exp $
+#	$NetBSD: files.imx51,v 1.17 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -94,9 +94,9 @@ file	arch/arm/imx/imx_genfb.c	imx_genfb
 
 # iMX UART
 device	imxuart
-attach	imxuart at axi
+attach	imxuart at axi with imx51_uart
 file	arch/arm/imx/imxuart.c			imxuart	needs-flag
-file	arch/arm/imx/imx51_uart.c		imxuart
+file	arch/arm/imx/imx51_uart.c		imx51_uart
 defflag	opt_imxuart.hIMXUARTCONSOLE
 
 # USB controller

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.10 src/sys/arch/arm/imx/files.imx6:1.11
--- src/sys/arch/arm/imx/files.imx6:1.10	Fri Aug 18 21:45:25 2017
+++ src/sys/arch/arm/imx/files.imx6	Fri Sep  8 05:29:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.10 2017/08/18 21:45:25 jakllsch Exp $
+#	$NetBSD: files.imx6,v 1.11 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -74,9 +74,9 @@ file	arch/arm/imx/imx6_i2c.c			imxi2c
 
 # iMX UART
 device	imxuart
-attach	imxuart at axi
+attach	imxuart at axi with imx6_uart
 file	arch/arm/imx/imxuart.c			imxuart	needs-flag
-file	arch/arm/imx/imx6_uart.c		imxuart
+file	arch/arm/imx/imx6_uart.c		imx6_uart
 defflag opt_imxuart.hIMXUARTCONSOLE
 
 # iMX6 10/100/1000-Mbps Ethernet MAC(ENET)

Index: src/sys/arch/arm/imx/files.imx7
diff -u src/sys/arch/arm/imx/files.imx7:1.4 src/sys/arch/arm/imx/files.imx7:1.5
--- src/sys/arch/arm/imx/files.imx7:1.4	Fri Aug 18 21:45:25 2017
+++ src/sys/arch/arm/imx/files.imx7	Fri Sep  8 05:29:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx7,v 1.4 2017/08/18 21:45:25 jakllsch Exp $
+#	$NetBSD: files.imx7,v 1.5 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX7
 #
@@ -69,9 +69,9 @@ file	arch/arm/imx/imx7_i2c.c			imxi2c
 
 # iMX UART
 device	imxuart
-attach	imxuart at axi
+attach	imxuart at axi with imx7_uart
 file	arch/arm/imx/imxuart.c			imxuart	needs-flag
-file	arch/arm/imx/imx7_uart.c		imxuart
+file	arch/arm/imx/imx7_uart.c		imx7_uart
 defflag opt_imxuart.hIMXUARTCONSOLE
 
 # iMX7 10/100/1000-Mbps Ethernet MAC(ENET)

Index: src/sys/arch/arm/imx/imx31_uart.c
diff -u src/sys/arch/arm/imx/imx31_uart.c:1.2 

CVS commit: src/sys/arch

2017-08-17 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Aug 17 09:11:04 UTC 2017

Modified Files:
src/sys/arch/arm/imx: files.imx51 files.imx6 files.imx7 imx51_axi.c
imx51_ipuv3.c imx51_usb.c imx51var.h imx6_axi.c imx6_usb.c
imx6var.h imx7_axi.c imx7_board.c imx7_usb.c imx7var.h
src/sys/arch/evbarm/imx7: imx7_machdep.c

Log Message:
Use armv7_generic_[dma|bs]_tag.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/files.imx7 \
src/sys/arch/arm/imx/imx51_usb.c src/sys/arch/arm/imx/imx6_axi.c \
src/sys/arch/arm/imx/imx7_board.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx51_axi.c \
src/sys/arch/arm/imx/imx51_ipuv3.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx51var.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx6_usb.c \
src/sys/arch/arm/imx/imx7_axi.c src/sys/arch/arm/imx/imx7_usb.c \
src/sys/arch/arm/imx/imx7var.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6var.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/imx7/imx7_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.14 src/sys/arch/arm/imx/files.imx51:1.15
--- src/sys/arch/arm/imx/files.imx51:1.14	Mon Dec 21 04:26:28 2015
+++ src/sys/arch/arm/imx/files.imx51	Thu Aug 17 09:11:04 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.14 2015/12/21 04:26:28 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.15 2017/08/17 09:11:04 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -13,9 +13,11 @@ file	arch/arm/arm32/arm32_boot.c
 file	arch/arm/arm32/arm32_kvminit.c
 file	arch/arm/arm32/arm32_reboot.c
 file	arch/arm/arm32/irq_dispatch.S
+
+define	bus_dma_generic
 file	arch/arm/arm32/armv7_generic_space.c
+file	arch/arm/arm32/armv7_generic_dma.c
 file	arch/arm/arm/bus_space_a4x.S
-file	arch/arm/imx/imx_dma.c		bus_dma_generic needs-flag
 
 # iMX51 AXI/AHB bus interface and SoC domains
 device	axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.8 src/sys/arch/arm/imx/files.imx6:1.9
--- src/sys/arch/arm/imx/files.imx6:1.8	Thu Nov 24 12:06:43 2016
+++ src/sys/arch/arm/imx/files.imx6	Thu Aug 17 09:11:04 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.8 2016/11/24 12:06:43 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.9 2017/08/17 09:11:04 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -16,8 +16,8 @@ file	arch/arm/arm32/irq_dispatch.S
 
 define	bus_dma_generic
 file	arch/arm/arm32/armv7_generic_space.c
+file	arch/arm/arm32/armv7_generic_dma.c
 file	arch/arm/arm/bus_space_a4x.S
-file	arch/arm/imx/imx_dma.c			bus_dma_generic needs-flag
 
 file	arch/arm/imx/imx6_board.c
 

Index: src/sys/arch/arm/imx/files.imx7
diff -u src/sys/arch/arm/imx/files.imx7:1.2 src/sys/arch/arm/imx/files.imx7:1.3
--- src/sys/arch/arm/imx/files.imx7:1.2	Mon Oct 17 10:36:56 2016
+++ src/sys/arch/arm/imx/files.imx7	Thu Aug 17 09:11:04 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx7,v 1.2 2016/10/17 10:36:56 ryo Exp $
+#	$NetBSD: files.imx7,v 1.3 2017/08/17 09:11:04 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX7
 #
@@ -16,12 +16,12 @@ file	arch/arm/arm32/arm32_reboot.c
 file	arch/arm/arm32/irq_dispatch.S
 
 define	bus_dma_generic
+file	arch/arm/arm32/armv7_generic_space.c
+file	arch/arm/arm32/armv7_generic_dma.c
+file	arch/arm/arm/bus_space_a4x.S
 
-file	arch/arm/imx/imx_space.c
-file	arch/arm/imx/imx_dma.c			bus_dma_generic needs-flag
 file	arch/arm/imx/imx7_board.c
 
-
 # iMX7 AXI/AHB bus interface and SoC domains
 device	axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic
 attach	axi at mainbus
Index: src/sys/arch/arm/imx/imx51_usb.c
diff -u src/sys/arch/arm/imx/imx51_usb.c:1.2 src/sys/arch/arm/imx/imx51_usb.c:1.3
--- src/sys/arch/arm/imx/imx51_usb.c:1.2	Fri Jul 25 07:49:56 2014
+++ src/sys/arch/arm/imx/imx51_usb.c	Thu Aug 17 09:11:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_usb.c,v 1.2 2014/07/25 07:49:56 hkenken Exp $	*/
+/*	$NetBSD: imx51_usb.c,v 1.3 2017/08/17 09:11:04 hkenken Exp $	*/
 /*
  * Copyright (c) 2010  Genetec Corporation.  All rights reserved.
  * Written by Hiroyuki Bessho for Genetec Corporation.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx51_usb.c,v 1.2 2014/07/25 07:49:56 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_usb.c,v 1.3 2017/08/17 09:11:04 hkenken Exp $");
 
 #include "opt_imx.h"
 
@@ -80,7 +80,7 @@ imxusbc_search(device_t parent, cfdata_t
 
 aa.aa_iot = sc->sc_iot;
 	aa.aa_ioh = sc->sc_ioh;
-	aa.aa_dmat = _bus_dma_tag;
+	aa.aa_dmat = _generic_dma_tag;
 aa.aa_unit = cf->cf_loc[IMXUSBCCF_UNIT];
 	aa.aa_irq = cf->cf_loc[IMXUSBCCF_IRQ];
 

CVS commit: src/sys

2017-08-07 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  7 09:24:43 UTC 2017

Modified Files:
src/sys/arch/arm/imx: imxspi.c
src/sys/arch/evbarm/conf: NETWALKER
src/sys/dev/spi: m25p.c

Log Message:
Add support Microchip SST25VF016B.
- Fixed imxspi send and receive bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxspi.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/spi/m25p.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxspi.c
diff -u src/sys/arch/arm/imx/imxspi.c:1.2 src/sys/arch/arm/imx/imxspi.c:1.3
--- src/sys/arch/arm/imx/imxspi.c:1.2	Sat Mar 29 12:00:27 2014
+++ src/sys/arch/arm/imx/imxspi.c	Mon Aug  7 09:24:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxspi.c,v 1.2 2014/03/29 12:00:27 hkenken Exp $	*/
+/*	$NetBSD: imxspi.c,v 1.3 2017/08/07 09:24:43 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.2 2014/03/29 12:00:27 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.3 2017/08/07 09:24:43 hkenken Exp $");
 
 #include "opt_imx.h"
 #include "opt_imxspi.h"
@@ -256,7 +256,7 @@ imxspi_send(struct imxspi_softc *sc)
 		while (chunk->chunk_wresid) {
 			/* transmit fifo full? */
 			if (READ_REG(sc, STATREG) & IMXSPI(STAT_TF))
-return;
+goto out;
 
 			if (chunk->chunk_wptr) {
 data = *chunk->chunk_wptr;
@@ -271,7 +271,7 @@ imxspi_send(struct imxspi_softc *sc)
 		/* advance to next transfer */
 		sc->sc_wchunk = sc->sc_wchunk->chunk_next;
 	}
-
+out:
 	if (!(READ_REG(sc, STATREG) & IMXSPI(INTR_TE_EN)))
 		WRITE_REG(sc, CONREG, READ_REG(sc, CONREG) | IMXSPI(CON_XCH));
 }
@@ -321,7 +321,7 @@ imxspi_sched(struct imxspi_softc *sc)
 			sc->sc_tag->spi_cs_enable(sc->sc_tag->cookie,
 			st->st_slave);
 
-		/*chip slect*/
+		/* chip slect */
 		chipselect = READ_REG(sc, CONREG);
 		chipselect &= ~IMXSPI(CON_CS);
 		chipselect |= __SHIFTIN(st->st_slave, IMXSPI(CON_CS));
@@ -382,19 +382,19 @@ imxspi_intr(void *arg)
 		return 0;
 	}
 
-	/* Transfer Conplete? */
-	if (sr & IMXSPI(INTR_TC_EN)) {
-		/* complete TX */
-		imxspi_send(sc);
-	}
-
-	/* RXFIFO ready */
+	/* RXFIFO ready? */
 	if (sr & IMXSPI(INTR_RR_EN)) {
 		imxspi_recv(sc);
 		if (sc->sc_wchunk == NULL && sc->sc_rchunk == NULL)
 			imxspi_done(sc, err);
 	}
 
+	/* Transfer Conplete? */
+	if (sr & IMXSPI(INTR_TC_EN)) {
+		/* complete TX */
+		imxspi_send(sc);
+	}
+
 	/* status register clear */
 	WRITE_REG(sc, STATREG, sr);
 

Index: src/sys/arch/evbarm/conf/NETWALKER
diff -u src/sys/arch/evbarm/conf/NETWALKER:1.35 src/sys/arch/evbarm/conf/NETWALKER:1.36
--- src/sys/arch/evbarm/conf/NETWALKER:1.35	Mon Dec 21 04:26:29 2015
+++ src/sys/arch/evbarm/conf/NETWALKER	Mon Aug  7 09:24:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: NETWALKER,v 1.35 2015/12/21 04:26:29 hkenken Exp $
+#	$NetBSD: NETWALKER,v 1.36 2017/08/07 09:24:43 hkenken Exp $
 #
 #	NETWALKER -- http://www.sharp.co.jp/netwalker/
 #
@@ -113,8 +113,8 @@ lidsw0		at gpio3 offset 12 mask 0x01 # i
 imxpwm0		at axi? addr 0x73FB4000 irq 61
 
 # SPI NOR-Flash
-#spiflash0	at spiflashbus?
-#m25p0		at spi0 slave 1
+spiflash0	at spiflashbus?
+m25p0		at spi0 slave 1
 
 # SD/MMC
 sdhc0	at axi? addr 0x70004000 irq 1	 # eSDHC1

Index: src/sys/dev/spi/m25p.c
diff -u src/sys/dev/spi/m25p.c:1.4 src/sys/dev/spi/m25p.c:1.5
--- src/sys/dev/spi/m25p.c:1.4	Sat Oct 26 15:18:21 2013
+++ src/sys/dev/spi/m25p.c	Mon Aug  7 09:24:43 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: m25p.c,v 1.4 2013/10/26 15:18:21 rkujawa Exp $ */
+/* $NetBSD: m25p.c,v 1.5 2017/08/07 09:24:43 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.4 2013/10/26 15:18:21 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.5 2017/08/07 09:24:43 hkenken Exp $");
 
 #include 
 #include 
@@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.4
 
 static int m25p_match(device_t , cfdata_t , void *);
 static void m25p_attach(device_t , device_t , void *);
+static void m25p_doattach(device_t);
 static const char *m25p_getname(void *);
 static struct spi_handle *m25p_gethandle(void *);
 static int m25p_getflags(void *);
@@ -95,7 +96,8 @@ static const struct m25p_info {
 	{ 0x14, 0x20, 0x2015, "STMicro M25P16", 2048, 64 },	/* 16Mbit */
 	{ 0x12,	0x20, 0x2013, "STMicro M25P40", 512, 64 },	/* 4Mbit */
 	{ 0xc0, 0x20, 0x7117, "STMicro M25PX64", 8192, 64 },	/* 64Mbit */
-	{ 0x0, 0x20, 0xBB18, "Numonyx N25Q128", 16384, 64 },	/* 128Mbit */
+	{ 0x00, 0x20, 0xBB18, "Numonyx N25Q128", 16384, 64 },	/* 128Mbit */
+	{ 0x00, 0xBF, 0x2541, "Microchip SST25VF016B", 2048, 64 }, /* 16Mbit */
 	{ 0 }
 };
 
@@ -116,20 +118,27 @@ m25p_attach(device_t parent, device_t se
 {
 	struct m25p_softc *sc = 

CVS commit: src/sys/arch/evbarm/netwalker

2017-08-07 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  7 08:54:54 UTC 2017

Modified Files:
src/sys/arch/evbarm/netwalker: netwalker_machdep.c

Log Message:
Clean up IOPORT settings.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/netwalker/netwalker_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/netwalker/netwalker_machdep.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.19 src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.20
--- src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.19	Mon Dec 21 04:26:29 2015
+++ src/sys/arch/evbarm/netwalker/netwalker_machdep.c	Mon Aug  7 08:54:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netwalker_machdep.c,v 1.19 2015/12/21 04:26:29 hkenken Exp $	*/
+/*	$NetBSD: netwalker_machdep.c,v 1.20 2017/08/07 08:54:54 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation.
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netwalker_machdep.c,v 1.19 2015/12/21 04:26:29 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_machdep.c,v 1.20 2017/08/07 08:54:54 hkenken Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_arm_debug.h"
@@ -144,6 +144,7 @@ __KERNEL_RCSID(0, "$NetBSD: netwalker_ma
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -463,27 +464,21 @@ const struct iomux_setup iomux_setup_dat
 	IOMUX_DATA(IOMUXC_GPIO3_IPP_IND_G_IN_3_SELECT_INPUT, INPUT_DAISY_0),
 	IOMUX_MP(CSI2_D12, ALT3, KEEPER | DSEHIGH | SRE), /* GPIO4_9 */
 	IOMUX_MP(CSI2_D13, ALT3, KEEPER | DSEHIGH | SRE),
-#if 1
 	IOMUX_MP(GPIO1_2, ALT1, DSEHIGH | ODE),	/* LCD backlight by PWM */
-#else
-	IOMUX_MP(GPIO1_2, ALT0, DSEHIGH | ODE),	/* LCD backlight by GPIO */
-#endif
-	IOMUX_MP(EIM_A19, ALT1, SRE | DSEHIGH),
+
+	IOMUX_MP(EIM_A19, ALT1, SRE | DSEHIGH),	/* GPIO2_13 */
+
 	/* XXX VGA pins */
 	IOMUX_M(DI_GP4, ALT4),
-	IOMUX_M(GPIO1_8, SION | ALT0),
-
 	IOMUX_MP(GPIO1_8, SION | ALT0, HYS | DSEMID | PU_100K),
+
 	/* I2C1 */
-	IOMUX_MP(EIM_D16, SION | ALT4, HYS | ODE | DSEHIGH | SRE),
-	IOMUX_MP(EIM_D19, SION | ALT4, SRE),	/* SCL */
-	IOMUX_MP(EIM_A19, ALT1, SRE | DSEHIGH), /* GPIO2_13 */
+	IOMUX_MP(EIM_D16, SION | ALT4, HYS | ODE | DSEHIGH | SRE),	/* SDA */
+	IOMUX_MP(EIM_D19, SION | ALT4, SRE),			   	/* SCL */
+	IOMUX_DATA(IOMUXC_I2C1_IPP_SDA_IN_SELECT_INPUT, INPUT_DAISY_0),
+	IOMUX_DATA(IOMUXC_I2C1_IPP_SCL_IN_SELECT_INPUT, INPUT_DAISY_0),
 
-#if 0
-	IOMUX_MP(EIM_A23, ALT1, 0),
-#else
 	IOMUX_M(EIM_A23, ALT1),	/* GPIO2_17 */
-#endif
 
 	/* BT */
 	IOMUX_M(EIM_D20, ALT1),	/* GPIO2_4 BT host wakeup */
@@ -497,6 +492,7 @@ const struct iomux_setup iomux_setup_dat
 	IOMUX_MP(EIM_D27, ALT3, KEEPER | PU_100K | DSEHIGH | SRE), /* RTS */
 	IOMUX_M(NANDF_D15, ALT3),	/* GPIO3_25 */
 	IOMUX_MP(NANDF_D14, ALT3, HYS | PULL | PU_100K ),	/* GPIO3_26 */
+	IOMUX_DATA(IOMUXC_UART3_IPP_UART_RTS_B_SELECT_INPUT, INPUT_DAISY_3),
 
 	/* OJ6SH-T25 */
 	IOMUX_M(CSI1_D9, ALT3),			/* GPIO3_13 */
@@ -532,12 +528,11 @@ const struct iomux_setup iomux_setup_dat
 	/* 26M Osc */
 	IOMUX_MP(DI1_PIN12, ALT4, KEEPER | DSEHIGH | SRE), /* GPIO3_1 */
 
-	/* I2C */
-	IOMUX_MP(KEY_COL4, SION | ALT3, SRE),
+	/* I2C2 */
+	IOMUX_MP(KEY_COL5, SION | ALT3, HYS | ODE | DSEHIGH | SRE),	/* SDA */
+	IOMUX_MP(KEY_COL4, SION | ALT3, SRE),/* SCL */
 	IOMUX_DATA(IOMUXC_I2C2_IPP_SCL_IN_SELECT_INPUT, INPUT_DAISY_1),
-	IOMUX_MP(KEY_COL5, SION | ALT3, HYS | ODE | DSEHIGH | SRE),
 	IOMUX_DATA(IOMUXC_I2C2_IPP_SDA_IN_SELECT_INPUT, INPUT_DAISY_1),
-	IOMUX_DATA(IOMUXC_UART3_IPP_UART_RTS_B_SELECT_INPUT, INPUT_DAISY_3),
 
 	/* NAND */
 	IOMUX_MP(NANDF_WE_B, ALT0, HVE | DSEHIGH | PULL | PU_47K),



CVS commit: src/sys/arch/arm/imx

2016-11-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Nov 25 05:03:36 UTC 2016

Modified Files:
src/sys/arch/arm/imx: imx6_pcie.c

Log Message:
* Fix compile error.
* typo


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx6_pcie.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_pcie.c
diff -u src/sys/arch/arm/imx/imx6_pcie.c:1.1 src/sys/arch/arm/imx/imx6_pcie.c:1.2
--- src/sys/arch/arm/imx/imx6_pcie.c:1.1	Thu Nov 24 12:06:43 2016
+++ src/sys/arch/arm/imx/imx6_pcie.c	Fri Nov 25 05:03:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.1 2016/11/24 12:06:43 hkenken Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.2 2016/11/25 05:03:36 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,10 +31,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.1 2016/11/24 12:06:43 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.2 2016/11/25 05:03:36 hkenken Exp $");
 
 #include "opt_pci.h"
-#include "opt_imx6pcie.h"
 
 #include "pci.h"
 #include "imxgpio.h"
@@ -760,7 +759,7 @@ imx6pcie_decompose_tag(void *v, pcitag_t
 /*
  * work around.
  * If there is no PCIe devices, DABT will be generated by read/write access to
- * config area, so replace original DABT handler with sinple jump-back one.
+ * config area, so replace original DABT handler with simple jump-back one.
  */
 extern u_int data_abort_handler_address;
 static bool data_abort_flag;



CVS commit: src/sys/dev/pci

2016-11-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 24 12:32:47 UTC 2016

Modified Files:
src/sys/dev/pci: if_iwn.c

Log Message:
bus_dmamap_sync() is required for ICT table read/write.
Tested by arm platform.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pci/if_iwn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.79 src/sys/dev/pci/if_iwn.c:1.80
--- src/sys/dev/pci/if_iwn.c:1.79	Wed Aug  3 19:56:41 2016
+++ src/sys/dev/pci/if_iwn.c	Thu Nov 24 12:32:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.79 2016/08/03 19:56:41 mlelstv Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.80 2016/11/24 12:32:47 hkenken Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.79 2016/08/03 19:56:41 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.80 2016/11/24 12:32:47 hkenken Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -2642,12 +2642,16 @@ iwn_intr(void *arg)
 
 	/* Read interrupts from ICT (fast) or from registers (slow). */
 	if (sc->sc_flags & IWN_FLAG_USE_ICT) {
+		bus_dmamap_sync(sc->sc_dmat, sc->ict_dma.map, 0,
+		IWN_ICT_SIZE, BUS_DMASYNC_POSTREAD);
 		tmp = 0;
 		while (sc->ict[sc->ict_cur] != 0) {
 			tmp |= sc->ict[sc->ict_cur];
 			sc->ict[sc->ict_cur] = 0;	/* Acknowledge. */
 			sc->ict_cur = (sc->ict_cur + 1) % IWN_ICT_COUNT;
 		}
+		bus_dmamap_sync(sc->sc_dmat, sc->ict_dma.map, 0,
+		IWN_ICT_SIZE, BUS_DMASYNC_PREWRITE);
 		tmp = le32toh(tmp);
 		if (tmp == 0x)	/* Shouldn't happen. */
 			tmp = 0;



CVS commit: src/sys/arch

2016-11-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 24 12:06:44 UTC 2016

Modified Files:
src/sys/arch/arm/imx: files.imx6
src/sys/arch/evbarm/conf: std.nitrogen6
src/sys/arch/evbarm/nitrogen6: nitrogen6_iomux.c
Added Files:
src/sys/arch/arm/imx: imx6_pcie.c imx6_pciereg.h
src/sys/arch/evbarm/conf: HUMMINGBOARD

Log Message:
Add support imx6 PCIe controller.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx6_pcie.c \
src/sys/arch/arm/imx/imx6_pciereg.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/HUMMINGBOARD
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/std.nitrogen6
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.7 src/sys/arch/arm/imx/files.imx6:1.8
--- src/sys/arch/arm/imx/files.imx6:1.7	Tue May 17 06:44:45 2016
+++ src/sys/arch/arm/imx/files.imx6	Thu Nov 24 12:06:43 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.7 2016/05/17 06:44:45 ryo Exp $
+#	$NetBSD: files.imx6,v 1.8 2016/11/24 12:06:43 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -26,6 +26,11 @@ device	axi { [addr=-1], [size=0], [irq=-
 attach	axi at mainbus
 file	arch/arm/imx/imx6_axi.c			axi
 
+# iMX6 PCIe
+device	imxpcie: pcibus
+attach	imxpcie at axi
+file	arch/arm/imx/imx6_pcie.c		imxpcie
+
 # iMX6 Clock Control Module
 device	imxccm
 attach	imxccm at axi
@@ -101,4 +106,3 @@ device	imxsnvs
 attach	imxsnvs at axi
 file	arch/arm/imx/imxsnvs.c			imxsnvs
 file	arch/arm/imx/imx6_snvs.c		imxsnvs
-

Index: src/sys/arch/evbarm/conf/std.nitrogen6
diff -u src/sys/arch/evbarm/conf/std.nitrogen6:1.3 src/sys/arch/evbarm/conf/std.nitrogen6:1.4
--- src/sys/arch/evbarm/conf/std.nitrogen6:1.3	Thu Jul 30 08:09:36 2015
+++ src/sys/arch/evbarm/conf/std.nitrogen6	Thu Nov 24 12:06:44 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: std.nitrogen6,v 1.3 2015/07/30 08:09:36 ryo Exp $
+#	$NetBSD: std.nitrogen6,v 1.4 2016/11/24 12:06:44 hkenken Exp $
 #
 # standard NetBSD/evbarm options for Nitrogen6X
 
@@ -14,6 +14,7 @@ options 	ARM_HAS_VBAR
 options 	__HAVE_CPU_COUNTER
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 options 	TPIDRPRW_IS_CURCPU
+options 	PCI_NETBSD_CONFIGURE
 
 makeoptions	CPUFLAGS="-mcpu=cortex-a9"
 

Index: src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c
diff -u src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c:1.2 src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c:1.3
--- src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c:1.2	Thu Dec 31 11:53:19 2015
+++ src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c	Thu Nov 24 12:06:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nitrogen6_iomux.c,v 1.2 2015/12/31 11:53:19 ryo Exp $	*/
+/*	$NetBSD: nitrogen6_iomux.c,v 1.3 2016/11/24 12:06:44 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2015 Ryo Shimizu 
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nitrogen6_iomux.c,v 1.2 2015/12/31 11:53:19 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nitrogen6_iomux.c,v 1.3 2016/11/24 12:06:44 hkenken Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include 
@@ -52,10 +52,11 @@ static void nitrogen6_mux_config(const s
 static void nitrogen6_gpio_config(const struct gpio_conf *);
 
 
-#define	nitrogen6x	1
-#define	nitrogen6max	2
-#define	cubox_i		3
-#define	hummingboard	4
+#define	nitrogen6x		1
+#define	nitrogen6max		2
+#define	cubox_i			3
+#define	hummingboard		4
+#define	hummingboard_edge	5
 
 #define PAD_UART	\
 		(PAD_CTL_HYS | PAD_CTL_PUS_100K_PU | PAD_CTL_PULL |	\
@@ -111,6 +112,10 @@ static void nitrogen6_gpio_config(const 
 		 PAD_CTL_SPEED_100MHZ | PAD_CTL_DSE_40OHM | PAD_CTL_SRE_SLOW)
 #define PAD_OUTPUT_40OHM	(PAD_CTL_SPEED_100MHZ | PAD_CTL_DSE_40OHM)
 
+#define PAD_PCIE_GPIO \
+		(PAD_CTL_HYS | PAD_CTL_PUS_22K_PU | PAD_CTL_PULL |	\
+		 PAD_CTL_SPEED_50MHZ | PAD_CTL_DSE_40OHM | PAD_CTL_SRE_FAST)
+
 
 /* iMX6 SoloLite */
 static const struct iomux_conf iomux_data_6sl[] = {
@@ -176,7 +181,8 @@ static const struct iomux_conf iomux_dat
 		.pad = 0
 	},
 #endif
-#if (EVBARM_BOARDTYPE == hummingboard)
+#if (EVBARM_BOARDTYPE == hummingboard) || \
+(EVBARM_BOARDTYPE == hummingboard_edge)
 	{
 		.pin = MUX_PIN(IMX6SDL, GPIO05),
 		.mux = IOMUX_CONFIG_ALT3,	/* CCM_CLKO1 */
@@ -184,7 +190,8 @@ static const struct iomux_conf iomux_dat
 	},
 #endif
 #if (EVBARM_BOARDTYPE == cubox_i) || \
-(EVBARM_BOARDTYPE == hummingboard)
+(EVBARM_BOARDTYPE == hummingboard) || \
+(EVBARM_BOARDTYPE == hummingboard_edge)
 	{
 		.pin = MUX_PIN(IMX6SDL, EIM_DATA22),
 		.mux = IOMUX_CONFIG_ALT5,	/* GPIO3_IO22 */
@@ -407,15 +414,33 @@ static const struct iomux_conf iomux_dat
 		.pad = 0
 	},
 #endif
-#if (EVBARM_BOARDTYPE == hummingboard)
+#if (EVBARM_BOARDTYPE == hummingboard) || \
+

CVS commit: src/sys/arch/arm/imx

2016-11-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 24 08:41:20 UTC 2016

Modified Files:
src/sys/arch/arm/imx: imx6_board.c imx6_usdhc.c imx6var.h

Log Message:
Move to common function.
sdhc_set_gpio_cd() -> imx6_set_gpio()


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx6_usdhc.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_board.c
diff -u src/sys/arch/arm/imx/imx6_board.c:1.6 src/sys/arch/arm/imx/imx6_board.c:1.7
--- src/sys/arch/arm/imx/imx6_board.c:1.6	Thu Oct 20 09:53:07 2016
+++ src/sys/arch/arm/imx/imx6_board.c	Thu Nov 24 08:41:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_board.c,v 1.6 2016/10/20 09:53:07 skrll Exp $	*/
+/*	$NetBSD: imx6_board.c,v 1.7 2016/11/24 08:41:20 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.6 2016/10/20 09:53:07 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.7 2016/11/24 08:41:20 hkenken Exp $");
 
 #include "opt_imx.h"
 #include "arml2cc.h"
@@ -36,6 +36,7 @@ __KERNEL_RCSID(1, "$NetBSD: imx6_board.c
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -47,6 +48,7 @@ __KERNEL_RCSID(1, "$NetBSD: imx6_board.c
 #include 
 #include 
 #include 
+#include 
 
 bus_space_tag_t imx6_ioreg_bst = _generic_bs_tag;
 bus_space_handle_t imx6_ioreg_bsh;
@@ -230,3 +232,50 @@ imx6_cpu_hatch(struct cpu_info *ci)
 	a9tmr_init_cpu_clock(ci);
 }
 #endif
+
+void
+imx6_set_gpio(device_t self, const char *name, int32_t *gpio,
+int32_t *active, u_int dir)
+{
+	prop_dictionary_t dict;
+	const char *pin_data;
+	int grp, pin;
+
+	*gpio = -1;
+	*active = -1;
+
+	dict = device_properties(self);
+	if (!prop_dictionary_get_cstring_nocopy(dict, name, _data))
+		return;
+
+	/*
+	 * "!1,6" -> gpio = GPIO_NO(1,6),  active = GPIO_PIN_LOW
+	 * "3,31" -> gpio = GPIO_NO(3,31), active = GPIO_PIN_HIGH
+	 * "!"-> always not detected
+	 * none   -> always detected
+	 */
+	if (*pin_data == '!') {
+		*active = GPIO_PIN_LOW;
+		pin_data++;
+	} else
+		*active = GPIO_PIN_HIGH;
+
+	if (*pin_data == '\0')
+		return;
+
+	for (grp = 0; (*pin_data >= '0') && (*pin_data <= '9'); pin_data++)
+		grp = grp * 10 + *pin_data - '0';
+
+	KASSERT(*pin_data == ',');
+	pin_data++;
+
+	for (pin = 0; (*pin_data >= '0') && (*pin_data <= '9'); pin_data++)
+		pin = pin * 10 + *pin_data - '0';
+
+	KASSERT(*pin_data == '\0');
+
+	*gpio = GPIO_NO(grp, pin);
+#if NIMXGPIO > 0
+	gpio_set_direction(*gpio, dir);
+#endif
+}

Index: src/sys/arch/arm/imx/imx6_usdhc.c
diff -u src/sys/arch/arm/imx/imx6_usdhc.c:1.2 src/sys/arch/arm/imx/imx6_usdhc.c:1.3
--- src/sys/arch/arm/imx/imx6_usdhc.c:1.2	Thu Dec 31 11:53:18 2015
+++ src/sys/arch/arm/imx/imx6_usdhc.c	Thu Nov 24 08:41:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_usdhc.c,v 1.2 2015/12/31 11:53:18 ryo Exp $ */
+/*	$NetBSD: imx6_usdhc.c,v 1.3 2016/11/24 08:41:20 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_usdhc.c,v 1.2 2015/12/31 11:53:18 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_usdhc.c,v 1.3 2016/11/24 08:41:20 hkenken Exp $");
 
 #include "imxgpio.h"
 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: imx6_usdhc.c
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -58,7 +59,7 @@ struct sdhc_axi_softc {
 	/* we have only one slot */
 	struct sdhc_host *sc_hosts[1];
 	int32_t sc_gpio_cd;
-	int32_t sc_gpio_cd_low_active;
+	int32_t sc_gpio_cd_active;
 	void *sc_ih;
 };
 
@@ -95,60 +96,16 @@ imx6_sdhc_card_detect(struct sdhc_softc 
 #if NIMXGPIO > 0
 	if (sc->sc_gpio_cd >= 0) {
 		detect = gpio_data_read(sc->sc_gpio_cd);
+		if (sc->sc_gpio_cd_active == GPIO_PIN_LOW)
+			detect = !detect;
 	} else
 #endif
 		detect = 1;
-	if (sc->sc_gpio_cd_low_active)
-		detect = detect ? 0 : 1;
 
 	return detect;
 }
 
 static void
-sdhc_set_gpio_cd(struct sdhc_axi_softc *sc, const char *name)
-{
-	prop_dictionary_t dict;
-	const char *pin_data;
-	int grp, pin;
-
-	dict = device_properties(sc->sc_sdhc.sc_dev);
-	if (!prop_dictionary_get_cstring_nocopy(dict, name, _data))
-		return;
-
-	/*
-	 * "!1,6" -> gpio_cd = GPIO_NO(1,6),  gpio_cd_low_active = 1
-	 * "3,31" -> gpio_cd = GPIO_NO(3,31), gpio_cd_low_active = 0
-	 * "!"-> always not detected
-	 * none   -> always detected
-	 */
-	if (*pin_data == '!') {
-		sc->sc_gpio_cd_low_active = 1;
-		pin_data++;
-	} else
-		sc->sc_gpio_cd_low_active = 0;
-
-	sc->sc_gpio_cd = -1;
-	if (*pin_data == '\0')
-		return;
-
-	for (grp = 0; (*pin_data >= '0') && (*pin_data <= '9'); pin_data++)
-		grp = grp * 10 + *pin_data - '0';
-
-	KASSERT(*pin_data == ',');
-	pin_data++;
-
-	for (pin = 0; (*pin_data >= '0') && 

CVS commit: src/sys/arch

2016-11-23 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 24 03:59:36 UTC 2016

Modified Files:
src/sys/arch/arm/imx: if_enet_imx6.c imx6_ahcisata.c imx6_ccm.c
imx6_ccmreg.h imx6_ccmvar.h
src/sys/arch/evbarm/nitrogen6: nitrogen6_usb.c

Log Message:
Modified imx6_pll_power() arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_ahcisata.c \
src/sys/arch/arm/imx/imx6_ccmreg.h src/sys/arch/arm/imx/imx6_ccmvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/nitrogen6/nitrogen6_usb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.1 src/sys/arch/arm/imx/if_enet_imx6.c:1.2
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.1	Tue May 17 06:44:45 2016
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Thu Nov 24 03:59:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.1 2016/05/17 06:44:45 ryo Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.2 2016/11/24 03:59:36 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.1 2016/05/17 06:44:45 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.2 2016/11/24 03:59:36 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -93,7 +93,8 @@ enet_attach(device_t parent, device_t se
 
 #if NIMXCCM > 0
 	/* PLL power up */
-	if (imx6_pll_power(CCM_ANALOG_PLL_ENET, 1) != 0) {
+	if (imx6_pll_power(CCM_ANALOG_PLL_ENET, 1,
+		CCM_ANALOG_PLL_ENET_ENABLE) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		"couldn't enable CCM_ANALOG_PLL_ENET\n");
 		return;

Index: src/sys/arch/arm/imx/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.3 src/sys/arch/arm/imx/imx6_ahcisata.c:1.4
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.3	Thu Feb 25 13:27:33 2016
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Thu Nov 24 03:59:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.3 2016/02/25 13:27:33 ryo Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.4 2016/11/24 03:59:36 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.3 2016/02/25 13:27:33 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.4 2016/11/24 03:59:36 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -266,7 +266,8 @@ ixm6_ahcisata_init(struct imx_ahci_softc
 	imx6_ccm_write(CCM_CCGR5, v | CCM_CCGR5_100M_CLK_ENABLE(3));
 
 	/* PLL power up */
-	if (imx6_pll_power(CCM_ANALOG_PLL_ENET, 1) != 0) {
+	if (imx6_pll_power(CCM_ANALOG_PLL_ENET, 1,
+		CCM_ANALOG_PLL_ENET_ENABLE_100M) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		"couldn't enable CCM_ANALOG_PLL_ENET\n");
 		return -1;
Index: src/sys/arch/arm/imx/imx6_ccmreg.h
diff -u src/sys/arch/arm/imx/imx6_ccmreg.h:1.3 src/sys/arch/arm/imx/imx6_ccmreg.h:1.4
--- src/sys/arch/arm/imx/imx6_ccmreg.h:1.3	Fri Jan  9 09:50:46 2015
+++ src/sys/arch/arm/imx/imx6_ccmreg.h	Thu Nov 24 03:59:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccmreg.h,v 1.3 2015/01/09 09:50:46 ryo Exp $	*/
+/*	$NetBSD: imx6_ccmreg.h,v 1.4 2016/11/24 03:59:36 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -79,7 +79,7 @@
 #define  CCM_CBCMR_VPU_AXI_CLK_SEL		__BITS(15, 14)
 #define  CCM_CBCMR_PERIPH_CLK2_SEL		__BITS(13, 12)
 #define  CCM_CBCMR_VDOAXI_CLK_SEL		__BIT(11)
-#define  CCM_CBCMR_PCIE_AXI_CLK_SE		__BIT(10)
+#define  CCM_CBCMR_PCIE_AXI_CLK_SEL		__BIT(10)
 #define  CCM_CBCMR_GPU3D_SHADER_CLK_SEL		__BITS(9, 8)
 #define  CCM_CBCMR_GPU3D_CORE_CLK_SEL		__BITS(5, 4)
 #define  CCM_CBCMR_GPU3D_AXI_CLK_SEL		__BIT(1)
@@ -140,6 +140,37 @@
 #define  CCM_CSCDR3_IPU1_HSP_PODF		__BITS(13, 11)
 #define  CCM_CSCDR3_IPU1_HSP_CLK_SEL		__BITS(10, 9)
 
+#define CCM_CCGR2		0x0070
+#define  CCM_CCGR2_IPSYNC_VDOA_IPG_CLK_ENABLE(n)		__SHIFTIN(n, __BITS(27, 26))
+#define  CCM_CCGR2_IPSYNC_IP2APB_TZASC2_IPG_CLK_ENABLE(n)   __SHIFTIN(n, __BITS(25, 24))
+#define  CCM_CCGR2_IPSYNC_IP2APB_TZASC1_IPG_CLK_ENABLE(n)   __SHIFTIN(n, __BITS(23, 22))
+#define  CCM_CCGR2_IPMUX3_CLK_ENABLE(n)__SHIFTIN(n, __BITS(21, 20))
+#define  CCM_CCGR2_IPMUX2_CLK_ENABLE(n)__SHIFTIN(n, __BITS(19, 18))
+#define  CCM_CCGR2_IPMUX1_CLK_ENABLE(n)__SHIFTIN(n, __BITS(17, 16))
+#define  CCM_CCGR2_IOMUX_IPT_CLK_IO_CLK_ENABLE(n)		__SHIFTIN(n, __BITS(15, 14))
+#define  CCM_CCGR2_IIM_CLK_ENABLE(n)__SHIFTIN(n, __BITS(13, 12))
+#define  CCM_CCGR2_I2C3_SERIAL_CLK_ENABLE(n)			__SHIFTIN(n, __BITS(11, 10))
+#define  CCM_CCGR2_I2C2_SERIAL_CLK_ENABLE(n)			__SHIFTIN(n, __BITS(9, 8))
+#define  CCM_CCGR2_I2C1_SERIAL_CLK_ENABLE(n)			__SHIFTIN(n, __BITS(7, 6))
+#define  CCM_CCGR2_HDMI_TX_ISFRCLK_ENABLE(n)			__SHIFTIN(n, __BITS(5, 4))
+#define  

CVS commit: src/sys/arch

2015-12-20 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Dec 21 04:26:29 UTC 2015

Modified Files:
src/sys/arch/arm/imx: files.imx51 imx51_ipuv3.c imx51_ipuv3var.h
imx51var.h
src/sys/arch/evbarm/conf: NETWALKER files.netwalker
src/sys/arch/evbarm/netwalker: netwalker_backlight.c
netwalker_backlightvar.h netwalker_lcd.c netwalker_machdep.c
Added Files:
src/sys/arch/arm/imx: imx_genfb.c

Log Message:
Rewritten to take advantage of genfb(4).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx51_ipuv3.c \
src/sys/arch/arm/imx/imx51var.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_ipuv3var.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx_genfb.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/files.netwalker
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/netwalker/netwalker_backlight.c \
src/sys/arch/evbarm/netwalker/netwalker_backlightvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/netwalker/netwalker_lcd.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/netwalker/netwalker_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.13 src/sys/arch/arm/imx/files.imx51:1.14
--- src/sys/arch/arm/imx/files.imx51:1.13	Thu May  7 04:13:47 2015
+++ src/sys/arch/arm/imx/files.imx51	Mon Dec 21 04:26:28 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.13 2015/05/07 04:13:47 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.14 2015/12/21 04:26:28 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -76,11 +76,14 @@ file	arch/arm/imx/imx51_iomux.c		imxiomu
 # defparam opt_imx50_epdc.h		EPDC_DEBUG
 
 # IPU v3 controller
-device	ipu : bus_dma_generic, wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation, vcons
-file	arch/arm/imx/imx51_ipuv3.c	ipu	 needs-flag
-defflag	opt_imx51_ipuv3.h		IMXIPUCONSOLE
+device	ipu { }
+file	arch/arm/imx/imx51_ipuv3.c	imx_ipuv3	needs-flag
 defparam opt_imx51_ipuv3.h		IPUV3_DEBUG
 
+# Framebuffer console
+attach	genfb at ipu with imx_genfb
+file	arch/arm/imx/imx_genfb.c	imx_genfb
+
 # iMX M3IF - Multi Master Memory Interface
 # iMX ESDCTL/MDDRC - Enhanced SDRAM/LPDDR memory controller
 # iMX PCMCIA - PCMCIA memory controller

Index: src/sys/arch/arm/imx/imx51_ipuv3.c
diff -u src/sys/arch/arm/imx/imx51_ipuv3.c:1.3 src/sys/arch/arm/imx/imx51_ipuv3.c:1.4
--- src/sys/arch/arm/imx/imx51_ipuv3.c:1.3	Fri Nov  7 11:54:18 2014
+++ src/sys/arch/arm/imx/imx51_ipuv3.c	Mon Dec 21 04:26:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ipuv3.c,v 1.3 2014/11/07 11:54:18 hkenken Exp $	*/
+/*	$NetBSD: imx51_ipuv3.c,v 1.4 2015/12/21 04:26:28 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.3 2014/11/07 11:54:18 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.4 2015/12/21 04:26:28 hkenken Exp $");
+
+#include "opt_imx51_ipuv3.h"
 
 #include 
 #include 
@@ -35,17 +37,6 @@ __KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.
 #include 
 #include 
 #include 			/* for cold */
-#include 
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
 #include 
@@ -59,19 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.
 #include 
 
 #include "imxccm.h"	/* if CCM driver is configured into the kernel */
-#include "wsdisplay.h"
-#include "opt_imx51_ipuv3.h"
-
-/*
- * Console variables. These are necessary since console is setup very early,
- * before devices get attached.
- */
-struct {
-	int is_console;
-	struct imx51_wsscreen_descr *descr;
-	struct wsdisplay_accessops *accessops;
-	const struct lcd_panel_geometry *geom;
-} imx51_ipuv3_console;
 
 #define	IPUV3_READ(ipuv3, module, reg)	  \
 	bus_space_read_4((ipuv3)->iot, (ipuv3)->module##_ioh, (reg))
@@ -89,16 +67,8 @@ int ipuv3intr(void *);
 
 static void imx51_ipuv3_initialize(struct imx51_ipuv3_softc *,
 const struct lcd_panel_geometry *);
-#if NWSDISPLAY > 0
-static void imx51_ipuv3_setup_rasops(struct imx51_ipuv3_softc *,
-struct rasops_info *, struct imx51_wsscreen_descr *,
-const struct lcd_panel_geometry *);
-#endif
 static void imx51_ipuv3_set_idma_param(uint32_t *, uint32_t, uint32_t);
 
-static bool imx51_ipuv3_resume(device_t, const pmf_qual_t *);
-static bool imx51_ipuv3_suspend(device_t, const pmf_qual_t *);
-
 #ifdef IPUV3_DEBUG
 static void
 imx51_ipuv3_dump(struct imx51_ipuv3_softc *sc)
@@ -581,34 +551,14 @@ imx51_ipuv3_initialize(struct imx51_ipuv
 	IPUV3_WRITE(sc, cm, IPU_CM_DISP_GEN, reg);
 }
 
-static void
-imx51_ipuv3_init_screen(void *cookie, struct vcons_screen *scr,
-		int existing, long *defattr)
+static int
+imx51_ipuv3_print(void *aux, 

CVS commit: src/sys/dev/spi

2015-12-14 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Dec 14 10:31:38 UTC 2015

Modified Files:
src/sys/dev/spi: oj6sh.c

Log Message:
use workqueue(9)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/spi/oj6sh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/spi/oj6sh.c
diff -u src/sys/dev/spi/oj6sh.c:1.1 src/sys/dev/spi/oj6sh.c:1.2
--- src/sys/dev/spi/oj6sh.c:1.1	Sat Mar 29 12:00:27 2014
+++ src/sys/dev/spi/oj6sh.c	Mon Dec 14 10:31:38 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: oj6sh.c,v 1.1 2014/03/29 12:00:27 hkenken Exp $	*/
+/*	$NetBSD: oj6sh.c,v 1.2 2015/12/14 10:31:38 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oj6sh.c,v 1.1 2014/03/29 12:00:27 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oj6sh.c,v 1.2 2015/12/14 10:31:38 hkenken Exp $");
 
 #include "opt_oj6sh.h"
 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: oj6sh.c,v 1.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -83,6 +84,9 @@ struct oj6sh_softc {
 	struct callout sc_c;
 
 	kmutex_t sc_lock;
+	struct workqueue *sc_wq;
+	struct work sc_wk;
+
 	int sc_enabled;
 
 	device_t sc_wsmousedev;
@@ -108,8 +112,9 @@ static bool oj6sh_shuttrer(struct spi_ha
 static int oj6sh_readdelta(struct spi_handle *, struct oj6sh_delta *);
 
 static void oj6sh_poll(void *);
-static int oj6sh_enable(void *v);
-static void oj6sh_disable(void *v);
+static void oj6sh_cb(struct work *, void *);
+static int oj6sh_enable(void *);
+static void oj6sh_disable(void *);
 static int oj6sh_ioctl(void *, u_long, void *, int, struct lwp *);
 
 static bool oj6sh_resume(device_t, const pmf_qual_t *);
@@ -183,6 +188,8 @@ oj6sh_attach(device_t parent, device_t s
 	sc->sc_enabled = 0;
 
 	callout_init(>sc_c, 0);
+	workqueue_create(>sc_wq, "oj6sh",
+	oj6sh_cb, sc, PRI_NONE, IPL_BIO, 0);
 
 	sc->sc_sh = sa->sa_handle;
 
@@ -198,6 +205,19 @@ static void
 oj6sh_poll(void *arg)
 {
 	struct oj6sh_softc *sc = (struct oj6sh_softc *)arg;
+
+	workqueue_enqueue(sc->sc_wq, >sc_wk, NULL);
+
+	if (sc->sc_enabled)
+		callout_reset(>sc_c, POLLRATE, oj6sh_poll, sc);
+
+	return;
+}
+
+static void
+oj6sh_cb(struct work *wk, void *arg)
+{
+	struct oj6sh_softc *sc = (struct oj6sh_softc *)arg;
 	struct oj6sh_delta delta = {0, 0};
 	uint32_t buttons = 0;
 	int s;
@@ -234,11 +254,6 @@ oj6sh_poll(void *arg)
 	splx(s);
 out:
 	mutex_exit(>sc_lock);
-
-	if (sc->sc_enabled)
-		callout_reset(>sc_c, POLLRATE, oj6sh_poll, sc);
-
-	return;
 }
 
 static uint8_t



CVS commit: src/sys/arch/arm

2015-09-09 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Sep 10 04:00:32 UTC 2015

Modified Files:
src/sys/arch/arm/imx: imxusb.c imxusbvar.h
src/sys/arch/arm/zynq: zynq_usb.c zynq_usbvar.h

Log Message:
USBMODE register's initialization should be done in sc_vendor_init() after 
sending EHCI_CMD_HCRESET command.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/imxusb.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxusbvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/zynq/zynq_usb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/zynq/zynq_usbvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxusb.c
diff -u src/sys/arch/arm/imx/imxusb.c:1.8 src/sys/arch/arm/imx/imxusb.c:1.9
--- src/sys/arch/arm/imx/imxusb.c:1.8	Fri Sep  4 07:34:32 2015
+++ src/sys/arch/arm/imx/imxusb.c	Thu Sep 10 04:00:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxusb.c,v 1.8 2015/09/04 07:34:32 skrll Exp $	*/
+/*	$NetBSD: imxusb.c,v 1.9 2015/09/10 04:00:32 hkenken Exp $	*/
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi and Hiroyuki Bessho for Genetec Corporation.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.8 2015/09/04 07:34:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.9 2015/09/10 04:00:32 hkenken Exp $");
 
 #include "opt_imx.h"
 
@@ -61,7 +61,8 @@ uint8_t imxusb_ulpi_read(struct imxehci_
 void imxusb_ulpi_write(struct imxehci_softc *sc, int addr, uint8_t data);
 static void ulpi_reset(struct imxehci_softc *sc);
 
-
+static void imxehci_select_interface(struct imxehci_softc *, enum imx_usb_if);
+static void imxehci_init(struct ehci_softc *);
 
 /* attach structures */
 CFATTACH_DECL_NEW(imxehci, sizeof(struct imxehci_softc),
@@ -98,6 +99,7 @@ imxehci_attach(device_t parent, device_t
 	sc->sc_usbc = usbc;
 	hsc->sc_bus.hci_private = sc;
 	hsc->sc_flags |= EHCIF_ETTF;
+	hsc->sc_vendor_init = imxehci_init;
 
 	aprint_naive("\n");
 	aprint_normal(": i.MX USB Controller\n");
@@ -153,7 +155,6 @@ imxehci_attach(device_t parent, device_t
 	/* Platform dependent setup */
 	if (usbc->sc_init_md_hook)
 		usbc->sc_init_md_hook(sc);
-
 	
 	imxehci_reset(sc);
 	imxehci_select_interface(sc, sc->sc_iftype);
@@ -172,8 +173,6 @@ imxehci_attach(device_t parent, device_t
 
 	}
 
-	imxehci_host_mode(sc);
-	
 	if (usbc->sc_setup_md_hook)
 		usbc->sc_setup_md_hook(sc, IMXUSB_HOST);
 
@@ -214,10 +213,7 @@ imxehci_attach(device_t parent, device_t
 	hsc->sc_child = config_found(self, >sc_bus, usbctlprint);
 }
 
-
-
-
-void
+static void
 imxehci_select_interface(struct imxehci_softc *sc, enum imx_usb_if interface)
 {
 	uint32_t reg;
@@ -244,7 +240,6 @@ imxehci_select_interface(struct imxehci_
 	EOWRITE4(hsc, EHCI_PORTSC(1), reg);
 }
 
-
 static uint32_t
 ulpi_wakeup(struct imxehci_softc *sc, int tout)
 {
@@ -407,10 +402,10 @@ imxehci_reset(struct imxehci_softc *sc)
 	usb_delay_ms(>sc_bus, 100);
 }
 
-void
-imxehci_host_mode(struct imxehci_softc *sc)
+static void
+imxehci_init(struct ehci_softc *hsc)
 {
-	struct ehci_softc *hsc = >sc_hsc;
+	struct imxehci_softc *sc = device_private(hsc->sc_dev);
 	uint32_t reg;
 
 	reg = EOREAD4(hsc, EHCI_PORTSC(1));
@@ -426,6 +421,7 @@ imxehci_host_mode(struct imxehci_softc *
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, IMXUSB_OTGSC, reg);
 
 	reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, IMXUSB_USBMODE);
+	reg &= ~USBMODE_CM;
 	reg |= USBMODE_CM_HOST;
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, IMXUSB_USBMODE, reg);
 }

Index: src/sys/arch/arm/imx/imxusbvar.h
diff -u src/sys/arch/arm/imx/imxusbvar.h:1.2 src/sys/arch/arm/imx/imxusbvar.h:1.3
--- src/sys/arch/arm/imx/imxusbvar.h:1.2	Fri Jul 25 07:49:56 2014
+++ src/sys/arch/arm/imx/imxusbvar.h	Thu Sep 10 04:00:32 2015
@@ -45,8 +45,6 @@ struct imxehci_softc {
 };
 
 int imxusbc_attach_common(device_t, device_t, bus_space_tag_t);
-void imxehci_select_interface(struct imxehci_softc *, enum imx_usb_if);
-void imxehci_host_mode(struct imxehci_softc *);
 void imxehci_reset(struct imxehci_softc *);
 
 #endif	/* _ARM_IMX_IMXUSBVAR_H */

Index: src/sys/arch/arm/zynq/zynq_usb.c
diff -u src/sys/arch/arm/zynq/zynq_usb.c:1.2 src/sys/arch/arm/zynq/zynq_usb.c:1.3
--- src/sys/arch/arm/zynq/zynq_usb.c:1.2	Fri Sep  4 07:38:05 2015
+++ src/sys/arch/arm/zynq/zynq_usb.c	Thu Sep 10 04:00:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: zynq_usb.c,v 1.2 2015/09/04 07:38:05 skrll Exp $	*/
+/*	$NetBSD: zynq_usb.c,v 1.3 2015/09/10 04:00:32 hkenken Exp $	*/
 /*-
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zynq_usb.c,v 1.2 2015/09/04 07:38:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_usb.c,v 1.3 2015/09/10 04:00:32 hkenken Exp $");
 
 #include "opt_zynq.h"
 
@@ -56,6 +56,9 

CVS commit: src/sys/arch/arm/imx

2015-05-25 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue May 26 05:11:33 UTC 2015

Modified Files:
src/sys/arch/arm/imx: imx51_esdhc.c

Log Message:
Add SDHC_FLAG_USE_DMA flag for internal DMA mode.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_esdhc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx51_esdhc.c
diff -u src/sys/arch/arm/imx/imx51_esdhc.c:1.2 src/sys/arch/arm/imx/imx51_esdhc.c:1.3
--- src/sys/arch/arm/imx/imx51_esdhc.c:1.2	Sat Mar 22 09:46:33 2014
+++ src/sys/arch/arm/imx/imx51_esdhc.c	Tue May 26 05:11:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_esdhc.c,v 1.2 2014/03/22 09:46:33 hkenken Exp $ */
+/*	$NetBSD: imx51_esdhc.c,v 1.3 2015/05/26 05:11:33 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_esdhc.c,v 1.2 2014/03/22 09:46:33 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_esdhc.c,v 1.3 2015/05/26 05:11:33 hkenken Exp $);
 
 #include opt_imx.h
 
@@ -117,6 +117,7 @@ sdhc_attach(device_t parent, device_t se
 		break;;
 	}
 	sc-sc_sdhc.sc_clkbase = perclk / 1000;
+	sc-sc_sdhc.sc_flags |= SDHC_FLAG_USE_DMA;
 	sc-sc_sdhc.sc_flags |= SDHC_FLAG_HAVE_DVS |
 		SDHC_FLAG_NO_PWR0 |
 		SDHC_FLAG_32BIT_ACCESS |



CVS commit: src/sys/arch

2015-05-06 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu May  7 04:13:47 UTC 2015

Modified Files:
src/sys/arch/arm/imx: files.imx51 imx51_axi.c imx51var.h
src/sys/arch/evbarm/conf: files.kobo files.netwalker
src/sys/arch/evbarm/kobo: kobo_machdep.c
src/sys/arch/evbarm/netwalker: netwalker_machdep.c

Log Message:
use armv7_generic_space


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx51_axi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51var.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/files.kobo
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/files.netwalker
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/kobo/kobo_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/netwalker/netwalker_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.12 src/sys/arch/arm/imx/files.imx51:1.13
--- src/sys/arch/arm/imx/files.imx51:1.12	Fri Mar 27 05:31:23 2015
+++ src/sys/arch/arm/imx/files.imx51	Thu May  7 04:13:47 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.12 2015/03/27 05:31:23 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.13 2015/05/07 04:13:47 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -9,7 +9,12 @@ defflag opt_imx.hIMX50
 
 define	bus_dma_generic
 
-file	arch/arm/imx/imx_space.c
+file	arch/arm/arm32/arm32_boot.c
+file	arch/arm/arm32/arm32_kvminit.c
+file	arch/arm/arm32/arm32_reboot.c
+file	arch/arm/arm32/irq_dispatch.S
+file	arch/arm/arm32/armv7_generic_space.c
+file	arch/arm/arm/bus_space_a4x.S
 file	arch/arm/imx/imx_dma.c		bus_dma_generic needs-flag
 
 # iMX51 AXI/AHB bus interface and SoC domains
@@ -22,7 +27,6 @@ include arch/arm/pic/files.pic
 device	tzic: pic, pic_splfuncs
 attach	tzic at axi
 file	arch/arm/imx/imx51_tzic.c		tzic	needs-flag
-file	arch/arm/arm32/irq_dispatch.S
 
 # iMX51 Enhanced Periodic Interrupt Timer
 device	imxclock

Index: src/sys/arch/arm/imx/imx51_axi.c
diff -u src/sys/arch/arm/imx/imx51_axi.c:1.4 src/sys/arch/arm/imx/imx51_axi.c:1.5
--- src/sys/arch/arm/imx/imx51_axi.c:1.4	Mon Mar 10 04:25:51 2014
+++ src/sys/arch/arm/imx/imx51_axi.c	Thu May  7 04:13:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_axi.c,v 1.4 2014/03/10 04:25:51 htodd Exp $	*/
+/*	$NetBSD: imx51_axi.c,v 1.5 2015/05/07 04:13:47 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2010 SHIMIZU Ryo r...@nerv.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_axi.c,v 1.4 2014/03/10 04:25:51 htodd Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_axi.c,v 1.5 2015/05/07 04:13:47 hkenken Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -76,7 +76,7 @@ axi_attach(device_t parent __unused, dev
 	aprint_naive(\n);
 
 	sc = device_private(self);
-	sc-sc_iot = imx_bs_tag;
+	sc-sc_iot = armv7_generic_bs_tag;
 #if NBUS_DMA_GENERIC  0
 	sc-sc_dmat = imx_bus_dma_tag;
 #else

Index: src/sys/arch/arm/imx/imx51var.h
diff -u src/sys/arch/arm/imx/imx51var.h:1.2 src/sys/arch/arm/imx/imx51var.h:1.3
--- src/sys/arch/arm/imx/imx51var.h:1.2	Tue Nov 30 13:05:27 2010
+++ src/sys/arch/arm/imx/imx51var.h	Thu May  7 04:13:47 2015
@@ -1,9 +1,10 @@
-/*	$NetBSD: imx51var.h,v 1.2 2010/11/30 13:05:27 bsh Exp $ */
+/*	$NetBSD: imx51var.h,v 1.3 2015/05/07 04:13:47 hkenken Exp $ */
 
 #ifndef _ARM_IMX_IMX51VAR_H
 #define	_ARM_IMX_IMX51VAR_H
 
-extern struct bus_space imx_bs_tag;
+extern struct bus_space armv7_generic_bs_tag;
+extern struct bus_space armv7_generic_a4x_bs_tag;
 extern struct arm32_bus_dma_tag imx_bus_dma_tag;
 
 void gpio_set_direction(uint32_t, uint32_t);

Index: src/sys/arch/evbarm/conf/files.kobo
diff -u src/sys/arch/evbarm/conf/files.kobo:1.1 src/sys/arch/evbarm/conf/files.kobo:1.2
--- src/sys/arch/evbarm/conf/files.kobo:1.1	Fri Jul 25 11:22:50 2014
+++ src/sys/arch/evbarm/conf/files.kobo	Thu May  7 04:13:47 2015
@@ -1,12 +1,8 @@
-#	$NetBSD: files.kobo,v 1.1 2014/07/25 11:22:50 hkenken Exp $
+#	$NetBSD: files.kobo,v 1.2 2015/05/07 04:13:47 hkenken Exp $
 #
 # KOBO evaluation board configuration info
 #
 
-file	arch/arm/arm32/arm32_boot.c
-file	arch/arm/arm32/arm32_kvminit.c
-file	arch/arm/arm32/arm32_reboot.c
-
 file	arch/evbarm/kobo/kobo_machdep.c
 
 # Kernel boot arguments

Index: src/sys/arch/evbarm/conf/files.netwalker
diff -u src/sys/arch/evbarm/conf/files.netwalker:1.8 src/sys/arch/evbarm/conf/files.netwalker:1.9
--- src/sys/arch/evbarm/conf/files.netwalker:1.8	Tue May  6 12:02:52 2014
+++ src/sys/arch/evbarm/conf/files.netwalker	Thu May  7 04:13:47 2015
@@ -1,12 +1,8 @@
-#	$NetBSD: files.netwalker,v 1.8 2014/05/06 12:02:52 hkenken Exp $
+#	$NetBSD: files.netwalker,v 1.9 2015/05/07 04:13:47 hkenken Exp $
 #
 # Sharp Netwalker configuration info
 #
 
-file   arch/arm/arm32/arm32_boot.c
-file   arch/arm/arm32/arm32_kvminit.c
-file   arch/arm/arm32/arm32_reboot.c
-
 file	

CVS commit: src/sys/arch/arm/imx

2015-05-06 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu May  7 04:37:29 UTC 2015

Modified Files:
src/sys/arch/arm/imx: imx51reg.h

Log Message:
fixed register size


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx51reg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx51reg.h
diff -u src/sys/arch/arm/imx/imx51reg.h:1.6 src/sys/arch/arm/imx/imx51reg.h:1.7
--- src/sys/arch/arm/imx/imx51reg.h:1.6	Fri Mar 27 05:31:23 2015
+++ src/sys/arch/arm/imx/imx51reg.h	Thu May  7 04:37:29 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: imx51reg.h,v 1.6 2015/03/27 05:31:23 hkenken Exp $ */
+/* $NetBSD: imx51reg.h,v 1.7 2015/05/07 04:37:29 hkenken Exp $ */
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -126,7 +126,7 @@
 #define	ESDHC2_BASE	(AIPSTZ1_BASE + 0x8000)
 #define	ESDHC3_BASE	(AIPSTZ1_BASE + 0x0002)
 #define	ESDHC4_BASE	(AIPSTZ1_BASE + 0x00024000)
-#define	ESDHC_SIZE	0x100
+#define	ESDHC_SIZE	0x4000
 
 #define PWM1_BASE	(AIPSTZ1_BASE + 0x03fb4000)
 #define PWM2_BASE	(AIPSTZ1_BASE + 0x03fb8000)
@@ -239,7 +239,7 @@
 #define	 USB_CLKONOFF_CTRL_H1_AHBCLK_OFF	__BIT(18)
 #define	 USB_CLKONOFF_CTRL_OTG_AHBCLK_OFF	__BIT(17)
 
-#define	USBOH3_SIZE	0x828
+#define	USBOH3_SIZE	0x4000
 
 /* GPIO module */
 
@@ -266,7 +266,7 @@
 
 #define	WDOG1_BASE	(AIPSTZ1_BASE + 0x03f98000)
 #define	WDOG2_BASE	(AIPSTZ1_BASE + 0x03f9c000)
-#define	WDOG_SIZE	0x000a
+#define	WDOG_SIZE	0x4000
 
 #define	GPT_BASE	(AIPSTZ1_BASE + 0x03fa)
 #define	GPT_SIZE	0x4000
@@ -342,7 +342,7 @@
 #define	SRC_SIZE	0x4000
 
 #define	CCM_BASE	(AIPSTZ1_BASE + 0x03fd4000)
-#define	CCM_SIZE	0x0088
+#define	CCM_SIZE	0x4000
 
 #define	GPC_BASE	(AIPSTZ1_BASE + 0x03fd8000)
 #define	GPC_SIZE	0x4000
@@ -419,6 +419,6 @@
 #define	SAHARA_SIZE	0x4000
 
 #define	DPLL_BASE(n)	((AIPSTZ2_BASE + 0x03F8 + (0x4000 * ((n)-1
-#define	DPLL_SIZE	0x100
+#define	DPLL_SIZE	0x4000
 
 #endif /* _ARM_IMX_IMX51REG_H_ */



CVS commit: src/sys/arch/evbarm/conf

2015-05-01 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri May  1 07:22:42 UTC 2015

Modified Files:
src/sys/arch/evbarm/conf: NETWALKER

Log Message:
remove DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/NETWALKER

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/NETWALKER
diff -u src/sys/arch/evbarm/conf/NETWALKER:1.33 src/sys/arch/evbarm/conf/NETWALKER:1.34
--- src/sys/arch/evbarm/conf/NETWALKER:1.33	Fri Apr 10 10:58:07 2015
+++ src/sys/arch/evbarm/conf/NETWALKER	Fri May  1 07:22:42 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: NETWALKER,v 1.33 2015/04/10 10:58:07 hkenken Exp $
+#	$NetBSD: NETWALKER,v 1.34 2015/05/01 07:22:42 hkenken Exp $
 #
 #	NETWALKER -- http://www.sharp.co.jp/netwalker/
 #
@@ -16,7 +16,7 @@ options 	IMX51
 options 	CONSDEVNAME=\imxuart\,CONADDR=0x73fbc000
 options 	CONSPEED=115200	# Console speed
 
-options DIAGNOSTIC  # internal consistency checks
+# Development and Debugging options
 #optionsDEBUG
 #options 	KGDB
 makeoptions	DEBUG=-g	# compile full symbol table



CVS commit: src/sys/arch/arm/imx

2015-03-26 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Mar 27 05:31:23 UTC 2015

Modified Files:
src/sys/arch/arm/imx: files.imx51 files.imx6 imx51_i2c.c imx51reg.h
imx6_i2c.c imx6_reg.h imxi2c.c imxi2cvar.h
Removed Files:
src/sys/arch/arm/imx: imxi2creg.h

Log Message:
Rewritten to take advantage of motoi2c code.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_i2c.c \
src/sys/arch/arm/imx/imx6_i2c.c src/sys/arch/arm/imx/imxi2c.c \
src/sys/arch/arm/imx/imxi2cvar.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx51reg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx6_reg.h
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/imx/imxi2creg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.11 src/sys/arch/arm/imx/files.imx51:1.12
--- src/sys/arch/arm/imx/files.imx51:1.11	Fri Jul 25 07:49:56 2014
+++ src/sys/arch/arm/imx/files.imx51	Fri Mar 27 05:31:23 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.11 2014/07/25 07:49:56 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.12 2015/03/27 05:31:23 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -103,7 +103,7 @@ attach	sdhc at axi with sdhc_axi
 file	arch/arm/imx/imx51_esdhc.c		sdhc_axi
 
 # iic Controler
-device	imxi2c: i2cbus
+device	imxi2c: motoi2c, i2cbus, i2cexec
 attach	imxi2c at axi
 file	arch/arm/imx/imxi2c.c		imxi2c
 file	arch/arm/imx/imx51_i2c.c	imxi2c

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.4 src/sys/arch/arm/imx/files.imx6:1.5
--- src/sys/arch/arm/imx/files.imx6:1.4	Tue Oct  7 09:36:09 2014
+++ src/sys/arch/arm/imx/files.imx6	Fri Mar 27 05:31:23 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.4 2014/10/07 09:36:09 ryo Exp $
+#	$NetBSD: files.imx6,v 1.5 2015/03/27 05:31:23 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -62,7 +62,7 @@ attach	imxiomux at axi
 file	arch/arm/imx/imx6_iomux.c		imxiomux
 
 # iMX iic Controler
-device	imxi2c: i2cbus
+device	imxi2c: motoi2c, i2cbus, i2cexec
 attach	imxi2c at axi
 file	arch/arm/imx/imxi2c.c			imxi2c
 file	arch/arm/imx/imx6_i2c.c			imxi2c

Index: src/sys/arch/arm/imx/imx51_i2c.c
diff -u src/sys/arch/arm/imx/imx51_i2c.c:1.1 src/sys/arch/arm/imx/imx51_i2c.c:1.2
--- src/sys/arch/arm/imx/imx51_i2c.c:1.1	Fri Jul 25 07:07:47 2014
+++ src/sys/arch/arm/imx/imx51_i2c.c	Fri Mar 27 05:31:23 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: imx51_i2c.c,v 1.1 2014/07/25 07:07:47 hkenken Exp $	*/
+/*	$NetBSD: imx51_i2c.c,v 1.2 2015/03/27 05:31:23 hkenken Exp $	*/
 
 /*
- * Copyright (c) 2012 Genetec Corporation.  All rights reserved.
+ * Copyright (c) 2012, 2015 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,24 +27,32 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_i2c.c,v 1.1 2014/07/25 07:07:47 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_i2c.c,v 1.2 2015/03/27 05:31:23 hkenken Exp $);
+
+#include opt_imx.h
 
 #include sys/param.h
 #include sys/bus.h
 #include sys/device.h
 
-#include opt_imx.h
-
-#include arm/imx/imxi2cvar.h
 #include arm/imx/imx51reg.h
 #include arm/imx/imx51var.h
 #include arm/imx/imx51_ccmvar.h
+#include arm/imx/imxi2cvar.h
 
 int
 imxi2c_match(device_t parent, cfdata_t cf, void *aux)
 {
-	if (strcmp(cf-cf_name, imxi2c) == 0)
+	struct axi_attach_args *aa = aux;
+
+	switch (aa-aa_addr) {
+	case I2C1_BASE:
+	case I2C2_BASE:
+#ifdef IMX50
+	case I2C3_BASE:
+#endif
 		return 1;
+	}
 
 	return 0;
 }
@@ -53,15 +61,11 @@ void
 imxi2c_attach(device_t parent, device_t self, void *aux)
 {
 	struct axi_attach_args * aa = aux;
-	struct imxi2c_softc *sc = device_private(self);
-	struct i2cbus_attach_args iba;
 
-	imxi2c_attach_common(parent, self,
-	aa-aa_iot, aa-aa_addr, aa-aa_size, aa-aa_irq, 0);
+	if (aa-aa_size = 0)
+		aa-aa_size = I2C_SIZE;
 
 	imxi2c_set_freq(self, imx51_get_clock(IMX51CLK_PERCLK_ROOT), 40);
-
-	memset(iba, 0, sizeof(iba));
-	iba.iba_tag = sc-sc_i2c;
-	config_found_ia(sc-sc_dev, i2cbus, iba, iicbus_print);
+	imxi2c_attach_common(parent, self,
+	aa-aa_iot, aa-aa_addr, aa-aa_size, aa-aa_irq, 0);
 }
Index: src/sys/arch/arm/imx/imx6_i2c.c
diff -u src/sys/arch/arm/imx/imx6_i2c.c:1.1 src/sys/arch/arm/imx/imx6_i2c.c:1.2
--- src/sys/arch/arm/imx/imx6_i2c.c:1.1	Tue Oct  7 09:36:09 2014
+++ src/sys/arch/arm/imx/imx6_i2c.c	Fri Mar 27 05:31:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_i2c.c,v 1.1 2014/10/07 09:36:09 ryo Exp $	*/
+/*	$NetBSD: imx6_i2c.c,v 1.2 2015/03/27 05:31:23 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu r...@nerv.org
@@ -31,7 +31,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: 

CVS commit: src/doc

2015-01-23 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jan 23 12:37:54 UTC 2015

Modified Files:
src/doc: CHANGES

Log Message:
Zynq


To generate a diff of this commit:
cvs rdiff -u -r1.2036 -r1.2037 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2036 src/doc/CHANGES:1.2037
--- src/doc/CHANGES:1.2036	Sat Jan 17 17:48:41 2015
+++ src/doc/CHANGES	Fri Jan 23 12:37:54 2015
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.2036 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.2037 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -124,3 +124,5 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	openssl: Import openssl 1.0.1k [spz 20150113]
 	am-utils: Upgrade to 6.2; adds nfsv4, lustre (which we can't use)
 		nfs3 rpc support for amfs [christos 20150117]
+	arm: Add support for Zynq SoC. [hkenken 20150123]
+	evbarm: Add support for the PARALLELLA (Zynq). [hkenken 20150123]



CVS commit: src/sys/arch/arm/cortex

2015-01-08 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Jan  8 10:38:08 UTC 2015

Modified Files:
src/sys/arch/arm/cortex: a9tmr.c

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/cortex/a9tmr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/a9tmr.c
diff -u src/sys/arch/arm/cortex/a9tmr.c:1.9 src/sys/arch/arm/cortex/a9tmr.c:1.10
--- src/sys/arch/arm/cortex/a9tmr.c:1.9	Fri Jan  2 23:19:28 2015
+++ src/sys/arch/arm/cortex/a9tmr.c	Thu Jan  8 10:38:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9tmr.c,v 1.9 2015/01/02 23:19:28 jmcneill Exp $	*/
+/*	$NetBSD: a9tmr.c,v 1.10 2015/01/08 10:38:08 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: a9tmr.c,v 1.9 2015/01/02 23:19:28 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: a9tmr.c,v 1.10 2015/01/08 10:38:08 hkenken Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -140,7 +140,7 @@ a9tmr_attach(device_t parent, device_t s
 	device_xname(self), missing interrupts);
 
 	bus_space_subregion(sc-sc_memt, sc-sc_memh, 
-	TMR_GLOBAL_BASE, TMR_GLOBAL_BASE, sc-sc_global_memh);
+	TMR_GLOBAL_BASE, TMR_GLOBAL_SIZE, sc-sc_global_memh);
 	bus_space_subregion(sc-sc_memt, sc-sc_memh, 
 	TMR_PRIVATE_BASE, TMR_PRIVATE_SIZE, sc-sc_private_memh);
 	bus_space_subregion(sc-sc_memt, sc-sc_memh, 



CVS commit: src/sys/arch/arm/imx

2014-11-07 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Nov  7 11:54:18 UTC 2014

Modified Files:
src/sys/arch/arm/imx: imx51_ipuv3.c imx51_ipuv3reg.h

Log Message:
- Use __SHIFTIN macro
- fix CM_DISP_GEN_DI1_COUNTER_RELEASE


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_ipuv3.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_ipuv3reg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx51_ipuv3.c
diff -u src/sys/arch/arm/imx/imx51_ipuv3.c:1.2 src/sys/arch/arm/imx/imx51_ipuv3.c:1.3
--- src/sys/arch/arm/imx/imx51_ipuv3.c:1.2	Tue May  6 11:22:53 2014
+++ src/sys/arch/arm/imx/imx51_ipuv3.c	Fri Nov  7 11:54:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ipuv3.c,v 1.2 2014/05/06 11:22:53 hkenken Exp $	*/
+/*	$NetBSD: imx51_ipuv3.c,v 1.3 2014/11/07 11:54:18 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_ipuv3.c,v 1.2 2014/05/06 11:22:53 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_ipuv3.c,v 1.3 2014/11/07 11:54:18 hkenken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -369,8 +369,8 @@ imx51_ipuv3_di_sync_conf(struct imx51_ip
 	IPUV3_WRITE(sc, di0, IPU_DI_SW_GEN0(no), reg_gen0);
 	IPUV3_WRITE(sc, di0, IPU_DI_SW_GEN1(no), reg_gen1);
 	reg = IPUV3_READ(sc, di0, IPU_DI_STP_REP(no));
-	reg = ~DI_STP_REP_MASK(no);
-	reg |= repeat  DI_STP_REP_SHIFT(no);
+	reg = ~DI_STP_REP(no);
+	reg |= __SHIFTIN(repeat, DI_STP_REP(no));
 	IPUV3_WRITE(sc, di0, IPU_DI_STP_REP(no), reg);
 
 #ifdef IPUV3_DEBUG
@@ -413,7 +413,7 @@ imx51_ipuv3_di_init(struct imx51_ipuv3_s
 
 	IPUV3_WRITE(sc, di0, IPU_DI_BS_CLKGEN0, div);
 	IPUV3_WRITE(sc, di0, IPU_DI_BS_CLKGEN1,
-	(div / 16)  DI_BS_CLKGEN1_DOWN_SHIFT);
+	__SHIFTIN(div / 16, DI_BS_CLKGEN1_DOWN));
 #ifdef IPUV3_DEBUG
 	printf(%s: IPU_DI_BS_CLKGEN0 = 0x%08X\n, __func__,
 	IPUV3_READ(sc, di0, IPU_DI_BS_CLKGEN0));
@@ -421,9 +421,9 @@ imx51_ipuv3_di_init(struct imx51_ipuv3_s
 	IPUV3_READ(sc, di0, IPU_DI_BS_CLKGEN1));
 #endif
 	/* Display Time settings */
-	reg = ((div / 16 - 1)  DI_DW_GEN_ACCESS_SIZE_SHIFT) |
-	((div / 16 - 1)  DI_DW_GEN_COMPONNENT_SIZE_SHIFT) |
-	(3  DI_DW_GEN_PIN_SHIFT(15));
+	reg = __SHIFTIN(div / 16 - 1, DI_DW_GEN_ACCESS_SIZE) |
+	__SHIFTIN(div / 16 - 1, DI_DW_GEN_COMPONNENT_SIZE) |
+	__SHIFTIN(3, DI_DW_GEN_PIN(15));
 	IPUV3_WRITE(sc, di0, IPU_DI_DW_GEN(0), reg);
 #ifdef IPUV3_DEBUG
 	printf(%s: div = %d\n, __func__, div);
@@ -432,7 +432,7 @@ imx51_ipuv3_di_init(struct imx51_ipuv3_s
 #endif
 
 	/* Up  Down Data Wave Set */
-	reg = (div / 16 * 2)  DI_DW_SET_DOWN_SHIFT;
+	reg = __SHIFTIN(div / 16 * 2, DI_DW_SET_DOWN);
 	IPUV3_WRITE(sc, di0, IPU_DI_DW_SET(0, 3), reg);
 #ifdef IPUV3_DEBUG
 	printf(%s: IPU_DI_DW_SET(0, 3) 0x%08X = 0x%08X\n, __func__,
@@ -486,13 +486,14 @@ imx51_ipuv3_di_init(struct imx51_ipuv3_s
 	IPUV3_WRITE(sc, di0, IPU_DI_SW_GEN1(9), 0);
 
 	reg = IPUV3_READ(sc, di0, IPU_DI_STP_REP(6));
-	reg = ~DI_STP_REP_MASK(6);
+	reg = ~DI_STP_REP(6);
 	IPUV3_WRITE(sc, di0, IPU_DI_STP_REP(6), reg);
 	IPUV3_WRITE(sc, di0, IPU_DI_STP_REP(7), 0);
 	IPUV3_WRITE(sc, di0, IPU_DI_STP_REP(9), 0);
 
 	IPUV3_WRITE(sc, di0, IPU_DI_GENERAL, 0);
-	reg = ((3 - 1)  DI_SYNC_AS_GEN_VSYNC_SEL_SHIFT) | 0x2;
+	reg = __SHIFTIN(3 - 1, DI_SYNC_AS_GEN_VSYNC_SEL) |
+	__SHIFTIN(0x2, DI_SYNC_AS_GEN_SYNC_START);
 	IPUV3_WRITE(sc, di0, IPU_DI_SYNC_AS_GEN, reg);
 	IPUV3_WRITE(sc, di0, IPU_DI_POL, DI_POL_DRDY_POLARITY_15);
 
@@ -576,7 +577,7 @@ imx51_ipuv3_initialize(struct imx51_ipuv
 
 	reg = IPUV3_READ(sc, cm, IPU_CM_DISP_GEN);
 	reg |= CM_DISP_GEN_MCU_MAX_BURST_STOP |
-	CM_DISP_GEN_MCU_T(0x8);
+	__SHIFTIN(0x8, CM_DISP_GEN_MCU_T);
 	IPUV3_WRITE(sc, cm, IPU_CM_DISP_GEN, reg);
 }
 

Index: src/sys/arch/arm/imx/imx51_ipuv3reg.h
diff -u src/sys/arch/arm/imx/imx51_ipuv3reg.h:1.1 src/sys/arch/arm/imx/imx51_ipuv3reg.h:1.2
--- src/sys/arch/arm/imx/imx51_ipuv3reg.h:1.1	Tue Apr 17 10:19:57 2012
+++ src/sys/arch/arm/imx/imx51_ipuv3reg.h	Fri Nov  7 11:54:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ipuv3reg.h,v 1.1 2012/04/17 10:19:57 bsh Exp $	*/
+/*	$NetBSD: imx51_ipuv3reg.h,v 1.2 2014/11/07 11:54:18 hkenken Exp $	*/
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -95,11 +95,11 @@
 #define IPU_CM_SKIP			0x00bc
 #define IPU_CM_DISP_ALT_CONF		0x00c0
 #define IPU_CM_DISP_GEN			0x00c4
+#define  CM_DISP_GEN_DI1_COUNTER_RELEASE	__BIT(25)
 #define  CM_DISP_GEN_DI0_COUNTER_RELEASE	__BIT(24)
-#define  CM_DISP_GEN_DI1_COUNTER_RELEASE	__BIT(23)
-#define  CM_DISP_GEN_MCU_MAX_BURST_STOP		__BIT(22)
-#define  CM_DISP_GEN_MCU_T_SHIFT		18
-#define  CM_DISP_GEN_MCU_T(n)		((n)  CM_DISP_GEN_MCU_T_SHIFT)
+#define  CM_DISP_GEN_MCU_CSI_VSYNC_DEST	__BIT(23)
+#define  

CVS commit: src/sys/arch/evbarm/conf

2014-11-02 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sun Nov  2 16:07:15 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: std.n900

Log Message:
Add options __HAVE_MM_MD_DIRECT_MAPPED_PHYS and ARM_HAS_VBAR for N900.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/std.n900

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/std.n900
diff -u src/sys/arch/evbarm/conf/std.n900:1.4 src/sys/arch/evbarm/conf/std.n900:1.5
--- src/sys/arch/evbarm/conf/std.n900:1.4	Fri Nov  1 18:41:06 2013
+++ src/sys/arch/evbarm/conf/std.n900	Sun Nov  2 16:07:15 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: std.n900,v 1.4 2013/11/01 18:41:06 skrll Exp $
+#	$NetBSD: std.n900,v 1.5 2014/11/02 16:07:15 hkenken Exp $
 #
 # standard NetBSD/evbarm for N900 options
 
@@ -12,6 +12,8 @@ include		arch/evbarm/conf/files.n900
 options 	__HAVE_CPU_COUNTER
 options 	CORTEX_PMC
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
+options 	ARM_HAS_VBAR
+options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 options 	TPIDRPRW_IS_CURCPU
 options 	KERNEL_BASE_EXT=0x8000
 options 	FPU_VFP



CVS commit: src/sys/arch/arm/imx

2014-07-25 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jul 25 06:36:16 UTC 2014

Modified Files:
src/sys/arch/arm/imx: imxuart.c

Log Message:
Delete unused variables for new gcc.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/imxuart.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxuart.c
diff -u src/sys/arch/arm/imx/imxuart.c:1.11 src/sys/arch/arm/imx/imxuart.c:1.12
--- src/sys/arch/arm/imx/imxuart.c:1.11	Sun Mar 16 05:20:23 2014
+++ src/sys/arch/arm/imx/imxuart.c	Fri Jul 25 06:36:16 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.11 2014/03/16 05:20:23 dholland Exp $ */
+/* $NetBSD: imxuart.c,v 1.12 2014/07/25 06:36:16 hkenken Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imxuart.c,v 1.11 2014/03/16 05:20:23 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: imxuart.c,v 1.12 2014/07/25 06:36:16 hkenken Exp $);
 
 #include opt_imxuart.h
 #include opt_ddb.h
@@ -2223,7 +2223,7 @@ imxuart_common_getc(dev_t dev, struct im
 	c = 0xff  bus_space_read_4(iot, ioh, IMX_URXD);
 
 	{
-		int cn_trapped = 0; /* unused */
+		int __attribute__((__unused__))cn_trapped = 0; /* unused */
 #ifdef DDB
 		extern int db_active;
 		if (!db_active)
@@ -2246,7 +2246,7 @@ imxuart_common_putc(dev_t dev, struct im
 	if (!READAHEAD_IS_FULL() 
 	((usr2 = bus_space_read_4(iot, ioh, IMX_USR2))  IMX_USR2_RDR)) {
 
-		int cn_trapped = 0;
+		int __attribute__((__unused__))cn_trapped = 0;
 		cin = bus_space_read_4(iot, ioh, IMX_URXD);
 		cn_check_magic(dev, cin  0xff, imxuart_cnm_state);
 		imxuart_readahead_in = (imxuart_readahead_in + 1) 



CVS commit: src/sys/arch/arm/imx

2014-07-25 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jul 25 07:07:47 UTC 2014

Modified Files:
src/sys/arch/arm/imx: files.imx51 imxi2creg.h
Added Files:
src/sys/arch/arm/imx: imx51_i2c.c imxi2c.c imxi2cvar.h

Log Message:
Add i2c driver for i.MX.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx51_i2c.c \
src/sys/arch/arm/imx/imxi2c.c src/sys/arch/arm/imx/imxi2cvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxi2creg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.9 src/sys/arch/arm/imx/files.imx51:1.10
--- src/sys/arch/arm/imx/files.imx51:1.9	Tue May  6 11:22:53 2014
+++ src/sys/arch/arm/imx/files.imx51	Fri Jul 25 07:07:47 2014
@@ -1,6 +1,6 @@
-#	$NetBSD: files.imx51,v 1.9 2014/05/06 11:22:53 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.10 2014/07/25 07:07:47 hkenken Exp $
 #
-# Configuration info for the Freescale i.MX51
+# Configuration info for the Freescale i.MX5x
 #
 
 defparam opt_imx.hMEMSIZE
@@ -90,19 +90,15 @@ file   arch/arm/imx/imx51_usb.c			imxusb
 attach ehci at imxusbc with imxehci
 file   arch/arm/imx/imxusb.c			imxehci
 
-# attach	wdc at ahb with wdc_ahb : bus_dma_generic
-# file	arch/arm/imx/wdc_axi.c			wdc_axi
-
 # SD host controller for SD/MMC
 attach	sdhc at axi with sdhc_axi
 file	arch/arm/imx/imx51_esdhc.c		sdhc_axi
 
 # iic Controler
-# device	imxi2c: i2cbus
-# file	arch/arm/imx/imx51_i2c.c		imxi2c
-
-# attach	imxi2c at aips with imxi2c_aips
-# file	arch/arm/imx/imxi2c_aips.c		imxi2c_aips
+device	imxi2c: i2cbus
+attach	imxi2c at axi
+file	arch/arm/imx/imxi2c.c		imxi2c
+file	arch/arm/imx/imx51_i2c.c	imxi2c
 
 # SPI bus controlloer
 # attach of this driver need to be specified in paltform configuration
@@ -116,7 +112,7 @@ defparam opt_imxspi.hIMXSPI_DEBUG
 
 # Smart Direct Memory Access Controller
 # device	imxsdma: dmover_service, bus_dma_generic
-# attach	imxsdma at ahb
+# attach	imxsdma at axi
 # file	arch/arm/imx/imxsdma.c		imxsdma
 # file	arch/arm/imx/imxsdmaprog.c		imxsdma
 

Index: src/sys/arch/arm/imx/imxi2creg.h
diff -u src/sys/arch/arm/imx/imxi2creg.h:1.1 src/sys/arch/arm/imx/imxi2creg.h:1.2
--- src/sys/arch/arm/imx/imxi2creg.h:1.1	Sat Nov 13 07:11:03 2010
+++ src/sys/arch/arm/imx/imxi2creg.h	Fri Jul 25 07:07:47 2014
@@ -1,24 +1,53 @@
+/*	$NetBSD: imxi2creg.h,v 1.2 2014/07/25 07:07:47 hkenken Exp $	*/
+
+/*
+ * Copyright (c) 2009  Genetec Corporation.  All rights reserved.
+ * Written by Hashimoto Kenichi for Genetec Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _ARM_IMX_IMXI2CREG_H
 #define	_ARM_IMX_IMXI2CREG_H
 
-#define	I2C_IADR	0x00	/* I2C address register */
-#define	I2C_IFDR	0x04	/* I2C frequency divider register */
-#define	I2C_I2CR	0x08	/* I2C control register */
-#define	 I2CR_IEN	0x80	/* I2C enable */
-#define	 I2CR_IIEN	0x40	/* I2C interrupt enable */
-#define	 I2CR_MSTA	0x20	/* Master/slave mode */
-#define	 I2CR_MTX	0x10	/* Transmit/receive mode */
-#define	 I2CR_TXAK	0x08	/* Transmit acknowledge */
-#define	 I2CR_RSTA	0x04	/* Repeat start */
-#define	I2C_I2SR	0x0c	/* I2C status register */
-#define	 I2SR_ICF	0x80	/* Data transferring */
-#define	 I2SR_IAAS	0x40	/* I2C addressed as a slave */
-#define	 I2SR_IBB	0x20	/* I2C busy */
-#define	 I2SR_IAL	0x10	/* I2C Arbitration lost */
-#define	 I2SR_SRW	0x04	/* Slave read/write */
-#define	 I2SR_IIF	0x02	/* I2C interrupt */
-#define	 I2SR_RXAK	0x01	/* Received acknowledge */
-#define	I2C_I2DR	0x10	/* I2C data I/O register */
-#define	I2C_SIZE	0x4000
+#define	I2C_IADR	

CVS commit: src/sys/arch/arm/imx

2014-07-25 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jul 25 07:49:56 UTC 2014

Modified Files:
src/sys/arch/arm/imx: files.imx51 imx51_ccm.c imx51_ccmreg.h
imx51_ccmvar.h imx51_clock.c imx51_dpllreg.h imx51_gpio.c
imx51_iomuxreg.h imx51_tzic.c imx51_uart.c imx51_usb.c imx51reg.h
imxclock.c imxsdmareg.h imxusb.c imxusbreg.h imxusbvar.h
Added Files:
src/sys/arch/arm/imx: imx50_iomuxreg.h

Log Message:
Add support i.MX50x
* i.MX50 series is e-ink e-reader processor.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx50_iomuxreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx51_ccm.c \
src/sys/arch/arm/imx/imxusb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx51_ccmreg.h \
src/sys/arch/arm/imx/imx51_clock.c src/sys/arch/arm/imx/imx51reg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_ccmvar.h \
src/sys/arch/arm/imx/imx51_gpio.c src/sys/arch/arm/imx/imx51_iomuxreg.h \
src/sys/arch/arm/imx/imx51_uart.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_dpllreg.h \
src/sys/arch/arm/imx/imx51_usb.c src/sys/arch/arm/imx/imxsdmareg.h \
src/sys/arch/arm/imx/imxusbreg.h src/sys/arch/arm/imx/imxusbvar.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx51_tzic.c \
src/sys/arch/arm/imx/imxclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.10 src/sys/arch/arm/imx/files.imx51:1.11
--- src/sys/arch/arm/imx/files.imx51:1.10	Fri Jul 25 07:07:47 2014
+++ src/sys/arch/arm/imx/files.imx51	Fri Jul 25 07:49:56 2014
@@ -1,10 +1,11 @@
-#	$NetBSD: files.imx51,v 1.10 2014/07/25 07:07:47 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.11 2014/07/25 07:49:56 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
 
 defparam opt_imx.hMEMSIZE
 defflag opt_imx.hIMX51
+defflag opt_imx.hIMX50
 
 define	bus_dma_generic
 
@@ -32,7 +33,8 @@ file	arch/arm/imx/imx51_clock.c
 # Clock Control Module
 device	imxccm
 attach	imxccm	at axi
-file	arch/arm/imx/imx51_ccm.c	imxccm		needs-flag
+file	arch/arm/imx/imx51_ccm.c		imxccm	needs-flag
+defflag opt_imx51clk.hIMXCCMDEBUG
 
 # frequency of external low frequency clock
 # typically 32000, 32768, or 38400.
@@ -63,6 +65,12 @@ device	imxiomux : bus_space_generic
 attach	imxiomux at axi
 file	arch/arm/imx/imx51_iomux.c		imxiomux
 
+# EPDC controller
+# device	epdc : bus_dma_generic, wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation, vcons
+# file	arch/arm/imx/imx50_epdc.c	epdc	 needs-flag
+# defflag opt_imx50_epdc.h		IMXEPDCCONSOLE
+# defparam opt_imx50_epdc.h		EPDC_DEBUG
+
 # IPU v3 controller
 device	ipu : bus_dma_generic, wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation, vcons
 file	arch/arm/imx/imx51_ipuv3.c	ipu	 needs-flag

Index: src/sys/arch/arm/imx/imx51_ccm.c
diff -u src/sys/arch/arm/imx/imx51_ccm.c:1.5 src/sys/arch/arm/imx/imx51_ccm.c:1.6
--- src/sys/arch/arm/imx/imx51_ccm.c:1.5	Sat Mar 22 09:46:33 2014
+++ src/sys/arch/arm/imx/imx51_ccm.c	Fri Jul 25 07:49:56 2014
@@ -1,6 +1,7 @@
-/*	$NetBSD: imx51_ccm.c,v 1.5 2014/03/22 09:46:33 hkenken Exp $	*/
+/*	$NetBSD: imx51_ccm.c,v 1.6 2014/07/25 07:49:56 hkenken Exp $	*/
+
 /*
- * Copyright (c) 2010, 2011, 2012  Genetec Corporation.  All rights reserved.
+ * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,11 +27,16 @@
  */
 
 /*
- * Clock Controller Module (CCM)
+ * Clock Controller Module (CCM) for i.MX5
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,v 1.5 2014/03/22 09:46:33 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,v 1.6 2014/07/25 07:49:56 hkenken Exp $);
+
+#include opt_imx.h
+#include opt_imx51clk.h
+
+#include locators.h
 
 #include sys/types.h
 #include sys/time.h
@@ -47,11 +53,6 @@ __KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,
 #include arm/imx/imx51var.h
 #include arm/imx/imx51reg.h
 
-#include opt_imx51clk.h
-#include locators.h
-
-//#define	IMXCCMDEBUG
-
 #ifndef	IMX51_OSC_FREQ
 #define	IMX51_OSC_FREQ	(24 * 1000 * 1000)	/* 24MHz */
 #endif
@@ -70,6 +71,9 @@ struct imxccm_softc {
 struct imxccm_softc *ccm_softc;
 
 static uint64_t imx51_get_pll_freq(u_int);
+#if IMX50
+static uint64_t imx51_get_pfd_freq(u_int);
+#endif
 
 static int imxccm_match(device_t, cfdata_t, void *);
 static void imxccm_attach(device_t, device_t, void *);
@@ -122,16 +126,21 @@ imxccm_attach(device_t parent, device_t 
 	imx51_get_pll_freq(2);
 	imx51_get_pll_freq(3);
 
-
 	aprint_verbose_dev(self, CPU clock=%d, UART clock=%d\n,
 	imx51_get_clock(IMX51CLK_ARM_ROOT),
 	imx51_get_clock(IMX51CLK_UART_CLK_ROOT));
-	aprint_verbose_dev(self, 
+	aprint_verbose_dev(self, 

CVS commit: src

2014-07-25 Thread Kenichi Hashimoto
, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2002, 2003, 2010  Genetec Corporation.  All rights reserved.
+ * Written by Kenichi Hashimoto and Hiroyuki Bessho for Genetec Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include opt_imx.h
+#include opt_com.h
+#include opt_cpuoptions.h
+#include opt_cputypes.h
+#include opt_arm_debug.h
+
+#include arm/asm.h
+#include arm/armreg.h
+#include assym.h
+
+#include arm/imx/imx51reg.h
+#include arm/imx/imxuartreg.h
+#include evbarm/kobo/kobo_reg.h
+
+RCSID($NetBSD: kobo_start.S,v 1.1 2014/07/25 11:22:50 hkenken Exp $)
+
+#if defined(VERBOSE_INIT_ARM)
+#define DEBUG_STARTUP
+#define	XPUTC(n) 	mov r0, n; bl _C_LABEL(debugputc)
+#else
+#define	XPUTC(n)
+#endif
+
+#ifndef SDRAM_START
+#define SDRAM_START CSD0DDR_BASE
+#endif
+#define KERNEL_TEXT_ADDR	(SDRAM_START+0x0010)
+
+#define INIT_MEMSIZE	128
+#define TEMP_L1_TABLE	(SDRAM_START + INIT_MEMSIZE * 0x10 - L1_TABLE_SIZE)
+
+#ifdef	DEBUG_STARTUP
+#define	CHECKPOINT(n)	CHECKPOINT2(n,r0,r1)
+#define	CHECKPOINT2(n,ra,rb)		\
+	mov	ra, #0x30+(n); 		\
+	ldr	rb, =UART2_BASE;	\
+	str	ra, [rb, #IMX_UTXD];
+#else
+#define	CHECKPOINT(n)		/* nothing to do */
+#define	CHECKPOINT2(n,ra,rb)	/* nothing to do */
+#endif
+
+	.section .start,ax,%progbits
+
+	.text
+
+	.global _C_LABEL(kobo_start)
+_C_LABEL(kobo_start):
+	CHECKPOINT(0)
+
+#ifdef	DEBUG_STARTUP
+	ldr	sp,=SDRAM_START+0x4000
+
+	bl	newline
+	ldr	r0, =0xdeadb01f
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	mov	r0, pc
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	mrc	p15, 0, r0, c0, c0, 3	/* read TLB type register */
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	mrc	p15, 0, r0, c1, c0, 0	/* read control register */
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	mrc	p15, 0, r0, c2, c0, 0	/* read TTB0 */
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	mrc	p15, 0, r0, c2, c0, 1	/* read TTB1 */
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	ldr	r0, =0xbabeface
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+
+	/* dump some of UART2 registers to know clock frequency */
+	ldr	r4,=UART2_BASE
+	ldr	r0,[r4,#IMX_UBMR]
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+	ldr	r0,[r4,#IMX_UBIR]
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+	ldr	r0,[r4,#IMX_UFCR]
+	bl	_C_LABEL(debugprintx)
+	bl	newline
+#endif	/* DEBUG_STARTUP */
+
+	/* Are we running on right place ? */
+	ldr	r2, =KERNEL_TEXT_ADDR
+	adr	r0, _C_LABEL(kobo_start)
+	cmp	r0, r2
+	beq	relocated
+
+	/*
+	 * move me to RAM
+	 */
+	ldr	r1, .Lcopy_size
+	add	r1, r1, #3
+	mov	r1, r1, LSR #2
+	mov	r4, r2
+
+	bhs	5f
+
+	/* src  dest. copy from top */
+	add r0,r0,r1,LSL #2
+	add r2,r2,r1,LSL #2
+
+3:	ldr r3,[r0,#-4]!
+	str r3,[r2,#-4]!
+	subs r1,r1,#1
+	bhi 3b
+	b 7f
+
+	/* src = dest. copy from bottom */
+5:	ldr r3,[r0],#4
+	str r3,[r2],#4
+	subs r1,r1,#1
+	bhi 5b
+7:
+	/*
+	 * Okay, we are finished relocating the text segment.  Now
+	 * we need to leap to the next instruction.
+	 */
+	ldr	r0, .Lrelocate_address
+	ldr	r1, .Lrelocate_offset
+	add	pc, r0, r1
+
+.Lrelocate_offset:	.word relocated-_C_LABEL(kobo_start)
+
+relocated:
+	CHECKPOINT(1)
+
+	/* Move into supervisor mode and disable IRQs/FIQs. */
+	cpsid   if, #PSR_SVC32_MODE
+
+	bl	cortex_init
+
+	movw	r0, #:lower16:TEMP_L1_TABLE
+	movt	r0, #:upper16:TEMP_L1_TABLE
+	adr	r1, .Lmmu_init_table
+	bl	arm_boot_l1pt_init
+
+	CHECKPOINT(2)
+
+	/*
+	 * Turn on the MMU, Caches, etc.
+	 */
+	movw	r0, #:lower16:TEMP_L1_TABLE
+	movt	r0, #:upper16:TEMP_L1_TABLE
+	movw	lr, #:lower16:1f
+	movt	lr, #:upper16:1f
+	bl	arm_cpuinit
+
+	CHECKPOINT(3)
+
+	movw	ip, #:lower16:start
+	movt	ip, #:upper16:start
+	bx	ip		/* Jump to start (flushes pipeline

CVS commit: src/doc

2014-07-25 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jul 25 15:53:00 UTC 2014

Modified Files:
src/doc: CHANGES

Log Message:
Kobo touch


To generate a diff of this commit:
cvs rdiff -u -r1.1951 -r1.1952 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1951 src/doc/CHANGES:1.1952
--- src/doc/CHANGES:1.1951	Thu Jul 24 15:12:20 2014
+++ src/doc/CHANGES	Fri Jul 25 15:53:00 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1951 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1952 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -451,3 +451,4 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	urtwn(4): Add support for Realtek RTL8188EUS and RTL8188ETV chipsets.
 		Ported from FreeBSD. [nonaka 20140720]
 	tmux(1): Import of tmux 1.9a.  [christos 20140724]
+	arm: Add support for the Kobo touch (i.MX50). [hkenken 20140725]



CVS commit: src/sys/arch/evbarm

2014-07-25 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jul 25 16:04:27 UTC 2014

Modified Files:
src/sys/arch/evbarm/kobo: kobo_machdep.c
src/sys/arch/evbarm/netwalker: netwalker_machdep.c

Log Message:
fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/kobo/kobo_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/netwalker/netwalker_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/kobo/kobo_machdep.c
diff -u src/sys/arch/evbarm/kobo/kobo_machdep.c:1.1 src/sys/arch/evbarm/kobo/kobo_machdep.c:1.2
--- src/sys/arch/evbarm/kobo/kobo_machdep.c:1.1	Fri Jul 25 11:22:50 2014
+++ src/sys/arch/evbarm/kobo/kobo_machdep.c	Fri Jul 25 16:04:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobo_machdep.c,v 1.1 2014/07/25 11:22:50 hkenken Exp $	*/
+/*	$NetBSD: kobo_machdep.c,v 1.2 2014/07/25 16:04:27 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation.
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kobo_machdep.c,v 1.1 2014/07/25 11:22:50 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: kobo_machdep.c,v 1.2 2014/07/25 16:04:27 hkenken Exp $);
 
 #include opt_evbarm_boardtype.h
 #include opt_arm_debug.h
@@ -118,6 +118,7 @@ __KERNEL_RCSID(0, $NetBSD: kobo_machdep
 
 #include sys/param.h
 #include sys/device.h
+#include sys/reboot.h
 #include sys/termios.h
 #include sys/bus.h
 

Index: src/sys/arch/evbarm/netwalker/netwalker_machdep.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.16 src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.17
--- src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.16	Tue May  6 11:22:53 2014
+++ src/sys/arch/evbarm/netwalker/netwalker_machdep.c	Fri Jul 25 16:04:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netwalker_machdep.c,v 1.16 2014/05/06 11:22:53 hkenken Exp $	*/
+/*	$NetBSD: netwalker_machdep.c,v 1.17 2014/07/25 16:04:27 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation.
@@ -102,9 +102,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.16 2014/05/06 11:22:53 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.17 2014/07/25 16:04:27 hkenken Exp $);
 
 #include opt_evbarm_boardtype.h
+#include opt_arm_debug.h
 #include opt_cputypes.h
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -119,6 +120,7 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 
 #include sys/param.h
 #include sys/device.h
+#include sys/reboot.h
 #include sys/termios.h
 #include sys/bus.h
 



CVS commit: src/sys/dev/sdmmc

2014-05-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat May 24 12:10:32 UTC 2014

Modified Files:
src/sys/dev/sdmmc: sdhc.c

Log Message:
eSDHC Controller doesn't have Host SDMA Buffer Boundary bit field


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sdmmc/sdhc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.43 src/sys/dev/sdmmc/sdhc.c:1.44
--- src/sys/dev/sdmmc/sdhc.c:1.43	Thu Jan 10 17:19:33 2013
+++ src/sys/dev/sdmmc/sdhc.c	Sat May 24 12:10:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.43 2013/01/10 17:19:33 jmcneill Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.44 2014/05/24 12:10:32 hkenken Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sdhc.c,v 1.43 2013/01/10 17:19:33 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: sdhc.c,v 1.44 2014/05/24 12:10:32 hkenken Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_sdmmc.h
@@ -1229,8 +1229,10 @@ sdhc_start_command(struct sdhc_host *hp,
 	DPRINTF(1,(%s: writing cmd: blksize=%d blkcnt=%d mode=%04x cmd=%04x\n,
 	HDEVNAME(hp), blksize, blkcount, mode, command));
 
-	blksize |= (MAX(0, PAGE_SHIFT - 12)  SDHC_DMA_BOUNDARY_MASK) 
-	SDHC_DMA_BOUNDARY_SHIFT;	/* PAGE_SIZE DMA boundary */
+	if (!ISSET(hp-sc-sc_flags, SDHC_FLAG_ENHANCED)) {
+		blksize |= (MAX(0, PAGE_SHIFT - 12)  SDHC_DMA_BOUNDARY_MASK) 
+		SDHC_DMA_BOUNDARY_SHIFT;	/* PAGE_SIZE DMA boundary */
+	}
 
 	mutex_enter(hp-host_mtx);
 



CVS commit: src/sys/arch/evbarm

2014-05-06 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue May  6 11:08:51 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: NETWALKER files.netwalker
src/sys/arch/evbarm/netwalker: netwalker.h netwalker_btn.c
Added Files:
src/sys/arch/evbarm/netwalker: netwalker_lid.c netwalker_pwr.c

Log Message:
Imported pwrbtn and lidsw drivers for NetWalker. Those attached to GPIO bus.
+ power button
+ lid close switch


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/files.netwalker
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/netwalker/netwalker.h \
src/sys/arch/evbarm/netwalker/netwalker_btn.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/netwalker/netwalker_lid.c \
src/sys/arch/evbarm/netwalker/netwalker_pwr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/NETWALKER
diff -u src/sys/arch/evbarm/conf/NETWALKER:1.25 src/sys/arch/evbarm/conf/NETWALKER:1.26
--- src/sys/arch/evbarm/conf/NETWALKER:1.25	Sat Mar 29 12:00:27 2014
+++ src/sys/arch/evbarm/conf/NETWALKER	Tue May  6 11:08:51 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: NETWALKER,v 1.25 2014/03/29 12:00:27 hkenken Exp $
+#	$NetBSD: NETWALKER,v 1.26 2014/05/06 11:08:51 hkenken Exp $
 #
 #	NETWALKER -- http://www.sharp.co.jp/netwalker/
 #
@@ -149,6 +149,17 @@ makeoptions	DEBUG=-g	# compile full sy
 #options	SCSIPI_DEBUG_TARGET=0
 #options	SCSIPI_DEBUG_LUN=0
 
+# Valid options for BOOT_ARGS:
+#  single		Boot to single user only
+#  kdb			Give control to kernel debugger
+#  ask			Ask for file name to reboot from
+#  pmapdebug=n	If PMAP_DEBUG, set pmap_debug_level to n
+#  memorydisk=n	Set memorydisk size to n KB
+#  quiet		Show aprint_naive output
+#  verbose		Show aprint_normal and aprint_verbose output
+#options		BOOT_ARGS=\verbose\
+#options		BOOT_ARGS=\pmapdebug=1\
+
 # Kernel root file system and dump configuration.
 config		netbsd		root on ? type ?
 config		netbsd-ld0	root on ld0 type ffs
@@ -214,14 +225,18 @@ options		IMXSPINSLAVES=3
 #options	IMXSPI_DEBUG=10
 
 # Optical Joystick
-mousebtn0	at gpio1 offset 22 mask 0x03 # intr 182, 183
-#options	MOUSEBTN_POLLING
 oj6sh0		at spi0 slave 2
 #options	OJ6SH_DEBUG=4
 options		OJ6SH_UP_X_LEFT_Y
 wsmouse*	at oj6sh? mux 0
+
+mousebtn0	at gpio1 offset 22 mask 0x03 # intr 182, 183
+#options	MOUSEBTN_POLLING
 wsmouse*	at mousebtn? mux 0
 
+pwrbtn0		at gpio1 offset 21 mask 0x01 # intr 181
+lidsw0		at gpio3 offset 12 mask 0x01 # intr 236
+
 # SPI NOR-Flash
 #spiflash0	at spiflashbus?
 #m25p0		at spi0 slave 1

Index: src/sys/arch/evbarm/conf/files.netwalker
diff -u src/sys/arch/evbarm/conf/files.netwalker:1.5 src/sys/arch/evbarm/conf/files.netwalker:1.6
--- src/sys/arch/evbarm/conf/files.netwalker:1.5	Sat Mar 29 12:00:27 2014
+++ src/sys/arch/evbarm/conf/files.netwalker	Tue May  6 11:08:51 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.netwalker,v 1.5 2014/03/29 12:00:27 hkenken Exp $
+#	$NetBSD: files.netwalker,v 1.6 2014/05/06 11:08:51 hkenken Exp $
 #
 # Sharp Netwalker configuration info
 #
@@ -30,10 +30,20 @@ file	arch/evbarm/netwalker/netwalker_spi
 
 # Mouse button
 device	mousebtn: wsmousedev
-attach	mousebtn at gpio with btn_netwalker
-file	arch/evbarm/netwalker/netwalker_btn.c	btn_netwalker
+attach	mousebtn at gpio with netwalker_btn
+file	arch/evbarm/netwalker/netwalker_btn.c	netwalker_btn
 defflag	opt_mousebtn.hMOUSEBTN_POLLING
 
+# Power button
+device	pwrbtn: sysmon_envsys
+attach	pwrbtn at gpio with netwalker_pwr
+file	arch/evbarm/netwalker/netwalker_pwr.c	netwalker_pwr
+
+# Lid close switch
+device	lidsw: sysmon_envsys
+attach	lidsw at gpio with netwalker_lid
+file	arch/evbarm/netwalker/netwalker_lid.c	netwalker_lid
+
 # OJ6SH-T25 Optical Joystick
 device  oj6sh: wsmousedev
 attach  oj6sh at spi

Index: src/sys/arch/evbarm/netwalker/netwalker.h
diff -u src/sys/arch/evbarm/netwalker/netwalker.h:1.1 src/sys/arch/evbarm/netwalker/netwalker.h:1.2
--- src/sys/arch/evbarm/netwalker/netwalker.h:1.1	Wed Apr  9 04:00:50 2014
+++ src/sys/arch/evbarm/netwalker/netwalker.h	Tue May  6 11:08:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netwalker.h,v 1.1 2014/04/09 04:00:50 hkenken Exp $	*/
+/*	$NetBSD: netwalker.h,v 1.2 2014/05/06 11:08:51 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -35,4 +35,9 @@
 #define KERNEL_VM_BASE		0xc000
 #define KERNEL_VM_SIZE		0x2000
 
+#define GPIO0_IRQBASE		128
+#define GPIO1_IRQBASE		160
+#define GPIO2_IRQBASE		192
+#define GPIO3_IRQBASE		224
+
 #endif /* _EVBARM_NETWALKER_NETWALKER_H */
Index: src/sys/arch/evbarm/netwalker/netwalker_btn.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_btn.c:1.1 src/sys/arch/evbarm/netwalker/netwalker_btn.c:1.2
--- src/sys/arch/evbarm/netwalker/netwalker_btn.c:1.1	Sat Mar 29 12:00:27 2014
+++ src/sys/arch/evbarm/netwalker/netwalker_btn.c	Tue May  6 11:08:51 2014
@@ -1,4 +1,4 @@

CVS commit: src/sys/arch

2014-05-06 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue May  6 11:22:53 UTC 2014

Modified Files:
src/sys/arch/arm/imx: files.imx51 imx51_ipuv3.c imx51_ipuv3var.h
src/sys/arch/evbarm/conf: NETWALKER files.netwalker
src/sys/arch/evbarm/netwalker: netwalker_lcd.c netwalker_machdep.c
netwalker_start.S
Added Files:
src/sys/arch/arm/imx: imx51_pwm.c imxpwm.c imxpwmreg.h imxpwmvar.h
src/sys/arch/evbarm/netwalker: netwalker_backlight.c
netwalker_backlightvar.h

Log Message:
Add support for LCD Backlight control on NetWalker.
+ use imxpwm driver (PWM control driver for i.MX)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_ipuv3.c \
src/sys/arch/arm/imx/imx51_ipuv3var.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx51_pwm.c \
src/sys/arch/arm/imx/imxpwm.c src/sys/arch/arm/imx/imxpwmreg.h \
src/sys/arch/arm/imx/imxpwmvar.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/files.netwalker
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/netwalker/netwalker_backlight.c \
src/sys/arch/evbarm/netwalker/netwalker_backlightvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/netwalker/netwalker_lcd.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/netwalker/netwalker_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/netwalker/netwalker_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.8 src/sys/arch/arm/imx/files.imx51:1.9
--- src/sys/arch/arm/imx/files.imx51:1.8	Sat Mar 22 09:28:08 2014
+++ src/sys/arch/arm/imx/files.imx51	Tue May  6 11:22:53 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.8 2014/03/22 09:28:08 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.9 2014/05/06 11:22:53 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX51
 #
@@ -123,3 +123,8 @@ defparam opt_imxspi.hIMXSPI_DEBUG
 # iis sound Controller (SSI module)
 # device	imxi2s {} : bus_dma_generic
 # file	arch/arm/imx/imx51_i2s.c		imxi2s needs-flag
+
+# PWM controlloer
+device	imxpwm
+file	arch/arm/imx/imxpwm.c			imxpwm
+file	arch/arm/imx/imx51_pwm.c		imxpwm

Index: src/sys/arch/arm/imx/imx51_ipuv3.c
diff -u src/sys/arch/arm/imx/imx51_ipuv3.c:1.1 src/sys/arch/arm/imx/imx51_ipuv3.c:1.2
--- src/sys/arch/arm/imx/imx51_ipuv3.c:1.1	Tue Apr 17 10:19:57 2012
+++ src/sys/arch/arm/imx/imx51_ipuv3.c	Tue May  6 11:22:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ipuv3.c,v 1.1 2012/04/17 10:19:57 bsh Exp $	*/
+/*	$NetBSD: imx51_ipuv3.c,v 1.2 2014/05/06 11:22:53 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_ipuv3.c,v 1.1 2012/04/17 10:19:57 bsh Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_ipuv3.c,v 1.2 2014/05/06 11:22:53 hkenken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, $NetBSD: imx51_ipuv3.
 #include sys/uio.h
 #include sys/malloc.h
 #include sys/kernel.h			/* for cold */
+#include sys/pmf.h
 
 #include uvm/uvm_extern.h
 
@@ -66,7 +67,10 @@ __KERNEL_RCSID(0, $NetBSD: imx51_ipuv3.
  * before devices get attached.
  */
 struct {
-	intis_console;
+	int is_console;
+	struct imx51_wsscreen_descr *descr;
+	struct wsdisplay_accessops *accessops;
+	const struct lcd_panel_geometry *geom;
 } imx51_ipuv3_console;
 
 #define	IPUV3_READ(ipuv3, module, reg)	  \
@@ -92,45 +96,8 @@ static void imx51_ipuv3_setup_rasops(str
 #endif
 static void imx51_ipuv3_set_idma_param(uint32_t *, uint32_t, uint32_t);
 
-#if NWSDISPLAY  0
-/*
- * wsdisplay glue
- */
-static struct imx51_wsscreen_descr imx51_ipuv3_stdscreen = {
-	.c = {
-		.name	  = std,
-		.ncols	  = 0,
-		.nrows	  = 0,
-		.textops  = NULL,
-		.fontwidth= 8,
-		.fontheight   = 16,
-		.capabilities = WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
-		.modecookie   = NULL
-	},
-	.depth = 16,		/* bits per pixel */
-	.flags = RI_CENTER | RI_FULLCLEAR
-};
-
-static const struct wsscreen_descr *imx51_ipuv3_scr_descr[] = {
-	imx51_ipuv3_stdscreen.c,
-};
-
-const struct wsscreen_list imx51_ipuv3_screen_list = {
-	sizeof imx51_ipuv3_scr_descr / sizeof imx51_ipuv3_scr_descr[0],
-	imx51_ipuv3_scr_descr
-};
-
-struct wsdisplay_accessops imx51_ipuv3_accessops = {
-	.ioctl	  = imx51_ipuv3_ioctl,
-	.mmap	  = imx51_ipuv3_mmap,
-	.alloc_screen = NULL,
-	.free_screen  = NULL,
-	.show_screen  = NULL,
-	.load_font= NULL,
-	.pollc	  = NULL,
-	.scroll	  = NULL
-};
-#endif
+static bool imx51_ipuv3_resume(device_t, const pmf_qual_t *);
+static bool imx51_ipuv3_suspend(device_t, const pmf_qual_t *);
 
 #ifdef IPUV3_DEBUG
 static void
@@ -621,7 +588,7 @@ imx51_ipuv3_init_screen(void *cookie, st
 
 	struct imx51_ipuv3_softc *sc = 

CVS commit: src/sys/arch/evbarm/conf

2014-05-06 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue May  6 12:02:52 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: files.netwalker

Log Message:
Add needs-flag to netwalker_backlight.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/files.netwalker

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/files.netwalker
diff -u src/sys/arch/evbarm/conf/files.netwalker:1.7 src/sys/arch/evbarm/conf/files.netwalker:1.8
--- src/sys/arch/evbarm/conf/files.netwalker:1.7	Tue May  6 11:22:53 2014
+++ src/sys/arch/evbarm/conf/files.netwalker	Tue May  6 12:02:52 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.netwalker,v 1.7 2014/05/06 11:22:53 hkenken Exp $
+#	$NetBSD: files.netwalker,v 1.8 2014/05/06 12:02:52 hkenken Exp $
 #
 # Sharp Netwalker configuration info
 #
@@ -46,7 +46,7 @@ file	arch/evbarm/netwalker/netwalker_lid
 
 # LCD BackLight
 attach	imxpwm at axi with netwalker_backlight
-file	arch/evbarm/netwalker/netwalker_backlight.c	netwalker_backlight
+file	arch/evbarm/netwalker/netwalker_backlight.c	netwalker_backlight needs-flag
 
 # OJ6SH-T25 Optical Joystick
 device  oj6sh: wsmousedev



CVS commit: src/sys/arch/arm/imx

2014-05-01 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri May  2 03:05:41 UTC 2014

Modified Files:
src/sys/arch/arm/imx: imxwdog.c

Log Message:
struct device * - device_t


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxwdog.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxwdog.c
diff -u src/sys/arch/arm/imx/imxwdog.c:1.1 src/sys/arch/arm/imx/imxwdog.c:1.2
--- src/sys/arch/arm/imx/imxwdog.c:1.1	Sat Mar 22 04:55:00 2014
+++ src/sys/arch/arm/imx/imxwdog.c	Fri May  2 03:05:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxwdog.c,v 1.1 2014/03/22 04:55:00 hkenken Exp $	*/
+/*	$NetBSD: imxwdog.c,v 1.2 2014/05/02 03:05:41 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2010  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imxwdog.c,v 1.1 2014/03/22 04:55:00 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imxwdog.c,v 1.2 2014/05/02 03:05:41 hkenken Exp $);
 
 #include opt_imx.h
 
@@ -131,7 +131,7 @@ wdog_setmode(struct sysmon_wdog *smw)
 }
 
 void
-wdog_attach_common(struct device *parent, struct device *self,
+wdog_attach_common(device_t parent, device_t self,
 bus_space_tag_t iot, paddr_t addr, size_t size, int irq)
 {
 	struct wdog_softc *sc = device_private(self);



CVS commit: src/sys/arch/evbarm/netwalker

2014-04-09 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Apr  9 12:35:34 UTC 2014

Modified Files:
src/sys/arch/evbarm/netwalker: netwalker_start.S

Log Message:
delete trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/netwalker/netwalker_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/netwalker/netwalker_start.S
diff -u src/sys/arch/evbarm/netwalker/netwalker_start.S:1.3 src/sys/arch/evbarm/netwalker/netwalker_start.S:1.4
--- src/sys/arch/evbarm/netwalker/netwalker_start.S:1.3	Wed Apr  9 04:00:50 2014
+++ src/sys/arch/evbarm/netwalker/netwalker_start.S	Wed Apr  9 12:35:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netwalker_start.S,v 1.3 2014/04/09 04:00:50 hkenken Exp $	*/
+/*	$NetBSD: netwalker_start.S,v 1.4 2014/04/09 12:35:34 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2009 SHIMIZU Ryo r...@nerv.org
@@ -66,7 +66,7 @@
 #include arm/imx/imxuartreg.h
 #include evbarm/netwalker/netwalker_reg.h
 
-RCSID($NetBSD: netwalker_start.S,v 1.3 2014/04/09 04:00:50 hkenken Exp $)
+RCSID($NetBSD: netwalker_start.S,v 1.4 2014/04/09 12:35:34 hkenken Exp $)
 
 #if defined(VERBOSE_INIT_ARM)
 #define DEBUG_STARTUP
@@ -93,7 +93,7 @@ RCSID($NetBSD: netwalker_start.S,v 1.3 
 #define	CHECKPOINT(n)		/* nothing to do */
 #define	CHECKPOINT2(n,ra,rb)	/* nothing to do */
 #endif
-	
+
 	.section .start,ax,%progbits
 
 	.text
@@ -109,11 +109,11 @@ _C_LABEL(netwalker_start):
 	ldr	r0, =0xdeadb01f
 	bl	_C_LABEL(debugprintx)
 	bl	newline
-	
+
 	mov	r0, pc
 	bl	_C_LABEL(debugprintx)
 	bl	newline
-	
+
 	mrc	p15, 0, r0, c0, c0, 3	/* read TLB type register */
 	bl	_C_LABEL(debugprintx)
 	bl	newline
@@ -146,13 +146,13 @@ _C_LABEL(netwalker_start):
 	bl	_C_LABEL(debugprintx)
 	bl	newline
 #endif	/* DEBUG_STARTUP */
-	
+
 	/* Are we running on right place ? */
 	ldr	r2, =KERNEL_TEXT_ADDR
 	adr	r0, _C_LABEL(netwalker_start)
 	cmp	r0, r2
 	beq	relocated
-	
+
 	/*
 	 * move me to RAM
 	 */
@@ -179,8 +179,8 @@ _C_LABEL(netwalker_start):
 	subs r1,r1,#1
 	bhi 5b
 
-7:	
-	
+7:
+
 
 	/*
 	 * Okay, we are finished relocating the text segment.  Now
@@ -315,7 +315,7 @@ _C_LABEL(debugputc):
 
 	ldmfd	sp!, {r0, r1, r2, pc}
 
-newline:	
+newline:
 	mov	r1, lr
 	mov	r0, #0x0d
 	bl	_C_LABEL(debugputc)



CVS commit: src/sys/arch/evbarm

2014-04-08 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Apr  9 04:00:50 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: mk.netwalker std.netwalker
src/sys/arch/evbarm/netwalker: netwalker_machdep.c netwalker_start.S
Added Files:
src/sys/arch/evbarm/netwalker: netwalker.h

Log Message:
NetWalker kernels boot again.
* Enable __HAVE_MM_MD_DIRECT_MAPPED_PHYS
* Change VM layout
* Use common start-up routine


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/mk.netwalker
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/std.netwalker
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/netwalker/netwalker.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/netwalker/netwalker_machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/netwalker/netwalker_start.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/mk.netwalker
diff -u src/sys/arch/evbarm/conf/mk.netwalker:1.3 src/sys/arch/evbarm/conf/mk.netwalker:1.4
--- src/sys/arch/evbarm/conf/mk.netwalker:1.3	Fri Mar  7 12:35:14 2014
+++ src/sys/arch/evbarm/conf/mk.netwalker	Wed Apr  9 04:00:50 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.netwalker,v 1.3 2014/03/07 12:35:14 hkenken Exp $
+#	$NetBSD: mk.netwalker,v 1.4 2014/04/09 04:00:50 hkenken Exp $
 
 CPPFLAGS+= -mcpu=cortex-a8 -mfpu=neon
 
@@ -6,7 +6,7 @@ SYSTEM_FIRST_OBJ=	netwalker_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/netwalker/netwalker_start.S
 
 KERNEL_BASE_PHYS=0x9010
-KERNEL_BASE_VIRT=0xc010
+KERNEL_BASE_VIRT=0x8010
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${OBJCOPY} -S -O binary $@ $@.bin; \

Index: src/sys/arch/evbarm/conf/std.netwalker
diff -u src/sys/arch/evbarm/conf/std.netwalker:1.8 src/sys/arch/evbarm/conf/std.netwalker:1.9
--- src/sys/arch/evbarm/conf/std.netwalker:1.8	Fri Mar  7 12:35:14 2014
+++ src/sys/arch/evbarm/conf/std.netwalker	Wed Apr  9 04:00:50 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: std.netwalker,v 1.8 2014/03/07 12:35:14 hkenken Exp $
+#	$NetBSD: std.netwalker,v 1.9 2014/04/09 04:00:50 hkenken Exp $
 #
 # standard NetBSD/evbarm options for Sharp NetWalker
 
@@ -11,11 +11,12 @@ include	  	arch/evbarm/conf/files.netwa
 options 	MODULAR
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 options 	__HAVE_CPU_COUNTER
+options __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 options 	ARM_HAS_VBAR
 options 	TPIDRPRW_IS_CURCPU
 options 	CORTEX_PMC
 options 	CORTEX_PMC_CCNT_HZ=8
-options 	KERNEL_BASE_EXT=0xc000
+options 	KERNEL_BASE_EXT=0x8000
 options 	EVBARM_BOARDTYPE=netwalker
 options 	FPU_VFP
 

Index: src/sys/arch/evbarm/netwalker/netwalker_machdep.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.14 src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.15
--- src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.14	Sat Mar 29 12:00:27 2014
+++ src/sys/arch/evbarm/netwalker/netwalker_machdep.c	Wed Apr  9 04:00:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netwalker_machdep.c,v 1.14 2014/03/29 12:00:27 hkenken Exp $	*/
+/*	$NetBSD: netwalker_machdep.c,v 1.15 2014/04/09 04:00:50 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation.
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.14 2014/03/29 12:00:27 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.15 2014/04/09 04:00:50 hkenken Exp $);
 
 #include opt_evbarm_boardtype.h
 #include opt_cputypes.h
@@ -137,7 +137,9 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 #include arm/imx/imxuartreg.h
 #include arm/imx/imxuartvar.h
 #include arm/imx/imx51_iomuxreg.h
+
 #include evbarm/netwalker/netwalker_reg.h
+#include evbarm/netwalker/netwalker.h
 
 #include ukbd.h
 #if (NUKBD  0)
@@ -146,20 +148,12 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 
 /* Kernel text starts 1MB in from the bottom of the kernel address space. */
 #define	KERNEL_TEXT_BASE	(KERNEL_BASE + 0x0010)
-#define	KERNEL_VM_BASE		(KERNEL_BASE + 0x0100)
-
-/*
- * The range 0xc100 - 0xccff is available for kernel VM space
- * Core-logic registers and I/O mappings occupy 0xfd00 - 0x
- */
-#define KERNEL_VM_SIZE		0x0C00
 
 BootConfig bootconfig;		/* Boot config storage */
 static char bootargs[MAX_BOOT_STRING];
 char *boot_args = NULL;
 
 extern char KERNEL_BASE_phys[];
-extern char KERNEL_BASE_virt[];
 
 extern int cpu_do_powersave;
 
@@ -167,12 +161,7 @@ extern int cpu_do_powersave;
  * Macros to translate between physical and virtual for a subset of the
  * kernel address space.  *Not* for general use.
  */
-#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
-#define KERNEL_BASE_VIRT ((vaddr_t)KERNEL_BASE_virt)
-#define KERN_VTOPHYS(va) \
-	((paddr_t)((vaddr_t)va - KERNEL_BASE_VIRT + KERNEL_BASE_PHYS))
-#define KERN_PHYSTOV(pa) \
-	((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE_VIRT))
+#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
 
 
 /* Prototypes */
@@ -212,14 

CVS commit: src/sys

2014-03-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar 29 12:00:27 UTC 2014

Modified Files:
src/sys/arch/arm/imx: imxspi.c
src/sys/arch/evbarm/conf: NETWALKER files.netwalker
src/sys/arch/evbarm/netwalker: netwalker_machdep.c
Added Files:
src/sys/arch/evbarm/netwalker: netwalker_btn.c netwalker_spi.c
src/sys/dev/spi: oj6sh.c

Log Message:
Add optical joystick support for NetWalker.
+ OJ6SH-T25 (Sharp Optical TOUCH CRUISER sensor)
+ 2 Mouse buttons (GPIO)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxspi.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/files.netwalker
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/netwalker/netwalker_btn.c \
src/sys/arch/evbarm/netwalker/netwalker_spi.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/netwalker/netwalker_machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/spi/oj6sh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imxspi.c
diff -u src/sys/arch/arm/imx/imxspi.c:1.1 src/sys/arch/arm/imx/imxspi.c:1.2
--- src/sys/arch/arm/imx/imxspi.c:1.1	Sat Mar 22 09:28:08 2014
+++ src/sys/arch/arm/imx/imxspi.c	Sat Mar 29 12:00:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxspi.c,v 1.1 2014/03/22 09:28:08 hkenken Exp $	*/
+/*	$NetBSD: imxspi.c,v 1.2 2014/03/29 12:00:27 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imxspi.c,v 1.1 2014/03/22 09:28:08 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imxspi.c,v 1.2 2014/03/29 12:00:27 hkenken Exp $);
 
 #include opt_imx.h
 #include opt_imxspi.h
@@ -391,7 +391,7 @@ imxspi_intr(void *arg)
 	/* RXFIFO ready */
 	if (sr  IMXSPI(INTR_RR_EN)) {
 		imxspi_recv(sc);
-		if(sc-sc_wchunk == NULL sc-sc_rchunk == NULL)
+		if (sc-sc_wchunk == NULL  sc-sc_rchunk == NULL)
 			imxspi_done(sc, err);
 	}
 
@@ -408,7 +408,7 @@ imxspi_transfer(void *arg, struct spi_tr
 	int s;
 
 	/* make sure we select the right chip */
-	s = splserial();
+	s = splbio();
 	spi_transq_enqueue(sc-sc_q, st);
 	if (sc-sc_running == FALSE)
 		imxspi_sched(sc);

Index: src/sys/arch/evbarm/conf/NETWALKER
diff -u src/sys/arch/evbarm/conf/NETWALKER:1.24 src/sys/arch/evbarm/conf/NETWALKER:1.25
--- src/sys/arch/evbarm/conf/NETWALKER:1.24	Mon Mar 24 14:15:37 2014
+++ src/sys/arch/evbarm/conf/NETWALKER	Sat Mar 29 12:00:27 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: NETWALKER,v 1.24 2014/03/24 14:15:37 szptvlfn Exp $
+#	$NetBSD: NETWALKER,v 1.25 2014/03/29 12:00:27 hkenken Exp $
 #
 #	NETWALKER -- http://www.sharp.co.jp/netwalker/
 #
@@ -128,7 +128,7 @@ options 	NO_POWERSAVE	# uncomment this t
 
 # Development and Debugging options
 #options 	PERFCTRS	# performance counters
-options 	DIAGNOSTIC	# internally consistency checks
+#options 	DIAGNOSTIC	# internally consistency checks
 #options 	DEBUG
 #options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
 options 	DDB		# in-kernel debugger
@@ -151,6 +151,7 @@ makeoptions	DEBUG=-g	# compile full sy
 
 # Kernel root file system and dump configuration.
 config		netbsd		root on ? type ?
+config		netbsd-ld0	root on ld0 type ffs
 
 # The main bus device
 mainbus0	at root
@@ -175,6 +176,7 @@ imxuart0	at axi? addr 0x73fbc000 irq 31	
 # Clock Control
 imxccm0		at axi? addr 0x73fd4000
 options		IMX51_CKIL_FREQ=32768
+#options	IMXCCMDEBUG
 
 # Enhanced Periodic Interrupt Timer
 imxclock0	at axi? addr 0x73fac000 size 0x4000 irq 40
@@ -183,11 +185,46 @@ imxclock1	at axi? addr 0x73fb size 0
 # IOMUX
 imxiomux0	at axi? addr 0x73fa8000
 
+# WatchDog
+imxwdog0	at axi? addr 0x73f98000 irq 58 flags 0
+
 # GPIO
-imxgpio0	at axi? addr 0x73f84000
-imxgpio1	at axi? addr 0x73f88000
-imxgpio2	at axi? addr 0x73f8c000
-imxgpio3	at axi? addr 0x73f9
+imxgpio0	at axi? addr 0x73f84000 irqbase 128 irq 50
+imxgpio1	at axi? addr 0x73f88000 irqbase 160 irq 52
+imxgpio2	at axi? addr 0x73f8c000 irqbase 192 irq 54
+imxgpio3	at axi? addr 0x73f9 irqbase 224 irq 56
+gpio*		at imxgpio?
+options		IMX_GPIO_INTR_SPLIT
+
+# I2C
+#imxi2c0	at axi? addr 0x83fc8000 irq 62
+#imxi2c1	at axi? addr 0x83fc4000 irq 63
+
+# IIC
+#iic*	   at imxi2c?
+
+# SPI bus
+imxspi0		at axi? addr 0x7001 irq 36 flags 1
+#imxspi1	at axi? addr 0x83fac000 irq 37 flags 1
+#imxspi2	at axi? addr 0x83fc irq 38 flags 0
+spi0		at imxspi0 # eCSPI1
+#spi1		at imxspi1 # eCSPI2
+#spi2		at imxspi2 # CSPI1
+options		IMXSPINSLAVES=3
+#options	IMXSPI_DEBUG=10
+
+# Optical Joystick
+mousebtn0	at gpio1 offset 22 mask 0x03 # intr 182, 183
+#options	MOUSEBTN_POLLING
+oj6sh0		at spi0 slave 2
+#options	OJ6SH_DEBUG=4
+options		OJ6SH_UP_X_LEFT_Y
+wsmouse*	at oj6sh? mux 0
+wsmouse*	at mousebtn? mux 0
+
+# SPI NOR-Flash
+#spiflash0	at spiflashbus?
+#m25p0		at spi0 slave 1
 
 # SD/MMC
 sdhc0	at axi? addr 0x70004000 irq 1	 # eSDHC1
@@ -238,9 +275,9 

CVS commit: src/sys/dev/spi

2014-03-28 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Mar 28 11:52:51 UTC 2014

Modified Files:
src/sys/dev/spi: spiflash.c

Log Message:
Fix printf formating in DPRINTF.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/spi/spiflash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/spi/spiflash.c
diff -u src/sys/dev/spi/spiflash.c:1.12 src/sys/dev/spi/spiflash.c:1.13
--- src/sys/dev/spi/spiflash.c:1.12	Tue Jan 28 19:26:32 2014
+++ src/sys/dev/spi/spiflash.c	Fri Mar 28 11:52:51 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: spiflash.c,v 1.12 2014/01/28 19:26:32 martin Exp $ */
+/* $NetBSD: spiflash.c,v 1.13 2014/03/28 11:52:51 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spiflash.c,v 1.12 2014/01/28 19:26:32 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: spiflash.c,v 1.13 2014/03/28 11:52:51 hkenken Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -457,7 +457,7 @@ spiflash_process_write(spiflash_handle_t
 	 * do the erase, if we need to.
 	 */
 	if (neederase) {
-		DPRINTF((erasing from %x - %x\n, base, base + len));
+		DPRINTF((erasing from %zx - %zx\n, base, base + len));
 		if ((err = sc-sc_erase(sc, base, len)) != 0) {
 			spiflash_process_done(sc, err);
 			return;
@@ -467,8 +467,7 @@ spiflash_process_write(spiflash_handle_t
 	/*
 	 * now write our save area, and finish up.
 	 */
-	DPRINTF((flashing %d bytes to %x from %x\n, len,
-		base, (unsigned)save));
+	DPRINTF((flashing %d bytes to %zx from %p\n, len, base, save));
 	err = sc-sc_write(sc, base, len, save);
 	spiflash_process_done(sc, err);
 }



CVS commit: src/sys/arch/arm/imx

2014-03-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar 22 09:28:08 UTC 2014

Modified Files:
src/sys/arch/arm/imx: files.imx51 imx51_ccm.c imx51_ccmreg.h
Added Files:
src/sys/arch/arm/imx: imx51_spi.c imxcspireg.h imxecspireg.h imxspi.c
imxspireg.h imxspivar.h

Log Message:
Add SPI driver.
i.MX51 have two eCSPI, and one CSPI.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx51_ccm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_ccmreg.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx51_spi.c \
src/sys/arch/arm/imx/imxcspireg.h src/sys/arch/arm/imx/imxecspireg.h \
src/sys/arch/arm/imx/imxspi.c src/sys/arch/arm/imx/imxspireg.h \
src/sys/arch/arm/imx/imxspivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.7 src/sys/arch/arm/imx/files.imx51:1.8
--- src/sys/arch/arm/imx/files.imx51:1.7	Sat Mar 22 05:19:18 2014
+++ src/sys/arch/arm/imx/files.imx51	Sat Mar 22 09:28:08 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.7 2014/03/22 05:19:18 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.8 2014/03/22 09:28:08 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX51
 #
@@ -104,9 +104,15 @@ file	arch/arm/imx/imx51_esdhc.c		sdhc_ax
 # attach	imxi2c at aips with imxi2c_aips
 # file	arch/arm/imx/imxi2c_aips.c		imxi2c_aips
 
-# spi bus controlloer
-# device	imxspi: spibus
-# file	arch/arm/imx/imx51_spi.c		imxspi
+# SPI bus controlloer
+# attach of this driver need to be specified in paltform configuration
+# use flags to module version
+device  imxspi : spibus
+filearch/arm/imx/imxspi.c			imxspi
+defparam opt_imxspi.h   	IMXSPINSLAVES
+defparam opt_imxspi.hIMXSPI_DEBUG
+# attach	imxspi at axi with imx51_spi
+# file	arch/arm/imx/imx51_spi.c		imx51_spi
 
 # Smart Direct Memory Access Controller
 # device	imxsdma: dmover_service, bus_dma_generic

Index: src/sys/arch/arm/imx/imx51_ccm.c
diff -u src/sys/arch/arm/imx/imx51_ccm.c:1.3 src/sys/arch/arm/imx/imx51_ccm.c:1.4
--- src/sys/arch/arm/imx/imx51_ccm.c:1.3	Wed Sep 19 07:28:38 2012
+++ src/sys/arch/arm/imx/imx51_ccm.c	Sat Mar 22 09:28:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ccm.c,v 1.3 2012/09/19 07:28:38 bsh Exp $	*/
+/*	$NetBSD: imx51_ccm.c,v 1.4 2014/03/22 09:28:08 hkenken Exp $	*/
 /*
  * Copyright (c) 2010, 2011, 2012  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,v 1.3 2012/09/19 07:28:38 bsh Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,v 1.4 2014/03/22 09:28:08 hkenken Exp $);
 
 #include sys/types.h
 #include sys/time.h
@@ -146,6 +146,7 @@ imx51_get_clock(enum imx51_clock clk)
 	uint32_t cacrr;	/* ARM clock root register */
 	uint32_t ccsr;
 	uint32_t cscdr1;
+	uint32_t cscdr2;
 	uint32_t cscmr1;
 	uint32_t cbcdr;
 	uint32_t cbcmr;
@@ -293,6 +294,26 @@ imx51_get_clock(enum imx51_clock clk)
 break;
 			}
 		return freq;
+	case IMX51CLK_CSPI_CLK_ROOT:
+		cscmr1 = bus_space_read_4(iot, ioh, CCMC_CSCMR1);
+		cscdr2 = bus_space_read_4(iot, ioh, CCMC_CSCDR2);
+
+		sel = __SHIFTOUT(cscmr1, CSCMR1_CSPI_CLK_SEL);
+		switch (sel) {
+		case 0:
+		case 1:
+		case 2:
+			freq = imx51_get_clock(IMX51CLK_PLL1SW + sel);
+			break;
+		case 3:
+			freq = imx51_get_clock(IMX51CLK_LP_APM);
+			break;
+		}
+
+		freq = freq / (1 + __SHIFTOUT(cscdr2, CSCDR2_ECSPI_CLK_PRED)) /
+		(1 + __SHIFTOUT(cscdr2, CSCDR2_ECSPI_CLK_PODF));
+
+		return freq;
 	default:
 		aprint_error_dev(ccm_softc-sc_dev,
 		clock %d: not supported yet\n, clk);

Index: src/sys/arch/arm/imx/imx51_ccmreg.h
diff -u src/sys/arch/arm/imx/imx51_ccmreg.h:1.2 src/sys/arch/arm/imx/imx51_ccmreg.h:1.3
--- src/sys/arch/arm/imx/imx51_ccmreg.h:1.2	Sat Sep  1 00:07:32 2012
+++ src/sys/arch/arm/imx/imx51_ccmreg.h	Sat Mar 22 09:28:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ccmreg.h,v 1.2 2012/09/01 00:07:32 matt Exp $	*/
+/*	$NetBSD: imx51_ccmreg.h,v 1.3 2014/03/22 09:28:08 hkenken Exp $	*/
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -85,6 +85,7 @@
 #define	CCMC_CSCMR1	0x001c
 #define	 CSCMR1_UART_CLK_SEL_SHIFT	24
 #define	 CSCMR1_UART_CLK_SEL_MASK	__BITS(25, CSCMR1_UART_CLK_SEL_SHIFT)
+#define	 CSCMR1_CSPI_CLK_SEL		__BITS(5, 4)
 #define	CCMC_CSCMR2	0x0020
 #define	CCMC_CSCDR1	0x0024
 #define	 CSCDR1_UART_CLK_PRED_SHIFT	3
@@ -96,6 +97,8 @@
 #define	CCMC_CDCDR	0x0030
 #define	CCMC_CHSCCDR	0x0034		// i.MX6
 #define	CCMC_CSCDR2	0x0038
+#define	 CSCDR2_ECSPI_CLK_PRED		__BITS(27, 25)
+#define	 CSCDR2_ECSPI_CLK_PODF		__BITS(24, 19)
 #define	CCMC_CSCDR3	0x003c
 #define	CCMC_CSCDR4	0x0040
 #define	CCMC_CWDR	0x0044

Added files:

Index: 

CVS commit: src/sys/arch/arm/imx

2014-03-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar 22 09:46:33 UTC 2014

Modified Files:
src/sys/arch/arm/imx: imx51_ccm.c imx51_ccmreg.h imx51_ccmvar.h
imx51_esdhc.c

Log Message:
Fix SDHC clocks.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx51_ccm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imx51_ccmreg.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_ccmvar.h \
src/sys/arch/arm/imx/imx51_esdhc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx51_ccm.c
diff -u src/sys/arch/arm/imx/imx51_ccm.c:1.4 src/sys/arch/arm/imx/imx51_ccm.c:1.5
--- src/sys/arch/arm/imx/imx51_ccm.c:1.4	Sat Mar 22 09:28:08 2014
+++ src/sys/arch/arm/imx/imx51_ccm.c	Sat Mar 22 09:46:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ccm.c,v 1.4 2014/03/22 09:28:08 hkenken Exp $	*/
+/*	$NetBSD: imx51_ccm.c,v 1.5 2014/03/22 09:46:33 hkenken Exp $	*/
 /*
  * Copyright (c) 2010, 2011, 2012  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,v 1.4 2014/03/22 09:28:08 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: imx51_ccm.c,v 1.5 2014/03/22 09:46:33 hkenken Exp $);
 
 #include sys/types.h
 #include sys/time.h
@@ -294,6 +294,52 @@ imx51_get_clock(enum imx51_clock clk)
 break;
 			}
 		return freq;
+	case IMX51CLK_ESDHC2_CLK_ROOT:
+	case IMX51CLK_ESDHC4_CLK_ROOT:
+		cscmr1 = bus_space_read_4(iot, ioh, CCMC_CSCMR1);
+
+		sel = 0;
+		if (clk == IMX51CLK_ESDHC2_CLK_ROOT)
+			sel = __SHIFTOUT(cscmr1, CSCMR1_ESDHC2_CLK_SEL);
+		else if (clk == IMX51CLK_ESDHC4_CLK_ROOT)
+			sel = __SHIFTOUT(cscmr1, CSCMR1_ESDHC4_CLK_SEL);
+
+		if (sel == 0)
+			freq = imx51_get_clock(IMX51CLK_ESDHC1_CLK_ROOT);
+		else
+			freq = imx51_get_clock(IMX51CLK_ESDHC3_CLK_ROOT);
+
+		return freq;
+	case IMX51CLK_ESDHC1_CLK_ROOT:
+	case IMX51CLK_ESDHC3_CLK_ROOT:
+
+		cscdr1 = bus_space_read_4(iot, ioh, CCMC_CSCDR1);
+		cscmr1 = bus_space_read_4(iot, ioh, CCMC_CSCMR1);
+
+		sel = 0;
+		if (clk == IMX51CLK_ESDHC1_CLK_ROOT)
+			sel = __SHIFTOUT(cscmr1, CSCMR1_ESDHC1_CLK_SEL);
+		else if (clk == IMX51CLK_ESDHC3_CLK_ROOT)
+			sel = __SHIFTOUT(cscmr1, CSCMR1_ESDHC3_CLK_SEL);
+
+		switch (sel) {
+		case 0:
+		case 1:
+		case 2:
+			freq = imx51_get_clock(IMX51CLK_PLL1SW + sel);
+			break;
+		case 3:
+			freq = imx51_get_clock(IMX51CLK_LP_APM);
+			break;
+		}
+
+		if (clk == IMX51CLK_ESDHC1_CLK_ROOT)
+			freq = freq / (1 + __SHIFTOUT(cscdr1, CSCDR1_ESDHC1_CLK_PRED)) /
+			(1 + __SHIFTOUT(cscdr1, CSCDR1_ESDHC1_CLK_PODF));
+		else if (clk == IMX51CLK_ESDHC3_CLK_ROOT)
+			freq = freq / (1 + __SHIFTOUT(cscdr1, CSCDR1_ESDHC3_CLK_PRED)) /
+			(1 + __SHIFTOUT(cscdr1, CSCDR1_ESDHC3_CLK_PODF));
+		return freq;
 	case IMX51CLK_CSPI_CLK_ROOT:
 		cscmr1 = bus_space_read_4(iot, ioh, CCMC_CSCMR1);
 		cscdr2 = bus_space_read_4(iot, ioh, CCMC_CSCDR2);

Index: src/sys/arch/arm/imx/imx51_ccmreg.h
diff -u src/sys/arch/arm/imx/imx51_ccmreg.h:1.3 src/sys/arch/arm/imx/imx51_ccmreg.h:1.4
--- src/sys/arch/arm/imx/imx51_ccmreg.h:1.3	Sat Mar 22 09:28:08 2014
+++ src/sys/arch/arm/imx/imx51_ccmreg.h	Sat Mar 22 09:46:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ccmreg.h,v 1.3 2014/03/22 09:28:08 hkenken Exp $	*/
+/*	$NetBSD: imx51_ccmreg.h,v 1.4 2014/03/22 09:46:33 hkenken Exp $	*/
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -85,9 +85,17 @@
 #define	CCMC_CSCMR1	0x001c
 #define	 CSCMR1_UART_CLK_SEL_SHIFT	24
 #define	 CSCMR1_UART_CLK_SEL_MASK	__BITS(25, CSCMR1_UART_CLK_SEL_SHIFT)
+#define	 CSCMR1_ESDHC1_CLK_SEL		__BITS(22, 21)
+#define	 CSCMR1_ESDHC2_CLK_SEL		__BIT(20)
+#define	 CSCMR1_ESDHC4_CLK_SEL		__BIT(19)
+#define	 CSCMR1_ESDHC3_CLK_SEL		__BITS(18, 16)
 #define	 CSCMR1_CSPI_CLK_SEL		__BITS(5, 4)
 #define	CCMC_CSCMR2	0x0020
 #define	CCMC_CSCDR1	0x0024
+#define	 CSCDR1_ESDHC3_CLK_PRED		__BITS(24, 22)
+#define	 CSCDR1_ESDHC3_CLK_PODF		__BITS(21, 19)
+#define	 CSCDR1_ESDHC1_CLK_PRED		__BITS(18, 16)
+#define	 CSCDR1_ESDHC1_CLK_PODF		__BITS(13, 11)
 #define	 CSCDR1_UART_CLK_PRED_SHIFT	3
 #define	 CSCDR1_UART_CLK_PRED_MASK	__BITS(5, CSCDR1_UART_CLK_PRED_SHIFT)
 #define	 CSCDR1_UART_CLK_PODF_SHIFT	0

Index: src/sys/arch/arm/imx/imx51_ccmvar.h
diff -u src/sys/arch/arm/imx/imx51_ccmvar.h:1.1 src/sys/arch/arm/imx/imx51_ccmvar.h:1.2
--- src/sys/arch/arm/imx/imx51_ccmvar.h:1.1	Tue Apr 17 09:33:31 2012
+++ src/sys/arch/arm/imx/imx51_ccmvar.h	Sat Mar 22 09:46:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ccmvar.h,v 1.1 2012/04/17 09:33:31 bsh Exp $	*/
+/*	$NetBSD: imx51_ccmvar.h,v 1.2 2014/03/22 09:46:33 hkenken Exp $	*/
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -56,6 +56,7 @@ enum imx51_clock {
 	

CVS commit: src/sys/lib/libsa

2014-03-21 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar 22 02:51:44 UTC 2014

Modified Files:
src/sys/lib/libsa: subr_prf.c

Log Message:
for LIBSA_PRINTF_WIDTH_SUPPORT,
Fix right and left-adjusting padding.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/lib/libsa/subr_prf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libsa/subr_prf.c
diff -u src/sys/lib/libsa/subr_prf.c:1.23 src/sys/lib/libsa/subr_prf.c:1.24
--- src/sys/lib/libsa/subr_prf.c:1.23	Tue Dec 24 22:26:21 2013
+++ src/sys/lib/libsa/subr_prf.c	Sat Mar 22 02:51:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.23 2013/12/24 22:26:21 jakllsch Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.24 2014/03/22 02:51:44 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -79,7 +79,7 @@ const char hexdigits[16] = 0123456789ab
 #define ZEROPAD		0x40
 #define NEGATIVE	0x80
 #define KPRINTN(base)	kprintn(put, ul, base, lflag, width)
-#define RZERO()			\
+#define LZERO()			\
 do {\
 	if ((lflag  (ZEROPAD|LADJUST)) == ZEROPAD) {		\
 		while (width--  0)\
@@ -102,7 +102,7 @@ do {\
 } while (/*CONSTCOND*/0)
 #else	/* LIBSA_PRINTF_WIDTH_SUPPORT */
 #define KPRINTN(base)	kprintn(put, ul, base)
-#define RZERO()		/**/
+#define LZERO()		/**/
 #define RPAD()		/**/
 #define LPAD()		/**/
 #endif	/* LIBSA_PRINTF_WIDTH_SUPPORT */
@@ -235,9 +235,9 @@ reswitch:
 #ifdef LIBSA_PRINTF_WIDTH_SUPPORT
 			--width;
 #endif
-			RPAD();
-			put(ch  0xFF);
 			LPAD();
+			put(ch  0xFF);
+			RPAD();
 			break;
 		case 's':
 			p = va_arg(ap, char *);
@@ -246,10 +246,10 @@ reswitch:
 continue;
 			width -= q - p;
 #endif
-			RPAD();
+			LPAD();
 			while ((ch = (unsigned char)*p++))
 put(ch);
-			LPAD();
+			RPAD();
 			break;
 		case 'd':
 			ul =
@@ -327,15 +327,15 @@ kprintn(void (*put)(int), UINTMAX_T ul, 
 	else if (lflag  SPACE)
 		*p++ = ' ';
 	width -= p - buf;
-	if ((lflag  LADJUST) == 0) {
+	if (lflag  ZEROPAD) {
 		while (p  q)
 			put(*--p);
 	}
 #endif
-	RPAD();
-	RZERO();
+	LPAD();
+	LZERO();
 	do {
 		put(*--p);
 	} while (p  buf);
-	LPAD();
+	RPAD();
 }



CVS commit: src/sys/arch/arm/imx

2014-03-21 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar 22 04:55:00 UTC 2014

Modified Files:
src/sys/arch/arm/imx: files.imx51 imxwdogreg.h
Added Files:
src/sys/arch/arm/imx: imx51_wdog.c imxwdog.c imxwdogvar.h

Log Message:
add Watchdog Timer support for i.MX51.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx51_wdog.c \
src/sys/arch/arm/imx/imxwdog.c src/sys/arch/arm/imx/imxwdogvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxwdogreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.5 src/sys/arch/arm/imx/files.imx51:1.6
--- src/sys/arch/arm/imx/files.imx51:1.5	Thu Apr 19 09:53:53 2012
+++ src/sys/arch/arm/imx/files.imx51	Sat Mar 22 04:55:00 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.5 2012/04/19 09:53:53 bsh Exp $
+#	$NetBSD: files.imx51,v 1.6 2014/03/22 04:55:00 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX51
 #
@@ -45,6 +45,12 @@ defparam opt_imx51clk.h	IMX51_OSC_FREQ
 defparam opt_imx51clk.h IMX51_AHBCLK_FREQ
 defparam opt_imx51clk.h IMX51_IPGCLK_FREQ
 
+# Watchdog
+device imxwdog: sysmon_wdog
+attach imxwdog at axi
+file   arch/arm/imx/imx51_wdog.c	imxwdog
+file   arch/arm/imx/imxwdog.c		imxwdog
+
 # iMX GPIO
 device	imxgpio: gpiobus
 attach	imxgpio at axi

Index: src/sys/arch/arm/imx/imxwdogreg.h
diff -u src/sys/arch/arm/imx/imxwdogreg.h:1.1 src/sys/arch/arm/imx/imxwdogreg.h:1.2
--- src/sys/arch/arm/imx/imxwdogreg.h:1.1	Sat Nov 13 07:11:03 2010
+++ src/sys/arch/arm/imx/imxwdogreg.h	Sat Mar 22 04:55:00 2014
@@ -42,20 +42,8 @@
  *  2/2010
  */
 
-#ifndef IMXWDOGREG_H
-#define	IMXWDOGREG_H
-
-#ifdef	_LOCORE
-#ifndef	__BIT
-#define	__BIT(n)	(1(n))
-#endif
-#ifndef	__BITS
-#define	__BITS(hi,lo)	(((1((hi)+1))-1)  ~((1((lo))-1))
-#endif
-#else
-#include sys/cdefs.h
-#endif
-
+#ifndef _ARM_IMX_IMXWDOGREG_H
+#define _ARM_IMX_IMXWDOGREG_H
 
 #define	IMX_WDOG_WCR	0x	/* Watchdog Control Register */
 #define	 WCR_WDZST	__BIT(0)	/* watchdog low power */
@@ -65,9 +53,7 @@
 #define	 WCR_SRS	__BIT(4)	/* software reset signal */
 #define	 WCR_WDA	__BIT(5)	/* ipp_wdog* assertion */
 #define	 WCR_WDW	__BIT(7)	/* disable for wait */
-#define	 WCR_WT_SHIFT	8
-#define	 WCR_WT_LEN	8
-#define	 WCR_WT_MASK	__BIT(WCR_WT_SHIFT+WCR_WT_LEN-1, WCR_WT_SHIFT)
+#define	 WCR_WT		__BITS(15, 8)
 	/* watchdog timeout
 	   0=0.5sec 0xff=128sec */
 
@@ -86,17 +72,14 @@
 #define	 WRSR_PWR	__BIT(4)
 #define	 WRSR_JRST	__BIT(5)
 
-
 /* only for i.MX51 */
 #define	IMX_WDOG_WICR	0x0006	/* Watchdog Interrupt Control Register */
-#define	 WICR_WICT_LEN	8
-#define	 WICR_WICT_MASK	__BITS(WICT_LEN-1,0)  /* interrupt count timeout */
+#define	 WICR_WICT	__BITS(7,0)	/* interrupt count timeout */
 #define	 WICR_WTIS	__BIT(14)	/* interrupt status [w1c] */
 #define	 WICR_WIE	__BIT(15)	/* interrupt enable */
 
-
 /* only for i.MX51 */
 #define	IMX_WDOG_WMCR	0x0008
 #define	 WMCR_PDE	__BIT(0)	/* power down enable */
 
-#endif
+#endif /* _ARM_IMX_IMXWDOGREG_H */

Added files:

Index: src/sys/arch/arm/imx/imx51_wdog.c
diff -u /dev/null src/sys/arch/arm/imx/imx51_wdog.c:1.1
--- /dev/null	Sat Mar 22 04:55:00 2014
+++ src/sys/arch/arm/imx/imx51_wdog.c	Sat Mar 22 04:55:00 2014
@@ -0,0 +1,62 @@
+/*	$NetBSD: imx51_wdog.c,v 1.1 2014/03/22 04:55:00 hkenken Exp $	*/
+
+/*
+ * Copyright (c) 2010  Genetec Corporation.  All rights reserved.
+ * Written by Hiroyuki Bessho for Genetec Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: imx51_wdog.c,v 1.1 

CVS commit: src/sys/arch/arm/imx

2014-03-21 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar 22 05:19:18 UTC 2014

Modified Files:
src/sys/arch/arm/imx: files.imx51 imxgpio.c

Log Message:
* GPIO interrupts of i.MX5 are divided into two groups.
  add IMX_GPIO_INTR_SPLIT option
* Support GPIO both edge trigger interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imxgpio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/files.imx51
diff -u src/sys/arch/arm/imx/files.imx51:1.6 src/sys/arch/arm/imx/files.imx51:1.7
--- src/sys/arch/arm/imx/files.imx51:1.6	Sat Mar 22 04:55:00 2014
+++ src/sys/arch/arm/imx/files.imx51	Sat Mar 22 05:19:18 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.6 2014/03/22 04:55:00 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.7 2014/03/22 05:19:18 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX51
 #
@@ -56,6 +56,7 @@ device	imxgpio: gpiobus
 attach	imxgpio at axi
 file	arch/arm/imx/imxgpio.c		imxgpio		needs-flag
 file	arch/arm/imx/imx51_gpio.c	imxgpio
+defflag opt_imxgpio.h			IMX_GPIO_INTR_SPLIT
 
 # iMX IOMUX
 device	imxiomux : bus_space_generic

Index: src/sys/arch/arm/imx/imxgpio.c
diff -u src/sys/arch/arm/imx/imxgpio.c:1.3 src/sys/arch/arm/imx/imxgpio.c:1.4
--- src/sys/arch/arm/imx/imxgpio.c:1.3	Sat Oct 27 17:17:39 2012
+++ src/sys/arch/arm/imx/imxgpio.c	Sat Mar 22 05:19:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxgpio.c,v 1.3 2012/10/27 17:17:39 chs Exp $ */
+/*	$NetBSD: imxgpio.c,v 1.4 2014/03/22 05:19:18 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -29,12 +29,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: imxgpio.c,v 1.3 2012/10/27 17:17:39 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: imxgpio.c,v 1.4 2014/03/22 05:19:18 hkenken Exp $);
 
 #define	_INTR_PRIVATE
 
 #include locators.h
 #include gpio.h
+#include opt_imxgpio.h
 
 #include sys/param.h
 #include sys/evcnt.h
@@ -82,7 +83,12 @@ const struct pic_ops gpio_pic_ops = {
 struct gpio_softc {
 	device_t gpio_dev;
 	struct pic_softc gpio_pic;
+#if defined(IMX_GPIO_INTR_SPLIT)
+	struct intrsource *gpio_is_0_15;
+	struct intrsource *gpio_is_16_31;
+#else
 	struct intrsource *gpio_is;
+#endif
 	bus_space_tag_t gpio_memt;
 	bus_space_handle_t gpio_memh;
 	uint32_t gpio_enable_mask;
@@ -174,6 +180,25 @@ gpio_pic_find_pending_irqs(struct pic_so
 		KASSERT(pending != 0);
 		irq = 31 - __builtin_clz(pending);
 		pending = ~__BIT(irq);
+
+		const struct intrsource *is = pic-pic_sources[irq];
+		if (is-is_type == IST_EDGE_BOTH) {
+			/*
+			 * for both edge
+			 */
+			uint32_t icr_reg = GPIO_ICR1 + ((is-is_irq  0x10)  2);
+			v = GPIO_READ(gpio, icr_reg);
+			uint32_t icr_shift = (is-is_irq  0x0f)  1;
+			uint32_t mask = (3  icr_shift);
+			int gtype = __SHIFTOUT(v, mask);
+			if (gtype == GPIO_ICR_EDGE_RISING)
+gtype = GPIO_ICR_EDGE_FALLING;
+			else if (gtype == GPIO_ICR_EDGE_FALLING)
+gtype = GPIO_ICR_EDGE_RISING;
+			v = ~mask;
+			v |= __SHIFTIN(gtype, mask);
+			GPIO_WRITE(gpio, icr_reg, v);
+		}
 		pic_mark_pending(gpio-gpio_pic, irq);
 	} while (pending != 0);
 
@@ -184,7 +209,8 @@ gpio_pic_find_pending_irqs(struct pic_so
 	((GPIO_ICR_LEVEL_LOW  (2*IST_LEVEL_LOW)) | \
 	 (GPIO_ICR_LEVEL_HIGH  (2*IST_LEVEL_HIGH)) | \
 	 (GPIO_ICR_EDGE_RISING  (2*IST_EDGE_RISING)) | \
-	 (GPIO_ICR_EDGE_FALLING  (2*IST_EDGE_FALLING)))
+	 (GPIO_ICR_EDGE_FALLING  (2*IST_EDGE_FALLING)) | \
+	 (GPIO_ICR_EDGE_RISING  (2*IST_EDGE_BOTH)))
 
 void
 gpio_pic_establish_irq(struct pic_softc *pic, struct intrsource *is)
@@ -341,9 +367,18 @@ imxgpio_attach_common(device_t self, bus
 		aprint_normal(: interrupts %d..%d,
 		irqbase, irqbase + GPIO_NPINS - 1);
 
+#if defined(IMX_GPIO_INTR_SPLIT)
+		gpio-gpio_is_0_15 = intr_establish(intr,
+		IPL_NET, IST_LEVEL, pic_handle_intr, gpio-gpio_pic);
+		KASSERT( gpio-gpio_is_0_15 != NULL );
+		gpio-gpio_is_16_31 = intr_establish(intr + 1,
+		IPL_NET, IST_LEVEL, pic_handle_intr, gpio-gpio_pic);
+		KASSERT( gpio-gpio_is_16_31 != NULL );
+#else
 		gpio-gpio_is = intr_establish(intr,
 		IPL_NET, IST_LEVEL, pic_handle_intr, gpio-gpio_pic);
 		KASSERT( gpio-gpio_is != NULL );
+#endif
 	}
 	aprint_normal(\n);
 		  



CVS commit: src/sys/arch/evbarm/conf

2014-03-08 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Mar  8 23:38:52 UTC 2014

Added Files:
src/sys/arch/evbarm/conf: NETWALKER_INSTALL

Log Message:
add NETWALKER_INSTALL


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/NETWALKER_INSTALL

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/evbarm/conf/NETWALKER_INSTALL
diff -u /dev/null src/sys/arch/evbarm/conf/NETWALKER_INSTALL:1.1
--- /dev/null	Sat Mar  8 23:38:52 2014
+++ src/sys/arch/evbarm/conf/NETWALKER_INSTALL	Sat Mar  8 23:38:52 2014
@@ -0,0 +1,8 @@
+#	$NetBSD: NETWALKER_INSTALL,v 1.1 2014/03/08 23:38:52 hkenken Exp $
+#
+#	NETWALKER_INSTALL -- NETWALKER kernel with installation-sized
+#	ramdisk
+#
+
+include arch/evbarm/conf/NETWALKER
+include arch/evbarm/conf/INSTALL



CVS commit: src

2014-03-07 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Mar  7 12:35:14 UTC 2014

Modified Files:
src/etc/etc.evbarm: Makefile.inc
src/sys/arch/evbarm/conf: NETWALKER mk.netwalker std.netwalker

Log Message:
modified NetWalker kernel config
* add ARM_HAS_VBAR, FPU_VFP etc.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/etc/etc.evbarm/Makefile.inc
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/mk.netwalker
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/std.netwalker

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.60 src/etc/etc.evbarm/Makefile.inc:1.61
--- src/etc/etc.evbarm/Makefile.inc:1.60	Sat Mar  1 01:51:01 2014
+++ src/etc/etc.evbarm/Makefile.inc	Fri Mar  7 12:35:14 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.60 2014/03/01 01:51:01 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.61 2014/03/07 12:35:14 hkenken Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -77,7 +77,8 @@ EVBARM_BOARDS.armv7+=		CUBIEBOARD
 EVBARM_BOARDS.armv7hf+= 	CUBIEBOARD
 #EVBARM_BOARDS.armv7+=		IGEPV2
 #EVBARM_BOARDS.armv7+=		N900
-#EVBARM_BOARDS.armv7+=		NETWALKER
+EVBARM_BOARDS.armv7+=		NETWALKER
+EVBARM_BOARDS.armv7hf+=		NETWALKER
 #EVBARM_BOARDS.armv7+=		OVERO
 #EVBARM_BOARDS.armv7+=		PANDABOARD
 #EVBARM_BOARDS.armv7hf+= 	PANDABOARD

Index: src/sys/arch/evbarm/conf/NETWALKER
diff -u src/sys/arch/evbarm/conf/NETWALKER:1.22 src/sys/arch/evbarm/conf/NETWALKER:1.23
--- src/sys/arch/evbarm/conf/NETWALKER:1.22	Thu Jan 23 12:23:20 2014
+++ src/sys/arch/evbarm/conf/NETWALKER	Fri Mar  7 12:35:14 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: NETWALKER,v 1.22 2014/01/23 12:23:20 hkenken Exp $
+#	$NetBSD: NETWALKER,v 1.23 2014/03/07 12:35:14 hkenken Exp $
 #
 #	NETWALKER -- http://www.sharp.co.jp/netwalker/
 #
@@ -23,8 +23,6 @@ options 	PMAPCOUNTERS
 
 # Architecture options
 
-optionsIMX51_IPGCLK_FREQ=5000   # XXX This value is not correct.
-
 # File systems
 
 file-system	FFS		# UFS
@@ -77,8 +75,8 @@ options 	INET6		# IPV6
 
 #options 	COMPAT_43	# 4.3BSD compatibility.
 options 	COMPAT_60	# NetBSD 6.0 compatibility.
-options 	COMPAT_50	# NetBSD 5.0 compatibility.
-options 	COMPAT_40	# NetBSD 4.0 compatibility.
+#options 	COMPAT_50	# NetBSD 5.0 compatibility.
+#options 	COMPAT_40	# NetBSD 4.0 compatibility.
 #options 	COMPAT_30	# NetBSD 3.0 compatibility.
 #options 	COMPAT_20	# NetBSD 2.0 compatibility.
 #options 	COMPAT_16	# NetBSD 1.6 compatibility.
@@ -140,7 +138,7 @@ options 	DDB_VERBOSE_HELP
 #options 	LOCKDEBUG
 #options 	PMAP_DEBUG	# Enable pmap_debug_level code
 #options 	IPKDB		# remote kernel debugging
-options 	VERBOSE_INIT_ARM # verbose bootstraping messages
+#options 	VERBOSE_INIT_ARM # verbose bootstraping messages
 makeoptions	DEBUG=-g	# compile full symbol table
 #makeoptions	COPTS=-O2
 #options 	SYSCALL_STATS	# per syscall counts
@@ -207,50 +205,11 @@ ehci1	  at imxusbc0	unit 1	irq 14 # Host
 #ehci3	  at imxusbc0	unit 3	irq 17 # Host3
 
 usb*		at ehci?
-uhub*		at usb?
-uhub*		at uhub? port ?
-ugen*		at uhub? port ?
-
-# USB HID device
-uhidev* at uhub? port ? configuration ? interface ?
-
-# USB Mice
-ums*	at uhidev? reportid ?
-wsmouse* at ums? mux 0
-
-# USB Keyboards
-ukbd*	at uhidev? reportid ?
-wskbd*	at ukbd? console ? mux 1
-
-# USB Mass Storage
-umass*	at uhub? port ? configuration ? interface ?
-wd*	at umass?
-
-# Serial adapters
-ubsa*	at uhub? port ?		# Belkin serial adapter
-ucom*	at ubsa? portno ?
-
-uchcom* at uhub? port ? 	# WinChipHead CH341/CH340 serial adapter
-ucom*	at uchcom? portno ?
 
-uftdi*	at uhub? port ?		# FTDI FT8U100AX serial adapter
-ucom*	at uftdi? portno ?
+# USB device drivers
+include dev/usb/usbdevices.config
 
-umct*	at uhub? port ?		# MCT USB-RS232 serial adapter
-ucom*	at umct? portno ?
-
-uplcom* at uhub? port ? 	# I/O DATA USB-RSAQ2 serial adapter
-ucom*	at uplcom? portno ?
-
-uslsa*	at uhub? port ?		# Silicon Labs USB-RS232 serial adapter
-ucom*	at uslsa? portno ?
-
-uvscom* at uhub? port ? 	# SUNTAC Slipper U VS-10U serial adapter
-ucom*	at uvscom? portno ?
-
-# USB generic serial port (e.g., data over cellular)
-ugensa* at uhub? port ?
-ucom*	at ugensa?
+ukphy*		at mii? phy ?
 
 # IPUv3 LCD Controller
 ipu0		at axi?
@@ -272,12 +231,6 @@ options 	WSDISPLAY_COMPAT_USL		# wsconsc
 options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 options 	WSDISPLAY_DEFAULTSCREENS=4
 
-# SCSI bus support
-scsibus* at scsi?
-
-# SCSI devices
-sd*	at scsibus? target ? lun ?	# SCSI disk drives
-
 # Pseudo-Devices
 
 pseudo-device	crypto			# /dev/crypto device
@@ -290,10 +243,10 @@ pseudo-device	swcrypto		# software crypt
 #pseudo-device	putter			# for puffs and pud
 
 # network pseudo-devices
-#pseudo-device	bpfilter		# Berkeley packet filter
+pseudo-device	bpfilter		# Berkeley packet filter

CVS commit: src/sys/arch/arm/imx

2014-02-26 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Feb 27 03:09:58 UTC 2014

Modified Files:
src/sys/arch/arm/imx: imx51_tzicreg.h

Log Message:
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx51_tzicreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx51_tzicreg.h
diff -u src/sys/arch/arm/imx/imx51_tzicreg.h:1.1 src/sys/arch/arm/imx/imx51_tzicreg.h:1.2
--- src/sys/arch/arm/imx/imx51_tzicreg.h:1.1	Sat Nov 13 07:11:03 2010
+++ src/sys/arch/arm/imx/imx51_tzicreg.h	Thu Feb 27 03:09:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_tzicreg.h,v 1.1 2010/11/13 07:11:03 bsh Exp $	*/
+/*	$NetBSD: imx51_tzicreg.h,v 1.2 2014/02/27 03:09:57 hkenken Exp $	*/
 /*
  * Copyright (c) 2010  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef _ARM_IMX_IMX51_TZICREG_H_
-#define	_ARM_IMX_IMX51_TZICRREG_H_
+#define	_ARM_IMX_IMX51_TZICREG_H_
 
 #include sys/cdefs.h
 
@@ -50,4 +50,4 @@
 #define	TZIC_SWINT		0x0f00
 
 #define	TZIC_INTNUM		128
-#endif /* _ARM_IMX_IMX51_TZICRREG_H_ */
+#endif /* _ARM_IMX_IMX51_TZICREG_H_ */



CVS commit: src/sys/arch/evbarm

2014-01-23 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Jan 23 12:23:20 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: NETWALKER
src/sys/arch/evbarm/netwalker: netwalker_machdep.c

Log Message:
use ukbd_cnattach()


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/NETWALKER
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/netwalker/netwalker_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/NETWALKER
diff -u src/sys/arch/evbarm/conf/NETWALKER:1.21 src/sys/arch/evbarm/conf/NETWALKER:1.22
--- src/sys/arch/evbarm/conf/NETWALKER:1.21	Sun Jun 30 21:38:56 2013
+++ src/sys/arch/evbarm/conf/NETWALKER	Thu Jan 23 12:23:20 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: NETWALKER,v 1.21 2013/06/30 21:38:56 rmind Exp $
+#	$NetBSD: NETWALKER,v 1.22 2014/01/23 12:23:20 hkenken Exp $
 #
 #	NETWALKER -- http://www.sharp.co.jp/netwalker/
 #
@@ -172,7 +172,7 @@ tzic0		at axi? addr 0xe000 size 0x40
 imxuart0	at axi? addr 0x73fbc000 irq 31		# UART1
 #imxuart1	at axi? addr 0x73fc irq 32
 #imxuart2	at axi? addr 0x7000c000 irq 33
-options		IMXUARTCONSOLE
+#options	IMXUARTCONSOLE
 
 # Clock Control
 imxccm0		at axi? addr 0x73fd4000

Index: src/sys/arch/evbarm/netwalker/netwalker_machdep.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.11 src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.12
--- src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.11	Sun Aug 18 15:58:21 2013
+++ src/sys/arch/evbarm/netwalker/netwalker_machdep.c	Thu Jan 23 12:23:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netwalker_machdep.c,v 1.11 2013/08/18 15:58:21 matt Exp $	*/
+/*	$NetBSD: netwalker_machdep.c,v 1.12 2014/01/23 12:23:20 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation. 
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.11 2013/08/18 15:58:21 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.12 2014/01/23 12:23:20 hkenken Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -113,6 +113,8 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 #include imxuart.h
 #include opt_imxuart.h
 #include opt_imx.h
+#include opt_imx51_ipuv3.h
+#include wsdisplay.h
 
 #include sys/param.h
 #include sys/device.h
@@ -156,6 +158,11 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 #include arm/imx/imx51_iomuxreg.h
 #include evbarm/netwalker/netwalker_reg.h
 
+#include ukbd.h
+#if (NUKBD  0)
+#include dev/usb/ukbdvar.h
+#endif
+
 /* Kernel text starts 1MB in from the bottom of the kernel address space. */
 #define	KERNEL_TEXT_BASE	(KERNEL_BASE + 0x0010)
 #define	KERNEL_VM_BASE		(KERNEL_BASE + 0x0100)
@@ -1233,7 +1240,10 @@ consinit(void)
 
 #endif
 
-#if (NWSDISPLAY  0)  defined(IMXLCDCONSOLE)
+#if (NWSDISPLAY  0)  defined(IMXIPUCONSOLE)
+#if NUKBD  0
+	ukbd_cnattach();
+#endif
 	{
 		extern void netwalker_cnattach(void);
 		netwalker_cnattach();



CVS commit: src/sys/arch/evbarm

2014-01-23 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jan 24 02:06:03 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: files.netwalker
src/sys/arch/evbarm/netwalker: netwalker_machdep.c

Log Message:
use initarm_common()


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/files.netwalker
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/netwalker/netwalker_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/files.netwalker
diff -u src/sys/arch/evbarm/conf/files.netwalker:1.3 src/sys/arch/evbarm/conf/files.netwalker:1.4
--- src/sys/arch/evbarm/conf/files.netwalker:1.3	Tue Apr 17 10:19:57 2012
+++ src/sys/arch/evbarm/conf/files.netwalker	Fri Jan 24 02:06:03 2014
@@ -1,8 +1,12 @@
-#	$NetBSD: files.netwalker,v 1.3 2012/04/17 10:19:57 bsh Exp $
+#	$NetBSD: files.netwalker,v 1.4 2014/01/24 02:06:03 hkenken Exp $
 #
 # Sharp Netwalker
 #
 
+file   arch/arm/arm32/arm32_boot.c
+file   arch/arm/arm32/arm32_kvminit.c
+file   arch/arm/arm32/arm32_reboot.c
+
 file	arch/evbarm/netwalker/netwalker_machdep.c
 
 # Kernel boot arguments

Index: src/sys/arch/evbarm/netwalker/netwalker_machdep.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.12 src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.13
--- src/sys/arch/evbarm/netwalker/netwalker_machdep.c:1.12	Thu Jan 23 12:23:20 2014
+++ src/sys/arch/evbarm/netwalker/netwalker_machdep.c	Fri Jan 24 02:06:03 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: netwalker_machdep.c,v 1.12 2014/01/23 12:23:20 hkenken Exp $	*/
+/*	$NetBSD: netwalker_machdep.c,v 1.13 2014/01/24 02:06:03 hkenken Exp $	*/
 
 /*
- * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation. 
+ * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation.
  * All rights reserved.
  * Written by Hiroyuki Bessho for Genetec Corporation.
  *
@@ -102,12 +102,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.12 2014/01/23 12:23:20 hkenken Exp $);
+__KERNEL_RCSID(0, $NetBSD: netwalker_machdep.c,v 1.13 2014/01/24 02:06:03 hkenken Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
-#include opt_ipkdb.h
-#include opt_pmap_debug.h
 #include opt_md.h
 #include opt_com.h
 #include imxuart.h
@@ -118,35 +116,16 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 
 #include sys/param.h
 #include sys/device.h
-#include sys/systm.h
-#include sys/kernel.h
-#include sys/exec.h
-#include sys/proc.h
-#include sys/msgbuf.h
-#include sys/reboot.h
 #include sys/termios.h
-#include sys/ksyms.h
 #include sys/bus.h
-#include sys/cpu.h
-#include sys/conf.h
-
-#include uvm/uvm_extern.h
-
-#include dev/cons.h
-#include dev/md.h
 
 #include machine/db_machdep.h
-#include ddb/db_sym.h
-#include ddb/db_extern.h
 #ifdef KGDB
 #include sys/kgdb.h
 #endif
 
 #include machine/bootconfig.h
-#include arm/locore.h
-#include arm/undefined.h
 
-#include arm/arm32/pte.h
 #include arm/arm32/machdep.h
 
 #include arm/imx/imx51reg.h
@@ -174,38 +153,13 @@ __KERNEL_RCSID(0, $NetBSD: netwalker_ma
 #define KERNEL_VM_SIZE		0x0C00
 
 BootConfig bootconfig;		/* Boot config storage */
+static char bootargs[MAX_BOOT_STRING];
 char *boot_args = NULL;
-char *boot_file = NULL;
-
-vm_offset_t physical_start;
-vm_offset_t physical_freestart;
-vm_offset_t physical_freeend;
-vm_offset_t physical_end;
-u_int free_pages;
-vm_offset_t pagetables_start;
-
-/*int debug_flags;*/
-#ifndef PMAP_STATIC_L1S
-int max_processes = 64;			/* Default number */
-#endif	/* !PMAP_STATIC_L1S */
-
-vm_offset_t msgbufphys;
 
 extern char KERNEL_BASE_phys[];
 extern char KERNEL_BASE_virt[];
-extern char etext[], __data_start[], _edata[], __bss_start[], __bss_end__[];
-extern char _end[];
-extern int cpu_do_powersave;
-
-#define KERNEL_PT_SYS		0	/* Page table for mapping proc0 zero page */
-#define KERNEL_PT_KERNEL	1	/* Page table for mapping kernel */
-#define	KERNEL_PT_KERNEL_NUM	4
-#define KERNEL_PT_VMDATA	(KERNEL_PT_KERNEL+KERNEL_PT_KERNEL_NUM)
-/* Page tables for mapping kernel VM */
-#define	KERNEL_PT_VMDATA_NUM	4	/* start with 16MB of KVM */
-#define NUM_KERNEL_PTS		(KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
 
-pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
+extern int cpu_do_powersave;
 
 /*
  * Macros to translate between physical and virtual for a subset of the
@@ -222,22 +176,13 @@ pv_addr_t kernel_pt_table[NUM_KERNEL_PTS
 /* Prototypes */
 
 void consinit(void);
-#if 0
-void	process_kernel_args(char *);
-#endif
 
 #ifdef KGDB
 void	kgdb_port_init(void);
 #endif
-void	change_clock(uint32_t v);
 
 static void init_clocks(void);
 static void setup_ioports(void);
-#ifdef DEBUG_IOPORTS
-void dump_registers(void);
-#endif
-
-bs_protos(bs_notimpl);
 
 #ifndef CONSPEED
 #define CONSPEED B115200	/* What RedBoot uses */
@@ -250,76 +195,6 @@ int comcnspeed = CONSPEED;
 int comcnmode = CONMODE;
 
 /*
- * void cpu_reboot(int howto, char *bootstr)
- *
- * Reboots the system
- *
- * 

CVS commit: src/distrib/notes/common

2014-01-16 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Jan 17 00:19:25 UTC 2014

Modified Files:
src/distrib/notes/common: main

Log Message:
added myself


To generate a diff of this commit:
cvs rdiff -u -r1.500 -r1.501 src/distrib/notes/common/main

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.500 src/distrib/notes/common/main:1.501
--- src/distrib/notes/common/main:1.500	Tue Jan  7 04:46:02 2014
+++ src/distrib/notes/common/main	Fri Jan 17 00:19:25 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.500 2014/01/07 04:46:02 pho Exp $
+.\	$NetBSD: main,v 1.501 2014/01/17 00:19:25 hkenken Exp $
 .\
 .\ Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -1208,6 +1208,7 @@ If you're one of them, and would like to
 .It Ta Charles M. Hannum Ta Mt mycr...@netbsd.org
 .It Ta Yorick Hardy Ta Mt yha...@netbsd.org
 .It Ta Ben Harris Ta Mt bj...@netbsd.org
+.It Ta Kenichi Hashimoto Ta Mt hken...@netbsd.org
 .It Ta Eric Haszlakiewicz Ta Mt e...@netbsd.org
 .It Ta John Hawkinson Ta Mt jh...@netbsd.org
 .It Ta Emile Heitor Ta Mt i...@netbsd.org