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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 17:29:27 UTC 2024

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

Log Message:
Fix imx23_usb_init() function declaration, it expects two parameters.

Fixes build for IMX23_OLINUXINO kernel config.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx23_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/imx23_usb.c
diff -u src/sys/arch/arm/imx/imx23_usb.c:1.6 src/sys/arch/arm/imx/imx23_usb.c:1.7
--- src/sys/arch/arm/imx/imx23_usb.c:1.6	Thu May  4 17:09:44 2023
+++ src/sys/arch/arm/imx/imx23_usb.c	Mon Jan 15 17:29:27 2024
@@ -1,4 +1,4 @@
-/* $Id: imx23_usb.c,v 1.6 2023/05/04 17:09:44 bouyer Exp $ */
+/* $Id: imx23_usb.c,v 1.7 2024/01/15 17:29:27 andvar Exp $ */
 
 /*
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@ static void	imx23_usb_attach(device_t, d
 static int	imx23_usb_activate(device_t, enum devact);
 
 static int  imxusbc_search(device_t, cfdata_t, const int *, void *);
-static void	imx23_usb_init(struct imxehci_softc *);
+static void	imx23_usb_init(struct imxehci_softc *, uintptr_t);
 
 CFATTACH_DECL3_NEW(imxusbc,
 sizeof(struct imx23_usb_softc),



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

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 17:29:27 UTC 2024

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

Log Message:
Fix imx23_usb_init() function declaration, it expects two parameters.

Fixes build for IMX23_OLINUXINO kernel config.


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

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



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

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 13:53:06 UTC 2022

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enetvar.h

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/if_enetvar.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/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.35 src/sys/arch/arm/imx/if_enet.c:1.36
--- src/sys/arch/arm/imx/if_enet.c:1.35	Mon Jan 24 09:14:37 2022
+++ src/sys/arch/arm/imx/if_enet.c	Sun Sep 18 13:53:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.35 2022/01/24 09:14:37 andvar Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.36 2022/09/18 13:53:06 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.35 2022/01/24 09:14:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.36 2022/09/18 13:53:06 thorpej Exp $");
 
 #include "vlan.h"
 
@@ -498,7 +498,7 @@ enet_tx_intr(void *arg)
 	sc->sc_tx_considx = idx;
 
 	if (sc->sc_tx_free > 0)
-		ifp->if_flags &= ~IFF_OACTIVE;
+		sc->sc_txbusy = false;
 
 	/*
 	 * No more pending TX descriptor,
@@ -823,7 +823,7 @@ enet_init(struct ifnet *ifp)
 
 	/* update if_flags */
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 
 	/* update local copy of if_flags */
 	sc->sc_if_flags = ifp->if_flags;
@@ -850,18 +850,18 @@ enet_start(struct ifnet *ifp)
 	struct mbuf *m;
 	int npkt;
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
 	sc = ifp->if_softc;
-	for (npkt = 0; ; npkt++) {
+	for (npkt = 0; !sc->sc_txbusy; npkt++) {
 		IFQ_POLL(&ifp->if_snd, m);
 		if (m == NULL)
 			break;
 
 		if (sc->sc_tx_free <= 0) {
 			/* no tx descriptor now... */
-			ifp->if_flags |= IFF_OACTIVE;
+			sc->sc_txbusy = true;
 			DEVICE_DPRINTF("TX descriptor is full\n");
 			break;
 		}
@@ -870,7 +870,7 @@ enet_start(struct ifnet *ifp)
 
 		if (enet_encap_txring(sc, &m) != 0) {
 			/* too many mbuf chains? */
-			ifp->if_flags |= IFF_OACTIVE;
+			sc->sc_txbusy = true;
 			DEVICE_DPRINTF(
 			"TX descriptor is full. dropping packet\n");
 			m_freem(m);
@@ -909,8 +909,9 @@ enet_stop(struct ifnet *ifp, int disable
 	ENET_REG_WRITE(sc, ENET_ECR, v & ~ENET_ECR_ETHEREN);
 
 	/* Mark the interface as down and cancel the watchdog timer. */
-	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+	ifp->if_flags &= ~IFF_RUNNING;
 	ifp->if_timer = 0;
+	sc->sc_txbusy = false;
 
 	if (disable) {
 		enet_drain_txbuf(sc);

Index: src/sys/arch/arm/imx/if_enetvar.h
diff -u src/sys/arch/arm/imx/if_enetvar.h:1.7 src/sys/arch/arm/imx/if_enetvar.h:1.8
--- src/sys/arch/arm/imx/if_enetvar.h:1.7	Wed Jan 15 01:09:56 2020
+++ src/sys/arch/arm/imx/if_enetvar.h	Sun Sep 18 13:53:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enetvar.h,v 1.7 2020/01/15 01:09:56 jmcneill Exp $	*/
+/*	$NetBSD: if_enetvar.h,v 1.8 2022/09/18 13:53:06 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -81,6 +81,7 @@ struct enet_softc {
 	int sc_tx_considx;
 	int sc_tx_prodidx;
 	int sc_tx_free;
+	bool sc_txbusy;
 
 	/* RX */
 	struct enet_rxsoft sc_rxsoft[ENET_RX_RING_CNT];



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

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 13:53:06 UTC 2022

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enetvar.h

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/if_enetvar.h

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



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

2022-05-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 20 06:59:02 UTC 2022

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

Log Message:
Add the character read in as part of imxuart_common_putc into the
readahead buffer

port-arm/45354: no character is put in the read-ahead buffer in a console code 
of arch/arm/imx/imxuart.c


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/arch/arm/imx/imxuart.c:1.29
--- src/sys/arch/arm/imx/imxuart.c:1.28	Fri May 20 06:56:59 2022
+++ src/sys/arch/arm/imx/imxuart.c	Fri May 20 06:59:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.28 2022/05/20 06:56:59 skrll Exp $ */
+/* $NetBSD: imxuart.c,v 1.29 2022/05/20 06:59:02 skrll Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.28 2022/05/20 06:56:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.29 2022/05/20 06:59:02 skrll Exp $");
 
 #include "opt_imxuart.h"
 #include "opt_ddb.h"
@@ -1819,7 +1819,6 @@ imxuintr_read(struct imxuart_softc *sc)
 	while (cc > 0) {
 		int cn_trapped = 0;
 
-
 		sc->sc_rbuf[sc->sc_rbuf_in] = rd =
 		bus_space_read_4(iot, ioh, IMX_URXD);
 
@@ -2152,6 +2151,7 @@ imxuart_common_putc(dev_t dev, struct im
 		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[imxuart_readahead_in] = cin & 0xff;
 		imxuart_readahead_in = (imxuart_readahead_in + 1) &
 		(READAHEAD_RING_LEN-1);
 	}



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

2022-05-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 20 06:59:02 UTC 2022

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

Log Message:
Add the character read in as part of imxuart_common_putc into the
readahead buffer

port-arm/45354: no character is put in the read-ahead buffer in a console code 
of arch/arm/imx/imxuart.c


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.



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

2022-05-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 20 06:56:59 UTC 2022

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

Log Message:
Use a macro.  Part of

port-arm/45354: no character is put in the read-ahead buffer in a console code 
of arch/arm/imx/imxuart.c


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/arch/arm/imx/imxuart.c:1.28
--- src/sys/arch/arm/imx/imxuart.c:1.27	Mon Mar  8 06:23:31 2021
+++ src/sys/arch/arm/imx/imxuart.c	Fri May 20 06:56:59 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.27 2021/03/08 06:23:31 mlelstv Exp $ */
+/* $NetBSD: imxuart.c,v 1.28 2022/05/20 06:56:59 skrll Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.27 2021/03/08 06:23:31 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.28 2022/05/20 06:56:59 skrll Exp $");
 
 #include "opt_imxuart.h"
 #include "opt_ddb.h"
@@ -2111,8 +2111,7 @@ imxuart_common_getc(dev_t dev, struct im
 	uint32_t usr2;
 
 	/* got a character from reading things earlier */
-	if (imxuart_readahead_in != imxuart_readahead_out) {
-
+	if (!READAHEAD_IS_EMPTY()) {
 		c = imxuart_readahead[imxuart_readahead_out];
 		imxuart_readahead_out = (imxuart_readahead_out + 1) &
 		(READAHEAD_RING_LEN-1);



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

2022-05-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 20 06:56:59 UTC 2022

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

Log Message:
Use a macro.  Part of

port-arm/45354: no character is put in the read-ahead buffer in a console code 
of arch/arm/imx/imxuart.c


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.



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

2019-11-29 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Nov 29 17:20:30 UTC 2019

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

Log Message:
set the multicast filter properly.

don't always IFF_ALLMULTI if multicast is configured.
fix the handling of GAUR and GALR.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/imx/if_enet.c

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



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

2019-11-29 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Nov 29 17:20:30 UTC 2019

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

Log Message:
set the multicast filter properly.

don't always IFF_ALLMULTI if multicast is configured.
fix the handling of GAUR and GALR.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/imx/if_enet.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.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.28 src/sys/arch/arm/imx/if_enet.c:1.29
--- src/sys/arch/arm/imx/if_enet.c:1.28	Tue Nov 12 05:09:29 2019
+++ src/sys/arch/arm/imx/if_enet.c	Fri Nov 29 17:20:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.28 2019/11/12 05:09:29 hkenken Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.29 2019/11/29 17:20:30 ryo Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.28 2019/11/12 05:09:29 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.29 2019/11/29 17:20:30 ryo Exp $");
 
 #include "vlan.h"
 
@@ -714,15 +714,14 @@ enet_setmulti(struct enet_softc *sc)
 	struct ifnet *ifp = &ec->ec_if;
 	struct ether_multi *enm;
 	struct ether_multistep step;
-	int promisc;
-	uint32_t crc;
+	uint32_t crc, hashidx;
 	uint32_t gaddr[2];
 
-	promisc = 0;
-	if ((ifp->if_flags & IFF_PROMISC) || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
-			promisc = 1;
+	if (ifp->if_flags & IFF_PROMISC) {
+		/* receive all unicast packet */
+		ENET_REG_WRITE(sc, ENET_IAUR, 0x);
+		ENET_REG_WRITE(sc, ENET_IALR, 0x);
+		/* receive all multicast packet */
 		gaddr[0] = gaddr[1] = 0x;
 	} else {
 		gaddr[0] = gaddr[1] = 0;
@@ -730,25 +729,38 @@ enet_setmulti(struct enet_softc *sc)
 		ETHER_LOCK(ec);
 		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm != NULL) {
+			if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
+			ETHER_ADDR_LEN)) {
+/*
+ * if specified by range, give up setting hash,
+ * and fallback to allmulti.
+ */
+gaddr[0] = gaddr[1] = 0x;
+break;
+			}
+
 			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
-			gaddr[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+			hashidx = __SHIFTOUT(crc, __BITS(30,26));
+			gaddr[__SHIFTOUT(crc, __BIT(31))] |= __BIT(hashidx);
+
 			ETHER_NEXT_MULTI(step, enm);
 		}
 		ETHER_UNLOCK(ec);
-	}
-
-	ENET_REG_WRITE(sc, ENET_GAUR, gaddr[0]);
-	ENET_REG_WRITE(sc, ENET_GALR, gaddr[1]);
 
-	if (promisc) {
-		/* match all packet */
-		ENET_REG_WRITE(sc, ENET_IAUR, 0x);
-		ENET_REG_WRITE(sc, ENET_IALR, 0x);
-	} else {
-		/* don't match any packet */
+		/* dont't receive any unicast packet (except own address) */
 		ENET_REG_WRITE(sc, ENET_IAUR, 0);
 		ENET_REG_WRITE(sc, ENET_IALR, 0);
 	}
+
+	if (gaddr[0] == 0x && gaddr[1] == 0x)
+		ifp->if_flags |= IFF_ALLMULTI;
+	else
+		ifp->if_flags &= ~IFF_ALLMULTI;
+
+	/* receive multicast packets according to multicast filter */
+	ENET_REG_WRITE(sc, ENET_GAUR, gaddr[1]);
+	ENET_REG_WRITE(sc, ENET_GALR, gaddr[0]);
+
 }
 
 static void



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

2019-11-28 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 28 14:13:37 UTC 2019

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

Log Message:
Remove FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_com.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_com.c
diff -u src/sys/arch/arm/imx/fdt/imx6_com.c:1.1 src/sys/arch/arm/imx/fdt/imx6_com.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_com.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_com.c	Thu Nov 28 14:13:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_com.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_com.c,v 1.2 2019/11/28 14:13:37 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_com.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_com.c,v 1.2 2019/11/28 14:13:37 hkenken Exp $");
 
 #include "opt_fdt.h"
 #include "opt_imxuart.h"
@@ -99,9 +99,11 @@ imx6_com_attach(device_t parent, device_
 	}
 
 	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_SERIAL,
-	FDT_INTR_MPSAFE, imxuintr, sc);
-	if (sc->sc_ih == NULL)
+	0, imxuintr, sc);
+	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt\n");
+		return;
+	}
 
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 



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

2019-11-28 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 28 14:13:37 UTC 2019

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

Log Message:
Remove FDT_INTR_MPSAFE flag.


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

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



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

2019-11-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Nov 25 00:54:47 UTC 2019

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

Log Message:
Fixed bug.

* typo


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

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



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

2019-11-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Nov 25 00:54:47 UTC 2019

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

Log Message:
Fixed bug.

* typo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/if_enet_imx6.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.7 src/sys/arch/arm/imx/if_enet_imx6.c:1.8
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.7	Tue Nov 12 05:09:29 2019
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Mon Nov 25 00:54:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.7 2019/11/12 05:09:29 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.8 2019/11/25 00:54:47 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.7 2019/11/12 05:09:29 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.8 2019/11/25 00:54:47 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -132,7 +132,7 @@ enet_attach(device_t parent, device_t se
 	}
 
 	sc->sc_clk_ipg = imx6_get_clock("enet");
-	if (sc->sc_clk_enet == NULL) {
+	if (sc->sc_clk_ipg == NULL) {
 		aprint_error(": couldn't get clock ipg\n");
 		return;
 	}



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

2019-11-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Nov 24 11:07:19 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx6_usbphy.c
src/sys/arch/arm/imx/fdt: imx6_gpio.c imx6_sdhc.c imx6_usb.c
imx6_usbphy.c

Log Message:
Use PRIxBUSADDR


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx6_usbphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_gpio.c \
src/sys/arch/arm/imx/fdt/imx6_usb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/imx6_sdhc.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_usbphy.c

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



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

2019-11-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Nov 24 11:07:19 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx6_usbphy.c
src/sys/arch/arm/imx/fdt: imx6_gpio.c imx6_sdhc.c imx6_usb.c
imx6_usbphy.c

Log Message:
Use PRIxBUSADDR


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx6_usbphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_gpio.c \
src/sys/arch/arm/imx/fdt/imx6_usb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/imx6_sdhc.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_usbphy.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_usbphy.c
diff -u src/sys/arch/arm/imx/imx6_usbphy.c:1.2 src/sys/arch/arm/imx/imx6_usbphy.c:1.3
--- src/sys/arch/arm/imx/imx6_usbphy.c:1.2	Thu Jun 20 08:16:19 2019
+++ src/sys/arch/arm/imx/imx6_usbphy.c	Sun Nov 24 11:07:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_usbphy.c,v 1.2 2019/06/20 08:16:19 hkenken Exp $	*/
+/*	$NetBSD: imx6_usbphy.c,v 1.3 2019/11/24 11:07:19 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017  Genetec Corporation.  All rights reserved.
@@ -32,7 +32,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: imx6_usbphy.c,v 1.2 2019/06/20 08:16:19 hkenken Exp $");
+__KERNEL_RCSID(1, "$NetBSD: imx6_usbphy.c,v 1.3 2019/11/24 11:07:19 skrll Exp $");
 
 #include 
 #include 
@@ -144,8 +144,8 @@ imx6_usbphy_attach(device_t parent, devi
 
 	error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh);
 	if (error) {
-		aprint_error(": couldn't map %#llx: %d",
-		(uint64_t)addr, error);
+		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d",
+		addr, error);
 		return;
 	}
 

Index: src/sys/arch/arm/imx/fdt/imx6_gpio.c
diff -u src/sys/arch/arm/imx/fdt/imx6_gpio.c:1.2 src/sys/arch/arm/imx/fdt/imx6_gpio.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_gpio.c:1.2	Mon Aug 19 03:45:51 2019
+++ src/sys/arch/arm/imx/fdt/imx6_gpio.c	Sun Nov 24 11:07:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_gpio.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $	*/
+/*	$NetBSD: imx6_gpio.c,v 1.3 2019/11/24 11:07:19 skrll 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_gpio.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_gpio.c,v 1.3 2019/11/24 11:07:19 skrll Exp $");
 
 #include "opt_fdt.h"
 #include "gpio.h"
@@ -107,7 +107,7 @@ imxgpio_attach(device_t parent, device_t
 
 	error = bus_space_map(faa->faa_bst, addr, size, 0, &ioh);
 	if (error) {
-		aprint_error(": couldn't map %#llx: %d", (uint64_t)addr, error);
+		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d", addr, error);
 		return;
 	}
 
Index: src/sys/arch/arm/imx/fdt/imx6_usb.c
diff -u src/sys/arch/arm/imx/fdt/imx6_usb.c:1.2 src/sys/arch/arm/imx/fdt/imx6_usb.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_usb.c:1.2	Mon Aug 19 03:45:51 2019
+++ src/sys/arch/arm/imx/fdt/imx6_usb.c	Sun Nov 24 11:07:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_usb.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $	*/
+/*	$NetBSD: imx6_usb.c,v 1.3 2019/11/24 11:07:19 skrll 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_usb.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_usb.c,v 1.3 2019/11/24 11:07:19 skrll Exp $");
 
 #include "opt_fdt.h"
 
@@ -111,7 +111,7 @@ imx6_usb_attach(device_t parent, device_
 
 	error = bus_space_map(bst, addr, size, 0, &bsh);
 	if (error) {
-		aprint_error(": couldn't map %#llx: %d", (uint64_t)addr, error);
+		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d", addr, error);
 		return;
 	}
 

Index: src/sys/arch/arm/imx/fdt/imx6_sdhc.c
diff -u src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.4 src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.5
--- src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.4	Wed Oct 23 05:20:52 2019
+++ src/sys/arch/arm/imx/fdt/imx6_sdhc.c	Sun Nov 24 11:07:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_sdhc.c,v 1.4 2019/10/23 05:20:52 hkenken Exp $	*/
+/*	$NetBSD: imx6_sdhc.c,v 1.5 2019/11/24 11:07:19 skrll 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_sdhc.c,v 1.4 2019/10/23 05:20:52 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_sdhc.c,v 1.5 2019/11/24 11:07:19 skrll Exp $");
 
 #include "opt_fdt.h"
 
@@ -133,7 +133,7 @@ imx6_sdhc_attach(device_t parent, device
 	sc->sc_bst = faa->faa_bst;
 	error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh);
 	if (error) {
-		aprint_error(": couldn't map %#llx: %d", (uint64_t)addr, error);
+		aprint_error(": couldn't map %#" PRIxBU

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

2019-11-14 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Nov 15 01:10:43 UTC 2019

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

Log Message:
Keep SCLK high in the inactive state. (SPI modes 2 and 3 only)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imxspi.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.6 src/sys/arch/arm/imx/imxspi.c:1.7
--- src/sys/arch/arm/imx/imxspi.c:1.6	Fri Sep 27 02:59:21 2019
+++ src/sys/arch/arm/imx/imxspi.c	Fri Nov 15 01:10:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxspi.c,v 1.6 2019/09/27 02:59:21 hkenken Exp $	*/
+/*	$NetBSD: imxspi.c,v 1.7 2019/11/15 01:10:42 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.6 2019/09/27 02:59:21 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.7 2019/11/15 01:10:42 hkenken Exp $");
 
 #include "opt_imxspi.h"
 #include "opt_fdt.h"
@@ -69,7 +69,7 @@ void imxspi_sched(struct imxspi_softc *)
 
 #define	IMXCSPI_TYPE(type, x)		  \
 	((sc->sc_type == IMX31_CSPI) ? __CONCAT(CSPI_IMX31_, x) :	  \
-	(sc->sc_type == IMX35_CSPI) ? __CONCAT(CSPI_IMX35_, x) : 0)
+	 (sc->sc_type == IMX35_CSPI) ? __CONCAT(CSPI_IMX35_, x) : 0)
 #define	IMXCSPI(x)	__CONCAT(CSPI_, x)
 #define	IMXESPI(x)	__CONCAT(ECSPI_, x)
 #define	IMXSPI(x)	((sc->sc_enhanced) ? IMXESPI(x) : IMXCSPI(x))
@@ -228,6 +228,7 @@ imxspi_configure_enhanced(void *arg, int
 
 	config = bus_space_read_4(sc->sc_iot, sc->sc_ioh, ECSPI_CONFIGREG);
 	config &= ~(__SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_POL) |
+	__SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_CTL) |
 	__SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_PHA));
 	switch (mode) {
 	case SPI_MODE_0:
@@ -240,11 +241,13 @@ imxspi_configure_enhanced(void *arg, int
 	case SPI_MODE_2:
 		/* CPHA = 0, CPOL = 1 */
 		config |= __SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_POL);
+		config |= __SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_CTL);
 		break;
 	case SPI_MODE_3:
 		/* CPHA = 1, CPOL = 1 */
 		config |= __SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_PHA);
 		config |= __SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_POL);
+		config |= __SHIFTIN(__BIT(slave), ECSPI_CONFIG_SCLK_CTL);
 		break;
 	default:
 		return EINVAL;



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

2019-11-14 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Nov 15 01:10:43 UTC 2019

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

Log Message:
Keep SCLK high in the inactive state. (SPI modes 2 and 3 only)


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

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



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

2019-11-13 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 14 06:00:16 UTC 2019

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

Log Message:
Fixed bug.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/fdt/if_enet_imx.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/if_enet_imx.c
diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.7 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.8
--- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.7	Wed Nov 13 07:56:10 2019
+++ src/sys/arch/arm/imx/fdt/if_enet_imx.c	Thu Nov 14 06:00:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx.c,v 1.7 2019/11/13 07:56:10 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx.c,v 1.8 2019/11/14 06:00:16 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: if_enet_imx.c,v 1.7 2019/11/13 07:56:10 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.8 2019/11/14 06:00:16 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -210,7 +210,7 @@ enet_phy_reset(struct enet_fdt_softc *sc
 	fdtbus_gpio_write(sc->sc_pin_reset, 0);
 
 	/* Post delay */
-	if (!of_getprop_uint32(phandle, "phy-reset-post-delay", &msec))
+	if (of_getprop_uint32(phandle, "phy-reset-post-delay", &msec))
 		msec = 0;
 
 	delay(msec * 1000);



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

2019-11-13 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Thu Nov 14 06:00:16 UTC 2019

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

Log Message:
Fixed bug.


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

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



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

2019-11-12 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Nov 13 07:56:11 UTC 2019

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

Log Message:
Add support "phy-reset-post-delay".


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/fdt/if_enet_imx.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/if_enet_imx.c
diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.6 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.7
--- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.6	Tue Nov 12 08:40:57 2019
+++ src/sys/arch/arm/imx/fdt/if_enet_imx.c	Wed Nov 13 07:56:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx.c,v 1.6 2019/11/12 08:40:57 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx.c,v 1.7 2019/11/13 07:56:10 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: if_enet_imx.c,v 1.6 2019/11/12 08:40:57 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.7 2019/11/13 07:56:10 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -195,19 +195,23 @@ enet_init_clocks(struct enet_softc *sc)
 static void
 enet_phy_reset(struct enet_fdt_softc *sc, const int phandle)
 {
-	int error;
+	u_int msec;
 
 	sc->sc_pin_reset = fdtbus_gpio_acquire(phandle, "phy-reset-gpios", GPIO_PIN_OUTPUT);
 	if (sc->sc_pin_reset == NULL)
 		return;
 
-	u_int msec;
-	error = of_getprop_uint32(phandle, "phy-reset-duration", &msec);
-	if (error)
+	if (of_getprop_uint32(phandle, "phy-reset-duration", &msec))
 		msec = 1;
 
 	/* Reset */
 	fdtbus_gpio_write(sc->sc_pin_reset, 1);
 	delay(msec * 1000);
 	fdtbus_gpio_write(sc->sc_pin_reset, 0);
+
+	/* Post delay */
+	if (!of_getprop_uint32(phandle, "phy-reset-post-delay", &msec))
+		msec = 0;
+
+	delay(msec * 1000);
 }



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

2019-11-12 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Nov 13 07:56:11 UTC 2019

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

Log Message:
Add support "phy-reset-post-delay".


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

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



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

2019-11-12 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Nov 12 08:40:57 UTC 2019

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

Log Message:
Fixed bug.

* typo


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

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



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

2019-11-12 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Nov 12 08:40:57 UTC 2019

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

Log Message:
Fixed bug.

* typo


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/fdt/if_enet_imx.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/if_enet_imx.c
diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.5 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.6
--- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.5	Tue Nov 12 05:09:29 2019
+++ src/sys/arch/arm/imx/fdt/if_enet_imx.c	Tue Nov 12 08:40:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx.c,v 1.5 2019/11/12 05:09:29 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx.c,v 1.6 2019/11/12 08:40:57 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: if_enet_imx.c,v 1.5 2019/11/12 05:09:29 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.6 2019/11/12 08:40:57 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -91,7 +91,7 @@ enet_attach(device_t parent, device_t se
 	}
 
 	sc->sc_clk_ipg = fdtbus_clock_get(phandle, "ipg");
-	if (sc->sc_clk_enet == NULL) {
+	if (sc->sc_clk_ipg == NULL) {
 		aprint_error(": couldn't get clock ipg\n");
 		goto failure;
 	}



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

2019-11-11 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Nov 12 05:09:29 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
if_enetreg.h if_enetvar.h
src/sys/arch/arm/imx/fdt: if_enet_imx.c

Log Message:
IPG clock is used instead of ENET_PLL clock to set MII Speed Control Register.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enetreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enetvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/if_enet_imx.c

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



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

2019-11-11 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Nov 12 05:09:29 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
if_enetreg.h if_enetvar.h
src/sys/arch/arm/imx/fdt: if_enet_imx.c

Log Message:
IPG clock is used instead of ENET_PLL clock to set MII Speed Control Register.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enetreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enetvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/if_enet_imx.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.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.27 src/sys/arch/arm/imx/if_enet.c:1.28
--- src/sys/arch/arm/imx/if_enet.c:1.27	Fri Sep 20 08:48:55 2019
+++ src/sys/arch/arm/imx/if_enet.c	Tue Nov 12 05:09:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.27 2019/09/20 08:48:55 maxv Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.28 2019/11/12 05:09:29 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.27 2019/09/20 08:48:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.28 2019/11/12 05:09:29 hkenken Exp $");
 
 #include "vlan.h"
 
@@ -1769,9 +1769,9 @@ enet_init_regs(struct enet_softc *sc, in
 	ENET_REG_WRITE(sc, ENET_MIBC, ENET_MIBC_MIB_CLEAR);
 	ENET_REG_WRITE(sc, ENET_MIBC, 0);
 
-	/* MII speed setup. MDCclk(=2.5MHz) = ENET_PLL/((val+1)*2) */
-	val = ((sc->sc_pllclock) / 50 - 1) / 10;
-	ENET_REG_WRITE(sc, ENET_MSCR, val << 1);
+	/* MII speed setup. MDCclk(=2.5MHz) = (internal module clock)/((val+1)*2) */
+	val = (sc->sc_clock + (500 - 1)) / 500 - 1;
+	ENET_REG_WRITE(sc, ENET_MSCR, __SHIFTIN(val, ENET_MSCR_MII_SPEED));
 
 	/* Opcode/Pause Duration */
 	ENET_REG_WRITE(sc, ENET_OPD, 0x00010020);

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.6 src/sys/arch/arm/imx/if_enet_imx6.c:1.7
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.6	Tue Jul 30 06:26:31 2019
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Tue Nov 12 05:09:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.7 2019/11/12 05:09:29 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.7 2019/11/12 05:09:29 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -131,6 +131,11 @@ enet_attach(device_t parent, device_t se
 		iomux_write(IMX6UL_IOMUX_GPR1, v);
 	}
 
+	sc->sc_clk_ipg = imx6_get_clock("enet");
+	if (sc->sc_clk_enet == NULL) {
+		aprint_error(": couldn't get clock ipg\n");
+		return;
+	}
 	sc->sc_clk_enet = imx6_get_clock("enet");
 	if (sc->sc_clk_enet == NULL) {
 		aprint_error(": couldn't get clock enet\n");
@@ -146,7 +151,7 @@ enet_attach(device_t parent, device_t se
 		return;
 	}
 
-	sc->sc_pllclock = clk_get_rate(sc->sc_clk_enet_ref);
+	sc->sc_clock = clk_get_rate(sc->sc_clk_ipg);
 
 	if (bus_space_map(sc->sc_iot, aa->aa_addr, aa->aa_size, 0,
 	&sc->sc_ioh)) {
@@ -179,6 +184,11 @@ enet_init_clocks(struct enet_softc *sc)
 {
 	int error;
 
+	error = clk_enable(sc->sc_clk_ipg);
+	if (error) {
+		aprint_error_dev(sc->sc_dev, "couldn't enable ipg: %d\n", error);
+		return error;
+	}
 	error = clk_enable(sc->sc_clk_enet);
 	if (error) {
 		aprint_error_dev(sc->sc_dev, "couldn't enable enet: %d\n", error);

Index: src/sys/arch/arm/imx/if_enet_imx7.c
diff -u src/sys/arch/arm/imx/if_enet_imx7.c:1.4 src/sys/arch/arm/imx/if_enet_imx7.c:1.5
--- src/sys/arch/arm/imx/if_enet_imx7.c:1.4	Tue Jul 30 06:26:31 2019
+++ src/sys/arch/arm/imx/if_enet_imx7.c	Tue Nov 12 05:09:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx7.c,v 1.5 2019/11/12 05:09:29 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.5 2019/11/12 05:09:29 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -103,9 +103,9 @@ enet_attach(device_t parent, device_t se
 		"couldn't enable CCM_ANALOG_PLL_ENET\n");
 		return;
 	}
-	sc->sc_pllclock = imx7_get_clock(IMX7CLK_ENET_PLL);
+	sc->sc_clock = imx7_get_clock(IMX7CLK_IPG_CLK_ROOT);
 #else
-	sc->sc_pllclock = 10;
+	sc->sc_clock = 6600;
 #endif
 
 	if (bus_space_map(sc->sc_iot, aa->aa_addr, aa->aa_size, 0,

Index: src/sys/arch/arm/imx/if_enetreg.h
diff -u src/sys/arch/arm/imx/if_enet

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

2019-11-11 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Nov 12 04:32:36 UTC 2019

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

Log Message:
Add imxccm_clk_set_rate_div().

+ Fixed BUG in imxccm_clk_get_rate_div().


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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.14 src/sys/arch/arm/imx/imx6_ccm.c:1.15
--- src/sys/arch/arm/imx/imx6_ccm.c:1.14	Mon Sep  2 01:28:41 2019
+++ src/sys/arch/arm/imx/imx6_ccm.c	Tue Nov 12 04:32:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.14 2019/09/02 01:28:41 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.15 2019/11/12 04:32:36 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.14 2019/09/02 01:28:41 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.15 2019/11/12 04:32:36 hkenken Exp $");
 
 #include "opt_cputypes.h"
 
@@ -1165,7 +1165,7 @@ imxccm_clk_get_rate_div(struct imxccm_so
 		KASSERT(div->tbl != NULL);
 
 		for (int i = 0; div->tbl[i] != 0; i++)
-			if (div->tbl[i] == n)
+			if (i == n)
 rate /= div->tbl[i];
 	} else {
 		rate /= n + 1;
@@ -1275,13 +1275,56 @@ imxccm_clk_get_parent_mux(struct imxccm_
 
 static int
 imxccm_clk_set_rate_pll(struct imxccm_softc *sc,
-struct imx6_clk *eclk, u_int rate)
+struct imx6_clk *iclk, u_int rate)
 {
 	/* ToDo */
 
 	return EOPNOTSUPP;
 }
 
+static int
+imxccm_clk_set_rate_div(struct imxccm_softc *sc,
+struct imx6_clk *iclk, u_int rate)
+{
+struct imx6_clk_div *div = &iclk->clk.div;
+struct imx6_clk *parent;
+
+KASSERT(iclk->type == IMX6_CLK_DIV);
+
+parent = imx6_clk_find(iclk->parent);
+KASSERT(parent != NULL);
+
+u_int rate_parent = imxccm_clk_get_rate(sc, &parent->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;
+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;
+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;
+}
+
 /*
  * CLK Driver APIs
  */
@@ -1345,13 +1388,15 @@ imxccm_clk_set_rate(void *priv, struct c
 	switch (iclk->type) {
 	case IMX6_CLK_FIXED:
 	case IMX6_CLK_FIXED_FACTOR:
-		return EIO;
+		return ENXIO;
 	case IMX6_CLK_PLL:
 		return imxccm_clk_set_rate_pll(sc, iclk, rate);
 	case IMX6_CLK_MUX:
-		return EIO;
+		return ENXIO;
 	case IMX6_CLK_GATE:
+		return ENXIO;
 	case IMX6_CLK_DIV:
+		return imxccm_clk_set_rate_div(sc, iclk, rate);
 	case IMX6_CLK_PFD:
 		return EINVAL;
 	default:



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

2019-11-11 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Nov 12 04:32:36 UTC 2019

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

Log Message:
Add imxccm_clk_set_rate_div().

+ Fixed BUG in imxccm_clk_get_rate_div().


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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.



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

2019-10-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Oct 23 02:34:43 UTC 2019

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

Log Message:
Implement platform reset for i.MX6.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/fdt/imx6_platform.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_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.7 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.8
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.7	Fri Oct 18 12:53:08 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Wed Oct 23 02:34:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.7 2019/10/18 12:53:08 hkenken Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.8 2019/10/23 02:34:43 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_platform.c,v 1.7 2019/10/18 12:53:08 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.8 2019/10/23 02:34:43 hkenken Exp $");
 
 #include "arml2cc.h"
 #include "opt_console.h"
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: imx6_platfor
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -197,6 +198,27 @@ imx_platform_mpstart(void)
 static void
 imx6_platform_reset(void)
 {
+	bus_space_tag_t bst = &armv7_generic_bs_tag;
+	bus_space_handle_t bsh;
+
+	if (bus_space_map(bst, IMX6_AIPS1_BASE + AIPS1_WDOG1_BASE, AIPS1_WDOG_SIZE, 0, &bsh))
+		panic("couldn't map wdog1 registers");
+
+	delay(1000);	/* wait for flushing FIFO of serial console */
+
+	cpsid(I32_bit|F32_bit);
+
+	/* software reset signal on wdog */
+	bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE);
+
+	/*
+	 * write twice due to errata.
+	 * Reference: ERR004346: IMX6DQCE Chip Errata for the i.MX 6Dual/6Quad
+	 */
+	bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE);
+
+	for (;;)
+		__asm("wfi");
 }
 
 const struct arm_platform imx6_platform = {



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

2019-10-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Oct 23 02:34:43 UTC 2019

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

Log Message:
Implement platform reset for i.MX6.


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

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



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

2019-10-16 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Oct 16 11:16:31 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx6_pcie.c imxpcie.c imxpciereg.h imxpcievar.h
src/sys/arch/arm/imx/fdt: imx6_pcie.c

Log Message:
Fixed bug when using PCIe external clock.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxpcie.c \
src/sys/arch/arm/imx/imxpciereg.h src/sys/arch/arm/imx/imxpcievar.h
cvs rdiff -u -r1.4 -r1.5 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.



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

2019-10-16 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Oct 16 11:16:31 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx6_pcie.c imxpcie.c imxpciereg.h imxpcievar.h
src/sys/arch/arm/imx/fdt: imx6_pcie.c

Log Message:
Fixed bug when using PCIe external clock.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxpcie.c \
src/sys/arch/arm/imx/imxpciereg.h src/sys/arch/arm/imx/imxpcievar.h
cvs rdiff -u -r1.4 -r1.5 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/imx6_pcie.c
diff -u src/sys/arch/arm/imx/imx6_pcie.c:1.13 src/sys/arch/arm/imx/imx6_pcie.c:1.14
--- src/sys/arch/arm/imx/imx6_pcie.c:1.13	Sat Jul 27 08:02:04 2019
+++ src/sys/arch/arm/imx/imx6_pcie.c	Wed Oct 16 11:16:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.13 2019/07/27 08:02:04 skrll Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.14 2019/10/16 11:16:30 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.13 2019/07/27 08:02:04 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.14 2019/10/16 11:16:30 hkenken Exp $");
 
 #include "opt_pci.h"
 
@@ -151,19 +151,19 @@ imx6_pcie_attach(device_t parent, device
 	imx6_set_gpio(self, "imxpcie-reset-gpio", &ipsc->sc_gpio_reset,
 	&ipsc->sc_gpio_reset_active, GPIO_PIN_OUTPUT);
 
-	sc->sc_clk_pcie_axi = imx6_get_clock("pcie_axi");
-	if (sc->sc_clk_pcie_axi == NULL) {
-		aprint_error(": couldn't get clock pcie_axi\n");
+	sc->sc_clk_pcie = imx6_get_clock("pcie_axi");
+	if (sc->sc_clk_pcie == NULL) {
+		aprint_error(": couldn't get clock pcie\n");
 		return;
 	}
-	sc->sc_clk_lvds1_gate = imx6_get_clock("lvds1_gate");
-	if (sc->sc_clk_lvds1_gate == NULL) {
-		aprint_error(": couldn't get clock lvds1_gate\n");
+	sc->sc_clk_pcie_bus = imx6_get_clock("lvds1_gate");
+	if (sc->sc_clk_pcie_bus == NULL) {
+		aprint_error(": couldn't get clock pcie_bus\n");
 		return;
 	}
-	sc->sc_clk_pcie_ref = imx6_get_clock("pcie_ref_125m");
-	if (sc->sc_clk_pcie_ref == NULL) {
-		aprint_error(": couldn't get clock pcie_ref\n");
+	sc->sc_clk_pcie_phy = imx6_get_clock("pcie_ref_125m");
+	if (sc->sc_clk_pcie_phy == NULL) {
+		aprint_error(": couldn't get clock pcie_phy\n");
 		return;
 	}
 

Index: src/sys/arch/arm/imx/imxpcie.c
diff -u src/sys/arch/arm/imx/imxpcie.c:1.2 src/sys/arch/arm/imx/imxpcie.c:1.3
--- src/sys/arch/arm/imx/imxpcie.c:1.2	Mon Sep  2 01:28:41 2019
+++ src/sys/arch/arm/imx/imxpcie.c	Wed Oct 16 11:16:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxpcie.c,v 1.2 2019/09/02 01:28:41 hkenken Exp $	*/
+/*	$NetBSD: imxpcie.c,v 1.3 2019/10/16 11:16:30 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2019  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxpcie.c,v 1.2 2019/09/02 01:28:41 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxpcie.c,v 1.3 2019/10/16 11:16:30 hkenken Exp $");
 
 #include "opt_pci.h"
 #include "opt_fdt.h"
@@ -133,6 +133,7 @@ imxpcie_init_phy(struct imxpcie_softc *s
 	v |= __SHIFTIN(20, IOMUX_GPR8_PCS_TX_DEEMPH_GEN1);
 	sc->sc_gpr_write(sc, IOMUX_GPR8, v);
 
+	v = sc->sc_gpr_read(sc, IOMUX_GPR12);
 	v &= ~IOMUX_GPR12_DEVICE_TYPE;
 	v |= IOMUX_GPR12_DEVICE_TYPE_PCIE_RC;
 	sc->sc_gpr_write(sc, IOMUX_GPR12, v);
@@ -244,12 +245,12 @@ imxpcie_phy_read(struct imxpcie_softc *s
 static int
 imxpcie_assert_core_reset(struct imxpcie_softc *sc)
 {
+	uint32_t gpr1 = sc->sc_gpr_read(sc, IOMUX_GPR1);
+
 	if (sc->sc_have_sw_reset) {
-		uint32_t gpr1 = sc->sc_gpr_read(sc, IOMUX_GPR1);
 		gpr1 |= IOMUX_GPR1_PCIE_SW_RST;
 		sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
 	} else {
-		uint32_t gpr1 = sc->sc_gpr_read(sc, IOMUX_GPR1);
 		uint32_t gpr12 = sc->sc_gpr_read(sc, IOMUX_GPR12);
 
 		/* already enabled by bootloader */
@@ -263,13 +264,13 @@ imxpcie_assert_core_reset(struct imxpcie
 			gpr12 &= ~IOMUX_GPR12_APP_LTSSM_ENABLE;
 			sc->sc_gpr_write(sc, IOMUX_GPR12, gpr12);
 		}
-
-		gpr1 |= IOMUX_GPR1_TEST_POWERDOWN;
-		sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
-		gpr1 &= ~IOMUX_GPR1_REF_SSP_EN;
-		sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
 	}
 
+	gpr1 |= IOMUX_GPR1_TEST_POWERDOWN;
+	sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
+	gpr1 &= ~IOMUX_GPR1_REF_SSP_EN;
+	sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
+
 	return 0;
 }
 
@@ -278,29 +279,28 @@ imxpcie_deassert_core_reset(struct imxpc
 {
 	int error;
 
-	error = clk_enable(sc->sc_clk_pcie_axi);
+	error = clk_enable(sc->sc_clk_pcie);
 	if (error) {
-		aprint_error_dev(sc->sc_dev, "couldn't enable pcie_axi: %d\n", error);
+		aprint_error_dev(sc->sc_dev, "couldn't enable pcie: %d\n", error);
 		return error;
 	}
 
 	if (sc->sc_ext_osc) {
-		clk_set_parent(sc->sc_clk_pcie_ext, sc->sc_clk_pcie_ext_src);
 		error = clk_enable(sc->sc_clk_pcie_ext);
 		if 

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

2019-10-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 12 06:46:13 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx51 files.imx6 files.imx7
src/sys/arch/arm/imx/fdt: files.imx6

Log Message:
Spell controller correctly


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/files.imx7
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/fdt/files.imx6

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.19 src/sys/arch/arm/imx/files.imx51:1.20
--- src/sys/arch/arm/imx/files.imx51:1.19	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/arm/imx/files.imx51	Sat Oct 12 06:46:13 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx51,v 1.19 2019/07/24 12:33:18 hkenken Exp $
+#	$NetBSD: files.imx51,v 1.20 2019/10/12 06:46:13 skrll Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -110,13 +110,13 @@ file   arch/arm/imx/imxusb.c			imxehci
 attach	sdhc at axi with sdhc_axi
 file	arch/arm/imx/imx51_esdhc.c		sdhc_axi
 
-# iic Controler
+# iic controller
 device	imxi2c: motoi2c, i2cbus, i2cexec
 attach	imxi2c at axi
 file	arch/arm/imx/imxi2c.c		imxi2c
 file	arch/arm/imx/imx51_i2c.c	imxi2c
 
-# SPI bus controlloer
+# SPI bus controller
 # attach of this driver need to be specified in paltform configuration
 # use flags to module version
 device  imxspi : spibus
@@ -136,7 +136,7 @@ defparam opt_imxspi.hIMXSPI_DEBUG
 # device	imxi2s {} : bus_dma_generic
 # file	arch/arm/imx/imx51_i2s.c		imxi2s needs-flag
 
-# PWM controlloer
+# PWM controller
 device	imxpwm
 file	arch/arm/imx/imxpwm.c			imxpwm
 file	arch/arm/imx/imx51_pwm.c		imxpwm

Index: src/sys/arch/arm/imx/files.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.18 src/sys/arch/arm/imx/files.imx6:1.19
--- src/sys/arch/arm/imx/files.imx6:1.18	Sat Jul 27 08:02:04 2019
+++ src/sys/arch/arm/imx/files.imx6	Sat Oct 12 06:46:13 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.18 2019/07/27 08:02:04 skrll Exp $
+#	$NetBSD: files.imx6,v 1.19 2019/10/12 06:46:13 skrll Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -71,7 +71,7 @@ device	imxiomux
 attach	imxiomux at axi
 file	arch/arm/imx/imx6_iomux.c		imxiomux
 
-# iMX iic Controler
+# iMX iic controller
 device	imxi2c: motoi2c, i2cbus, i2cexec
 attach	imxi2c at axi
 file	arch/arm/imx/imxi2c.c			imxi2c

Index: src/sys/arch/arm/imx/files.imx7
diff -u src/sys/arch/arm/imx/files.imx7:1.8 src/sys/arch/arm/imx/files.imx7:1.9
--- src/sys/arch/arm/imx/files.imx7:1.8	Sat Jul 27 12:07:24 2019
+++ src/sys/arch/arm/imx/files.imx7	Sat Oct 12 06:46:13 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx7,v 1.8 2019/07/27 12:07:24 hkenken Exp $
+#	$NetBSD: files.imx7,v 1.9 2019/10/12 06:46:13 skrll Exp $
 #
 # Configuration info for the Freescale i.MX7
 #
@@ -60,7 +60,7 @@ device	imxiomux
 attach	imxiomux at axi
 file	arch/arm/imx/imx7_iomux.c		imxiomux
 
-# iMX iic Controler
+# iMX iic controller
 device	imxi2c: motoi2c, i2cbus, i2cexec
 attach	imxi2c at axi
 file	arch/arm/imx/imxi2c.c			imxi2c

Index: src/sys/arch/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.6 src/sys/arch/arm/imx/fdt/files.imx6:1.7
--- src/sys/arch/arm/imx/fdt/files.imx6:1.6	Mon Aug 19 11:41:36 2019
+++ src/sys/arch/arm/imx/fdt/files.imx6	Sat Oct 12 06:46:13 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.6 2019/08/19 11:41:36 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.7 2019/10/12 06:46:13 skrll Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -71,13 +71,13 @@ attach	imxpcie at fdt with imxpcie_fdt
 file	arch/arm/imx/imxpcie.c			imxpcie
 file	arch/arm/imx/fdt/imx6_pcie.c		imxpcie_fdt
 
-# iMX iic Controler
+# iMX iic controller
 device	imxi2c: motoi2c, i2cbus, i2cexec
 attach	imxi2c at fdt
 file	arch/arm/imx/imxi2c.c			imxi2c
 file	arch/arm/imx/fdt/imx6_i2c.c		imxi2c
 
-# SPI bus controlloer
+# SPI bus controller
 device  imxspi : spibus
 attach	imxspi at fdt with imxspi_fdt
 filearch/arm/imx/imxspi.c			imxspi



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

2019-10-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 12 06:46:13 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx51 files.imx6 files.imx7
src/sys/arch/arm/imx/fdt: files.imx6

Log Message:
Spell controller correctly


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/imx/files.imx51
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/imx/files.imx7
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/fdt/files.imx6

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



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

2019-10-03 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Oct  4 06:49:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_ahcisata.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_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/fdt/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2	Mon Aug 19 03:45:51 2019
+++ src/sys/arch/arm/imx/fdt/imx6_ahcisata.c	Fri Oct  4 06:49:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.3 2019/10/04 06:49:40 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_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.3 2019/10/04 06:49:40 hkenken Exp $");
 
 #include 
 #include 
@@ -116,6 +116,8 @@ imx6_ahcisata_attach(device_t parent, de
 		sc->sc_rx_eq = 3000;
 	if (of_getprop_bool(phandle, "fsl,no-spread-spectrum") == false)
 		sc->sc_ss = 1;
+	else
+		sc->sc_ss = 0;
 
 	sc->sc_clk_sata = fdtbus_clock_get(phandle, "sata");
 	if (sc->sc_clk_sata == NULL) {
@@ -181,8 +183,8 @@ imx6_ahcisata_attach(device_t parent, de
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO,
-	FDT_INTR_MPSAFE, ahci_intr, &sc->sc);
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
+	ahci_intr, &sc->sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);
@@ -412,10 +414,10 @@ imx6_ahcisata_init(struct imx6_ahcisata_
 			val = gpr13_sata_phy_settings[i].def_val;
 		v |= __SHIFTIN(val, gpr13_sata_phy_settings[i].mask);
 	}
-	v |= __SHIFTIN(sc->sc_ss, IOMUX_GPR13_SATA_PHY_5);
 	v |= __SHIFTIN(0x12, IOMUX_GPR13_SATA_PHY_7);	/* Rx SATA2m */
 	v |= __SHIFTIN(3, IOMUX_GPR13_SATA_PHY_6);	/* Rx DPLL mode */
 	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_SPEED);	/* 3.0GHz */
+	v |= __SHIFTIN(sc->sc_ss, IOMUX_GPR13_SATA_PHY_5);
 	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_PHY_1);	/* PLL clock enable */
 	bus_space_write_4(sc->sc_iot, sc->sc_gpr_ioh, IOMUX_GPR13, v);
 



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

2019-10-03 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Oct  4 06:49:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_ahcisata.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_ahcisata.c

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



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

2019-10-01 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Oct  2 01:34:09 UTC 2019

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

Log Message:
Fixed compile error.

remove fdtbus_pinctrl_configure().


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

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



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

2019-10-01 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Oct  2 01:34:09 UTC 2019

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

Log Message:
Fixed compile error.

remove fdtbus_pinctrl_configure().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_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/fdt/imx6_iomux.c
diff -u src/sys/arch/arm/imx/fdt/imx6_iomux.c:1.1 src/sys/arch/arm/imx/fdt/imx6_iomux.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_iomux.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_iomux.c	Wed Oct  2 01:34:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_iomux.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_iomux.c,v 1.2 2019/10/02 01:34:09 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_iomux.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_iomux.c,v 1.2 2019/10/02 01:34:09 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -172,7 +172,5 @@ imxiomux_attach(device_t parent, device_
 			fdtbus_register_pinctrl_config(self, sub, &imx6_pinctrl_funcs);
 		}
 	}
-
-	fdtbus_pinctrl_configure();
 }
 



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

2019-09-26 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Sep 27 02:59:21 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx51_spi.c imxcspireg.h imxecspireg.h imxspi.c
imxspivar.h
src/sys/arch/arm/imx/fdt: imx6_spi.c

Log Message:
Add i.MX SPI device type.

IMX31_CSPI
IMX35_CSPI
IMX51_ECSPI


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_spi.c \
src/sys/arch/arm/imx/imxspivar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxcspireg.h \
src/sys/arch/arm/imx/imxecspireg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imxspi.c
cvs rdiff -u -r1.1 -r1.2 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.



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

2019-09-26 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Sep 27 02:59:21 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx51_spi.c imxcspireg.h imxecspireg.h imxspi.c
imxspivar.h
src/sys/arch/arm/imx/fdt: imx6_spi.c

Log Message:
Add i.MX SPI device type.

IMX31_CSPI
IMX35_CSPI
IMX51_ECSPI


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx51_spi.c \
src/sys/arch/arm/imx/imxspivar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxcspireg.h \
src/sys/arch/arm/imx/imxecspireg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imxspi.c
cvs rdiff -u -r1.1 -r1.2 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/imx51_spi.c
diff -u src/sys/arch/arm/imx/imx51_spi.c:1.2 src/sys/arch/arm/imx/imx51_spi.c:1.3
--- src/sys/arch/arm/imx/imx51_spi.c:1.2	Mon Aug 19 11:41:36 2019
+++ src/sys/arch/arm/imx/imx51_spi.c	Fri Sep 27 02:59:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_spi.c,v 1.2 2019/08/19 11:41:36 hkenken Exp $	*/
+/*	$NetBSD: imx51_spi.c,v 1.3 2019/09/27 02:59:21 hkenken Exp $	*/
 
 /*-
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx51_spi.c,v 1.2 2019/08/19 11:41:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_spi.c,v 1.3 2019/09/27 02:59:21 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -95,6 +95,10 @@ imxspi_attach(device_t parent, device_t 
 
 	sc->sc_iot = aa->aa_iot;
 	sc->sc_enhanced = cf_flags;
+	if (sc->sc_enhanced)
+		sc->sc_type = IMX51_ECSPI;
+	else
+		sc->sc_type = IMX35_CSPI;
 
 	sc->sc_nslaves = IMXSPINSLAVES;
 	sc->sc_freq = imx51_get_clock(IMX51CLK_CSPI_CLK_ROOT);
Index: src/sys/arch/arm/imx/imxspivar.h
diff -u src/sys/arch/arm/imx/imxspivar.h:1.2 src/sys/arch/arm/imx/imxspivar.h:1.3
--- src/sys/arch/arm/imx/imxspivar.h:1.2	Mon Aug 19 11:41:36 2019
+++ src/sys/arch/arm/imx/imxspivar.h	Fri Sep 27 02:59:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxspivar.h,v 1.2 2019/08/19 11:41:36 hkenken Exp $	*/
+/*	$NetBSD: imxspivar.h,v 1.3 2019/09/27 02:59:21 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -38,6 +38,12 @@ typedef struct spi_chipset_tag {
 	int (*spi_cs_disable)(void *, int);
 } *spi_chipset_tag_t;
 
+enum imxspi_type {
+	IMX31_CSPI,
+	IMX35_CSPI,
+	IMX51_ECSPI,
+};
+
 struct imxspi_softc {
 	device_t sc_dev;
 	int sc_phandle;
@@ -57,6 +63,7 @@ struct imxspi_softc {
 
 	int sc_nslaves;
 	int sc_enhanced;
+	enum imxspi_type sc_type;
 };
 
 int imxspi_attach_common(device_t);

Index: src/sys/arch/arm/imx/imxcspireg.h
diff -u src/sys/arch/arm/imx/imxcspireg.h:1.1 src/sys/arch/arm/imx/imxcspireg.h:1.2
--- src/sys/arch/arm/imx/imxcspireg.h:1.1	Sat Mar 22 09:28:08 2014
+++ src/sys/arch/arm/imx/imxcspireg.h	Fri Sep 27 02:59:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxcspireg.h,v 1.1 2014/03/22 09:28:08 hkenken Exp $	*/
+/*	$NetBSD: imxcspireg.h,v 1.2 2019/09/27 02:59:21 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -32,15 +32,12 @@
 #define	CSPI_RXDATA		0x00
 #define	CSPI_TXDATA		0x04
 #define	CSPI_CONREG		0x08
-#ifdef IMX51
-#define	 CSPI_CON_CS		__BITS(13, 12)
-#define	 CSPI_CON_DRCTL		__BITS( 9,  8)
-#define	 CSPI_CON_BITCOUNT	__BITS(31, 20)
-#else
-#define	 CSPI_CON_CS		__BITS(25, 24)
-#define	 CSPI_CON_DRCTL		__BITS(21, 20)
-#define	 CSPI_CON_BITCOUNT	__BITS(12,  8)
-#endif
+#define	 CSPI_IMX31_CON_CS		__BITS(25, 24)
+#define	 CSPI_IMX31_CON_DRCTL		__BITS(21, 20)
+#define	 CSPI_IMX31_CON_BITCOUNT	__BITS(12,  8)
+#define	 CSPI_IMX35_CON_CS		__BITS(13, 12)
+#define	 CSPI_IMX35_CON_DRCTL		__BITS( 9,  8)
+#define	 CSPI_IMX35_CON_BITCOUNT	__BITS(31, 20)
 #define	 CSPI_CON_DIV		__BITS(18, 16)
 #define	 CSPI_CON_SSPOL		__BIT(7)	/* SPI SS Polarity Select */
 #define	 CSPI_CON_SSCTL		__BIT(6)	/* In master mode, this bit
@@ -55,12 +52,9 @@
 #define	 CSPI_CON_ENABLE	__BIT(0)	/* EN */
 #define	CSPI_INTREG		0x0c
 #define	 CSPI_INTR_ALL_EN	0x01ff	/* All Intarruption Enabled */
-#ifdef IMX51
-#define	 CSPI_INTR_TC_EN	__BIT(7)	/* TX Complete */
-#else
-#define	 CSPI_INTR_TC_EN	__BIT(8)	/* TX Complete */
-#define	 CSPI_INTR_BO_EN	__BIT(7)	/* Bit Counter Overflow */
-#endif
+#define	 CSPI_IMX31_INTR_TC_EN	__BIT(8)	/* TX Complete */
+#define	 CSPI_IMX31_INTR_BO_EN	__BIT(7)	/* Bit Counter Overflow */
+#define	 CSPI_IMX35_INTR_TC_EN	__BIT(7)	/* TX Complete */
 #define	 CSPI_INTR_RO_EN	__BIT(6)	/* RXFIFO Overflow */
 #define	 CSPI_INTR_RF_EN	__BIT(5)	/* RXFIFO Full */
 #define	 CSPI_INTR_RH_EN	__BIT(4)	/* RXFIFO Half Full */
@@ -70,14 +64,11 @@
 #define	 CSPI_INTR_TE_EN	__BIT(0)	/* TXFIFO Empty */
 #define	CSPI_DMAREG		0x10
 #define	CSPI_STATREG		0x14
-#ifdef IMX51
-#define	 CSPI_STAT_CLR_TC	__BIT(7)	/* Clear TC of status register */
-#define  CSPI_STAT_CLR		CSPI_STAT_CLR_TC
-#

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

2019-09-26 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Sep 27 02:54:57 UTC 2019

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

Log Message:
Add SDHC_FLAG_NO_BUSY_INTR flag.


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

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



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

2019-09-26 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Sep 27 02:54:57 UTC 2019

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

Log Message:
Add SDHC_FLAG_NO_BUSY_INTR flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_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/arch/arm/imx/fdt/imx6_sdhc.c
diff -u src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.2 src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.2	Mon Aug 19 03:48:41 2019
+++ src/sys/arch/arm/imx/fdt/imx6_sdhc.c	Fri Sep 27 02:54:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_sdhc.c,v 1.2 2019/08/19 03:48:41 hkenken Exp $	*/
+/*	$NetBSD: imx6_sdhc.c,v 1.3 2019/09/27 02:54:57 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_sdhc.c,v 1.2 2019/08/19 03:48:41 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_sdhc.c,v 1.3 2019/09/27 02:54:57 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -119,7 +119,8 @@ imx6_sdhc_attach(device_t parent, device
 	SDHC_FLAG_HAVE_DVS |
 	SDHC_FLAG_32BIT_ACCESS |
 	SDHC_FLAG_USE_ADMA2 |
-	SDHC_FLAG_USDHC;
+	SDHC_FLAG_USDHC |
+	SDHC_FLAG_NO_BUSY_INTR;
 
 	if (bus_width == 8)
 		sc->sc_sdhc.sc_flags |= SDHC_FLAG_8BIT_MODE;



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

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:48:55 UTC 2019

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

Log Message:
Use M_BUFADDR.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/imx/if_enet.c

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



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

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:48:55 UTC 2019

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

Log Message:
Use M_BUFADDR.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/imx/if_enet.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.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.26 src/sys/arch/arm/imx/if_enet.c:1.27
--- src/sys/arch/arm/imx/if_enet.c:1.26	Fri Sep 13 07:55:05 2019
+++ src/sys/arch/arm/imx/if_enet.c	Fri Sep 20 08:48:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.26 2019/09/13 07:55:05 msaitoh Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.27 2019/09/20 08:48:55 maxv Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.26 2019/09/13 07:55:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.27 2019/09/20 08:48:55 maxv Exp $");
 
 #include "vlan.h"
 
@@ -1528,14 +1528,7 @@ enet_encap_mbufalign(struct mbuf **mp)
 		 * m_dat[] (aligned) to en-
 		 * large trailingspace
 		 */
-		if (mt->m_flags & M_EXT) {
-			ap = mt->m_ext.ext_buf;
-		} else if (mt->m_flags &
-		M_PKTHDR) {
-			ap = mt->m_pktdat;
-		} else {
-			ap = mt->m_dat;
-		}
+		ap = M_BUFADDR(mt);
 		ap = ALIGN_PTR(ap, ALIGNBYTE);
 		memcpy(ap, mt->m_data,
 		mt->m_len);



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

2019-09-01 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Sep  2 01:28:41 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx6_ccm.c imx6_iomuxreg.h imxpcie.c imxpciereg.h
imxpcievar.h
src/sys/arch/arm/imx/fdt: imx6_pcie.c

Log Message:
Add support for imx6qp-pcie.

+ Add vpcie-supply support
+ Add ext_osc support

Tested on SABRESD i.MX 6QP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_iomuxreg.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxpcie.c \
src/sys/arch/arm/imx/imxpciereg.h src/sys/arch/arm/imx/imxpcievar.h
cvs rdiff -u -r1.3 -r1.4 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.



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

2019-09-01 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Sep  2 01:28:41 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imx6_ccm.c imx6_iomuxreg.h imxpcie.c imxpciereg.h
imxpcievar.h
src/sys/arch/arm/imx/fdt: imx6_pcie.c

Log Message:
Add support for imx6qp-pcie.

+ Add vpcie-supply support
+ Add ext_osc support

Tested on SABRESD i.MX 6QP.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/imx6_iomuxreg.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imxpcie.c \
src/sys/arch/arm/imx/imxpciereg.h src/sys/arch/arm/imx/imxpcievar.h
cvs rdiff -u -r1.3 -r1.4 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/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.13 src/sys/arch/arm/imx/imx6_ccm.c:1.14
--- src/sys/arch/arm/imx/imx6_ccm.c:1.13	Tue Jul 30 11:11:15 2019
+++ src/sys/arch/arm/imx/imx6_ccm.c	Mon Sep  2 01:28:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.13 2019/07/30 11:11:15 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.14 2019/09/02 01:28:41 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.13 2019/07/30 11:11:15 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.14 2019/09/02 01:28:41 hkenken Exp $");
 
 #include "opt_cputypes.h"
 
@@ -886,6 +886,8 @@ static struct imx6_clk imx6_clks[] = {
 
 	CLK_GATE_EXCLUSIVE("lvds1_gate", "lvds1_sel", CCM_ANALOG, MISC1, LVDS_CLK1_OBEN, LVDS_CLK1_IBEN),
 	CLK_GATE_EXCLUSIVE("lvds2_gate", "lvds2_sel", CCM_ANALOG, MISC1, LVDS_CLK2_OBEN, LVDS_CLK2_IBEN),
+	CLK_GATE_EXCLUSIVE("lvds1_in", "anaclk1", CCM_ANALOG, MISC1, LVDS_CLK1_IBEN, LVDS_CLK1_OBEN),
+	CLK_GATE_EXCLUSIVE("lvds2_in", "anaclk2", CCM_ANALOG, MISC1, LVDS_CLK2_IBEN, LVDS_CLK2_OBEN),
 };
 
 static struct imx6_clk *imx6_clk_find(const char *);

Index: src/sys/arch/arm/imx/imx6_iomuxreg.h
diff -u src/sys/arch/arm/imx/imx6_iomuxreg.h:1.5 src/sys/arch/arm/imx/imx6_iomuxreg.h:1.6
--- src/sys/arch/arm/imx/imx6_iomuxreg.h:1.5	Mon Jul 22 11:44:01 2019
+++ src/sys/arch/arm/imx/imx6_iomuxreg.h	Mon Sep  2 01:28:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_iomuxreg.h,v 1.5 2019/07/22 11:44:01 hkenken Exp $	*/
+/*	$NetBSD: imx6_iomuxreg.h,v 1.6 2019/09/02 01:28:41 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -33,6 +33,7 @@
 #define IOMUX_GPR1	0x0004
 #define  IOMUX_GPR1_CFG_L1_CLK_REMOVAL_EN	__BIT(31)
 #define  IOMUX_GPR1_APP_CLK_REQ_N		__BIT(30)
+#define  IOMUX_GPR1_PCIE_SW_RST			__BIT(29)
 #define  IOMUX_GPR1_APP_REQ_EXIT_L1		__BIT(28)
 #define  IOMUX_GPR1_APP_READY_ENTR_L23		__BIT(27)
 #define  IOMUX_GPR1_APP_REQ_ENTR_L1		__BIT(26)

Index: src/sys/arch/arm/imx/imxpcie.c
diff -u src/sys/arch/arm/imx/imxpcie.c:1.1 src/sys/arch/arm/imx/imxpcie.c:1.2
--- src/sys/arch/arm/imx/imxpcie.c:1.1	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/arm/imx/imxpcie.c	Mon Sep  2 01:28:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxpcie.c,v 1.1 2019/07/24 12:33:18 hkenken Exp $	*/
+/*	$NetBSD: imxpcie.c,v 1.2 2019/09/02 01:28:41 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2019  Genetec Corporation.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxpcie.c,v 1.1 2019/07/24 12:33:18 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxpcie.c,v 1.2 2019/09/02 01:28:41 hkenken Exp $");
 
 #include "opt_pci.h"
 #include "opt_fdt.h"
@@ -244,34 +244,32 @@ imxpcie_phy_read(struct imxpcie_softc *s
 static int
 imxpcie_assert_core_reset(struct imxpcie_softc *sc)
 {
-	uint32_t gpr1;
-	uint32_t gpr12;
+	if (sc->sc_have_sw_reset) {
+		uint32_t gpr1 = sc->sc_gpr_read(sc, IOMUX_GPR1);
+		gpr1 |= IOMUX_GPR1_PCIE_SW_RST;
+		sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
+	} else {
+		uint32_t gpr1 = sc->sc_gpr_read(sc, IOMUX_GPR1);
+		uint32_t gpr12 = sc->sc_gpr_read(sc, IOMUX_GPR12);
 
-	gpr1 = sc->sc_gpr_read(sc, IOMUX_GPR1);
-	gpr12 = sc->sc_gpr_read(sc, IOMUX_GPR12);
+		/* already enabled by bootloader */
+		if ((gpr1 & IOMUX_GPR1_REF_SSP_EN) &&
+		(gpr12 & IOMUX_GPR12_APP_LTSSM_ENABLE)) {
+			uint32_t v = PCIE_READ(sc, PCIE_PL_PFLR);
+			v &= ~PCIE_PL_PFLR_LINK_STATE;
+			v |= PCIE_PL_PFLR_FORCE_LINK;
+			PCIE_WRITE(sc, PCIE_PL_PFLR, v);
 
-	/* already enabled by bootloader */
-	if ((gpr1 & IOMUX_GPR1_REF_SSP_EN) &&
-	(gpr12 & IOMUX_GPR12_APP_LTSSM_ENABLE)) {
-		uint32_t v = PCIE_READ(sc, PCIE_PL_PFLR);
-		v &= ~PCIE_PL_PFLR_LINK_STATE;
-		v |= PCIE_PL_PFLR_FORCE_LINK;
-		PCIE_WRITE(sc, PCIE_PL_PFLR, v);
+			gpr12 &= ~IOMUX_GPR12_APP_LTSSM_ENABLE;
+			sc->sc_gpr_write(sc, IOMUX_GPR12, gpr12);
+		}
 
-		gpr12 &= ~IOMUX_GPR12_APP_LTSSM_ENABLE;
-		sc->sc_gpr_write(sc, IOMUX_GPR12, gpr12);
+		gpr1 |= IOMUX_GPR1_TEST_POWERDOWN;
+		sc->sc_gpr_write(sc, IOMUX_GPR1, gpr1);
+		gpr1 &= ~IOMUX_GPR1_REF_SS

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

2019-08-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug 19 10:44:35 UTC 2019

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

Log Message:
Use a9ptmr_delay().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/fdt/imx6_platform.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_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.5 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.6
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.5	Mon Aug  5 12:44:01 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Mon Aug 19 10:44:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.5 2019/08/05 12:44:01 hkenken Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.6 2019/08/19 10:44:35 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_platform.c,v 1.5 2019/08/05 12:44:01 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.6 2019/08/19 10:44:35 hkenken Exp $");
 
 #include "arml2cc.h"
 #include "opt_console.h"
@@ -191,7 +191,7 @@ const struct arm_platform imx6_platform 
 	.ap_init_attach_args = imx_platform_init_attach_args,
 	.ap_device_register = imx_platform_device_register,
 	.ap_reset = imx6_platform_reset,
-	.ap_delay = a9tmr_delay,
+	.ap_delay = a9ptmr_delay,
 	.ap_uart_freq = imx_platform_uart_freq,
 	.ap_mpstart = imx_platform_mpstart,
 };



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

2019-08-19 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug 19 10:44:35 UTC 2019

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

Log Message:
Use a9ptmr_delay().


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

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



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

2019-08-18 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug 19 03:48:41 UTC 2019

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

Log Message:
Support write protect gpio pin.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_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/arch/arm/imx/fdt/imx6_sdhc.c
diff -u src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.1 src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_sdhc.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_sdhc.c	Mon Aug 19 03:48:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_sdhc.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_sdhc.c,v 1.2 2019/08/19 03:48:41 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_sdhc.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_sdhc.c,v 1.2 2019/08/19 03:48:41 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -50,6 +50,7 @@ static int imx6_sdhc_match(device_t, cfd
 static void imx6_sdhc_attach(device_t, device_t, void *);
 
 static int imx6_sdhc_card_detect(struct sdhc_softc *);
+static int imx6_sdhc_write_protect(struct sdhc_softc *);
 
 struct imx6_sdhc_softc {
 	struct sdhc_softc sc_sdhc;
@@ -64,6 +65,7 @@ struct imx6_sdhc_softc {
 	struct clk		*sc_clk_per;
 
 	struct fdtbus_gpio_pin	*sc_pin_cd;
+	struct fdtbus_gpio_pin	*sc_pin_wp;
 };
 
 CFATTACH_DECL_NEW(imx6_sdhc, sizeof(struct imx6_sdhc_softc),
@@ -116,13 +118,12 @@ imx6_sdhc_attach(device_t parent, device
 	SDHC_FLAG_NO_PWR0 |
 	SDHC_FLAG_HAVE_DVS |
 	SDHC_FLAG_32BIT_ACCESS |
-	SDHC_FLAG_8BIT_MODE |
 	SDHC_FLAG_USE_ADMA2 |
 	SDHC_FLAG_USDHC;
 
-	if (bus_width == 8) {
+	if (bus_width == 8)
 		sc->sc_sdhc.sc_flags |= SDHC_FLAG_8BIT_MODE;
-	}
+
 	sc->sc_sdhc.sc_host = &sc->sc_host;
 
 	sc->sc_bst = faa->faa_bst;
@@ -135,12 +136,17 @@ imx6_sdhc_attach(device_t parent, device
 
 	sc->sc_pin_cd = fdtbus_gpio_acquire(faa->faa_phandle,
 	"cd-gpios", GPIO_PIN_INPUT);
-
 	if (sc->sc_pin_cd) {
 		sc->sc_sdhc.sc_vendor_card_detect = imx6_sdhc_card_detect;
 		sc->sc_sdhc.sc_flags |= SDHC_FLAG_POLL_CARD_DET;
 	}
 
+	sc->sc_pin_wp = fdtbus_gpio_acquire(faa->faa_phandle,
+	"wp-gpios", GPIO_PIN_INPUT);
+	if (sc->sc_pin_wp) {
+		sc->sc_sdhc.sc_vendor_write_protect = imx6_sdhc_write_protect;
+	}
+
 	error = clk_enable(sc->sc_clk_per);
 	if (error) {
 		aprint_error(": couldn't enable clock: %d\n", error);
@@ -160,8 +166,8 @@ imx6_sdhc_attach(device_t parent, device
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SDMMC, 0,
-	sdhc_intr, &sc->sc_sdhc);
+	sc->sc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SDMMC,
+	FDT_INTR_MPSAFE, sdhc_intr, &sc->sc_sdhc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
 		intrstr);
@@ -189,3 +195,13 @@ imx6_sdhc_card_detect(struct sdhc_softc 
 	return fdtbus_gpio_read(sc->sc_pin_cd);
 }
 
+static int
+imx6_sdhc_write_protect(struct sdhc_softc *ssc)
+{
+	struct imx6_sdhc_softc *sc = device_private(ssc->sc_dev);
+
+	KASSERT(sc->sc_pin_wp != NULL);
+
+	return fdtbus_gpio_read(sc->sc_pin_wp);
+}
+



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

2019-08-18 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug 19 03:48:41 UTC 2019

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

Log Message:
Support write protect gpio pin.


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

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



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

2019-08-18 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug 19 03:45:51 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: if_enet_imx.c imx6_ahcisata.c imx6_gpio.c
imx6_pcie.c imx6_usb.c

Log Message:
Enable FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/if_enet_imx.c \
src/sys/arch/arm/imx/fdt/imx6_pcie.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c \
src/sys/arch/arm/imx/fdt/imx6_gpio.c src/sys/arch/arm/imx/fdt/imx6_usb.c

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



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

2019-08-18 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug 19 03:45:51 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: if_enet_imx.c imx6_ahcisata.c imx6_gpio.c
imx6_pcie.c imx6_usb.c

Log Message:
Enable FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/if_enet_imx.c \
src/sys/arch/arm/imx/fdt/imx6_pcie.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c \
src/sys/arch/arm/imx/fdt/imx6_gpio.c src/sys/arch/arm/imx/fdt/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/fdt/if_enet_imx.c
diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.2 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.3
--- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.2	Tue Jul 30 06:26:31 2019
+++ src/sys/arch/arm/imx/fdt/if_enet_imx.c	Mon Aug 19 03:45:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx.c,v 1.2 2019/07/30 06:26:31 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx.c,v 1.3 2019/08/19 03:45:51 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: if_enet_imx.c,v 1.2 2019/07/30 06:26:31 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx.c,v 1.3 2019/08/19 03:45:51 hkenken Exp $");
 
 #include "opt_fdt.h"
 
@@ -118,8 +118,8 @@ enet_attach(device_t parent, device_t se
 		aprint_error_dev(self, "failed to decode interrupt\n");
 		goto failure;
 	}
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET, 0,
-	enet_intr, sc);
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET,
+	FDT_INTR_MPSAFE, enet_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);
Index: src/sys/arch/arm/imx/fdt/imx6_pcie.c
diff -u src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.2 src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.2	Fri Jul 26 06:57:54 2019
+++ src/sys/arch/arm/imx/fdt/imx6_pcie.c	Mon Aug 19 03:45:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.2 2019/07/26 06:57:54 skrll Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.3 2019/08/19 03:45:51 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.2 2019/07/26 06:57:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.3 2019/08/19 03:45:51 hkenken Exp $");
 
 #include "opt_pci.h"
 #include "opt_fdt.h"
@@ -179,7 +179,8 @@ imx6_pcie_attach(device_t parent, device
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_VM, 0, imxpcie_intr, sc);
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_VM,
+	FDT_INTR_MPSAFE, imxpcie_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);

Index: src/sys/arch/arm/imx/fdt/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.1 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_ahcisata.c	Mon Aug 19 03:45:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 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_ahcisata.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $");
 
 #include 
 #include 
@@ -181,8 +181,8 @@ imx6_ahcisata_attach(device_t parent, de
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
-	ahci_intr, &sc->sc);
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO,
+	FDT_INTR_MPSAFE, ahci_intr, &sc->sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);
Index: src/sys/arch/arm/imx/fdt/imx6_gpio.c
diff -u src/sys/arch/arm/imx/fdt/imx6_gpio.c:1.1 src/sys/arch/arm/imx/fdt/imx6_gpio.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_gpio.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_gpio.c	Mon Aug 19 03:45:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_gpio.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_gpio.c,v 1.2 2019/08/19 03:45:51 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_gpio.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KE

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

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:44:01 UTC 2019

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

Log Message:
Add "fsl,imx6qp" (i.MX6QP) to ARM_PLATFORM list.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/imx6_platform.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_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.4 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.5
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.4	Sat Jul 27 07:41:43 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Mon Aug  5 12:44:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.4 2019/07/27 07:41:43 skrll Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.5 2019/08/05 12:44:01 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_platform.c,v 1.4 2019/07/27 07:41:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.5 2019/08/05 12:44:01 hkenken Exp $");
 
 #include "arml2cc.h"
 #include "opt_console.h"
@@ -196,5 +196,6 @@ const struct arm_platform imx6_platform 
 	.ap_mpstart = imx_platform_mpstart,
 };
 
-ARM_PLATFORM(imx6, "fsl,imx6q", &imx6_platform);
+ARM_PLATFORM(imx6q, "fsl,imx6q", &imx6_platform);
+ARM_PLATFORM(imx6qp, "fsl,imx6qp", &imx6_platform);
 



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

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:44:01 UTC 2019

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

Log Message:
Add "fsl,imx6qp" (i.MX6QP) to ARM_PLATFORM list.


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

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



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

2019-07-30 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 11:11:15 UTC 2019

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

Log Message:
Fix overflow to calculate frequencies.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 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.



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

2019-07-30 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 11:11:15 UTC 2019

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

Log Message:
Fix overflow to calculate frequencies.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 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.12 src/sys/arch/arm/imx/imx6_ccm.c:1.13
--- src/sys/arch/arm/imx/imx6_ccm.c:1.12	Fri Jul 26 06:57:54 2019
+++ src/sys/arch/arm/imx/imx6_ccm.c	Tue Jul 30 11:11:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.12 2019/07/26 06:57:54 skrll Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.13 2019/07/30 11:11:15 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.12 2019/07/26 06:57:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.13 2019/07/30 11:11:15 hkenken Exp $");
 
 #include "opt_cputypes.h"
 
@@ -1031,6 +1031,7 @@ imxccm_clk_get_rate_pll_generic(struct i
 const u_int rate_parent)
 {
 	struct imx6_clk_pll *pll = &iclk->clk.pll;
+	uint64_t freq = rate_parent;
 
 	KASSERT((pll->type == IMX6_CLK_PLL_GENNERIC) ||
 	(pll->type == IMX6_CLK_PLL_USB));
@@ -1038,7 +1039,7 @@ imxccm_clk_get_rate_pll_generic(struct i
 	uint32_t v = bus_space_read_4(sc->sc_iot, sc->sc_ioh_analog, pll->reg);
 	uint32_t div = __SHIFTOUT(v, pll->mask);
 
-	return rate_parent * ((div == 1) ? 22 : 20);
+	return freq * ((div == 1) ? 22 : 20);
 }
 
 static u_int
@@ -1046,13 +1047,14 @@ imxccm_clk_get_rate_pll_sys(struct imxcc
 const u_int rate_parent)
 {
 	struct imx6_clk_pll *pll = &iclk->clk.pll;
+	uint64_t freq = rate_parent;
 
 	KASSERT(pll->type == IMX6_CLK_PLL_SYS);
 
 	uint32_t v = bus_space_read_4(sc->sc_iot, sc->sc_ioh_analog, pll->reg);
 	uint32_t div = __SHIFTOUT(v, pll->mask);
 
-	return rate_parent * div / 2;
+	return freq * div / 2;
 }
 
 #define PLL_AUDIO_VIDEO_NUM_OFFSET	0x10
@@ -1063,7 +1065,7 @@ imxccm_clk_get_rate_pll_audio_video(stru
 struct imx6_clk *iclk, const u_int rate_parent)
 {
 	struct imx6_clk_pll *pll = &iclk->clk.pll;
-	uint64_t freq;
+	uint64_t freq = rate_parent;
 
 	KASSERT(pll->type == IMX6_CLK_PLL_AUDIO_VIDEO);
 
@@ -1074,10 +1076,9 @@ imxccm_clk_get_rate_pll_audio_video(stru
 	uint32_t denom = bus_space_read_4(sc->sc_iot, sc->sc_ioh_analog,
 	pll->reg + PLL_AUDIO_VIDEO_DENOM_OFFSET);
 
-	uint64_t tmp = rate_parent * num / denom;
-	freq = (uint64_t)rate_parent * div + tmp;
+	uint64_t tmp = freq * num / denom;
 
-	return freq;
+	return freq * div + tmp;
 }
 
 static u_int
@@ -1102,7 +1103,7 @@ imxccm_clk_get_rate_fixed_factor(struct 
 	parent = imx6_clk_find(iclk->parent);
 	KASSERT(parent != NULL);
 
-	const u_int rate_parent = imxccm_clk_get_rate(sc, &parent->base);
+	uint64_t rate_parent = imxccm_clk_get_rate(sc, &parent->base);
 
 	return rate_parent * fixed_factor->mult / fixed_factor->div;
 }
@@ -1118,7 +1119,7 @@ imxccm_clk_get_rate_pll(struct imxccm_so
 	parent = imx6_clk_find(iclk->parent);
 	KASSERT(parent != NULL);
 
-	const u_int rate_parent = imxccm_clk_get_rate(sc, &parent->base);
+	uint64_t rate_parent = imxccm_clk_get_rate(sc, &parent->base);
 
 	switch(pll->type) {
 	case IMX6_CLK_PLL_GENNERIC:
@@ -1182,7 +1183,7 @@ imxccm_clk_get_rate_pfd(struct imxccm_so
 	parent = imx6_clk_find(iclk->parent);
 	KASSERT(parent != NULL);
 
-	const u_int rate_parent = imxccm_clk_get_rate(sc, &parent->base);
+	uint64_t rate_parent = imxccm_clk_get_rate(sc, &parent->base);
 
 	uint32_t v = bus_space_read_4(sc->sc_iot, sc->sc_ioh_analog, pfd->reg);
 	uint32_t n = __SHIFTOUT(v, __BITS(5, 0) << (pfd->index * 8));



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

2019-07-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 06:26:31 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
src/sys/arch/arm/imx/fdt: files.imx6 if_enet_imx.c

Log Message:
Remove fdtbus_gpio_release() from enet_phy_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/if_enet_imx.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.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.24 src/sys/arch/arm/imx/if_enet.c:1.25
--- src/sys/arch/arm/imx/if_enet.c:1.24	Tue Jul 23 06:36:36 2019
+++ src/sys/arch/arm/imx/if_enet.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "vlan.h"
 
@@ -166,9 +166,6 @@ static void enet_drain_rxbuf(struct enet
 static int enet_alloc_dma(struct enet_softc *, size_t, void **,
 			  bus_dmamap_t *);
 
-CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
-enet_match, enet_attach, NULL, NULL);
-
 int
 enet_attach_common(device_t self)
 {

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.5 src/sys/arch/arm/imx/if_enet_imx6.c:1.6
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.5	Tue Jul 23 06:36:36 2019
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -47,6 +47,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx6
 #include 
 #include 
 
+CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
+enet_match, enet_attach, NULL, NULL);
+
 static int enet_init_clocks(struct enet_softc *);
 
 int

Index: src/sys/arch/arm/imx/if_enet_imx7.c
diff -u src/sys/arch/arm/imx/if_enet_imx7.c:1.3 src/sys/arch/arm/imx/if_enet_imx7.c:1.4
--- src/sys/arch/arm/imx/if_enet_imx7.c:1.3	Tue Jul 23 06:36:36 2019
+++ src/sys/arch/arm/imx/if_enet_imx7.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx7.c,v 1.3 2019/07/23 06:36:36 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.3 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -46,6 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx7
 #include 
 #include 
 
+CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
+enet_match, enet_attach, NULL, NULL);
+
 static void get_mac_from_ocotp(struct enet_softc *, device_t self,
 const char *);
 

Index: src/sys/arch/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.2 src/sys/arch/arm/imx/fdt/files.imx6:1.3
--- src/sys/arch/arm/imx/fdt/files.imx6:1.2	Sat Jul 27 08:02:04 2019
+++ src/sys/arch/arm/imx/fdt/files.imx6	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.2 2019/07/27 08:02:04 skrll Exp $
+#	$NetBSD: files.imx6,v 1.3 2019/07/30 06:26:31 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -48,9 +48,9 @@ defflag opt_imxuart.h			IMXUARTCONSOLE
 
 # FEC
 device	enet: ether, ifnet, arp, mii, bus_dma_generic
-attach	enet at fdt
+attach	enet at fdt with enet_fdt
 file	arch/arm/imx/if_enet.c		enet
-file	arch/arm/imx/fdt/if_enet_imx.c	enet
+file	arch/arm/imx/fdt/if_enet_imx.c	enet_fdt
 
 # SATA
 attach	ahcisata at fdt with imx6_ahcisata

Index: src/sys/arch/arm/imx/fdt/if_enet_imx.c
diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.1 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.2
--- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/if_enet_imx.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx.c,v 1.2 2019/07/30 06:26:31 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Wri

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

2019-07-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 06:26:31 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
src/sys/arch/arm/imx/fdt: files.imx6 if_enet_imx.c

Log Message:
Remove fdtbus_gpio_release() from enet_phy_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/if_enet_imx.c

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



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

2019-07-27 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Jul 27 12:07:24 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx7

Log Message:
Fixed compile error.


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

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



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

2019-07-27 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Sat Jul 27 12:07:24 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx7

Log Message:
Fixed compile error.


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

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.imx7
diff -u src/sys/arch/arm/imx/files.imx7:1.7 src/sys/arch/arm/imx/files.imx7:1.8
--- src/sys/arch/arm/imx/files.imx7:1.7	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/arm/imx/files.imx7	Sat Jul 27 12:07:24 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx7,v 1.7 2019/07/24 12:33:18 hkenken Exp $
+#	$NetBSD: files.imx7,v 1.8 2019/07/27 12:07:24 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX7
 #
@@ -52,7 +52,7 @@ file	arch/arm/imx/imxwdog.c			imxwdog
 # iMX GPIO
 device	imxgpio: gpiobus
 attach	imxgpio at axi
-file	arch/arm/imx/imxgpio.c			imxgpio
+file	arch/arm/imx/imxgpio.c			imxgpio		needs-flag
 file	arch/arm/imx/imx7_gpio.c		imxgpio
 
 # iMX7 IOMUX



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

2019-07-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 27 08:02:04 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx31_ahb.c imx6_board.c imx6_pcie.c
src/sys/arch/arm/imx/fdt: files.imx6

Log Message:
Fix builds properly


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx31_ahb.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/files.imx6

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



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

2019-07-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 27 08:02:04 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx31_ahb.c imx6_board.c imx6_pcie.c
src/sys/arch/arm/imx/fdt: files.imx6

Log Message:
Fix builds properly


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx31_ahb.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/files.imx6

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.17 src/sys/arch/arm/imx/files.imx6:1.18
--- src/sys/arch/arm/imx/files.imx6:1.17	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/arm/imx/files.imx6	Sat Jul 27 08:02:04 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.17 2019/07/24 12:33:18 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.18 2019/07/27 08:02:04 skrll Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -63,7 +63,7 @@ file	arch/arm/imx/imxwdog.c			imxwdog
 # iMX GPIO
 device	imxgpio: gpiobus
 attach	imxgpio at axi
-file	arch/arm/imx/imxgpio.c			imxgpio
+file	arch/arm/imx/imxgpio.c			imxgpio		needs-flag
 file	arch/arm/imx/imx6_gpio.c		imxgpio
 
 # iMX6 IOMUX

Index: src/sys/arch/arm/imx/imx31_ahb.c
diff -u src/sys/arch/arm/imx/imx31_ahb.c:1.6 src/sys/arch/arm/imx/imx31_ahb.c:1.7
--- src/sys/arch/arm/imx/imx31_ahb.c:1.6	Sat Oct 27 17:17:39 2012
+++ src/sys/arch/arm/imx/imx31_ahb.c	Sat Jul 27 08:02:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx31_ahb.c,v 1.6 2012/10/27 17:17:39 chs Exp $	*/
+/*	$NetBSD: imx31_ahb.c,v 1.7 2019/07/27 08:02:04 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2005  Genetec Corporation.  All rights reserved.
@@ -99,11 +99,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$Id: imx31_ahb.c,v 1.6 2012/10/27 17:17:39 chs Exp $");
+__KERNEL_RCSID(0, "$Id: imx31_ahb.c,v 1.7 2019/07/27 08:02:04 skrll Exp $");
 
 #include "locators.h"
 #include "avic.h"
-#include "imxgpio.h"
 
 #include 
 #include 

Index: src/sys/arch/arm/imx/imx6_board.c
diff -u src/sys/arch/arm/imx/imx6_board.c:1.13 src/sys/arch/arm/imx/imx6_board.c:1.14
--- src/sys/arch/arm/imx/imx6_board.c:1.13	Wed Jul 24 11:58:00 2019
+++ src/sys/arch/arm/imx/imx6_board.c	Sat Jul 27 08:02:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_board.c,v 1.13 2019/07/24 11:58:00 hkenken Exp $	*/
+/*	$NetBSD: imx6_board.c,v 1.14 2019/07/27 08:02:04 skrll Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,9 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.13 2019/07/24 11:58:00 hkenken Exp $");
+__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.14 2019/07/27 08:02:04 skrll Exp $");
 
 #include "arml2cc.h"
+#include "imxgpio.h"
 #include "opt_cputypes.h"
 #include "opt_imx.h"
 

Index: src/sys/arch/arm/imx/imx6_pcie.c
diff -u src/sys/arch/arm/imx/imx6_pcie.c:1.12 src/sys/arch/arm/imx/imx6_pcie.c:1.13
--- src/sys/arch/arm/imx/imx6_pcie.c:1.12	Sat Jul 27 08:00:41 2019
+++ src/sys/arch/arm/imx/imx6_pcie.c	Sat Jul 27 08:02:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.12 2019/07/27 08:00:41 skrll Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.13 2019/07/27 08:02:04 skrll Exp $	*/
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,11 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.12 2019/07/27 08:00:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.13 2019/07/27 08:02:04 skrll Exp $");
 
 #include "opt_pci.h"
 
 #include "locators.h"
+#include "imxgpio.h"
 #include "pci.h"
 
 #define	_INTR_PRIVATE

Index: src/sys/arch/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.1 src/sys/arch/arm/imx/fdt/files.imx6:1.2
--- src/sys/arch/arm/imx/fdt/files.imx6:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/files.imx6	Sat Jul 27 08:02:04 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.1 2019/07/24 13:12:33 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.2 2019/07/27 08:02:04 skrll Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -36,7 +36,7 @@ file	arch/arm/imx/fdt/imx6_iomux.c	imxio
 # GPIO controller
 device	imxgpio: gpiobus
 attach	imxgpio at fdt
-file	arch/arm/imx/imxgpio.c		imxgpio
+file	arch/arm/imx/imxgpio.c		imxgpio		needs-flag
 file	arch/arm/imx/fdt/imx6_gpio.c	imxgpio
 
 # UART



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

2019-07-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 27 08:00:41 UTC 2019

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

Log Message:
sort some #includes


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/arch/arm/imx/imx6_pcie.c:1.12
--- src/sys/arch/arm/imx/imx6_pcie.c:1.11	Fri Jul 26 06:57:54 2019
+++ src/sys/arch/arm/imx/imx6_pcie.c	Sat Jul 27 08:00:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.11 2019/07/26 06:57:54 skrll Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.12 2019/07/27 08:00:41 skrll Exp $	*/
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,12 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.11 2019/07/26 06:57:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.12 2019/07/27 08:00:41 skrll Exp $");
 
 #include "opt_pci.h"
 
-#include "pci.h"
 #include "locators.h"
+#include "pci.h"
 
 #define	_INTR_PRIVATE
 



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

2019-07-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 27 08:00:41 UTC 2019

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

Log Message:
sort some #includes


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.



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

2019-07-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 27 07:41:43 UTC 2019

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

Log Message:
Need opt_console for CONSADDR, etc


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/fdt/imx6_platform.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_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.3 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.4
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.3	Fri Jul 26 06:59:48 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Sat Jul 27 07:41:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.3 2019/07/26 06:59:48 skrll Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.4 2019/07/27 07:41:43 skrll Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,9 +25,10 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.3 2019/07/26 06:59:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.4 2019/07/27 07:41:43 skrll Exp $");
 
 #include "arml2cc.h"
+#include "opt_console.h"
 #include "opt_fdt.h"
 #include "opt_multiprocessor.h"
 #include "opt_soc.h"



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

2019-07-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 27 07:41:43 UTC 2019

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

Log Message:
Need opt_console for CONSADDR, etc


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

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



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

2019-07-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 26 06:57:55 UTC 2019

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

Log Message:
Fix builds


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/imx/imxusb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_pcie.c \
src/sys/arch/arm/imx/fdt/imx6_platform.c

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



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

2019-07-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 26 06:59:48 UTC 2019

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

Log Message:
KNF on #includes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_platform.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_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.2 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.2	Fri Jul 26 06:57:55 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Fri Jul 26 06:59:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.2 2019/07/26 06:57:55 skrll Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.3 2019/07/26 06:59:48 skrll Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,12 +25,12 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.2 2019/07/26 06:57:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.3 2019/07/26 06:59:48 skrll Exp $");
 
-#include "opt_soc.h"
 #include "arml2cc.h"
-#include "opt_multiprocessor.h"
 #include "opt_fdt.h"
+#include "opt_multiprocessor.h"
+#include "opt_soc.h"
 
 #include 
 #include 



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

2019-07-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 26 06:59:48 UTC 2019

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

Log Message:
KNF on #includes


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

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



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

2019-07-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 26 06:57:55 UTC 2019

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

Log Message:
Fix builds


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/imx/imx6_pcie.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/imx/imxusb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_pcie.c \
src/sys/arch/arm/imx/fdt/imx6_platform.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.11 src/sys/arch/arm/imx/imx6_ccm.c:1.12
--- src/sys/arch/arm/imx/imx6_ccm.c:1.11	Wed Jul 24 11:58:00 2019
+++ src/sys/arch/arm/imx/imx6_ccm.c	Fri Jul 26 06:57:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.11 2019/07/24 11:58:00 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.12 2019/07/26 06:57:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,9 +30,8 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.11 2019/07/24 11:58:00 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.12 2019/07/26 06:57:54 skrll Exp $");
 
-#include "opt_imx.h"
 #include "opt_cputypes.h"
 
 #include "locators.h"

Index: src/sys/arch/arm/imx/imx6_pcie.c
diff -u src/sys/arch/arm/imx/imx6_pcie.c:1.10 src/sys/arch/arm/imx/imx6_pcie.c:1.11
--- src/sys/arch/arm/imx/imx6_pcie.c:1.10	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/arm/imx/imx6_pcie.c	Fri Jul 26 06:57:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.10 2019/07/24 12:33:18 hkenken Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.11 2019/07/26 06:57:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 2016  Genetec Corporation.  All rights reserved.
@@ -31,12 +31,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.10 2019/07/24 12:33:18 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.11 2019/07/26 06:57:54 skrll Exp $");
 
 #include "opt_pci.h"
 
 #include "pci.h"
-#include "imxgpio.h"
 #include "locators.h"
 
 #define	_INTR_PRIVATE

Index: src/sys/arch/arm/imx/imxusb.c
diff -u src/sys/arch/arm/imx/imxusb.c:1.14 src/sys/arch/arm/imx/imxusb.c:1.15
--- src/sys/arch/arm/imx/imxusb.c:1.14	Wed Jul 24 11:20:55 2019
+++ src/sys/arch/arm/imx/imxusb.c	Fri Jul 26 06:57:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxusb.c,v 1.14 2019/07/24 11:20:55 hkenken Exp $	*/
+/*	$NetBSD: imxusb.c,v 1.15 2019/07/26 06:57:54 skrll Exp $	*/
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi and Hiroyuki Bessho for Genetec Corporation.
@@ -25,10 +25,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.14 2019/07/24 11:20:55 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxusb.c,v 1.15 2019/07/26 06:57:54 skrll Exp $");
 
 #include "locators.h"
-#include "opt_imx.h"
 
 #include 
 #include 

Index: src/sys/arch/arm/imx/fdt/imx6_pcie.c
diff -u src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.1 src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_pcie.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_pcie.c	Fri Jul 26 06:57:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_pcie.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_pcie.c,v 1.2 2019/07/26 06:57:54 skrll Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,13 +25,12 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_pcie.c,v 1.2 2019/07/26 06:57:54 skrll Exp $");
 
 #include "opt_pci.h"
 #include "opt_fdt.h"
 
 #include "pci.h"
-#include "imxgpio.h"
 #include "locators.h"
 
 #define	_INTR_PRIVATE
Index: src/sys/arch/arm/imx/fdt/imx6_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.1 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Fri Jul 26 06:57:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.2 2019/07/26 06:57:55 skrll Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,13 +25,12 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.2 2019/07/26 06:57:55 skrll Exp $");
 
 #include "opt_soc.h"
 #include "arml2cc.h"
 #include "opt_multiprocessor.h"
 #include "opt_fdt.h"
-#include "opt_fdt_arm.h"
 
 #include 
 #include 



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

2019-07-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jul 24 12:35:26 UTC 2019

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

Log Message:
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.



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

2019-07-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jul 24 12:35:26 UTC 2019

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

Log Message:
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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/imxclock.c
diff -u src/sys/arch/arm/imx/imxclock.c:1.7 src/sys/arch/arm/imx/imxclock.c:1.8
--- src/sys/arch/arm/imx/imxclock.c:1.7	Fri Jul 25 07:49:56 2014
+++ src/sys/arch/arm/imx/imxclock.c	Wed Jul 24 12:35:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxclock.c,v 1.7 2014/07/25 07:49:56 hkenken Exp $ */
+/*	$NetBSD: imxclock.c,v 1.8 2019/07/24 12:35:26 hkenken Exp $ */
 /*
  * Copyright (c) 2009, 2010  Genetec corp.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec corp.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxclock.c,v 1.7 2014/07/25 07:49:56 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxclock.c,v 1.8 2019/07/24 12:35:26 hkenken Exp $");
 
 #include "opt_imx.h"
 
@@ -111,7 +111,7 @@ cpu_initclocks(void)
 	bus_space_write_4(imxclock->sc_iot, imxclock->sc_ioh,
 	EPIT_EPITCR, reg);
 
-	epit1_sc->sc_ih = intr_establish(imxclock->sc_intr, IPL_CLOCK,
+	imxclock->sc_ih = intr_establish(imxclock->sc_intr, IPL_CLOCK,
 	IST_LEVEL, imxclock_intr, NULL);
 }
 



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

2019-07-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jul 24 11:58:00 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx6_board.c imx6_ccm.c imx6_ccmreg.h
imx6_ccmvar.h imx6_reg.h
Added Files:
src/sys/arch/arm/imx: imx6_clk.c

Log Message:
Modified imx6 Clock Controller Module (CCM).

+ Add imx6_get_clock_by_id().


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/imx/imx6_ccm.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_ccmvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx6_clk.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_reg.h

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



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

2019-07-24 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Wed Jul 24 11:58:00 UTC 2019

Modified Files:
src/sys/arch/arm/imx: files.imx6 imx6_board.c imx6_ccm.c imx6_ccmreg.h
imx6_ccmvar.h imx6_reg.h
Added Files:
src/sys/arch/arm/imx: imx6_clk.c

Log Message:
Modified imx6 Clock Controller Module (CCM).

+ Add imx6_get_clock_by_id().


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/imx/files.imx6
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/imx/imx6_board.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/imx/imx6_ccm.c \
src/sys/arch/arm/imx/imx6_ccmreg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/imx/imx6_ccmvar.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/imx6_clk.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_reg.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.imx6
diff -u src/sys/arch/arm/imx/files.imx6:1.15 src/sys/arch/arm/imx/files.imx6:1.16
--- src/sys/arch/arm/imx/files.imx6:1.15	Thu Jun 20 08:16:19 2019
+++ src/sys/arch/arm/imx/files.imx6	Wed Jul 24 11:58:00 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.15 2019/06/20 08:16:19 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.16 2019/07/24 11:58:00 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -34,8 +34,8 @@ file	arch/arm/imx/imx6_pcie.c		imxpcie
 # iMX6 Clock Control Module
 device	imxccm : clk
 attach	imxccm at axi
-file	arch/arm/imx/imx6_ccm.c			imxccm	needs-flag
-defflag opt_imx6clk.hIMXCCMDEBUG
+file	arch/arm/imx/imx6_ccm.c			imxccm needs-flag
+file	arch/arm/imx/imx6_clk.c			imxccm
 defparam opt_imx6clk.hIMX6_OSC_FREQ
 defparam opt_imx6clk.hIMX6_CKIL_FREQ
 defparam opt_imx6clk.hIMX6_CKIH_FREQ

Index: src/sys/arch/arm/imx/imx6_board.c
diff -u src/sys/arch/arm/imx/imx6_board.c:1.12 src/sys/arch/arm/imx/imx6_board.c:1.13
--- src/sys/arch/arm/imx/imx6_board.c:1.12	Thu Oct 18 09:01:52 2018
+++ src/sys/arch/arm/imx/imx6_board.c	Wed Jul 24 11:58:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_board.c,v 1.12 2018/10/18 09:01:52 skrll Exp $	*/
+/*	$NetBSD: imx6_board.c,v 1.13 2019/07/24 11:58:00 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,12 +27,14 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.12 2018/10/18 09:01:52 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: imx6_board.c,v 1.13 2019/07/24 11:58:00 hkenken Exp $");
 
 #include "arml2cc.h"
 #include "opt_cputypes.h"
 #include "opt_imx.h"
 
+#define	_INTR_PRIVATE
+
 #include 
 #include 
 #include 
@@ -189,7 +191,7 @@ imx6_armrootclk(void)
 	uint32_t v;
 
 	v = bus_space_read_4(imx6_ioreg_bst, imx6_ioreg_bsh,
-	AIPS1_CCM_ANALOG_BASE + CCM_ANALOG_PLL_ARM);
+	AIPS1_CCM_BASE + CCM_ANALOG_BASE + CCM_ANALOG_PLL_ARM);
 	clk = IMX6_OSC_FREQ * (v & CCM_ANALOG_PLL_ARM_DIV_SELECT) / 2;
 	v = bus_space_read_4(imx6_ioreg_bst, imx6_ioreg_bsh,
 	AIPS1_CCM_BASE + CCM_CACRR);

Index: src/sys/arch/arm/imx/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.10 src/sys/arch/arm/imx/imx6_ccm.c:1.11
--- src/sys/arch/arm/imx/imx6_ccm.c:1.10	Thu Jun 20 08:16:19 2019
+++ src/sys/arch/arm/imx/imx6_ccm.c	Wed Jul 24 11:58:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.10 2019/06/20 08:16:19 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.11 2019/07/24 11:58:00 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,10 +30,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.10 2019/06/20 08:16:19 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.11 2019/07/24 11:58:00 hkenken Exp $");
 
 #include "opt_imx.h"
-#include "opt_imx6clk.h"
 #include "opt_cputypes.h"
 
 #include "locators.h"
@@ -48,9 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v
 #include 
 
 #include 
-#ifdef CPU_CORTEXA9
-#include 
-#endif
 
 #include 
 #include 
@@ -60,15 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v
 
 #include 
 
-struct imxccm_softc {
-	device_t sc_dev;
-	bus_space_tag_t sc_iot;
-	bus_space_handle_t sc_ioh;
-	bus_space_handle_t sc_ioh_analog;
-
-	struct clk_domain sc_clkdom;
-};
-
 /* Clock Parents Tables */
 static const char *step_p[] = {
 	"osc",
@@ -369,6 +356,275 @@ static const char *lvds_p[] = {
 	"sata_ref_100m"
 };
 
+/* DT clock ID to clock name mappings */
+static struct imx_clock_id {
+	u_int		id;
+	const char	*name;
+} imx6_clock_ids[] = {
+	{ IMX6CLK_DUMMY,		"dummy" },
+	{ IMX6CLK_CKIL,			"ckil" },
+	{ IMX6CLK_CKIH,			"ckih" },
+	{ IMX6CLK_OSC,			"osc" },
+	{ IMX6CLK_PLL2_PFD0_352M,	"pll2_pfd0_352m" },
+	{ IMX6CLK_PLL2_PFD1_594M,	"pll2_pfd1_594m" },
+	{ IMX6CLK_PLL2_PFD2_396M,	"pll2_pfd2_396m" },
+	{ IMX6CLK_PLL3_PFD0_720M,	"pll3_pfd0_720m" },
+	{ IMX6CLK_PLL3_PFD1_540M,	"pll3_pfd1_540m" },
+	{ IMX6CLK_PLL3_PFD2_508M,	"pll3_pfd2_508m" },
+	{ IMX6CLK_PLL3_PFD3_454M,	"pll3_pfd3_454m" },
+	{ IMX6CLK_PLL2_198M,		"pll2_198m" },
+	{ IMX6CLK_PLL3_120M,		"pll3_120

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

2019-07-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 23 06:36:36 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
if_enetvar.h

Log Message:
Modified enet_attach_common().


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enetvar.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/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.23 src/sys/arch/arm/imx/if_enet.c:1.24
--- src/sys/arch/arm/imx/if_enet.c:1.23	Tue May 28 07:41:46 2019
+++ src/sys/arch/arm/imx/if_enet.c	Tue Jul 23 06:36:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.23 2019/05/28 07:41:46 msaitoh Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.23 2019/05/28 07:41:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $");
 
 #include "vlan.h"
 
@@ -132,7 +132,6 @@ static void enet_attach_evcnt(struct ene
 static void enet_update_evcnt(struct enet_softc *);
 #endif
 
-static int enet_intr(void *);
 static void enet_tick(void *);
 static int enet_tx_intr(void *);
 static int enet_rx_intr(void *);
@@ -170,30 +169,16 @@ static int enet_alloc_dma(struct enet_so
 CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
 enet_match, enet_attach, NULL, NULL);
 
-void
-enet_attach_common(device_t self, bus_space_tag_t iot,
-bus_dma_tag_t dmat, bus_addr_t addr, bus_size_t size, int irq)
+int
+enet_attach_common(device_t self)
 {
 	struct enet_softc *sc = device_private(self);
 	struct ifnet *ifp;
 	struct mii_data * const mii = &sc->sc_mii;
 
-	sc->sc_dev = self;
-	sc->sc_iot = iot;
-	sc->sc_addr = addr;
-	sc->sc_dmat = dmat;
-
-	aprint_naive("\n");
-	aprint_normal(": Gigabit Ethernet Controller\n");
-	if (bus_space_map(sc->sc_iot, sc->sc_addr, size, 0,
-	&sc->sc_ioh)) {
-		aprint_error_dev(self, "cannot map registers\n");
-		return;
-	}
-
 	/* allocate dma buffer */
 	if (enet_alloc_ring(sc))
-		return;
+		return -1;
 
 #define IS_ENADDR_ZERO(enaddr)\
 	((enaddr[0] | enaddr[1] | enaddr[2] |		\
@@ -225,32 +210,6 @@ enet_attach_common(device_t self, bus_sp
 
 	enet_init_regs(sc, 1);
 
-	/* setup interrupt handlers */
-	if ((sc->sc_ih = intr_establish(irq, IPL_NET,
-	IST_LEVEL, enet_intr, sc)) == NULL) {
-		aprint_error_dev(self, "unable to establish interrupt\n");
-		goto failure;
-	}
-
-	if (sc->sc_imxtype == 7) {
-		/* i.MX7 use 3 interrupts */
-		if ((sc->sc_ih2 = intr_establish(irq + 1, IPL_NET,
-		IST_LEVEL, enet_intr, sc)) == NULL) {
-			aprint_error_dev(self,
-			"unable to establish 2nd interrupt\n");
-			intr_disestablish(sc->sc_ih);
-			goto failure;
-		}
-		if ((sc->sc_ih3 = intr_establish(irq + 2, IPL_NET,
-		IST_LEVEL, enet_intr, sc)) == NULL) {
-			aprint_error_dev(self,
-			"unable to establish 3rd interrupt\n");
-			intr_disestablish(sc->sc_ih2);
-			intr_disestablish(sc->sc_ih);
-			goto failure;
-		}
-	}
-
 	/* callout will be scheduled from enet_init() */
 	callout_init(&sc->sc_tick_ch, 0);
 	callout_setfunc(&sc->sc_tick_ch, enet_tick, sc);
@@ -312,11 +271,7 @@ enet_attach_common(device_t self, bus_sp
 
 	sc->sc_stopping = false;
 
-	return;
-
- failure:
-	bus_space_unmap(sc->sc_iot, sc->sc_ioh, size);
-	return;
+	return 0;
 }
 
 #ifdef ENET_EVENT_COUNTER
@@ -446,7 +401,7 @@ enet_tick(void *arg)
 	splx(s);
 }
 
-static int
+int
 enet_intr(void *arg)
 {
 	struct enet_softc *sc;

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.4 src/sys/arch/arm/imx/if_enet_imx6.c:1.5
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.4	Thu Jun 20 08:16:19 2019
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Tue Jul 23 06:36:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.4 2019/06/20 08:16:19 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.4 2019/06/20 08:16:19 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -71,18 +71,19 @@ enet_match(device_t parent __unused, str
 void
 enet_attach(device_t parent, device_t self, void *aux)
 {
-	struct enet_softc *sc;
-	struct axi_attach_args *aa;
+	struct enet_softc *sc = device_private(self);
+	struct axi_attach_args *aa = aux;
 #if NIMXOCOTP > 0
 	uint32_t eaddr;
 #endif
 
-	aa = aux;
-	sc = device_private(self);
-
 	if (aa->aa_size == AXICF_SIZE_DEFAULT)
 		aa->aa_size = AIPS_ENET_SIZE;
 
+	sc->sc_dev = 

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

2019-07-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 23 06:36:36 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
if_enetvar.h

Log Message:
Modified enet_attach_common().


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enetvar.h

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



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

2019-07-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Jul 22 11:44:01 UTC 2019

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

Log Message:
Change register assignments.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_ahcisata.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_iomuxreg.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_ahcisata.c
diff -u src/sys/arch/arm/imx/imx6_ahcisata.c:1.9 src/sys/arch/arm/imx/imx6_ahcisata.c:1.10
--- src/sys/arch/arm/imx/imx6_ahcisata.c:1.9	Thu Jun 20 08:16:19 2019
+++ src/sys/arch/arm/imx/imx6_ahcisata.c	Mon Jul 22 11:44:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.9 2019/06/20 08:16:19 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.10 2019/07/22 11:44:01 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.9 2019/06/20 08:16:19 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.10 2019/07/22 11:44:01 hkenken Exp $");
 
 #include "locators.h"
 #include "opt_imx.h"
@@ -289,26 +289,26 @@ imx6_ahcisata_init(struct imx_ahci_softc
 
 	v = iomux_read(IOMUX_GPR13);
 	/* clear */
-	v &= ~(IOMUX_GPR13_SATA_PHY_8(7) |
-	IOMUX_GPR13_SATA_PHY_7(0x1f) |
-	IOMUX_GPR13_SATA_PHY_6(7) |
-	IOMUX_GPR13_SATA_SPEED(1) |
-	IOMUX_GPR13_SATA_PHY_5(1) |
-	IOMUX_GPR13_SATA_PHY_4(7) |
-	IOMUX_GPR13_SATA_PHY_3(0xf) |
-	IOMUX_GPR13_SATA_PHY_2(0x1f) |
-	IOMUX_GPR13_SATA_PHY_1(1) |
-	IOMUX_GPR13_SATA_PHY_0(1));
+	v &= ~(IOMUX_GPR13_SATA_PHY_8 |
+	IOMUX_GPR13_SATA_PHY_7 |
+	IOMUX_GPR13_SATA_PHY_6 |
+	IOMUX_GPR13_SATA_SPEED |
+	IOMUX_GPR13_SATA_PHY_5 |
+	IOMUX_GPR13_SATA_PHY_4 |
+	IOMUX_GPR13_SATA_PHY_3 |
+	IOMUX_GPR13_SATA_PHY_2 |
+	IOMUX_GPR13_SATA_PHY_1 |
+	IOMUX_GPR13_SATA_PHY_0);
 	/* setting */
-	v |= IOMUX_GPR13_SATA_PHY_8(5) |	/* Rx 3.0db */
-	IOMUX_GPR13_SATA_PHY_7(0x12) |	/* Rx SATA2m */
-	IOMUX_GPR13_SATA_PHY_6(3) |		/* Rx DPLL mode */
-	IOMUX_GPR13_SATA_SPEED(1) |		/* 3.0GHz */
-	IOMUX_GPR13_SATA_PHY_5(0) |		/* SpreadSpectram */
-	IOMUX_GPR13_SATA_PHY_4(4) |		/* Tx Attenuation 9/16 */
-	IOMUX_GPR13_SATA_PHY_3(0) |		/* Tx Boost 0db */
-	IOMUX_GPR13_SATA_PHY_2(0x11) |	/* Tx Level 1.104V */
-	IOMUX_GPR13_SATA_PHY_1(1);		/* PLL clock enable */
+	v |= __SHIFTIN(5, IOMUX_GPR13_SATA_PHY_8);	/* Rx 3.0db */
+	v |= __SHIFTIN(0x12, IOMUX_GPR13_SATA_PHY_7);	/* Rx SATA2m */
+	v |= __SHIFTIN(3, IOMUX_GPR13_SATA_PHY_6);	/* Rx DPLL mode */
+	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_SPEED);	/* 3.0GHz */
+	v |= __SHIFTIN(0, IOMUX_GPR13_SATA_PHY_5);	/* SpreadSpectram */
+	v |= __SHIFTIN(4, IOMUX_GPR13_SATA_PHY_4);	/* Tx Attenuation 9/16 */
+	v |= __SHIFTIN(0, IOMUX_GPR13_SATA_PHY_3);	/* Tx Boost 0db */
+	v |= __SHIFTIN(0x11, IOMUX_GPR13_SATA_PHY_2);	/* Tx Level 1.104V */
+	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_PHY_1);	/* PLL clock enable */
 	iomux_write(IOMUX_GPR13, v);
 
 	/* phy reset */

Index: src/sys/arch/arm/imx/imx6_iomuxreg.h
diff -u src/sys/arch/arm/imx/imx6_iomuxreg.h:1.4 src/sys/arch/arm/imx/imx6_iomuxreg.h:1.5
--- src/sys/arch/arm/imx/imx6_iomuxreg.h:1.4	Fri Jun  9 18:14:59 2017
+++ src/sys/arch/arm/imx/imx6_iomuxreg.h	Mon Jul 22 11:44:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_iomuxreg.h,v 1.4 2017/06/09 18:14:59 ryo Exp $	*/
+/*	$NetBSD: imx6_iomuxreg.h,v 1.5 2019/07/22 11:44:01 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -93,16 +93,16 @@
 #define  IOMUX_GPR13_CAN2_STOP_REQ		__BIT(29)
 #define  IOMUX_GPR13_CAN1_STOP_REQ		__BIT(28)
 #define  IOMUX_GPR13_ENET_STOP_REQ		__BIT(27)
-#define  IOMUX_GPR13_SATA_PHY_8(n)		__SHIFTIN(n, __BITS(26, 24))
-#define  IOMUX_GPR13_SATA_PHY_7(n)		__SHIFTIN(n, __BITS(23, 19))
-#define  IOMUX_GPR13_SATA_PHY_6(n)		__SHIFTIN(n, __BITS(18, 16))
-#define  IOMUX_GPR13_SATA_SPEED(n)		__SHIFTIN(n, __BIT(15))
-#define  IOMUX_GPR13_SATA_PHY_5(n)		__SHIFTIN(n, __BIT(14))
-#define  IOMUX_GPR13_SATA_PHY_4(n)		__SHIFTIN(n, __BITS(13, 11))
-#define  IOMUX_GPR13_SATA_PHY_3(n)		__SHIFTIN(n, __BITS(10, 7))
-#define  IOMUX_GPR13_SATA_PHY_2(n)		__SHIFTIN(n, __BITS(6, 2))
-#define  IOMUX_GPR13_SATA_PHY_1(n)		__SHIFTIN(n, __BIT(1))
-#define  IOMUX_GPR13_SATA_PHY_0(n)		__SHIFTIN(n, __BIT(0))
+#define  IOMUX_GPR13_SATA_PHY_8			__BITS(26, 24)
+#define  IOMUX_GPR13_SATA_PHY_7			__BITS(23, 19)
+#define  IOMUX_GPR13_SATA_PHY_6			__BITS(18, 16)
+#define  IOMUX_GPR13_SATA_SPEED			__BIT(15)
+#define  IOMUX_GPR13_SATA_PHY_5			__BIT(14)
+#define  IOMUX_GPR13_SATA_PHY_4			__BITS(13, 11)
+#define  IOMUX_GPR13_SATA_PHY_3			__BITS(10, 7)
+#define  IOMUX_GPR13_SATA_PHY_2			__BITS(6, 2)
+#define  IOMUX_GPR13_SATA_PHY_1			__BIT(1)
+#define  IOMUX_GPR13_SATA_PHY_0			__BIT(0)
 
 /* for iMX6Dual/Quad */
 #define IMX6DQ_IOMUXC_SW_MUX_CTL_PAD_SD2_DATA1			0x004c



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

2019-07-22 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Jul 22 11:44:01 UTC 2019

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

Log Message:
Change register assignments.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/imx/imx6_ahcisata.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx6_iomuxreg.h

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



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

2019-07-21 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Jul 22 01:35:37 UTC 2019

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx31_gpio.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/imx31_gpio.c
diff -u src/sys/arch/arm/imx/imx31_gpio.c:1.7 src/sys/arch/arm/imx/imx31_gpio.c:1.8
--- src/sys/arch/arm/imx/imx31_gpio.c:1.7	Sat Oct 27 17:17:39 2012
+++ src/sys/arch/arm/imx/imx31_gpio.c	Mon Jul 22 01:35:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx31_gpio.c,v 1.7 2012/10/27 17:17:39 chs Exp $	*/
+/*	$NetBSD: imx31_gpio.c,v 1.8 2019/07/22 01:35:36 hkenken Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,21 +28,21 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx31_gpio.c,v 1.7 2012/10/27 17:17:39 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx31_gpio.c,v 1.8 2019/07/22 01:35:36 hkenken Exp $");
 
 #define _INTR_PRIVATE
 
 #include "locators.h"
 #include "gpio.h"
- 
+
 #include 
 #include 
 #include 
- 
+
 #include 
-  
+
 #include 
- 
+
 #include 
 #include 
 #include 
@@ -182,7 +182,7 @@ gpio_pic_establish_irq(struct pic_softc 
 	GPIO_WRITE(gpio, GPIO_ISR, irq_mask);
 
 	/*
-	 * Convert the type to a gpio type and figure out which bits in what 
+	 * Convert the type to a gpio type and figure out which bits in what
 	 * register we have to tweak.
 	 */
 	gtype = (GPIO_TYPEMAP >> (2 * is->is_type)) & 3;
@@ -202,7 +202,7 @@ gpio_pic_establish_irq(struct pic_softc 
 	 */
 	v = GPIO_READ(gpio, GPIO_DIR);
 	v &= ~irq_mask;
-	GPIO_WRITE(gpio, GPIO_DIR, v); 
+	GPIO_WRITE(gpio, GPIO_DIR, v);
 
 	/*
 	 * Now record the type of interrupt.
@@ -243,7 +243,7 @@ imxgpio_pin_write(void *arg, int pin, in
 
 	old = GPIO_READ(gpio, GPIO_DR);
 	if (value)
-		new = old | mask; 
+		new = old | mask;
 	else
 		new = old & ~mask;
 



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

2019-07-21 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Jul 22 01:35:37 UTC 2019

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

Log Message:
Trailing whitespace


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

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



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

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 00:13:25 UTC 2019

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

Log Message:
 Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/imx/if_enet.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.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.21 src/sys/arch/arm/imx/if_enet.c:1.22
--- src/sys/arch/arm/imx/if_enet.c:1.21	Thu May 23 13:10:50 2019
+++ src/sys/arch/arm/imx/if_enet.c	Fri May 24 00:13:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.21 2019/05/23 13:10:50 msaitoh Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.22 2019/05/24 00:13:25 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.21 2019/05/23 13:10:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.22 2019/05/24 00:13:25 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -174,11 +174,10 @@ void
 enet_attach_common(device_t self, bus_space_tag_t iot,
 bus_dma_tag_t dmat, bus_addr_t addr, bus_size_t size, int irq)
 {
-	struct enet_softc *sc;
+	struct enet_softc *sc = device_private(self);
 	struct ifnet *ifp;
 	struct mii_data * const mii = &sc->sc_mii;
 
-	sc = device_private(self);
 	sc->sc_dev = self;
 	sc->sc_iot = iot;
 	sc->sc_addr = addr;



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

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 00:13:25 UTC 2019

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

Log Message:
 Fix compile error.


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

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



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

2014-10-07 Thread Matt Thomas

On Oct 7, 2014, at 2:36 AM, Ryo Shimizu  wrote:

> Module Name:  src
> Committed By: ryo
> Date: Tue Oct  7 09:36:09 UTC 2014
> 
> Modified Files:
>   src/sys/arch/arm/imx: files.imx6 imx6_ccm.c imx6_ccmvar.h
> Added Files:
>   src/sys/arch/arm/imx: imx6_i2c.c
> 
> Log Message:
> add support imx6 I2C Controller

This should be using dev/i2c/motoi2c*