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

2022-10-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 29 13:29:47 UTC 2022

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c exynos_soc.c

Log Message:
Build fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/samsung/exynos_soc.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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.38 src/sys/arch/arm/samsung/exynos_platform.c:1.39
--- src/sys/arch/arm/samsung/exynos_platform.c:1.38	Sat Apr 24 23:36:28 2021
+++ src/sys/arch/arm/samsung/exynos_platform.c	Sat Oct 29 13:29:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.38 2021/04/24 23:36:28 thorpej Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.39 2022/10/29 13:29:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,15 +35,15 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.38 2021/04/24 23:36:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.39 2022/10/29 13:29:46 jmcneill Exp $");
 
+#define	EXYNOS_CORE_VBASE	KERNEL_IO_VBASE
 
 /*
  * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
  */
 #defineEXYNOS5422_DISABLE_CA7_CLUSTER
 
-
 #include 
 #include 
 #include 
@@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_platf
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.40 src/sys/arch/arm/samsung/exynos_soc.c:1.41
--- src/sys/arch/arm/samsung/exynos_soc.c:1.40	Sun Sep 19 10:34:08 2021
+++ src/sys/arch/arm/samsung/exynos_soc.c	Sat Oct 29 13:29:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.40 2021/09/19 10:34:08 andvar Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.41 2022/10/29 13:29:46 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_exynos.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.40 2021/09/19 10:34:08 andvar Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.41 2022/10/29 13:29:46 jmcneill Exp $");
 
 #include 
 #include 
@@ -58,8 +58,9 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_soc.c
 #include 
 #include 
 
-/* XXXNH */
-#include 
+#include 
+
+#define	EXYNOS_CORE_VBASE	KERNEL_IO_VBASE
 
 
 /* these variables are retrieved in start.S and stored in .data */



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

2022-10-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 29 13:29:47 UTC 2022

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c exynos_soc.c

Log Message:
Build fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/samsung/exynos_soc.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/samsung

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 11 23:48:50 UTC 2022

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
arm/samsung: Don't abuse child's dv_private for the parent's uses.

dv_private belongs to the device itself, i.e., the child here.

This overwrote the child's softc pointer, causing all kinds of havoc;
if this worked it was by an amazing accident.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.32 src/sys/arch/arm/samsung/exynos_gpio.c:1.33
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.32	Sat Aug  7 16:18:45 2021
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Fri Feb 11 23:48:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.32 2021/08/07 16:18:45 thorpej Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.33 2022/02/11 23:48:50 riastradh Exp $ */
 
 /*-
 * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.32 2021/08/07 16:18:45 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.33 2022/02/11 23:48:50 riastradh Exp $");
 
 #include 
 #include 
@@ -398,7 +398,6 @@ exynos_gpio_bank_config(struct exynos_pi
 	bank->bank_sc = sc;
 	bank->bank_dev =
 	config_found(parent->sc_dev, , exynos_gpio_cfprint, CFARGS_NONE);
-	bank->bank_dev->dv_private = sc;
 
 	/* read in our initial settings */
 	bank->bank_cfg.cfg = GPIO_READ(bank, EXYNOS_GPIO_CON);
@@ -451,7 +450,14 @@ exynos_gpio_pin_lookup(const char *name)
 static void *
 exynos_gpio_fdt_acquire(device_t dev, const void *data, size_t len, int flags)
 {
+	device_t parent = device_parent(dev);
+	struct exynos_pinctrl_softc *sc = device_private(parent);
+	const struct exynos_pinctrl_banks *epb = sc->sc_epb;
+	struct exynos_gpio_bank *bank = NULL;
 	struct exynos_gpio_pin *gpin;
+	u_int n;
+
+	KASSERT(device_is_a(parent, "exyopctl"));
 
 	if (len != 12)
 		return NULL;
@@ -460,8 +466,14 @@ exynos_gpio_fdt_acquire(device_t dev, co
 	const int pin = be32toh(cells[1]) & 0x0f;
 	const int actlo = be32toh(cells[2]) & 0x01;
 
-	struct exynos_gpio_softc *bank_sc = device_private(dev);
-	struct exynos_gpio_bank * const bank = bank_sc->sc_bank;
+	for (n = 0; n < epb->epb_nbanks; n++) {
+		if (epb->epb_banks[n].bank_dev == dev) {
+			bank = >epb_banks[n];
+			break;
+		}
+	}
+	KASSERTMSG(bank != NULL, "no such gpio bank child of %s @ %p: %s @ %p",
+	device_xname(parent), parent, device_xname(dev), dev);
 
 	gpin = kmem_alloc(sizeof(*gpin), KM_SLEEP);
 	gpin->pin_sc = bank->bank_sc;



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

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 11 23:48:50 UTC 2022

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
arm/samsung: Don't abuse child's dv_private for the parent's uses.

dv_private belongs to the device itself, i.e., the child here.

This overwrote the child's softc pointer, causing all kinds of havoc;
if this worked it was by an amazing accident.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/samsung/exynos_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/samsung

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 11 23:48:41 UTC 2022

Modified Files:
src/sys/arch/arm/samsung: exynos_pinctrl.c

Log Message:
exyopctl(4): Don't leak a duplicate softc on attach.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.21 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.22
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.21	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Fri Feb 11 23:48:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.21 2021/01/27 03:10:19 thorpej Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.22 2022/02/11 23:48:41 riastradh Exp $ */
 
 /*-
 * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc.
@@ -34,14 +34,13 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.21 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.22 2022/02/11 23:48:41 riastradh Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -93,8 +92,7 @@ exynos_pinctrl_match(device_t parent, cf
 static void
 exynos_pinctrl_attach(device_t parent, device_t self, void *aux)
 {
-	struct exynos_pinctrl_softc * const sc
-		= kmem_zalloc(sizeof(*sc), KM_SLEEP);
+	struct exynos_pinctrl_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	bus_addr_t addr;
 	bus_size_t size;
@@ -107,7 +105,6 @@ exynos_pinctrl_attach(device_t parent, d
 	}
 
 	aprint_normal(" pinctrl @ 0x%08x ", (uint)addr);
-	self->dv_private = sc;
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
 	sc->sc_epb = of_compatible_lookup(faa->faa_phandle, compat_data)->data;



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

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 11 23:48:41 UTC 2022

Modified Files:
src/sys/arch/arm/samsung: exynos_pinctrl.c

Log Message:
exyopctl(4): Don't leak a duplicate softc on attach.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung

2021-03-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 14 08:16:57 UTC 2021

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c exynos_dwcmmc.c
exynos_ehci.c exynos_i2c.c exynos_ohci.c exynos_uart.c mct.c

Log Message:
Use fdtbus_intr_establish_xname


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos_combiner.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_ehci.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos_ohci.c \
src/sys/arch/arm/samsung/exynos_uart.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/mct.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/samsung

2021-03-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 14 08:16:57 UTC 2021

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c exynos_dwcmmc.c
exynos_ehci.c exynos_i2c.c exynos_ohci.c exynos_uart.c mct.c

Log Message:
Use fdtbus_intr_establish_xname


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos_combiner.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_ehci.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos_ohci.c \
src/sys/arch/arm/samsung/exynos_uart.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/mct.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/samsung/exynos_combiner.c
diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.13 src/sys/arch/arm/samsung/exynos_combiner.c:1.14
--- src/sys/arch/arm/samsung/exynos_combiner.c:1.13	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/samsung/exynos_combiner.c	Sun Mar 14 08:16:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_combiner.c,v 1.13 2021/01/27 03:10:19 thorpej Exp $ */
+/*	$NetBSD: exynos_combiner.c,v 1.14 2021/03/14 08:16:57 skrll Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.13 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.14 2021/03/14 08:16:57 skrll Exp $");
 
 #include 
 #include 
@@ -254,12 +254,13 @@ exynos_combiner_establish(device_t dev, 
 	if (!groupp) {
 		groupp = exynos_combiner_new_group(sc, group);
 		if (arg == NULL) {
-			groupp->irq_ih = fdtbus_intr_establish(sc->sc_phandle,
-			group, ipl /* XXX */, flags, func, NULL);
+			groupp->irq_ih = fdtbus_intr_establish_xname(
+			sc->sc_phandle, group, ipl /* XXX */, flags, func, NULL,
+			device_xname(dev));
 		} else {
-			groupp->irq_ih = fdtbus_intr_establish(sc->sc_phandle,
-			group, ipl /* XXX */, FDT_INTR_MPSAFE,
-			exynos_combiner_irq, groupp);
+			groupp->irq_ih = fdtbus_intr_establish_xname(
+			sc->sc_phandle,  group, ipl /* XXX */, FDT_INTR_MPSAFE,
+			exynos_combiner_irq, groupp, device_xname(dev));
 		}
 		KASSERT(groupp->irq_ih != NULL);
 		groupp->irq_ipl = ipl;

Index: src/sys/arch/arm/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.14 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.15
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.14	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Sun Mar 14 08:16:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.14 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.15 2021/03/14 08:16:57 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.14 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.15 2021/03/14 08:16:57 skrll Exp $");
 
 #include 
 #include 
@@ -165,8 +165,8 @@ exynos_dwcmmc_attach(device_t parent, de
 	if (dwc_mmc_init(sc) != 0)
 		return;
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
-	dwc_mmc_intr, sc);
+	sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_BIO, 0,
+	dwc_mmc_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
 		intrstr);

Index: src/sys/arch/arm/samsung/exynos_ehci.c
diff -u src/sys/arch/arm/samsung/exynos_ehci.c:1.5 src/sys/arch/arm/samsung/exynos_ehci.c:1.6
--- src/sys/arch/arm/samsung/exynos_ehci.c:1.5	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/samsung/exynos_ehci.c	Sun Mar 14 08:16:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_ehci.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: exynos_ehci.c,v 1.6 2021/03/14 08:16:57 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_ehci.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_ehci.c,v 1.6 2021/03/14 08:16:57 skrll Exp $");
 
 #include 
 #include 
@@ -126,8 +126,8 @@ exynos_ehci_attach(device_t parent, devi
 		return;
 	}
 
-	ih = fdtbus_intr_establish(phandle, 0, IPL_USB, FDT_INTR_MPSAFE,
-	ehci_intr, sc);
+	ih = fdtbus_intr_establish_xname(phandle, 0, IPL_USB, FDT_INTR_MPSAFE,
+	ehci_intr, sc, device_xname(self));
 	if (ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt on %s\n",
 		intrstr);

Index: src/sys/arch/arm/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.21 src/sys/arch/arm/samsung/exynos_i2c.c:1.22
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.21	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Sun Mar 14 08:16:57 2021
@@ 

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

2021-01-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 27 03:16:37 UTC 2021

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Rename of_match_compat_data() to of_compatible_match().  Similarly,
rename of_search_compatible() to of_compatible_lookup().

Standardize on of_compatible_match() for driver matching, and adapt
all call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.35 src/sys/arch/arm/samsung/exynos_platform.c:1.36
--- src/sys/arch/arm/samsung/exynos_platform.c:1.35	Wed Jan 27 02:01:53 2021
+++ src/sys/arch/arm/samsung/exynos_platform.c	Wed Jan 27 03:16:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.35 2021/01/27 02:01:53 thorpej Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.36 2021/01/27 03:16:37 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,7 +35,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.35 2021/01/27 02:01:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.36 2021/01/27 03:16:37 thorpej Exp $");
 
 
 /*
@@ -208,7 +208,7 @@ exynos_platform_mpstart(void)
 	int (*mp_start)(void) = NULL;
 
 	const struct device_compatible_entry *cd =
-	of_search_compatible(OF_finddevice("/"), mp_compat_data);
+	of_compatible_lookup(OF_finddevice("/"), mp_compat_data);
 	if (cd)
 		mp_start = cd->data;
 
@@ -339,7 +339,7 @@ exynos5_platform_bootstrap(void)
 
 #if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
 	const struct device_compatible_entry *cd =
-	of_search_compatible(OF_finddevice("/"), mp_compat_data);
+	of_compatible_lookup(OF_finddevice("/"), mp_compat_data);
 	if (cd && cd->data == exynos5800_mpstart) {
 		void *fdt_data = __UNCONST(fdtbus_get_data());
 		int cpu_off, cpus_off, len;



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

2021-01-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 27 03:16:37 UTC 2021

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Rename of_match_compat_data() to of_compatible_match().  Similarly,
rename of_search_compatible() to of_compatible_lookup().

Standardize on of_compatible_match() for driver matching, and adapt
all call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/samsung/exynos_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/samsung

2021-01-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 27 02:01:53 UTC 2021

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c exynos_pinctrl.c
exynos_platform.c exynos_usbdrdphy.c exynos_usbphy.c

Log Message:
Use DEVICE_COMPAT_EOL.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos_usbdrdphy.c \
src/sys/arch/arm/samsung/exynos_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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.12 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.13
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.12	Mon Jan 25 14:20:38 2021
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Wed Jan 27 02:01:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.12 2021/01/25 14:20:38 thorpej Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.13 2021/01/27 02:01:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.12 2021/01/25 14:20:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.13 2021/01/27 02:01:53 thorpej Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ static const struct device_compatible_en
 	{ .compat = "samsung,exynos5250-dw-mshc",	.value = 0 },
 	{ .compat = "samsung,exynos5420-dw-mshc-smu",	.value = 1 },
 	{ .compat = "samsung,exynos5420-dw-mshc",	.value = 0 },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 static int

Index: src/sys/arch/arm/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.19 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.20
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.19	Mon Jan 25 14:20:38 2021
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Wed Jan 27 02:01:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.19 2021/01/25 14:20:38 thorpej Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.20 2021/01/27 02:01:53 thorpej Exp $ */
 
 /*-
 * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.19 2021/01/25 14:20:38 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.20 2021/01/27 02:01:53 thorpej Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ static const struct device_compatible_en
 	{ .compat = "samsung,exynos5420-pinctrl",
 	  .data = _pinctrl_banks },
 
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 static int

Index: src/sys/arch/arm/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.34 src/sys/arch/arm/samsung/exynos_platform.c:1.35
--- src/sys/arch/arm/samsung/exynos_platform.c:1.34	Mon Jan 25 14:20:38 2021
+++ src/sys/arch/arm/samsung/exynos_platform.c	Wed Jan 27 02:01:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.34 2021/01/25 14:20:38 thorpej Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.35 2021/01/27 02:01:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,7 +35,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.34 2021/01/25 14:20:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.35 2021/01/27 02:01:53 thorpej Exp $");
 
 
 /*
@@ -198,7 +198,7 @@ exynos5800_mpstart(void)
 
 static struct device_compatible_entry mp_compat_data[] = {
 	{ .compat = "samsung,exynos5800",	.data = exynos5800_mpstart },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 static int

Index: src/sys/arch/arm/samsung/exynos_usbdrdphy.c
diff -u src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.4 src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.5
--- src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.4	Mon Jan 25 14:20:38 2021
+++ src/sys/arch/arm/samsung/exynos_usbdrdphy.c	Wed Jan 27 02:01:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_usbdrdphy.c,v 1.4 2021/01/25 14:20:38 thorpej Exp $ */
+/* $NetBSD: exynos_usbdrdphy.c,v 1.5 2021/01/27 02:01:53 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.4 2021/01/25 14:20:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.5 2021/01/27 02:01:53 thorpej Exp $");
 
 #include 
 #include 
@@ -91,7 +91,7 @@ enum {
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "samsung,exynos5420-usbdrd-phy" },
-	{ }
+	DEVICE_COMPAT_EOL
 };
 
 struct exynos_usbdrdphy_softc;
Index: src/sys/arch/arm/samsung/exynos_usbphy.c
diff -u src/sys/arch/arm/samsung/exynos_usbphy.c:1.4 src/sys/arch/arm/samsung/exynos_usbphy.c:1.5
--- src/sys/arch/arm/samsung/exynos_usbphy.c:1.4	Mon Jan 25 14:20:38 2021
+++ src/sys/arch/arm/samsung/exynos_usbphy.c	Wed Jan 27 02:01:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: 

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

2021-01-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 27 02:01:53 UTC 2021

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c exynos_pinctrl.c
exynos_platform.c exynos_usbdrdphy.c exynos_usbphy.c

Log Message:
Use DEVICE_COMPAT_EOL.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos_usbdrdphy.c \
src/sys/arch/arm/samsung/exynos_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/samsung

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 06:38:16 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c
exynos_pinctrl.h exynos_var.h

Log Message:
Support Exynos 5410 GPIO


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_pinctrl.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_var.h

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.28 src/sys/arch/arm/samsung/exynos_gpio.c:1.29
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.28	Fri Mar 20 06:35:59 2020
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Fri Mar 20 06:38:16 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: exynos_gpio.c,v 1.28 2020/03/20 06:35:59 skrll Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.29 2020/03/20 06:38:16 skrll Exp $ */
 
 /*-
-* Copyright (c) 2014 The NetBSD Foundation, Inc.
+* Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
-* by Reinoud Zandijk
+* by Reinoud Zandijk, and by Nick Hudson
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.28 2020/03/20 06:35:59 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.29 2020/03/20 06:38:16 skrll Exp $");
 
 #include 
 #include 
@@ -84,7 +84,30 @@ struct exynos_gpio_pin {
 		.bank_bits = b, \
 	}
 
-static struct exynos_gpio_bank exynos5_banks[] = {
+#define GPIO_GRP_INTR(o, n, b, i)			\
+	{ 		\
+		.bank_name = #n,			\
+		.bank_core_offset = GPIO_REG(v,s,o),	\
+		.bank_bits = b,\
+	}
+
+#define GPIO_GRP_NONE(o, n, b)	\
+	{ \
+		.bank_name = #n, \
+		.bank_core_offset = GPIO_REG(v,s,o), \
+		.bank_bits = b, \
+	}
+
+#define GPIO_GRP_WAKEUP(o, n, b, i)			\
+	{ 		\
+		.bank_name = #n,			\
+		.bank_core_offset = GPIO_REG(v,s,o),	\
+		.bank_bits = b,\
+	}
+
+
+
+static struct exynos_gpio_bank exynos5420_banks[] = {
 	GPIO_GRP(5, MUXA, 0x, gpy7, 8),
 	GPIO_GRP(5, MUXA, 0x0C00, gpx0, 8),
 	GPIO_GRP(5, MUXA, 0x0C20, gpx1, 8),
@@ -125,10 +148,78 @@ static struct exynos_gpio_bank exynos5_b
 	GPIO_GRP(5, MUXD, 0x0100, gph0, 4),
 
 	GPIO_GRP(5, MUXE, 0x, gpz, 7),
+};
+
+struct exynos_pinctrl_banks exynos5420_pinctrl_banks = {
+	.epb_banks = exynos5420_banks,
+	.epb_nbanks = __arraycount(exynos5420_banks)
+};
+
+static struct exynos_gpio_bank exynos5410_banks[] = {
+	/* pin-controller 0 */
+	GPIO_GRP_INTR(0x000, gpa0, 8, 0x00),
+	GPIO_GRP_INTR(0x020, gpa1, 6, 0x04),
+	GPIO_GRP_INTR(0x040, gpa2, 8, 0x08),
+	GPIO_GRP_INTR(0x060, gpb0, 5, 0x0c),
+	GPIO_GRP_INTR(0x080, gpb1, 5, 0x10),
+	GPIO_GRP_INTR(0x0A0, gpb2, 4, 0x14),
+	GPIO_GRP_INTR(0x0C0, gpb3, 4, 0x18),
+	GPIO_GRP_INTR(0x0E0, gpc0, 7, 0x1c),
+	GPIO_GRP_INTR(0x100, gpc3, 4, 0x20),
+	GPIO_GRP_INTR(0x120, gpc1, 7, 0x24),
+	GPIO_GRP_INTR(0x140, gpc2, 7, 0x28),
+	GPIO_GRP_INTR(0x180, gpd1, 8, 0x2c),
+	GPIO_GRP_INTR(0x1A0, gpe0, 8, 0x30),
+	GPIO_GRP_INTR(0x1C0, gpe1, 2, 0x34),
+	GPIO_GRP_INTR(0x1E0, gpf0, 6, 0x38),
+	GPIO_GRP_INTR(0x200, gpf1, 8, 0x3c),
+	GPIO_GRP_INTR(0x220, gpg0, 8, 0x40),
+	GPIO_GRP_INTR(0x240, gpg1, 8, 0x44),
+	GPIO_GRP_INTR(0x260, gpg2, 2, 0x48),
+	GPIO_GRP_INTR(0x280, gph0, 4, 0x4c),
+	GPIO_GRP_INTR(0x2A0, gph1, 8, 0x50),
+	GPIO_GRP_NONE(0x160, gpm5, 2),
+	GPIO_GRP_NONE(0x2C0, gpm7, 8),
+	GPIO_GRP_NONE(0x2E0, gpy0, 6),
+	GPIO_GRP_NONE(0x300, gpy1, 4),
+	GPIO_GRP_NONE(0x320, gpy2, 6),
+	GPIO_GRP_NONE(0x340, gpy3, 8),
+	GPIO_GRP_NONE(0x360, gpy4, 8),
+	GPIO_GRP_NONE(0x380, gpy5, 8),
+	GPIO_GRP_NONE(0x3A0, gpy6, 8),
+	GPIO_GRP_NONE(0x3C0, gpy7, 8),
+	GPIO_GRP_WAKEUP(0xC00, gpx0, 8, 0x00),
+	GPIO_GRP_WAKEUP(0xC20, gpx1, 8, 0x04),
+	GPIO_GRP_WAKEUP(0xC40, gpx2, 8, 0x08),
+	GPIO_GRP_WAKEUP(0xC60, gpx3, 8, 0x0c),
+
+	/* pin-controller 1 */
+	GPIO_GRP_INTR(0x000, gpj0, 5, 0x00),
+	GPIO_GRP_INTR(0x020, gpj1, 8, 0x04),
+	GPIO_GRP_INTR(0x040, gpj2, 8, 0x08),
+	GPIO_GRP_INTR(0x060, gpj3, 8, 0x0c),
+	GPIO_GRP_INTR(0x080, gpj4, 2, 0x10),
+	GPIO_GRP_INTR(0x0A0, gpk0, 8, 0x14),
+	GPIO_GRP_INTR(0x0C0, gpk1, 8, 0x18),
+	GPIO_GRP_INTR(0x0E0, gpk2, 8, 0x1c),
+	GPIO_GRP_INTR(0x100, gpk3, 7, 0x20),
+
+	/* pin-controller 2 */
+	GPIO_GRP_INTR(0x000, gpv0, 8, 0x00),
+	GPIO_GRP_INTR(0x020, gpv1, 8, 0x04),
+	GPIO_GRP_INTR(0x060, gpv2, 8, 0x08),
+	GPIO_GRP_INTR(0x080, gpv3, 8, 0x0c),
+	GPIO_GRP_INTR(0x0C0, gpv4, 2, 0x10),
+
+	/* pin-controller 2 */
+	GPIO_GRP_INTR(0x000, gpz, 7, 0x00),
+};
 
+struct exynos_pinctrl_banks exynos5410_pinctrl_banks = {
+	.epb_banks = exynos5410_banks,
+	.epb_nbanks = 

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

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 06:38:16 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c
exynos_pinctrl.h exynos_var.h

Log Message:
Support Exynos 5410 GPIO


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_pinctrl.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_var.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/samsung

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 06:35:59 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.27 src/sys/arch/arm/samsung/exynos_gpio.c:1.28
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.27	Fri Mar 20 06:33:00 2020
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Fri Mar 20 06:35:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.27 2020/03/20 06:33:00 skrll Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.28 2020/03/20 06:35:59 skrll Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.27 2020/03/20 06:33:00 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.28 2020/03/20 06:35:59 skrll Exp $");
 
 #include 
 #include 
@@ -63,11 +63,7 @@ struct exynos_gpio_bank {
 	const bus_addr_t	bank_core_offset;
 	const uint8_t		bank_bits;
 
-	uint8_t			bank_pin_mask;
-	uint8_t			bank_pin_inuse_mask;
-	bus_space_handle_t	bank_bsh;
 	struct exynos_gpio_pin_cfg bank_cfg;
-	struct exynos_gpio_bank * bank_next;
 };
 
 struct exynos_gpio_pin {
@@ -311,10 +307,6 @@ exynos_gpio_bank_config(struct exynos_pi
 	bank->bank_dev = config_found_ia(parent->sc_dev, "gpiobus", ,
 	 exynos_gpio_cfprint);
 
-	bank->bank_pin_mask = __BIT(bank->bank_bits) - 1;
-	bank->bank_pin_inuse_mask = 0;
-
-
 	/* read in our initial settings */
 	bank->bank_cfg.cfg = GPIO_READ(bank, EXYNOS_GPIO_CON);
 	bank->bank_cfg.pud = GPIO_READ(bank, EXYNOS_GPIO_PUD);



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

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 06:35:59 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_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/samsung

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 06:33:00 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
Use __BIT/__SHIFTOUT some more.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/exynos_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/samsung

2020-03-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 20 06:33:00 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
Use __BIT/__SHIFTOUT some more.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.26 src/sys/arch/arm/samsung/exynos_gpio.c:1.27
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.26	Tue Mar 17 21:24:30 2020
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Fri Mar 20 06:33:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.27 2020/03/20 06:33:00 skrll Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.27 2020/03/20 06:33:00 skrll Exp $");
 
 #include 
 #include 
@@ -179,11 +179,13 @@ static int
 exynos_gpio_pin_read(void *cookie, int pin)
 {
 	struct exynos_gpio_bank * const bank = cookie;
+	uint8_t val;
 
 	KASSERT(pin < bank->bank_bits);
-	return (bus_space_read_1(bank->bank_sc->sc_bst,
- bank->bank_sc->sc_bsh,
-		EXYNOS_GPIO_DAT) >> pin) & 1;
+	val = bus_space_read_1(bank->bank_sc->sc_bst, bank->bank_sc->sc_bsh,
+	EXYNOS_GPIO_DAT);
+
+	return __SHIFTOUT(val, __BIT(pin));
 }
 
 static void
@@ -193,15 +195,13 @@ exynos_gpio_pin_write(void *cookie, int 
 	int val;
 
 	KASSERT(pin < bank->bank_bits);
-	val = bus_space_read_1(bank->bank_sc->sc_bst,
-			   bank->bank_sc->sc_bsh,
-			   EXYNOS_GPIO_DAT);
+	val = bus_space_read_1(bank->bank_sc->sc_bst, bank->bank_sc->sc_bsh,
+	EXYNOS_GPIO_DAT);
 	val &= ~__BIT(pin);
 	if (value)
 		val |= __BIT(pin);
-	bus_space_write_1(bank->bank_sc->sc_bst,
-			  bank->bank_sc->sc_bsh,
-		EXYNOS_GPIO_DAT, val);
+	bus_space_write_1(bank->bank_sc->sc_bst, bank->bank_sc->sc_bsh,
+	EXYNOS_GPIO_DAT, val);
 }
 
 static void



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

2020-03-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 19 08:33:04 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Bring back EXYNOS5422_DISABLE_CA7_CLUSTER the bug is back


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_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/samsung

2020-03-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 19 08:33:04 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Bring back EXYNOS5422_DISABLE_CA7_CLUSTER the bug is back


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.27 src/sys/arch/arm/samsung/exynos_platform.c:1.28
--- src/sys/arch/arm/samsung/exynos_platform.c:1.27	Sat Feb 15 08:16:11 2020
+++ src/sys/arch/arm/samsung/exynos_platform.c	Thu Mar 19 08:33:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.27 2020/02/15 08:16:11 skrll Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.28 2020/03/19 08:33:04 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,7 +35,14 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.27 2020/02/15 08:16:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.28 2020/03/19 08:33:04 skrll Exp $");
+
+
+/*
+ * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
+ */
+#defineEXYNOS5422_DISABLE_CA7_CLUSTER
+
 
 #include 
 #include 
@@ -143,6 +150,11 @@ exynos5800_mpstart(void)
 		const u_int aff0 = __SHIFTOUT(mpidr, MPIDR_AFF0);
 		const u_int cpu = cluster * 4 + aff0;
 
+#if defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
+		if (cluster == 1)
+			continue;
+#endif
+
 		val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_STATUS(cpu));
 		bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_CONFIG(cpu),
 		EXYNOS5800_PMU_CORE_POWER_EN);
@@ -327,6 +339,27 @@ exynos5_platform_bootstrap(void)
 
 	exynos_bootstrap(5);
 
+#if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
+	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);
+	if (cd && cd->data == (uintptr_t)exynos5800_mpstart) {
+		void *fdt_data = __UNCONST(fdtbus_get_data());
+		int cpu_off, cpus_off, len;
+
+		cpus_off = fdt_path_offset(fdt_data, "/cpus");
+		if (cpus_off < 0)
+			return;
+
+		fdt_for_each_subnode(cpu_off, fdt_data, cpus_off) {
+			const void *prop = fdt_getprop(fdt_data, cpu_off, "reg", );
+			if (len != 4)
+continue;
+			const uint32_t mpidr = be32dec(prop);
+			if (mpidr != cpu_mpidr_aff_read() && __SHIFTOUT(mpidr, MPIDR_AFF1) == 1)
+fdt_setprop_string(fdt_data, cpu_off, "status", "fail");
+		}
+	}
+#endif
+
 	arm_fdt_cpu_bootstrap();
 }
 



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

2020-03-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 17 21:24:30 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
exynos_gpio.c exynos_i2c.c exynos_pinctrl.c exynos_uart.c

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_uart.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/samsung

2020-03-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 17 21:24:30 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
exynos_gpio.c exynos_i2c.c exynos_pinctrl.c exynos_uart.c

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_uart.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/samsung/exynos5410_clock.c
diff -u src/sys/arch/arm/samsung/exynos5410_clock.c:1.5 src/sys/arch/arm/samsung/exynos5410_clock.c:1.6
--- src/sys/arch/arm/samsung/exynos5410_clock.c:1.5	Fri Oct 18 06:13:38 2019
+++ src/sys/arch/arm/samsung/exynos5410_clock.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5410_clock.c,v 1.5 2019/10/18 06:13:38 skrll Exp $ */
+/* $NetBSD: exynos5410_clock.c,v 1.6 2020/03/17 21:24:30 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.5 2019/10/18 06:13:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.6 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -448,7 +448,7 @@ exynos5410_clock_attach(device_t parent,
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
-	
+
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh);
 	if (error) {
 		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d",
@@ -583,7 +583,7 @@ exynos5410_clock_get_rate_pll(struct exy
 	_parent->base);
 
 	const uint32_t v = CLOCK_READ(sc, epll->con0_reg);
-	
+
 	return PLL_FREQ(rate_parent, v);
 }
 

Index: src/sys/arch/arm/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.14 src/sys/arch/arm/samsung/exynos5422_clock.c:1.15
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.14	Fri Oct 18 06:13:38 2019
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.14 2019/10/18 06:13:38 skrll Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.15 2020/03/17 21:24:30 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.14 2019/10/18 06:13:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.15 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -625,7 +625,7 @@ exynos5422_clock_attach(device_t parent,
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
-	
+
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh);
 	if (error) {
 		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d",
@@ -760,7 +760,7 @@ exynos5422_clock_get_rate_pll(struct exy
 	_parent->base);
 
 	const uint32_t v = CLOCK_READ(sc, epll->con0_reg);
-	
+
 	return PLL_FREQ(rate_parent, v);
 }
 

Index: src/sys/arch/arm/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.25 src/sys/arch/arm/samsung/exynos_gpio.c:1.26
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.25	Wed Jul  4 22:16:42 2018
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.25 2018/07/04 22:16:42 jmcneill Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.25 2018/07/04 22:16:42 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -292,7 +292,7 @@ exynos_gpio_bank_config(struct exynos_pi
 		result);
 		return NULL;
 	}
-	
+
 	sc->sc_dev = parent->sc_dev;
 	sc->sc_bst = _generic_bs_tag;
 	sc->sc_bsh = parent->sc_bsh;

Index: src/sys/arch/arm/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.18 src/sys/arch/arm/samsung/exynos_i2c.c:1.19
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.18	Sun Dec 22 23:50:43 2019
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.18 2019/12/22 23:50:43 thorpej Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.19 2020/03/17 21:24:30 skrll Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.18 2019/12/22 23:50:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.19 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -169,7 +169,7 @@ exynos_i2c_attach(device_t parent, devic
 		return;
 	

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

2019-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 22 23:50:43 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_i2c.c

Log Message:
Use a separate lock (not the i2c bus lock) to synchronize with the
interrupt handler.  Refactor the code slightly to make the lock use
consistent.

Also includes the changes for:

Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus().  "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/exynos_i2c.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/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.17 src/sys/arch/arm/samsung/exynos_i2c.c:1.18
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.17	Fri Oct 18 06:13:38 2019
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Sun Dec 22 23:50:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.17 2019/10/18 06:13:38 skrll Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.18 2019/12/22 23:50:43 thorpej Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.17 2019/10/18 06:13:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.18 2019/12/22 23:50:43 thorpej Exp $");
 
 #include 
 #include 
@@ -65,15 +65,12 @@ struct exynos_i2c_softc {
 	bool			sc_sda_is_output;
 
 	struct i2c_controller 	sc_ic;
-	kmutex_t		sc_lock;
-	kcondvar_t		sc_cv;
+	kmutex_t		sc_intr_lock;
+	kcondvar_t		sc_intr_wait;
 };
 
 static int	exynos_i2c_intr(void *);
 
-static int	exynos_i2c_acquire_bus(void *, int);
-static void	exynos_i2c_release_bus(void *, int);
-
 static int	exynos_i2c_send_start(void *, int);
 static int	exynos_i2c_send_stop(void *, int);
 static int	exynos_i2c_initiate_xfer(void *, i2c_addr_t, int);
@@ -155,8 +152,8 @@ exynos_i2c_attach(device_t parent, devic
 		return;
 	}
 
-	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM);
-	cv_init(>sc_cv, device_xname(self));
+	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_VM);
+	cv_init(>sc_intr_wait, device_xname(self));
 	aprint_normal(" @ 0x%08x\n", (uint)addr);
 
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
@@ -173,9 +170,8 @@ exynos_i2c_attach(device_t parent, devic
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 	
+	iic_tag_init(>sc_ic);
 	sc->sc_ic.ic_cookie = sc;
-	sc->sc_ic.ic_acquire_bus = exynos_i2c_acquire_bus;
-	sc->sc_ic.ic_release_bus = exynos_i2c_release_bus;
 	sc->sc_ic.ic_send_start  = exynos_i2c_send_start;
 	sc->sc_ic.ic_send_stop   = exynos_i2c_send_stop;
 	sc->sc_ic.ic_initiate_xfer = exynos_i2c_initiate_xfer;
@@ -206,31 +202,14 @@ exynos_i2c_intr(void *priv)
 	istatus &= ~IRQPEND;
 	I2C_WRITE(sc, IICCON, istatus);
 
-	mutex_enter(>sc_lock);
-	cv_broadcast(>sc_cv);
-	mutex_exit(>sc_lock);
+	mutex_enter(>sc_intr_lock);
+	cv_broadcast(>sc_intr_wait);
+	mutex_exit(>sc_intr_lock);
 
 	return 1;
 }
 
 static int
-exynos_i2c_acquire_bus(void *cookie, int flags)
-{
-	struct exynos_i2c_softc *i2c_sc = cookie;
-
-	mutex_enter(_sc->sc_lock);
-	return 0;
-}
-
-static void
-exynos_i2c_release_bus(void *cookie, int flags)
-{
-	struct exynos_i2c_softc *i2c_sc = cookie;
-
-	mutex_exit(_sc->sc_lock);
-}
-
-static int
 exynos_i2c_wait(struct exynos_i2c_softc *sc, int flags)
 {
 	int error, retry;
@@ -240,8 +219,9 @@ exynos_i2c_wait(struct exynos_i2c_softc 
 
 	while (--retry > 0) {
 		if ((flags & I2C_F_POLL) == 0) {
-			error = cv_timedwait_sig(>sc_cv, >sc_lock,
-			uimax(mstohz(10), 1));
+			error = cv_timedwait_sig(>sc_intr_wait,
+		 >sc_intr_lock,
+		 uimax(mstohz(10), 1));
 			if (error) {
 return error;
 			}
@@ -265,46 +245,90 @@ exynos_i2c_wait(struct exynos_i2c_softc 
 
 
 static int
-exynos_i2c_send_start(void *cookie, int flags)
+exynos_i2c_send_start_locked(struct exynos_i2c_softc *sc, int flags)
 {
-	struct exynos_i2c_softc *sc = cookie;
 	I2C_WRITE(sc, IICSTAT, 0xF0);
 	return 0;
 }
 
 static int
-exynos_i2c_send_stop(void *cookie, int flags)
+exynos_i2c_send_stop_locked(struct exynos_i2c_softc *sc, int flags)
 {
-	struct exynos_i2c_softc *sc = cookie;
 	I2C_WRITE(sc, IICSTAT, 0xD0);
 	return 0;
 }
 
 static int
+exynos_i2c_write_byte_locked(struct exynos_i2c_softc *sc, uint8_t byte,
+int flags)
+{
+	int error = exynos_i2c_wait(sc, flags);
+	if (error) {
+		return error;
+	}
+	I2C_WRITE(sc, IICDS, byte);
+	return 0;
+}
+
+static int
+exynos_i2c_send_start(void *cookie, int flags)
+{
+	struct exynos_i2c_softc *sc = cookie;
+
+	

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

2019-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 22 23:50:43 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_i2c.c

Log Message:
Use a separate lock (not the i2c bus lock) to synchronize with the
interrupt handler.  Refactor the code slightly to make the lock use
consistent.

Also includes the changes for:

Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus().  "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/exynos_i2c.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/samsung

2019-10-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Oct 18 06:13:38 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
exynos_combiner.c exynos_dwcmmc.c exynos_i2c.c exynos_pinctrl.c
exynos_pwm.c exynos_rtc.c exynos_wdt.c mct.c

Log Message:
Use PRIxBUSADDR


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_combiner.c \
src/sys/arch/arm/samsung/exynos_wdt.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_pwm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_rtc.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/mct.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/samsung

2019-10-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Oct 18 06:13:38 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
exynos_combiner.c exynos_dwcmmc.c exynos_i2c.c exynos_pinctrl.c
exynos_pwm.c exynos_rtc.c exynos_wdt.c mct.c

Log Message:
Use PRIxBUSADDR


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_combiner.c \
src/sys/arch/arm/samsung/exynos_wdt.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_pwm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_rtc.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/mct.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/samsung/exynos5410_clock.c
diff -u src/sys/arch/arm/samsung/exynos5410_clock.c:1.4 src/sys/arch/arm/samsung/exynos5410_clock.c:1.5
--- src/sys/arch/arm/samsung/exynos5410_clock.c:1.4	Sun Sep  9 07:21:18 2018
+++ src/sys/arch/arm/samsung/exynos5410_clock.c	Fri Oct 18 06:13:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5410_clock.c,v 1.4 2018/09/09 07:21:18 aymeric Exp $ */
+/* $NetBSD: exynos5410_clock.c,v 1.5 2019/10/18 06:13:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.4 2018/09/09 07:21:18 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.5 2019/10/18 06:13:38 skrll Exp $");
 
 #include 
 #include 
@@ -451,8 +451,8 @@ exynos5410_clock_attach(device_t parent,
 	
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >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/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.13 src/sys/arch/arm/samsung/exynos5422_clock.c:1.14
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.13	Sun Sep  9 07:21:18 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Fri Oct 18 06:13:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.13 2018/09/09 07:21:18 aymeric Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.14 2019/10/18 06:13:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.13 2018/09/09 07:21:18 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.14 2019/10/18 06:13:38 skrll Exp $");
 
 #include 
 #include 
@@ -628,8 +628,8 @@ exynos5422_clock_attach(device_t parent,
 	
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >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/samsung/exynos_combiner.c
diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.10 src/sys/arch/arm/samsung/exynos_combiner.c:1.11
--- src/sys/arch/arm/samsung/exynos_combiner.c:1.10	Thu Oct 18 09:01:53 2018
+++ src/sys/arch/arm/samsung/exynos_combiner.c	Fri Oct 18 06:13:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_combiner.c,v 1.10 2018/10/18 09:01:53 skrll Exp $ */
+/*	$NetBSD: exynos_combiner.c,v 1.11 2019/10/18 06:13:38 skrll Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.10 2018/10/18 09:01:53 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.11 2019/10/18 06:13:38 skrll Exp $");
 
 #include 
 #include 
@@ -134,8 +134,8 @@ exynos_combiner_attach(device_t parent, 
 
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >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/samsung/exynos_wdt.c
diff -u src/sys/arch/arm/samsung/exynos_wdt.c:1.10 src/sys/arch/arm/samsung/exynos_wdt.c:1.11
--- src/sys/arch/arm/samsung/exynos_wdt.c:1.10	Thu Jan  7 04:41:46 2016
+++ src/sys/arch/arm/samsung/exynos_wdt.c	Fri Oct 18 06:13:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_wdt.c,v 1.10 2016/01/07 04:41:46 marty Exp $	*/
+/*	$NetBSD: exynos_wdt.c,v 1.11 2019/10/18 06:13:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "exynos_wdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.10 

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

2019-04-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  9 07:37:16 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
EXYNOS5422_DISABLE_CA7_CLUSTER isn't required anymore


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.25 src/sys/arch/arm/samsung/exynos_platform.c:1.26
--- src/sys/arch/arm/samsung/exynos_platform.c:1.25	Thu Jan 31 13:06:10 2019
+++ src/sys/arch/arm/samsung/exynos_platform.c	Tue Apr  9 07:37:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.25 2019/01/31 13:06:10 skrll Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.26 2019/04/09 07:37:16 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,12 +35,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.25 2019/01/31 13:06:10 skrll Exp $");
-
-/* XXXJDM
- * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
- */
-#define	EXYNOS5422_DISABLE_CA7_CLUSTER
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.26 2019/04/09 07:37:16 skrll Exp $");
 
 #include 
 #include 
@@ -148,11 +143,6 @@ exynos5800_mpstart(void)
 		const u_int aff0 = __SHIFTOUT(mpidr, MPIDR_AFF0);
 		const u_int cpu = cluster * 4 + aff0;
 
-#if defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
-		if (cluster == 1)
-			continue;
-#endif
-
 		val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_STATUS(cpu));
 		bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_CONFIG(cpu),
 		EXYNOS5800_PMU_CORE_POWER_EN);
@@ -337,27 +327,6 @@ exynos5_platform_bootstrap(void)
 
 	exynos_bootstrap(5);
 
-#if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
-	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);
-	if (cd && cd->data == (uintptr_t)exynos5800_mpstart) {
-		void *fdt_data = __UNCONST(fdtbus_get_data());
-		int cpu_off, cpus_off, len;
-
-		cpus_off = fdt_path_offset(fdt_data, "/cpus");
-		if (cpus_off < 0)
-			return;
-
-		fdt_for_each_subnode(cpu_off, fdt_data, cpus_off) {
-			const void *prop = fdt_getprop(fdt_data, cpu_off, "reg", );
-			if (len != 4)
-continue;
-			const uint32_t mpidr = be32dec(prop);
-			if (mpidr != cpu_mpidr_aff_read() && __SHIFTOUT(mpidr, MPIDR_AFF1) == 1)
-fdt_setprop_string(fdt_data, cpu_off, "status", "fail");
-		}
-	}
-#endif
-
 	arm_fdt_cpu_bootstrap();
 }
 



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

2019-04-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  9 07:37:16 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
EXYNOS5422_DISABLE_CA7_CLUSTER isn't required anymore


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_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/samsung

2019-04-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  9 05:59:24 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Fix softc size in CFATTACH_DECL_NEW


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.7 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.8
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.7	Mon Jul  2 23:52:53 2018
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Tue Apr  9 05:59:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.8 2019/04/09 05:59:24 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.8 2019/04/09 05:59:24 skrll Exp $");
 
 #include 
 #include 
@@ -65,7 +65,7 @@ struct exynos_dwcmmc_softc {
 	u_int			sc_ciu_div;
 };
 
-CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(struct dwc_mmc_softc),
+CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(struct exynos_dwcmmc_softc),
 	exynos_dwcmmc_match, exynos_dwcmmc_attach, NULL, NULL);
 
 static const char * const exynos_dwcmmc_compat[] = {



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

2019-04-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  9 05:59:24 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Fix softc size in CFATTACH_DECL_NEW


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 04:53:59 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/samsung/exynos_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/samsung

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 04:53:59 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.23 src/sys/arch/arm/samsung/exynos_platform.c:1.24
--- src/sys/arch/arm/samsung/exynos_platform.c:1.23	Sun Jan 27 02:08:37 2019
+++ src/sys/arch/arm/samsung/exynos_platform.c	Sun Jan 27 04:53:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.23 2019/01/27 02:08:37 pgoyette Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.24 2019/01/27 04:53:59 dholland Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,12 +35,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.23 2019/01/27 02:08:37 pgoyette Exp $");
-
-/* XXXJDM
- * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
- */
-#define	EXYNOS5422_DISABLE_CA7_CLUSTER
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.24 2019/01/27 04:53:59 dholland Exp $");
 
 /* XXXJDM
  * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.



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

2019-01-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan  4 15:57:04 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Starting CPUs in cluster 1 of Exynos5422 causes strange things to happen
around ap_mpstart. Until we figure out why, only start CPUs in cluster 0.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_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/samsung

2019-01-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan  4 15:57:04 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Starting CPUs in cluster 1 of Exynos5422 causes strange things to happen
around ap_mpstart. Until we figure out why, only start CPUs in cluster 0.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.21 src/sys/arch/arm/samsung/exynos_platform.c:1.22
--- src/sys/arch/arm/samsung/exynos_platform.c:1.21	Thu Jan  3 23:04:09 2019
+++ src/sys/arch/arm/samsung/exynos_platform.c	Fri Jan  4 15:57:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.21 2019/01/03 23:04:09 jmcneill Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.22 2019/01/04 15:57:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,7 +35,12 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.21 2019/01/03 23:04:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.22 2019/01/04 15:57:03 jmcneill Exp $");
+
+/* XXXJDM
+ * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
+ */
+#define	EXYNOS5422_DISABLE_CA7_CLUSTER
 
 #include 
 #include 
@@ -60,6 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_platf
 
 #include 
 
+#include 
+
 void exynos_platform_early_putchar(char);
 
 #define	EXYNOS5800_PMU_BASE		0x1004
@@ -140,6 +147,11 @@ exynos5800_mpstart(void)
 		const u_int aff0 = __SHIFTOUT(mpidr, MPIDR_AFF0);
 		const u_int cpu = cluster * 4 + aff0;
 
+#if defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
+		if (cluster == 1)
+			continue;
+#endif
+
 		val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_STATUS(cpu));
 		bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_CONFIG(cpu),
 		EXYNOS5800_PMU_CORE_POWER_EN);
@@ -319,6 +331,27 @@ exynos5_platform_bootstrap(void)
 
 	exynos_bootstrap(5);
 
+#if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
+	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);
+	if (cd && cd->data == (uintptr_t)exynos5800_mpstart) {
+		void *fdt_data = __UNCONST(fdtbus_get_data());
+		int cpu_off, cpus_off, len;
+
+		cpus_off = fdt_path_offset(fdt_data, "/cpus");
+		if (cpus_off < 0)
+			return;
+
+		fdt_for_each_subnode(cpu_off, fdt_data, cpus_off) {
+			const void *prop = fdt_getprop(fdt_data, cpu_off, "reg", );
+			if (len != 4)
+continue;
+			const uint32_t mpidr = be32dec(prop);
+			if (mpidr != cpu_mpidr_aff_read() && __SHIFTOUT(mpidr, MPIDR_AFF1) == 1)
+fdt_setprop_string(fdt_data, cpu_off, "status", "fail");
+		}
+	}
+#endif
+
 	arm_fdt_cpu_bootstrap();
 }
 



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

2019-01-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jan  3 23:04:09 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c files.exynos

Log Message:
Add multi-cluster CPU spinup code for Exynos5422.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/samsung/files.exynos

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/samsung

2019-01-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jan  3 23:04:09 UTC 2019

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c files.exynos

Log Message:
Add multi-cluster CPU spinup code for Exynos5422.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/samsung/files.exynos

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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.20 src/sys/arch/arm/samsung/exynos_platform.c:1.21
--- src/sys/arch/arm/samsung/exynos_platform.c:1.20	Tue Oct 30 16:41:52 2018
+++ src/sys/arch/arm/samsung/exynos_platform.c	Thu Jan  3 23:04:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.20 2018/10/30 16:41:52 skrll Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.21 2019/01/03 23:04:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,7 +35,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.20 2018/10/30 16:41:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.21 2019/01/03 23:04:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -62,60 +62,116 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_platf
 
 void exynos_platform_early_putchar(char);
 
-#define	EXYNOS5_SWRESET_REG	0x10040400
-
-#define EXYNOS_IOPHYSTOVIRT(a) \
-((vaddr_t)(((a) - EXYNOS_CORE_PBASE) + EXYNOS_CORE_VBASE))
-
 #define	EXYNOS5800_PMU_BASE		0x1004
 #define	EXYNOS5800_PMU_SIZE		0x2
-#define	 EXYNOS5800_PMU_CORE_CONFIG(n)	(0x2000 + 0x80 * (n))
-#define	 EXYNOS5800_PMU_CORE_STATUS(n)	(0x2004 + 0x80 * (n))
-#define	 EXYNOS5800_PMU_CORE_POWER_EN	0x3
-#define	EXYNOS5800_SYSRAM_BASE		0x0207301c
-#define	EXYNOS5800_SYSRAM_SIZE		0x4
-
-static void
-exynos_platform_bootstrap(void)
-{
-
-#if defined(MULTIPROCESSOR)
-	arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU);
-#endif
-}
+#define	 EXYNOS5800_PMU_SWRESET			0x0400
+#define	  EXYNOS5800_PMU_KFC_ETM_RESET(n)	__BIT(20 + (n))
+#define	  EXYNOS5800_PMU_KFC_CORE_RESET(n)	__BIT(8 + (n))
+#define	 EXYNOS5800_PMU_SPARE2			0x0908
+#define	 EXYNOS5800_PMU_SPARE3			0x090c
+#define	  EXYNOS5800_PMU_SWRESET_KFC_SEL	0x3
+#define	 EXYNOS5800_PMU_CORE_CONFIG(n)		(0x2000 + 0x80 * (n))
+#define	 EXYNOS5800_PMU_CORE_STATUS(n)		(0x2004 + 0x80 * (n))
+#define	  EXYNOS5800_PMU_CORE_POWER_EN		0x3
+#define	 EXYNOS5800_PMU_COMMON_CONFIG(n)	(0x2500 + 0x80 * (n))
+#define	  EXYNOS5800_PMU_COMMON_POWER_EN	0x3
+#define	 EXYNOS5800_PMU_COMMON_OPTION(n)	(0x2508 + 0x80 * (n))
+#define	  EXYNOS5800_PMU_USE_L2_COMMON_UP_STATE		__BIT(30)
+#define	  EXYNOS5800_PMU_USE_ARM_CORE_DOWN_STATE	__BIT(29)
+#define	  EXYNOS5800_PMU_AUTO_CORE_DOWN			__BIT(9)
+
+#define	EXYNOS5800_SYSRAM_BASE		0x02073000
+#define	EXYNOS5800_SYSRAM_SIZE		0x1000
+#define	 EXYNOS5800_SYSRAM_HOTPLUG		0x001c
 
 static void
 exynos5800_mpstart(void)
 {
 #if defined(MULTIPROCESSOR)
-	extern void cpu_mpstart(void);
 	bus_space_tag_t bst = _generic_bs_tag;
 	bus_space_handle_t pmu_bsh, sysram_bsh;
+	uint64_t mpidr, bp_mpidr;
 	uint32_t val, started = 0;
-	int n;
+	u_int cpuindex, n;
+	int child;
 
 	bus_space_map(bst, EXYNOS5800_PMU_BASE, EXYNOS5800_PMU_SIZE, 0, _bsh);
 	bus_space_map(bst, EXYNOS5800_SYSRAM_BASE, EXYNOS5800_SYSRAM_SIZE, 0, _bsh);
 
-	bus_space_write_4(bst, sysram_bsh, 0, KERN_VTOPHYS((vaddr_t)cpu_mpstart));
-	bus_space_barrier(bst, sysram_bsh, 0, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	const int cpus = OF_finddevice("/cpus");
+	if (cpus == -1) {
+		aprint_error("%s: no /cpus node found\n", __func__);
+		return;
+	}
+
+	/* MPIDR affinity levels of boot processor. */
+	bp_mpidr = cpu_mpidr_aff_read();
+
+	/* Setup KFC reset */
+	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_SPARE3, EXYNOS5800_PMU_SWRESET_KFC_SEL);
 
-	for (n = 1; n < arm_cpu_max; n++) {
-		bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_CONFIG(n),
+	const uint32_t option = EXYNOS5800_PMU_USE_L2_COMMON_UP_STATE |
+	EXYNOS5800_PMU_USE_ARM_CORE_DOWN_STATE |
+	EXYNOS5800_PMU_AUTO_CORE_DOWN;
+	val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(0));
+	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(0), val | option);
+	val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(1));
+	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(1), val | option);
+
+	bus_space_write_4(bst, sysram_bsh, EXYNOS5800_SYSRAM_HOTPLUG, KERN_VTOPHYS((vaddr_t)cpu_mpstart));
+	arm_dsb();
+
+	/* Power on clusters */
+	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_CONFIG(0),
+	EXYNOS5800_PMU_COMMON_POWER_EN);
+	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_CONFIG(1),
+	EXYNOS5800_PMU_COMMON_POWER_EN);
+
+	/* Boot APs */
+	cpuindex = 1;
+	for (child = OF_child(cpus); child; child = OF_peer(child)) {
+		if (fdtbus_get_reg64(child, 0, , NULL) 

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

2018-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov 21 08:48:23 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/samsung/files.exynos

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/samsung/files.exynos
diff -u src/sys/arch/arm/samsung/files.exynos:1.34 src/sys/arch/arm/samsung/files.exynos:1.35
--- src/sys/arch/arm/samsung/files.exynos:1.34	Thu Oct 18 09:01:53 2018
+++ src/sys/arch/arm/samsung/files.exynos	Wed Nov 21 08:48:23 2018
@@ -1,11 +1,8 @@
-#	$NetBSD: files.exynos,v 1.34 2018/10/18 09:01:53 skrll Exp $
+#	$NetBSD: files.exynos,v 1.35 2018/11/21 08:48:23 skrll Exp $
 #
 # Configuration info for Samsung Exynos SoC ARM Peripherals
 #
 
-#include "arch/arm/pic/files.pic"
-#include "arch/arm/cortex/files.cortex"
-
 defflag	opt_cpuoptions.h			ARM_TRUSTZONE_FIRMWARE
 
 file	arch/arm/samsung/exynos_soc.c



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

2018-11-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov 21 08:48:23 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/samsung/files.exynos

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/samsung

2018-10-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 31 08:41:47 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_soc.c

Log Message:
Fix non-DIGNOSTIC builds


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/samsung/exynos_soc.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/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.38 src/sys/arch/arm/samsung/exynos_soc.c:1.39
--- src/sys/arch/arm/samsung/exynos_soc.c:1.38	Thu Oct 18 09:01:53 2018
+++ src/sys/arch/arm/samsung/exynos_soc.c	Wed Oct 31 08:41:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.38 2018/10/18 09:01:53 skrll Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.39 2018/10/31 08:41:47 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_exynos.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.38 2018/10/18 09:01:53 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.39 2018/10/31 08:41:47 skrll Exp $");
 
 #include 
 #include 
@@ -489,7 +489,6 @@ exynos_bootstrap(int soc)
 	bus_addr_t exynos_pmu_offset;
 	bus_addr_t exynos_sysreg_offset;
 	bus_addr_t exynos_cmu_apll_offset;
-	const vaddr_t iobase = EXYNOS_CORE_VBASE;
 
 	switch (soc) {
 #ifdef SOC_EXYNOS4
@@ -532,7 +531,7 @@ exynos_bootstrap(int soc)
 	if (error)
 		panic("%s: failed to map in Exynos SFR registers: %d",
 			__func__, error);
-	KASSERT(exynos_core_bsh == iobase);
+	KASSERT(exynos_core_bsh == EXYNOS_CORE_VBASE);
 
 	error = bus_space_map(_generic_bs_tag, audiocore_pbase,
 		audiocore_size, 0, _audiocore_bsh);



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

2018-10-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Oct 31 08:41:47 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_soc.c

Log Message:
Fix non-DIGNOSTIC builds


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/samsung/exynos_soc.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/samsung

2018-10-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct  8 08:17:00 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c exynos_soc.c exynos_var.h

Log Message:
Remove a build dependency on SOC_EXYNOS4 and SOC_EXYNOS5.  Now runtime.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/exynos_var.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/samsung

2018-10-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct  8 08:17:00 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c exynos_soc.c exynos_var.h

Log Message:
Remove a build dependency on SOC_EXYNOS4 and SOC_EXYNOS5.  Now runtime.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/samsung/exynos_var.h

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.17 src/sys/arch/arm/samsung/exynos_platform.c:1.18
--- src/sys/arch/arm/samsung/exynos_platform.c:1.17	Fri Sep 21 12:04:07 2018
+++ src/sys/arch/arm/samsung/exynos_platform.c	Mon Oct  8 08:17:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.17 2018/09/21 12:04:07 skrll Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.18 2018/10/08 08:17:00 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -35,7 +35,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.17 2018/09/21 12:04:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.18 2018/10/08 08:17:00 skrll Exp $");
 
 #include 
 #include 
@@ -124,8 +124,6 @@ static void
 exynos_platform_bootstrap(void)
 {
 
-	exynos_bootstrap();
-
 	void (*mp_bootstrap)(void) = NULL;
 	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);
 	if (cd)
@@ -205,9 +203,18 @@ exynos4_platform_devmap(void)
 	return devmap;
 }
 
+static void
+exynos4_platform_bootstrap(void)
+{
+
+	exynos_bootstrap(4);
+
+	exynos_platform_bootstrap();
+}
+
 static const struct arm_platform exynos4_platform = {
 	.ap_devmap = exynos4_platform_devmap,
-	.ap_bootstrap = exynos_platform_bootstrap,
+	.ap_bootstrap = exynos4_platform_bootstrap,
 	.ap_init_attach_args = exynos_platform_init_attach_args,
 	.ap_early_putchar = exynos_platform_early_putchar,
 	.ap_device_register = exynos_platform_device_register,
@@ -240,9 +247,18 @@ exynos5_platform_devmap(void)
 	return devmap;
 }
 
+static void
+exynos5_platform_bootstrap(void)
+{
+
+	exynos_bootstrap(5);
+
+	exynos_platform_bootstrap();
+}
+
 static const struct arm_platform exynos5_platform = {
 	.ap_devmap = exynos5_platform_devmap,
-	.ap_bootstrap = exynos_platform_bootstrap,
+	.ap_bootstrap = exynos5_platform_bootstrap,
 	.ap_init_attach_args = exynos_platform_init_attach_args,
 	.ap_early_putchar = exynos_platform_early_putchar,
 	.ap_device_register = exynos_platform_device_register,

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.36 src/sys/arch/arm/samsung/exynos_soc.c:1.37
--- src/sys/arch/arm/samsung/exynos_soc.c:1.36	Fri Sep 14 11:58:38 2018
+++ src/sys/arch/arm/samsung/exynos_soc.c	Mon Oct  8 08:16:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.36 2018/09/14 11:58:38 skrll Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.37 2018/10/08 08:16:59 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_exynos.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.36 2018/09/14 11:58:38 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.37 2018/10/08 08:16:59 skrll Exp $");
 
 #include 
 #include 
@@ -475,7 +475,7 @@ exynos_clocks_bootstrap(void)
 
 
 void
-exynos_bootstrap(void)
+exynos_bootstrap(int soc)
 {
 	int error;
 	size_t core_size, audiocore_size;
@@ -487,33 +487,40 @@ exynos_bootstrap(void)
 	bus_addr_t exynos_cmu_apll_offset;
 	const vaddr_t iobase = EXYNOS_CORE_VBASE;
 
+	switch (soc) {
 #ifdef SOC_EXYNOS4
-	core_size = EXYNOS4_CORE_SIZE;
-	audiocore_size = EXYNOS4_AUDIOCORE_SIZE;
-	audiocore_pbase = EXYNOS4_AUDIOCORE_PBASE;
-	audiocore_vbase = EXYNOS4_AUDIOCORE_VBASE;
-	exynos_wdt_offset = EXYNOS4_WDT_OFFSET;
-	exynos_pmu_offset = EXYNOS4_PMU_OFFSET;
-	exynos_sysreg_offset = EXYNOS4_SYSREG_OFFSET;
-	exynos_cmu_apll_offset = EXYNOS4_CMU_APLL;
-
-	cpu_freq_settings = cpu_freq_settings_exynos4;
-	ncpu_freq_settings = __arraycount(cpu_freq_settings_exynos4);
+	case 4:
+		core_size = EXYNOS4_CORE_SIZE;
+		audiocore_size = EXYNOS4_AUDIOCORE_SIZE;
+		audiocore_pbase = EXYNOS4_AUDIOCORE_PBASE;
+		audiocore_vbase = EXYNOS4_AUDIOCORE_VBASE;
+		exynos_wdt_offset = EXYNOS4_WDT_OFFSET;
+		exynos_pmu_offset = EXYNOS4_PMU_OFFSET;
+		exynos_sysreg_offset = EXYNOS4_SYSREG_OFFSET;
+		exynos_cmu_apll_offset = EXYNOS4_CMU_APLL;
+
+		cpu_freq_settings = cpu_freq_settings_exynos4;
+		ncpu_freq_settings = __arraycount(cpu_freq_settings_exynos4);
+		break;
 #endif
-
 #ifdef SOC_EXYNOS5
-	core_size = EXYNOS5_CORE_SIZE;
-	audiocore_size = EXYNOS5_AUDIOCORE_SIZE;
-	audiocore_pbase = EXYNOS5_AUDIOCORE_PBASE;
-	audiocore_vbase = EXYNOS5_AUDIOCORE_VBASE;
-	exynos_wdt_offset = EXYNOS5_WDT_OFFSET;
-	exynos_pmu_offset = 

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

2018-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 14 11:58:38 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c exynos_soc.c exynos_var.h

Log Message:
exynos_bootstrap doesn't need an argument


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_var.h

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.15 src/sys/arch/arm/samsung/exynos_platform.c:1.16
--- src/sys/arch/arm/samsung/exynos_platform.c:1.15	Tue Sep 11 10:06:53 2018
+++ src/sys/arch/arm/samsung/exynos_platform.c	Fri Sep 14 11:58:38 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.15 2018/09/11 10:06:53 jmcneill Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.16 2018/09/14 11:58:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -34,7 +34,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.15 2018/09/11 10:06:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.16 2018/09/14 11:58:38 skrll Exp $");
 
 #include 
 #include 
@@ -123,7 +123,7 @@ static void
 exynos_platform_bootstrap(void)
 {
 
-	exynos_bootstrap(EXYNOS_CORE_VBASE);
+	exynos_bootstrap();
 
 	void (*mp_bootstrap)(void) = NULL;
 	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);

Index: src/sys/arch/arm/samsung/exynos_soc.c
diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.35 src/sys/arch/arm/samsung/exynos_soc.c:1.36
--- src/sys/arch/arm/samsung/exynos_soc.c:1.35	Sun Aug 19 07:27:33 2018
+++ src/sys/arch/arm/samsung/exynos_soc.c	Fri Sep 14 11:58:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_soc.c,v 1.35 2018/08/19 07:27:33 skrll Exp $	*/
+/*	$NetBSD: exynos_soc.c,v 1.36 2018/09/14 11:58:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_exynos.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.35 2018/08/19 07:27:33 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.36 2018/09/14 11:58:38 skrll Exp $");
 
 #include 
 #include 
@@ -475,7 +475,7 @@ exynos_clocks_bootstrap(void)
 
 
 void
-exynos_bootstrap(vaddr_t iobase)
+exynos_bootstrap(void)
 {
 	int error;
 	size_t core_size, audiocore_size;
@@ -485,6 +485,7 @@ exynos_bootstrap(vaddr_t iobase)
 	bus_addr_t exynos_pmu_offset;
 	bus_addr_t exynos_sysreg_offset;
 	bus_addr_t exynos_cmu_apll_offset;
+	const vaddr_t iobase = EXYNOS_CORE_VBASE;
 
 #ifdef SOC_EXYNOS4
 	core_size = EXYNOS4_CORE_SIZE;

Index: src/sys/arch/arm/samsung/exynos_var.h
diff -u src/sys/arch/arm/samsung/exynos_var.h:1.25 src/sys/arch/arm/samsung/exynos_var.h:1.26
--- src/sys/arch/arm/samsung/exynos_var.h:1.25	Sun Aug 19 07:27:33 2018
+++ src/sys/arch/arm/samsung/exynos_var.h	Fri Sep 14 11:58:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_var.h,v 1.25 2018/08/19 07:27:33 skrll Exp $	*/
+/*	$NetBSD: exynos_var.h,v 1.26 2018/09/14 11:58:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -143,7 +143,7 @@ extern bus_space_handle_t exynos_pmu_bsh
 extern bus_space_handle_t exynos_cmu_bsh;
 extern bus_space_handle_t exynos_sysreg_bsh;
 
-extern void exynos_bootstrap(vaddr_t);
+extern void exynos_bootstrap(void);
 extern void exynos_dma_bootstrap(psize_t memsize);
 
 struct exynos_pinctrl_softc;



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

2018-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 14 11:58:38 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c exynos_soc.c exynos_var.h

Log Message:
exynos_bootstrap doesn't need an argument


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/samsung/exynos_soc.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_var.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/samsung

2018-09-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep 11 10:05:31 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_uart.c

Log Message:
Make this driver MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_uart.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/samsung

2018-09-11 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Sep 11 10:05:31 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_uart.c

Log Message:
Make this driver MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_uart.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/samsung/exynos_uart.c
diff -u src/sys/arch/arm/samsung/exynos_uart.c:1.1 src/sys/arch/arm/samsung/exynos_uart.c:1.2
--- src/sys/arch/arm/samsung/exynos_uart.c:1.1	Thu Jul  5 13:11:58 2018
+++ src/sys/arch/arm/samsung/exynos_uart.c	Tue Sep 11 10:05:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_uart.c,v 1.1 2018/07/05 13:11:58 jmcneill Exp $ */
+/* $NetBSD: exynos_uart.c,v 1.2 2018/09/11 10:05:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013-2018 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: exynos_uart.c,v 1.1 2018/07/05 13:11:58 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_uart.c,v 1.2 2018/09/11 10:05:31 jmcneill Exp $");
 
 #define cn_trap()			\
 	do {\
@@ -77,6 +77,7 @@ struct exynos_uart_softc {
 	device_t sc_dev;
 	bus_space_tag_t	sc_bst;
 	bus_space_handle_t sc_bsh;
+	kmutex_t sc_lock;
 	u_int sc_freq;
 	void *sc_ih;
 
@@ -186,6 +187,7 @@ exynos_uart_attach(device_t parent, devi
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
+	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_HIGH);
 	sc->sc_console = is_console;
 	if (is_console) {
 		sc->sc_bsh = exynos_uart_cnsc.sc_bsh;
@@ -259,13 +261,13 @@ static int
 exynos_uart_cngetc(dev_t dev)
 {
 	struct exynos_uart_softc * const sc = _uart_cnsc;
-	uint32_t status;
+	uint32_t ufstat;
 	int s, c;
 
 	s = splserial();
 
-	status = RD4(sc, SSCOM_UTRSTAT);
-	if ((status & UTRSTAT_RXREADY) == 0) {
+	ufstat = RD4(sc, SSCOM_UFSTAT);
+	if (__SHIFTOUT(ufstat, UFSTAT_RXCOUNT) == 0) {
 		splx(s);
 		return -1;
 	}
@@ -334,6 +336,8 @@ exynos_uart_open(dev_t dev, int flag, in
 		return EBUSY;
 	}
 
+	mutex_enter(>sc_lock);
+
 	if ((tp->t_state & TS_ISOPEN) == 0 && tp->t_wopen == 0) {
 		tp->t_dev = dev;
 		ttychars(tp);
@@ -354,6 +358,8 @@ exynos_uart_open(dev_t dev, int flag, in
 	/* Enable RX and error interrupts */
 	WR4(sc, SSCOM_UINTM, ~0u & ~(UINT_RXD|UINT_ERROR));
 
+	mutex_exit(>sc_lock);
+
 	return tp->t_linesw->l_open(dev, tp);
 }
 
@@ -364,12 +370,16 @@ exynos_uart_close(dev_t dev, int flag, i
 	device_lookup_private(_cd, minor(dev));
 	struct tty *tp = sc->sc_tty;
 
+	mutex_enter(>sc_lock);
+
 	tp->t_linesw->l_close(tp, flag);
 	ttyclose(tp);
 
 	/* Disable interrupts */
 	WR4(sc, SSCOM_UINTM, ~0u);
 
+	mutex_exit(>sc_lock);
+
 	return 0;
 }
 
@@ -447,8 +457,6 @@ exynos_uart_start(struct tty *tp)
 	}
 	tp->t_state |= TS_BUSY;
 
-	splx(s);
-
 	for (brem = q_to_b(>t_outq, sc->sc_buf, sizeof(sc->sc_buf));
 	 brem > 0;
 	 brem--, p++) {
@@ -459,7 +467,6 @@ exynos_uart_start(struct tty *tp)
 		SSCOM_UTXH, *p);
 	}
 
-	s = spltty();
 	tp->t_state &= ~TS_BUSY;
 	if (ttypull(tp)) {
 		tp->t_state |= TS_TIMEOUT;
@@ -473,47 +480,51 @@ exynos_uart_param(struct tty *tp, struct
 {
 	struct exynos_uart_softc *sc = tp->t_sc;
 
-	if (tp->t_ospeed == t->c_ospeed &&
-	tp->t_cflag == t->c_cflag)
-		return 0;
-
-	uint32_t ulcon = 0, ubrdiv;
-	switch (ISSET(t->c_cflag, CSIZE)) {
-	case CS5:
-		ulcon |= ULCON_LENGTH_5;
-		break;
-	case CS6:
-		ulcon |= ULCON_LENGTH_6;
-		break;
-	case CS7:
-		ulcon |= ULCON_LENGTH_7;
-		break;
-	case CS8:
-		ulcon |= ULCON_LENGTH_8;
-		break;
-	}
-	switch (ISSET(t->c_cflag, PARENB|PARODD)) {
-	case PARENB|PARODD:
-		ulcon |= ULCON_PARITY_ODD;
-		break;
-	case PARENB:
-		ulcon |= ULCON_PARITY_EVEN;
-		break;
-	default:
-		ulcon |= ULCON_PARITY_NONE;
-		break;
-	}
-	if (ISSET(t->c_cflag, CSTOPB))
-		ulcon |= ULCON_STOP;
-	WR4(sc, SSCOM_ULCON, ulcon);
+	mutex_enter(>sc_lock);
+
+	if (tp->t_cflag != t->c_cflag) {
+		uint32_t ulcon = 0;
+		switch (ISSET(t->c_cflag, CSIZE)) {
+		case CS5:
+			ulcon |= ULCON_LENGTH_5;
+			break;
+		case CS6:
+			ulcon |= ULCON_LENGTH_6;
+			break;
+		case CS7:
+			ulcon |= ULCON_LENGTH_7;
+			break;
+		case CS8:
+			ulcon |= ULCON_LENGTH_8;
+			break;
+		}
+		switch (ISSET(t->c_cflag, PARENB|PARODD)) {
+		case PARENB|PARODD:
+			ulcon |= ULCON_PARITY_ODD;
+			break;
+		case PARENB:
+			ulcon |= ULCON_PARITY_EVEN;
+			break;
+		default:
+			ulcon |= ULCON_PARITY_NONE;
+			break;
+		}
+		if (ISSET(t->c_cflag, CSTOPB))
+			ulcon |= ULCON_STOP;
+		WR4(sc, SSCOM_ULCON, ulcon);
+	}
 
-	ubrdiv = (sc->sc_freq / 16) / t->c_ospeed - 1;
-	WR4(sc, SSCOM_UBRDIV, ubrdiv);
+	if (tp->t_ospeed != t->c_ospeed) {
+		const uint32_t ubrdiv = (sc->sc_freq / 16) / t->c_ospeed - 1;
+		WR4(sc, SSCOM_UBRDIV, ubrdiv);
+	}
 
 	tp->t_ispeed = t->c_ispeed;
 	tp->t_ospeed = t->c_ospeed;
 	tp->t_cflag = t->c_cflag;
 
+	mutex_exit(>sc_lock);
+
 	return 0;
 }
 
@@ -524,6 +535,8 @@ exynos_uart_intr(void *priv)
 	struct tty *tp = sc->sc_tty;
 	

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

2018-08-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 22 07:43:03 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.13 src/sys/arch/arm/samsung/exynos_platform.c:1.14
--- src/sys/arch/arm/samsung/exynos_platform.c:1.13	Sun Aug 19 07:27:33 2018
+++ src/sys/arch/arm/samsung/exynos_platform.c	Wed Aug 22 07:43:02 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.13 2018/08/19 07:27:33 skrll Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.14 2018/08/22 07:43:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -34,7 +34,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.13 2018/08/19 07:27:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.14 2018/08/22 07:43:02 skrll Exp $");
 
 #include 
 #include 
@@ -94,7 +94,7 @@ exynos_platform_early_putchar(char c)
 	volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ?
 	(volatile uint32_t *)CONSADDR_VA :
 	(volatile uint32_t *)CONSADDR;
-	
+
 	while ((uartaddr[SSCOM_UFSTAT / 4] & UFSTAT_TXFULL) != 0)
 		;
 



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

2018-08-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug 22 07:43:03 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos_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/samsung

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 23:06:55 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
Added Files:
src/sys/arch/arm/samsung: exynos_pwm.c

Log Message:
Add driver for Exynos PWM timer.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_pwm.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/samsung/files.exynos

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/samsung/files.exynos
diff -u src/sys/arch/arm/samsung/files.exynos:1.28 src/sys/arch/arm/samsung/files.exynos:1.29
--- src/sys/arch/arm/samsung/files.exynos:1.28	Tue Jul  3 16:09:04 2018
+++ src/sys/arch/arm/samsung/files.exynos	Wed Jul  4 23:06:54 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.exynos,v 1.28 2018/07/03 16:09:04 jmcneill Exp $
+#	$NetBSD: files.exynos,v 1.29 2018/07/04 23:06:54 jmcneill Exp $
 #
 # Configuration info for Samsung Exynos SoC ARM Peripherals
 #
@@ -106,6 +106,11 @@ device	exyoi2c: i2cbus, i2c_bitbang
 attach	exyoi2c at fdt with exynos_i2c
 file	arch/arm/samsung/exynos_i2c.c		exynos_i2c needs-flag
 
+# PWM timer
+device	expwm: pwm
+attach	expwm at fdt with exynos_pwm
+file	arch/arm/samsung/exynos_pwm.c		exynos_pwm
+
 device	exy5422clk: clk
 attach	exy5422clk at fdt with exynos5422_clock
 file	arch/arm/samsung/exynos5422_clock.c	exynos5422_clock

Added files:

Index: src/sys/arch/arm/samsung/exynos_pwm.c
diff -u /dev/null src/sys/arch/arm/samsung/exynos_pwm.c:1.1
--- /dev/null	Wed Jul  4 23:06:55 2018
+++ src/sys/arch/arm/samsung/exynos_pwm.c	Wed Jul  4 23:06:54 2018
@@ -0,0 +1,263 @@
+/* $NetBSD: exynos_pwm.c,v 1.1 2018/07/04 23:06:54 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+
+__KERNEL_RCSID(1, "$NetBSD: exynos_pwm.c,v 1.1 2018/07/04 23:06:54 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	TCFG0			0x00
+#define	TCFG1			0x04
+#define	TCON			0x08
+#define	 _TCON_OFF(n)		((n) == 0 ? 0 : (((n) + 1) * 4))
+#define	 TCON_START(n)		__BIT(_TCON_OFF(n) + 0)
+#define	 TCON_UPDATE(n)		__BIT(_TCON_OFF(n) + 1)
+#define	 TCON_OUTINV(n)		__BIT(_TCON_OFF(n) + 2)
+#define	 TCON_AUTO_RELOAD(n)	__BIT(_TCON_OFF(n) + 3)
+#define	 TCON_DEADZONE_EN(n)	__BIT(_TCON_OFF(n) + 4)
+#define	TCNTB(n)		(0x0c + (n) * 12)
+#define	TCMPB(n)		(0x10 + (n) * 12)
+#define	TCNTO(n)		(0x14 + (n) * 12)
+#define	TINT_CSTAT		0x44
+
+#define	PWM_NTIMERS		5
+
+static const char * const compatible[] = {
+	"samsung,exynos4210-pwm",
+	NULL
+};
+
+struct exynos_pwm_softc;
+
+struct exynos_pwm_timer {
+	u_int			timer_index;
+	struct pwm_controller	timer_pwm;
+};
+
+struct exynos_pwm_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+
+	struct exynos_pwm_timer	sc_timer[PWM_NTIMERS];
+	u_int			sc_timermask;
+
+	u_int			sc_clkfreq;
+};
+
+#define	PWM_READ(sc, reg)		\
+	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
+#define	PWM_WRITE(sc, reg, val)		\
+	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+
+static int
+exynos_pwm_enable(pwm_tag_t pwm, bool enable)
+{
+	struct exynos_pwm_timer * const timer = pwm->pwm_priv;
+	struct exynos_pwm_softc * const sc = device_private(pwm->pwm_dev);
+	uint32_t tcon;
+
+	if (enable) {
+		tcon = PWM_READ(sc, TCON);
+		tcon &= ~TCON_START(timer->timer_index);
+		tcon |= TCON_UPDATE(timer->timer_index);
+		PWM_WRITE(sc, TCON, tcon);
+		tcon &= ~TCON_UPDATE(timer->timer_index);
+		tcon |= TCON_START(timer->timer_index);
+		tcon |= 

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

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 23:06:55 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
Added Files:
src/sys/arch/arm/samsung: exynos_pwm.c

Log Message:
Add driver for Exynos PWM timer.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_pwm.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/samsung/files.exynos

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/samsung

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 23:06:28 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Add pwm clocks


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.10 src/sys/arch/arm/samsung/exynos5422_clock.c:1.11
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.10	Tue Jul  3 16:30:13 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Wed Jul  4 23:06:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.10 2018/07/03 16:30:13 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.11 2018/07/04 23:06:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.10 2018/07/03 16:30:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.11 2018/07/04 23:06:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -378,6 +378,7 @@ static const struct clk_funcs exynos5422
 #define EXYNOS5422_SRC_TOP12		0x10288
 
 #define EXYNOS5422_DIV_TOP0		0x10500
+#define EXYNOS5422_DIV_TOP1		0x10504
 #define EXYNOS5422_DIV_FSYS0		0x10548
 #define EXYNOS5422_DIV_FSYS1		0x1054c
 #define EXYNOS5422_DIV_PERIC0		0x10558
@@ -385,7 +386,8 @@ static const struct clk_funcs exynos5422
 #define	EXYNOS5422_GATE_BUS_FSYS0	0x10740
 #define EXYNOS5422_GATE_TOP_SCLK_FSYS	0x10840
 #define EXYNOS5422_GATE_TOP_SCLK_PERIC	0x10850
-#define	EXYNOS5422_GATE_IP_FSYS		0x10944
+#define EXYNOS5422_GATE_IP_FSYS		0x10944
+#define EXYNOS5422_GATE_IP_PERIC	0x10950
 
 static const char *mout_cpll_p[] = { "fin_pll", "fout_cpll" };
 static const char *mout_dpll_p[] = { "fin_pll", "fout_dpll" };
@@ -403,6 +405,10 @@ static const char *mout_user_aclk200_fsy
 	{ "fin_pll", "mout_sw_aclk200_fsys" };
 static const char *mout_user_aclk200_fsys2_p[] =
 	{ "fin_pll", "mout_sw_aclk200_fsys2" };
+static const char *mout_user_aclk66_peric_p[] =
+	{ "fin_pll", "mout_sw_aclk66" };
+static const char *mout_sw_aclk66_p[] =
+	{ "dout_aclk66", "sclk_spll" };
 static const char *mout_sw_aclk200_fsys_p[] =
 	{ "dout_aclk200_fsys", "sclk_spll" };
 static const char *mout_sw_aclk200_fsys2_p[] =
@@ -457,11 +463,18 @@ static struct exynos_clk exynos5422_cloc
 	mout_user_aclk200_fsys_p),
 	CLK_MUX("mout_user_aclk200_fsys2", EXYNOS5422_SRC_TOP3, __BIT(12),
 	mout_user_aclk200_fsys2_p),
+	CLK_MUX("mout_aclk66", EXYNOS5422_SRC_TOP1, __BITS(9,8),
+	mout_group1_p),
 	CLK_MUX("mout_aclk200_fsys", EXYNOS5422_SRC_TOP0, __BITS(25,24),
 	mout_group1_p),
 	CLK_MUX("mout_aclk200_fsys2", EXYNOS5422_SRC_TOP0, __BITS(13,12),
 	mout_group1_p),
 
+	CLK_MUX("mout_sw_aclk66", EXYNOS5422_SRC_TOP11, __BIT(8),
+	mout_sw_aclk66_p),
+	CLK_MUX("mout_user_aclk66_peric", EXYNOS5422_SRC_TOP4, __BIT(8),
+	mout_user_aclk66_peric_p),
+
 	CLK_MUX("mout_usbd301", EXYNOS5422_SRC_FSYS, __BITS(6,4),
 	mout_group2_p),
 	CLK_MUX("mout_usbd300", EXYNOS5422_SRC_FSYS, __BITS(22,20),
@@ -481,6 +494,7 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUX("mout_uart3", EXYNOS5422_SRC_PERIC0, __BITS(18,16),
 	mout_group2_p),
 
+	CLK_DIV("dout_aclk66", "mout_aclk66", EXYNOS5422_DIV_TOP1, __BITS(13,8)),
 	CLK_DIV("dout_aclk200_fsys", "mout_aclk200_fsys", EXYNOS5422_DIV_TOP0, __BITS(30,28)),
 	CLK_DIV("dout_aclk200_fsys2", "mout_aclk200_fsys2", EXYNOS5422_DIV_TOP0, __BITS(14,12)),
 
@@ -540,6 +554,9 @@ static struct exynos_clk exynos5422_cloc
 	__BIT(19), CLK_SET_RATE_PARENT),
 	CLK_GATE("usbd301", "aclk200_fsys", EXYNOS5422_GATE_IP_FSYS,
 	__BIT(20), CLK_SET_RATE_PARENT),
+
+	CLK_GATE("pwm", "mout_user_aclk66_peric", EXYNOS5422_GATE_IP_PERIC,
+	__BIT(24), CLK_SET_RATE_PARENT),
 };
 
 static int	exynos5422_clock_match(device_t, cfdata_t, void *);



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

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 23:06:28 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Add pwm clocks


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 23:06:05 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5_reg.h

Log Message:
Align AUDIOCORE size to 1M, and add definition for SYSRAM


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos5_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/samsung

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 23:06:05 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5_reg.h

Log Message:
Align AUDIOCORE size to 1M, and add definition for SYSRAM


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos5_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/samsung/exynos5_reg.h
diff -u src/sys/arch/arm/samsung/exynos5_reg.h:1.21 src/sys/arch/arm/samsung/exynos5_reg.h:1.22
--- src/sys/arch/arm/samsung/exynos5_reg.h:1.21	Fri Dec 11 04:03:44 2015
+++ src/sys/arch/arm/samsung/exynos5_reg.h	Wed Jul  4 23:06:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos5_reg.h,v 1.21 2015/12/11 04:03:44 marty Exp $	*/
+/*	$NetBSD: exynos5_reg.h,v 1.22 2018/07/04 23:06:05 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -365,7 +365,11 @@
 #define EXYNOS5_AUDIOCORE_VBASE			(EXYNOS_CORE_VBASE + EXYNOS5_CORE_SIZE)
 #define EXYNOS5_AUDIOCORE_PBASE			0x0380	/* Audio SFR */
 #define EXYNOS5_GPIO_I2S_OFFSET			(EXYNOS5_CORE_SIZE + 0x0006)
-#define EXYNOS5_AUDIOCORE_SIZE			0x0007
+#define EXYNOS5_AUDIOCORE_SIZE			0x0010
+
+#define EXYNOS5_SYSRAM_VBASE			(EXYNOS5_AUDIOCORE_VBASE + EXYNOS5_AUDIOCORE_SIZE)
+#define EXYNOS5_SYSRAM_PBASE			0x0200
+#define EXYNOS5_SYSRAM_SIZE			0x0010
 
 
 /* used Exynos5 USB PHY registers */



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

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 22:16:43 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
Remove some duplicate code


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/samsung/exynos_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/samsung

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 22:16:43 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
Remove some duplicate code


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.24 src/sys/arch/arm/samsung/exynos_gpio.c:1.25
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.24	Mon Jul  2 23:54:52 2018
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Wed Jul  4 22:16:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.24 2018/07/02 23:54:52 jmcneill Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.25 2018/07/04 22:16:42 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.24 2018/07/02 23:54:52 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.25 2018/07/04 22:16:42 jmcneill Exp $");
 
 #include 
 #include 
@@ -175,33 +175,6 @@ exynos_gpio_cfprint(void *priv, const ch
 	return UNCONF;
 }
 
-static void
-exynos_gpio_update_cfg_regs(struct exynos_gpio_bank *bank,
-	const struct exynos_gpio_pin_cfg *ncfg)
-{
-	if (bank->bank_cfg.cfg != ncfg->cfg) {
-		GPIO_WRITE(bank, EXYNOS_GPIO_CON, ncfg->cfg);
-		bank->bank_cfg.cfg = ncfg->cfg;
-	}
-	if (bank->bank_cfg.pud != ncfg->pud) {
-		GPIO_WRITE(bank, EXYNOS_GPIO_PUD, ncfg->pud);
-		bank->bank_cfg.pud = ncfg->pud;
-	}
-
-	if (bank->bank_cfg.drv != ncfg->drv) {
-		GPIO_WRITE(bank, EXYNOS_GPIO_DRV, ncfg->drv);
-		bank->bank_cfg.drv = ncfg->drv;
-	}
-	if (bank->bank_cfg.conpwd != ncfg->conpwd) {
-		GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, ncfg->conpwd);
-		bank->bank_cfg.conpwd = ncfg->conpwd;
-	}
-	if (bank->bank_cfg.pudpwd != ncfg->pudpwd) {
-		GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, ncfg->pudpwd);
-		bank->bank_cfg.pudpwd = ncfg->pudpwd;
-	}
-}
-
 static int
 exynos_gpio_pin_read(void *cookie, int pin)
 {
@@ -235,31 +208,29 @@ static void
 exynos_gpio_pin_ctl(void *cookie, int pin, int flags)
 {
 	struct exynos_gpio_bank * const bank = cookie;
-	struct exynos_gpio_pin_cfg ncfg = bank->bank_cfg;
-	u_int shift;
-	int pull;
+	struct exynos_gpio_pin_cfg ncfg = { 0 };
 
 	/* honour pullup requests */
-	pull = EXYNOS_GPIO_PIN_FLOAT;
-	if (flags & GPIO_PIN_PULLUP)
-		pull = EXYNOS_GPIO_PIN_PULL_UP;
-	if (flags & GPIO_PIN_PULLDOWN)
-		pull = EXYNOS_GPIO_PIN_PULL_DOWN;
-	shift = (pin & 7) << 1;
-	ncfg.pud &= ~(0x3 << shift);
-	ncfg.pud |= pull << shift;
+	if (flags & GPIO_PIN_PULLUP) {
+		ncfg.pud = EXYNOS_GPIO_PIN_PULL_UP;
+		ncfg.pud_valid = true;
+	}
+	if (flags & GPIO_PIN_PULLDOWN) {
+		ncfg.pud = EXYNOS_GPIO_PIN_PULL_DOWN;
+		ncfg.pud_valid = true;
+	}
 
 	/* honour i/o */
 	if (flags & GPIO_PIN_INPUT) {
-		ncfg.cfg &= ~(0x0f << shift);
-		ncfg.cfg |= EXYNOS_GPIO_FUNC_INPUT << shift;
+		ncfg.cfg = EXYNOS_GPIO_FUNC_INPUT;
+		ncfg.cfg_valid = true;
 	} else if (flags & GPIO_PIN_OUTPUT) {
-		ncfg.cfg &= ~(0x0f << shift);
-		ncfg.cfg |= EXYNOS_GPIO_FUNC_OUTPUT << shift;
+		ncfg.cfg = EXYNOS_GPIO_FUNC_OUTPUT;
+		ncfg.cfg_valid = true;
 	}
 
 	/* update any config registers that changed */
-	exynos_gpio_update_cfg_regs(bank, );
+	exynos_gpio_pin_ctl_write(bank, , pin);
 }
 
 void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *bank,



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

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 13:14:51 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_sscom.c sscom.c sscom_var.h

Log Message:
Only process a tx or rx interrupt if the pending bit is set.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_sscom.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/sscom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/sscom_var.h

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_sscom.c
diff -u src/sys/arch/arm/samsung/exynos_sscom.c:1.10 src/sys/arch/arm/samsung/exynos_sscom.c:1.11
--- src/sys/arch/arm/samsung/exynos_sscom.c:1.10	Mon Jun 19 21:58:13 2017
+++ src/sys/arch/arm/samsung/exynos_sscom.c	Wed Jul  4 13:14:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_sscom.c,v 1.10 2017/06/19 21:58:13 jmcneill Exp $ */
+/*	$NetBSD: exynos_sscom.c,v 1.11 2018/07/04 13:14:51 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2014 Reinoud Zandijk
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.10 2017/06/19 21:58:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.11 2018/07/04 13:14:51 jmcneill Exp $");
 
 #include "opt_sscom.h"
 #include "opt_ddb.h"
@@ -95,27 +95,17 @@ sscom_match(device_t parent, cfdata_t cf
 static void
 exynos_unmask_interrupts(struct sscom_softc *sc, int intbits)
 {
-	int psw = disable_interrupts(IF32_bits);
-	uint32_t val;
-
-	val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
+	uint32_t val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
 	val &= ~intbits;
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM, val);
-
-	restore_interrupts(psw);
 }
 
 static void
 exynos_mask_interrupts(struct sscom_softc *sc, int intbits)
 {
-	int psw = disable_interrupts(IF32_bits);
-	uint32_t val;
-
-	val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
+	uint32_t val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM);
 	val |= intbits;
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM, val);
-
-	restore_interrupts(psw);
 }
 
 static void
@@ -134,6 +124,20 @@ exynos_change_txrx_interrupts(struct ssc
 	}
 }
 
+static int
+exynos_pending_interrupts(struct sscom_softc *sc)
+{
+	uint32_t val, ret = 0;
+
+	val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTP);
+	if (val & UINT_RXD)
+		ret |= SSCOM_HW_RXINT;
+	if (val & UINT_TXD)
+		ret |= SSCOM_HW_TXINT;
+
+	return ret;
+}
+
 static void
 exynos_clear_interrupts(struct sscom_softc *sc, u_int flags)
 {
@@ -193,6 +197,7 @@ sscom_attach(device_t parent, device_t s
 	sc->sc_frequency = clk_get_rate(clk_uart_baud0);
 
 	sc->sc_change_txrx_interrupts = exynos_change_txrx_interrupts;
+	sc->sc_pending_interrupts = exynos_pending_interrupts;
 	sc->sc_clear_interrupts = exynos_clear_interrupts;
 
 	/* not used here, but do initialise */
@@ -204,6 +209,11 @@ sscom_attach(device_t parent, device_t s
 
 	aprint_normal("\n");
 
+	/* Disable interrupts */
+	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTM, 0);
+	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTP,
+	bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSCOM_UINTP));
+
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error_dev(self, "failed to decode interrupt\n");
 		return;

Index: src/sys/arch/arm/samsung/sscom.c
diff -u src/sys/arch/arm/samsung/sscom.c:1.9 src/sys/arch/arm/samsung/sscom.c:1.10
--- src/sys/arch/arm/samsung/sscom.c:1.9	Sat Jun 10 15:13:18 2017
+++ src/sys/arch/arm/samsung/sscom.c	Wed Jul  4 13:14:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sscom.c,v 1.9 2017/06/10 15:13:18 jmcneill Exp $ */
+/*	$NetBSD: sscom.c,v 1.10 2018/07/04 13:14:51 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 Fujitsu Component Limited
@@ -98,7 +98,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.9 2017/06/10 15:13:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.10 2018/07/04 13:14:51 jmcneill Exp $");
 
 #include "opt_sscom.h"
 #include "opt_ddb.h"
@@ -422,6 +422,7 @@ sscom_attach_subr(struct sscom_softc *sc
 
 	/* Disable interrupts before configuring the device. */
 	KASSERT(sc->sc_change_txrx_interrupts != NULL);
+	KASSERT(sc->sc_pending_interrupts != NULL);
 	KASSERT(sc->sc_clear_interrupts != NULL);
 	sscom_disable_txrxint(sc);
 
@@ -1818,17 +1819,19 @@ int
 sscomintr(void *v)
 {
 	struct sscom_softc *sc = v;
-	int clear = 0;
+	int pend, rv = 0;
 
-	if (sscomrxintr(v))
-		clear |= SSCOM_HW_RXINT;
-	if (sscomtxintr(v))
-		clear |= SSCOM_HW_TXINT;
+	pend = sc->sc_pending_interrupts(sc);
 
-	if (clear)
-		sc->sc_clear_interrupts(sc, clear);
+	if (pend & SSCOM_HW_RXINT)
+		rv += sscomrxintr(v);
+	if (pend & SSCOM_HW_TXINT)
+		rv += sscomtxintr(v);
 
-	return clear? 1: 0;
+	if (pend)
+		sc->sc_clear_interrupts(sc, pend);
+
+	return rv;
 }
 
 

Index: src/sys/arch/arm/samsung/sscom_var.h
diff -u 

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

2018-07-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jul  4 13:14:51 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_sscom.c sscom.c sscom_var.h

Log Message:
Only process a tx or rx interrupt if the pending bit is set.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_sscom.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/sscom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/sscom_var.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/samsung

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:30:13 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Dump clock tree with aprint_debug instead of printf


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.9 src/sys/arch/arm/samsung/exynos5422_clock.c:1.10
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.9	Tue Jul  3 16:06:41 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Jul  3 16:30:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.10 2018/07/03 16:30:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.10 2018/07/03 16:30:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -648,9 +648,9 @@ exynos5422_clock_find_by_id(u_int clock_
 static void
 exynos5422_clock_print_header(void)
 {
-	printf("  %-10s %2s %-10s %-5s %10s\n",
+	aprint_debug("  %-10s %2s %-10s %-5s %10s\n",
 	"clock", "", "parent", "type", "rate");
-	printf("  %-10s %2s %-10s %-5s %10s\n",
+	aprint_debug("  %-10s %2s %-10s %-5s %10s\n",
 	"=", "", "==", "", "");
 }
 
@@ -683,7 +683,7 @@ exynos5422_clock_print(struct exynos5422
 	clk_parent = exynos5422_clock_get_parent(sc, >base);
 	eclk_parent = (struct exynos_clk *)clk_parent;
 
-	printf("  %-10s %2s %-10s %-5s %10d Hz\n",
+	aprint_debug("  %-10s %2s %-10s %-5s %10d Hz\n",
 	eclk->base.name,
 	eclk_parent ? "<-" : "",
 	eclk_parent ? eclk_parent->base.name : "",



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:30:13 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Dump clock tree with aprint_debug instead of printf


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:22:48 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_usbdrdphy.c

Log Message:
Fix value of PHY_CLK_RST_FSEL_24M, USB2 on XHCI works now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_usbdrdphy.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/samsung

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:22:48 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_usbdrdphy.c

Log Message:
Fix value of PHY_CLK_RST_FSEL_24M, USB2 on XHCI works now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_usbdrdphy.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/samsung/exynos_usbdrdphy.c
diff -u src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.1 src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.2
--- src/sys/arch/arm/samsung/exynos_usbdrdphy.c:1.1	Tue Jul  3 16:09:04 2018
+++ src/sys/arch/arm/samsung/exynos_usbdrdphy.c	Tue Jul  3 16:22:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_usbdrdphy.c,v 1.1 2018/07/03 16:09:04 jmcneill Exp $ */
+/* $NetBSD: exynos_usbdrdphy.c,v 1.2 2018/07/03 16:22:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.1 2018/07/03 16:09:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_usbdrdphy.c,v 1.2 2018/07/03 16:22:48 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_usbdr
 #define	 PHY_CLK_RST_MPLL_MULT		__BITS(17,11)
 #define	  PHY_CLK_RST_MPLL_MULT_24M	0x68
 #define	 PHY_CLK_RST_FSEL		__BITS(10,5)
-#define	  PHY_CLK_RST_FSEL_24M		0x2a
+#define	  PHY_CLK_RST_FSEL_24M		0x5
 #define	 PHY_CLK_RST_RETENABLEN		__BIT(4)
 #define	 PHY_CLK_RST_REFCLKSEL		__BITS(3,2)
 #define	  PHY_CLK_RST_REFCLKSEL_EXT	3



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:09:04 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_ehci.c exynos_ohci.c exynos_usbphy.c
files.exynos
Added Files:
src/sys/arch/arm/samsung: exynos_usbdrdphy.c
Removed Files:
src/sys/arch/arm/samsung: exynos_usb3.c

Log Message:
Add support for Samsung Exynos USB.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_ehci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_ohci.c
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/samsung/exynos_usb3.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_usbdrdphy.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_usbphy.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/files.exynos

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/samsung/exynos_ehci.c
diff -u src/sys/arch/arm/samsung/exynos_ehci.c:1.3 src/sys/arch/arm/samsung/exynos_ehci.c:1.4
--- src/sys/arch/arm/samsung/exynos_ehci.c:1.3	Mon Apr  9 16:21:09 2018
+++ src/sys/arch/arm/samsung/exynos_ehci.c	Tue Jul  3 16:09:04 2018
@@ -1,12 +1,9 @@
-/*	$NetBSD: exynos_ehci.c,v 1.3 2018/04/09 16:21:09 jakllsch Exp $	*/
+/* $NetBSD: exynos_ehci.c,v 1.4 2018/07/03 16:09:04 jmcneill Exp $ */
 
 /*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2015-2018 Jared McNeill 
  * All rights reserved.
  *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Reinoud Zandijk.
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -16,107 +13,132 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
-#include "locators.h"
-#include "ohci.h"
-#include "ehci.h"
-
 #include 
-
-__KERNEL_RCSID(1, "$NetBSD: exynos_ehci.c,v 1.3 2018/04/09 16:21:09 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_ehci.c,v 1.4 2018/07/03 16:09:04 jmcneill Exp $");
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
-
 #include 
 #include 
 
-#include 
-#include 
-
 #include 
 
 static int	exynos_ehci_match(device_t, cfdata_t, void *);
 static void	exynos_ehci_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(exynos_ehci, sizeof(struct ehci_softc),
-exynos_ehci_match, exynos_ehci_attach, NULL, NULL);
-
+CFATTACH_DECL2_NEW(exynos_ehci, sizeof(struct ehci_softc),
+	exynos_ehci_match, exynos_ehci_attach, NULL,
+	ehci_activate, NULL, ehci_childdet);
 
 static int
 exynos_ehci_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = { "samsung,exynos5-ehci",
-	NULL };
+	const char * const compatible[] = {
+		"samsung,exynos4210-ehci",
+		NULL
+	};
 	struct fdt_attach_args * const faa = aux;
+
 	return of_match_compatible(faa->faa_phandle, compatible);
 }
 
-
 static void
 exynos_ehci_attach(device_t parent, device_t self, void *aux)
 {
-	struct ehci_softc *sc = device_private(self);
+	struct ehci_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
+	const int phandle = 

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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:09:04 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_ehci.c exynos_ohci.c exynos_usbphy.c
files.exynos
Added Files:
src/sys/arch/arm/samsung: exynos_usbdrdphy.c
Removed Files:
src/sys/arch/arm/samsung: exynos_usb3.c

Log Message:
Add support for Samsung Exynos USB.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_ehci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_ohci.c
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/samsung/exynos_usb3.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_usbdrdphy.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_usbphy.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/files.exynos

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/samsung

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:06:41 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Add more USB3 clocks


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.8 src/sys/arch/arm/samsung/exynos5422_clock.c:1.9
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.8	Tue Jul  3 09:39:32 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Jul  3 16:06:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.9 2018/07/03 16:06:41 jmcneill Exp $");
 
 #include 
 #include 
@@ -378,6 +378,7 @@ static const struct clk_funcs exynos5422
 #define EXYNOS5422_SRC_TOP12		0x10288
 
 #define EXYNOS5422_DIV_TOP0		0x10500
+#define EXYNOS5422_DIV_FSYS0		0x10548
 #define EXYNOS5422_DIV_FSYS1		0x1054c
 #define EXYNOS5422_DIV_PERIC0		0x10558
 
@@ -461,6 +462,10 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUX("mout_aclk200_fsys2", EXYNOS5422_SRC_TOP0, __BITS(13,12),
 	mout_group1_p),
 
+	CLK_MUX("mout_usbd301", EXYNOS5422_SRC_FSYS, __BITS(6,4),
+	mout_group2_p),
+	CLK_MUX("mout_usbd300", EXYNOS5422_SRC_FSYS, __BITS(22,20),
+	mout_group2_p),
 	CLK_MUX("mout_mmc0", EXYNOS5422_SRC_FSYS, __BITS(10,8),
 	mout_group2_p),
 	CLK_MUX("mout_mmc1", EXYNOS5422_SRC_FSYS, __BITS(14,12),
@@ -479,6 +484,10 @@ static struct exynos_clk exynos5422_cloc
 	CLK_DIV("dout_aclk200_fsys", "mout_aclk200_fsys", EXYNOS5422_DIV_TOP0, __BITS(30,28)),
 	CLK_DIV("dout_aclk200_fsys2", "mout_aclk200_fsys2", EXYNOS5422_DIV_TOP0, __BITS(14,12)),
 
+	CLK_DIV("dout_usbphy301", "mout_usbd301", EXYNOS5422_DIV_FSYS0, __BITS(15,12)),
+	CLK_DIV("dout_usbphy300", "mout_usbd300", EXYNOS5422_DIV_FSYS0, __BITS(19,16)),
+	CLK_DIV("dout_usbd301", "mout_usbd301", EXYNOS5422_DIV_FSYS0, __BITS(23,20)),
+	CLK_DIV("dout_usbd300", "mout_usbd300", EXYNOS5422_DIV_FSYS0, __BITS(27,24)),
 	CLK_DIV("dout_mmc0", "mout_mmc0", EXYNOS5422_DIV_FSYS1, __BITS(9,0)),
 	CLK_DIV("dout_mmc1", "mout_mmc1", EXYNOS5422_DIV_FSYS1, __BITS(19,10)),
 	CLK_DIV("dout_mmc2", "mout_mmc2", EXYNOS5422_DIV_FSYS1, __BITS(29,20)),
@@ -502,6 +511,14 @@ static struct exynos_clk exynos5422_cloc
 	__BIT(1), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_mmc2", "dout_mmc2", EXYNOS5422_GATE_TOP_SCLK_FSYS,
 	__BIT(2), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbphy301", "dout_usbphy301", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(7), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbphy300", "dout_usbphy300", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(8), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbd300", "dout_usbd300", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(9), CLK_SET_RATE_PARENT),
+	CLK_GATE("sclk_usbd301", "dout_usbd301", EXYNOS5422_GATE_TOP_SCLK_FSYS,
+	__BIT(10), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_uart0", "dout_uart0", EXYNOS5422_GATE_TOP_SCLK_PERIC,
 	__BIT(0), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_uart1", "dout_uart1", EXYNOS5422_GATE_TOP_SCLK_PERIC,



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

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 16:06:41 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Add more USB3 clocks


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 09:39:32 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Add USB clocks and missing MMC biu clocks


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung

2018-07-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jul  3 09:39:32 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Add USB clocks and missing MMC biu clocks


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.7 src/sys/arch/arm/samsung/exynos5422_clock.c:1.8
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.7	Mon Jul  2 20:24:55 2018
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Jul  3 09:39:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.8 2018/07/03 09:39:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -374,14 +374,17 @@ static const struct clk_funcs exynos5422
 #define EXYNOS5422_SRC_PERIC1		0x10254
 #define EXYNOS5422_SRC_ISP		0x10270
 #define EXYNOS5422_SRC_TOP10		0x10280
-#define EXYNOS5422_SRC_TOP11		0x10280
-#define EXYNOS5422_SRC_TOP12		0x10280
+#define EXYNOS5422_SRC_TOP11		0x10284
+#define EXYNOS5422_SRC_TOP12		0x10288
 
+#define EXYNOS5422_DIV_TOP0		0x10500
 #define EXYNOS5422_DIV_FSYS1		0x1054c
 #define EXYNOS5422_DIV_PERIC0		0x10558
 
+#define	EXYNOS5422_GATE_BUS_FSYS0	0x10740
 #define EXYNOS5422_GATE_TOP_SCLK_FSYS	0x10840
 #define EXYNOS5422_GATE_TOP_SCLK_PERIC	0x10850
+#define	EXYNOS5422_GATE_IP_FSYS		0x10944
 
 static const char *mout_cpll_p[] = { "fin_pll", "fout_cpll" };
 static const char *mout_dpll_p[] = { "fin_pll", "fout_dpll" };
@@ -390,9 +393,19 @@ static const char *mout_spll_p[] = { "fi
 static const char *mout_ipll_p[] = { "fin_pll", "fout_ipll" };
 static const char *mout_epll_p[] = { "fin_pll", "fout_epll" };
 static const char *mout_rpll_p[] = { "fin_pll", "fout_rpll" };
+static const char *mout_group1_p[] =
+	{ "sclk_cpll", "sclk_dpll", "sclk_mpp" };
 static const char *mout_group2_p[] =
 	{ "fin_pll", "sclk_cpll", "sclk_dpll", "sclk_mpll",
 	  "sclk_spll", "sclk_ipll", "sclk_epll", "sclk_rpll" };
+static const char *mout_user_aclk200_fsys_p[] =
+	{ "fin_pll", "mout_sw_aclk200_fsys" };
+static const char *mout_user_aclk200_fsys2_p[] =
+	{ "fin_pll", "mout_sw_aclk200_fsys2" };
+static const char *mout_sw_aclk200_fsys_p[] =
+	{ "dout_aclk200_fsys", "sclk_spll" };
+static const char *mout_sw_aclk200_fsys2_p[] =
+	{ "dout_aclk200_fsys2", "sclk_spll" };
 
 static struct exynos_clk exynos5422_clocks[] = {
 	CLK_FIXED("fin_pll", EXYNOS_F_IN_FREQ),
@@ -435,6 +448,19 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUXF("sclk_rpll", "mout_rpll", EXYNOS5422_SRC_TOP6, __BIT(16),
 	CLK_SET_RATE_PARENT, mout_rpll_p),
 
+	CLK_MUX("mout_sw_aclk200_fsys", EXYNOS5422_SRC_TOP10, __BIT(24),
+	mout_sw_aclk200_fsys_p),
+	CLK_MUX("mout_sw_aclk200_fsys2", EXYNOS5422_SRC_TOP10, __BIT(12),
+	mout_sw_aclk200_fsys2_p),
+	CLK_MUX("mout_user_aclk200_fsys", EXYNOS5422_SRC_TOP3, __BIT(28),
+	mout_user_aclk200_fsys_p),
+	CLK_MUX("mout_user_aclk200_fsys2", EXYNOS5422_SRC_TOP3, __BIT(12),
+	mout_user_aclk200_fsys2_p),
+	CLK_MUX("mout_aclk200_fsys", EXYNOS5422_SRC_TOP0, __BITS(25,24),
+	mout_group1_p),
+	CLK_MUX("mout_aclk200_fsys2", EXYNOS5422_SRC_TOP0, __BITS(13,12),
+	mout_group1_p),
+
 	CLK_MUX("mout_mmc0", EXYNOS5422_SRC_FSYS, __BITS(10,8),
 	mout_group2_p),
 	CLK_MUX("mout_mmc1", EXYNOS5422_SRC_FSYS, __BITS(14,12),
@@ -450,6 +476,9 @@ static struct exynos_clk exynos5422_cloc
 	CLK_MUX("mout_uart3", EXYNOS5422_SRC_PERIC0, __BITS(18,16),
 	mout_group2_p),
 
+	CLK_DIV("dout_aclk200_fsys", "mout_aclk200_fsys", EXYNOS5422_DIV_TOP0, __BITS(30,28)),
+	CLK_DIV("dout_aclk200_fsys2", "mout_aclk200_fsys2", EXYNOS5422_DIV_TOP0, __BITS(14,12)),
+
 	CLK_DIV("dout_mmc0", "mout_mmc0", EXYNOS5422_DIV_FSYS1, __BITS(9,0)),
 	CLK_DIV("dout_mmc1", "mout_mmc1", EXYNOS5422_DIV_FSYS1, __BITS(19,10)),
 	CLK_DIV("dout_mmc2", "mout_mmc2", EXYNOS5422_DIV_FSYS1, __BITS(29,20)),
@@ -462,6 +491,11 @@ static struct exynos_clk exynos5422_cloc
 	CLK_DIV("dout_uart3", "mout_uart3", EXYNOS5422_DIV_PERIC0,
 	__BITS(23,20)),
 
+	CLK_GATE("aclk200_fsys", "mout_user_aclk200_fsys", EXYNOS5422_GATE_BUS_FSYS0,
+	__BIT(9), CLK_SET_RATE_PARENT),
+	CLK_GATE("aclk200_fsys2", "mout_user_aclk200_fsys2", EXYNOS5422_GATE_BUS_FSYS0,
+	__BIT(10), CLK_SET_RATE_PARENT),
+
 	CLK_GATE("sclk_mmc0", "dout_mmc0", EXYNOS5422_GATE_TOP_SCLK_FSYS,
 	__BIT(0), CLK_SET_RATE_PARENT),
 	CLK_GATE("sclk_mmc1", "dout_mmc1", EXYNOS5422_GATE_TOP_SCLK_FSYS,
@@ -476,6 +510,19 @@ static struct exynos_clk 

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:54:53 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c exynos_var.h

Log Message:
Make the pinctrl driver actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/samsung/exynos_gpio.c \
src/sys/arch/arm/samsung/exynos_var.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.23 src/sys/arch/arm/samsung/exynos_gpio.c:1.24
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.23	Thu Dec 31 03:50:34 2015
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Mon Jul  2 23:54:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.24 2018/07/02 23:54:52 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.24 2018/07/02 23:54:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -262,24 +262,46 @@ exynos_gpio_pin_ctl(void *cookie, int pi
 	exynos_gpio_update_cfg_regs(bank, );
 }
 
-void exynos_gpio_pin_ctl_read(const struct exynos_gpio_bank *bank,
-			  struct exynos_gpio_pin_cfg *cfg)
-{
-	cfg->cfg = GPIO_READ(bank, EXYNOS_GPIO_CON);
-	cfg->pud = GPIO_READ(bank, EXYNOS_GPIO_PUD);
-	cfg->drv = GPIO_READ(bank, EXYNOS_GPIO_DRV);
-	cfg->conpwd = GPIO_READ(bank, EXYNOS_GPIO_CONPWD);
-	cfg->pudpwd = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD);
-}
-
 void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *bank,
-			   const struct exynos_gpio_pin_cfg *cfg)
+			   const struct exynos_gpio_pin_cfg *cfg,
+			   int pin)
 {
-		GPIO_WRITE(bank, EXYNOS_GPIO_CON, cfg->cfg);
-		GPIO_WRITE(bank, EXYNOS_GPIO_PUD, cfg->pud);
-		GPIO_WRITE(bank, EXYNOS_GPIO_DRV, cfg->drv);
-		GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, cfg->conpwd);
-		GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, cfg->pudpwd);
+	uint32_t val;
+
+	if (cfg->cfg_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_CON);
+		val &= ~(0xf << (pin * 4));
+		val |= (cfg->cfg << (pin * 4));
+		GPIO_WRITE(bank, EXYNOS_GPIO_CON, val);
+	}
+
+	if (cfg->pud_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_PUD);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->pud << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_PUD, val);
+	}
+
+	if (cfg->drv_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_DRV);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->drv << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_DRV, val);
+	}
+
+	if (cfg->conpwd_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_CONPWD);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->conpwd << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, val);
+	}
+
+	if (cfg->pudpwd_valid) {
+		val = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD);
+		val &= ~(0x3 << (pin * 2));
+		val |= (cfg->pudpwd << (pin * 2));
+		GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, val);
+	}
 }
 
 struct exynos_gpio_softc *
Index: src/sys/arch/arm/samsung/exynos_var.h
diff -u src/sys/arch/arm/samsung/exynos_var.h:1.23 src/sys/arch/arm/samsung/exynos_var.h:1.24
--- src/sys/arch/arm/samsung/exynos_var.h:1.23	Wed Dec 30 04:30:27 2015
+++ src/sys/arch/arm/samsung/exynos_var.h	Mon Jul  2 23:54:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_var.h,v 1.23 2015/12/30 04:30:27 marty Exp $	*/
+/*	$NetBSD: exynos_var.h,v 1.24 2018/07/02 23:54:52 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -106,10 +106,15 @@ struct exynos_gpio_pindata {
 
 struct exynos_gpio_pin_cfg {
 	uint32_t cfg;
+	int cfg_valid;
 	uint32_t pud;
+	int pud_valid;
 	uint32_t drv;
+	int drv_valid;
 	uint32_t conpwd;
+	int conpwd_valid;
 	uint32_t pudpwd;
+	int pudpwd_valid;
 };
 
 struct exynos_gpio_softc {
@@ -170,10 +175,9 @@ extern void exynos_gpio_pinset_release(c
 extern void exynos_gpio_pinset_to_pindata(const struct exynos_gpio_pinset *,
 	int pinnr, struct exynos_gpio_pindata *);
 extern bool exynos_gpio_pin_reserve(const char *, struct exynos_gpio_pindata *);
-extern void exynos_gpio_pin_ctl_read(const struct exynos_gpio_bank *,
- struct exynos_gpio_pin_cfg *);
 extern void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *,
-  const struct exynos_gpio_pin_cfg *);
+  const struct exynos_gpio_pin_cfg *,
+  int);
 static inline void
 exynos_gpio_pindata_write(const struct exynos_gpio_pindata *pd, int value)
 {

Index: src/sys/arch/arm/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.12 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.13
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.12	Sun Jul  2 18:21:52 2017
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Mon Jul  2 23:54:52 2018
@@ -1,4 +1,4 @@
-/*	

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:54:53 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c exynos_var.h

Log Message:
Make the pinctrl driver actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/samsung/exynos_gpio.c \
src/sys/arch/arm/samsung/exynos_var.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:52:54 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
No need to use hold reg when updating clocks, and auto-discover some values.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.6 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.7
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.6	Mon Jul  2 20:28:24 2018
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Mon Jul  2 23:52:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.7 2018/07/02 23:52:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_dwcmm
 #include 
 #include 
 
-#define	FIFO_REG	0x200
 #define	MPS_BEGIN	0x200
 #define	MPS_END		0x204
 #define	MPS_CTRL	0x20c
@@ -94,7 +93,6 @@ exynos_dwcmmc_attach(device_t parent, de
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
-	u_int fifo_depth;
 	int error;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -102,9 +100,6 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
-	if (of_getprop_uint32(phandle, "fifo-depth", _depth)) {
-		fifo_depth = 64;
-	}
 	if (of_getprop_uint32(phandle, "samsung,dw-mshc-ciu-div", >sc_ciu_div)) {
 		aprint_error(": missing samsung,dw-mshc-ciu-div property\n");
 		return;
@@ -143,9 +138,8 @@ exynos_dwcmmc_attach(device_t parent, de
 	}
 
 	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (esc->sc_ciu_div + 1);
-	sc->sc_fifo_depth = fifo_depth;
-	sc->sc_fifo_reg = FIFO_REG;
-	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
+	of_getprop_uint32(phandle, "fifo-depth", >sc_fifo_depth);
+	sc->sc_flags = DWC_MMC_F_DMA;
 	sc->sc_bus_clock = exynos_dwcmmc_bus_clock;
 
 	esc->sc_pin_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 23:52:54 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
No need to use hold reg when updating clocks, and auto-discover some values.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:28:24 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Set module clock on rate changes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.5 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.6
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.5	Thu Jun 22 06:42:38 2017
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Mon Jul  2 20:28:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.5 2017/06/22 06:42:38 skrll Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.5 2017/06/22 06:42:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.6 2018/07/02 20:28:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -56,12 +56,14 @@ static int	exynos_dwcmmc_match(device_t,
 static void	exynos_dwcmmc_attach(device_t, device_t, void *);
 
 static int	exynos_dwcmmc_card_detect(struct dwc_mmc_softc *);
+static int	exynos_dwcmmc_bus_clock(struct dwc_mmc_softc *, int);
 
 struct exynos_dwcmmc_softc {
 	struct dwc_mmc_softc	sc;
 	struct clk		*sc_clk_biu;
 	struct clk		*sc_clk_ciu;
 	struct fdtbus_gpio_pin	*sc_pin_cd;
+	u_int			sc_ciu_div;
 };
 
 CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(struct dwc_mmc_softc),
@@ -92,7 +94,7 @@ exynos_dwcmmc_attach(device_t parent, de
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
-	u_int ciu_div, fifo_depth;
+	u_int fifo_depth;
 	int error;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -100,13 +102,10 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
-	//if (of_getprop_uint32(phandle, "bus-width", _width)) {
-	//	bus_width = 4;
-	//}
 	if (of_getprop_uint32(phandle, "fifo-depth", _depth)) {
 		fifo_depth = 64;
 	}
-	if (of_getprop_uint32(phandle, "samsung,dw-mshc-ciu-div", _div)) {
+	if (of_getprop_uint32(phandle, "samsung,dw-mshc-ciu-div", >sc_ciu_div)) {
 		aprint_error(": missing samsung,dw-mshc-ciu-div property\n");
 		return;
 	}
@@ -143,10 +142,11 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
-	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (ciu_div + 1);
+	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (esc->sc_ciu_div + 1);
 	sc->sc_fifo_depth = fifo_depth;
 	sc->sc_fifo_reg = FIFO_REG;
 	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
+	sc->sc_bus_clock = exynos_dwcmmc_bus_clock;
 
 	esc->sc_pin_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",
 	GPIO_PIN_INPUT);
@@ -193,3 +193,25 @@ exynos_dwcmmc_card_detect(struct dwc_mmc
 
 	return fdtbus_gpio_read(esc->sc_pin_cd);
 }
+
+static int
+exynos_dwcmmc_bus_clock(struct dwc_mmc_softc *sc, int rate)
+{
+	struct exynos_dwcmmc_softc *esc = device_private(sc->sc_dev);
+	const int ciu_div = esc->sc_ciu_div + 1;
+	int error;
+
+	error = clk_set_rate(esc->sc_clk_ciu, 1000 * rate * ciu_div);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "failed to set rate to %u Hz: %d\n",
+		rate * ciu_div * 1000, error);
+		return error;
+	}
+
+	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / ciu_div;
+
+	aprint_debug_dev(sc->sc_dev, "set clock rate to %u Hz (target %u Hz)\n",
+	sc->sc_clock_freq, rate * 1000);
+
+	return 0;
+}



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:28:24 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Set module clock on rate changes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:24:55 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c

Log Message:
Fix a stupid bug in exynos*_clock_set_rate_div


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5410_clock.c
diff -u src/sys/arch/arm/samsung/exynos5410_clock.c:1.2 src/sys/arch/arm/samsung/exynos5410_clock.c:1.3
--- src/sys/arch/arm/samsung/exynos5410_clock.c:1.2	Tue Jun 20 17:43:51 2017
+++ src/sys/arch/arm/samsung/exynos5410_clock.c	Mon Jul  2 20:24:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5410_clock.c,v 1.2 2017/06/20 17:43:51 skrll Exp $ */
+/* $NetBSD: exynos5410_clock.c,v 1.3 2018/07/02 20:24:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.2 2017/06/20 17:43:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.3 2018/07/02 20:24:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -669,7 +669,7 @@ exynos5410_clock_set_rate_div(struct exy
 	clk_parent = exynos5410_clock_get_parent(sc, >base);
 	const u_int parent_rate = exynos5410_clock_get_rate(sc, clk_parent);
 
-	for (tmp_div = 0; tmp_div < popcount32(ediv->bits); tmp_div++) {
+	for (tmp_div = 0; tmp_div < __SHIFTOUT_MASK(ediv->bits); tmp_div++) {
 		tmp_rate = parent_rate / (tmp_div + 1);
 		if (tmp_rate <= rate) {
 			new_div = tmp_div;

Index: src/sys/arch/arm/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.6 src/sys/arch/arm/samsung/exynos5422_clock.c:1.7
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.6	Mon Jun 19 21:59:55 2017
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Mon Jul  2 20:24:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.6 2017/06/19 21:59:55 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.6 2017/06/19 21:59:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.7 2018/07/02 20:24:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -747,7 +747,7 @@ exynos5422_clock_set_rate_div(struct exy
 	clk_parent = exynos5422_clock_get_parent(sc, >base);
 	const u_int parent_rate = exynos5422_clock_get_rate(sc, clk_parent);
 
-	for (tmp_div = 0; tmp_div < popcount32(ediv->bits); tmp_div++) {
+	for (tmp_div = 0; tmp_div < __SHIFTOUT_MASK(ediv->bits); tmp_div++) {
 		tmp_rate = parent_rate / (tmp_div + 1);
 		if (tmp_rate <= rate) {
 			new_div = tmp_div;



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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 20:24:55 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c

Log Message:
Fix a stupid bug in exynos*_clock_set_rate_div


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:49:37 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c mct.c mct_var.h

Log Message:
Add a proper MCT driver rather than relying on ARM Generic Timer (which
may not be functional or even present).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/mct.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/mct_var.h

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.9 src/sys/arch/arm/samsung/exynos_platform.c:1.10
--- src/sys/arch/arm/samsung/exynos_platform.c:1.9	Sat Mar 17 18:34:09 2018
+++ src/sys/arch/arm/samsung/exynos_platform.c	Mon Jul  2 12:49:37 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.9 2018/03/17 18:34:09 ryo Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.10 2018/07/02 12:49:37 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -33,7 +33,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.9 2018/03/17 18:34:09 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.10 2018/07/02 12:49:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,11 +50,10 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_platf
 
 #include 
 #include 
+#include 
 
 #include 
 
-#include 
-
 #include 
 
 #define	EXYNOS5_SWRESET_REG	0x10040400
@@ -123,12 +122,6 @@ exynos5_platform_reset(void)
 	bus_space_write_4(bst, bsh, 0, 1);
 }
 
-static void
-exynos_platform_delay(u_int us)
-{
-	gtmr_delay(us);
-}
-
 static u_int
 exynos_platform_uart_freq(void)
 {
@@ -142,7 +135,7 @@ static const struct arm_platform exynos5
 	.early_putchar = exynos_platform_early_putchar,
 	.device_register = exynos_platform_device_register,
 	.reset = exynos5_platform_reset,
-	.delay = exynos_platform_delay,
+	.delay = mct_delay,
 	.uart_freq = exynos_platform_uart_freq,
 };
 

Index: src/sys/arch/arm/samsung/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.13 src/sys/arch/arm/samsung/mct.c:1.14
--- src/sys/arch/arm/samsung/mct.c:1.13	Sun Jul  1 23:21:43 2018
+++ src/sys/arch/arm/samsung/mct.c	Mon Jul  2 12:49:37 2018
@@ -1,11 +1,11 @@
-/*	$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $	*/
+/*	$NetBSD: mct.c,v 1.14 2018/07/02 12:49:37 jmcneill Exp $	*/
 
 /*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2014-2018 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Reinoud Zandijk.
+ * by Reinoud Zandijk and Jared McNeill.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.14 2018/07/02 12:49:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,16 +50,25 @@ __KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.13
 #include 
 #include 
 
-#include 
-#include 
-#include 
-
 #include 
 #include 
 
+static struct mct_softc mct_sc;
+
 static int  mct_match(device_t, cfdata_t, void *);
 static void mct_attach(device_t, device_t, void *);
 
+static u_int mct_get_timecount(struct timecounter *);
+
+static struct timecounter mct_timecounter = {
+	.tc_get_timecount = mct_get_timecount,
+	.tc_counter_mask = ~0u,
+	.tc_frequency = EXYNOS_F_IN_FREQ,
+	.tc_name = "MCT",
+	.tc_quality = 500,
+	.tc_priv = _sc,
+};
+
 CFATTACH_DECL_NEW(exyo_mct, 0, mct_match, mct_attach, NULL, NULL);
 
 static inline uint32_t
@@ -85,20 +94,31 @@ mct_write_global(struct mct_softc *sc, b
 		wreg = MCT_G_CNT_WSTAT;
 		bit  = (o == MCT_G_CNT_L) ? G_CNT_WSTAT_L : G_CNT_WSTAT_U;
 	} else {
-		wreg = MCT_G_WSTAT;
 		switch (o) {
 		case MCT_G_COMP0_L:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_COMP0_L;
 			break;
 		case MCT_G_COMP0_U:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_COMP0_U;
 			break;
 		case MCT_G_COMP0_ADD_INCR:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_ADD_INCR;
 			break;
 		case MCT_G_TCON:
+			wreg = MCT_G_WSTAT;
 			bit  = G_WSTAT_TCON;
 			break;
+		case MCT_G_CNT_L:
+			wreg = MCT_G_CNT_WSTAT;
+			bit  = G_CNT_WSTAT_L;
+			break;
+		case MCT_G_CNT_U:
+			wreg = MCT_G_CNT_WSTAT;
+			bit  = G_CNT_WSTAT_U;
+			break;
 		default:
 			/* all other registers */
 			return;
@@ -120,7 +140,69 @@ mct_write_global(struct mct_softc *sc, b
 static void
 mct_fdt_cpu_hatch(void *priv, struct cpu_info *ci)
 {
-	gtmr_init_cpu_clock(ci);
+	panic("%s: not implemented", __func__);
+}
+
+static int
+mct_intr(void *arg)
+{
+	struct mct_softc * const sc = _sc;
+	struct clockframe *frame = arg;
+
+	mct_write_global(sc, MCT_G_INT_CSTAT, G_INT_CSTAT_CLEAR);
+
+	hardclock(frame);
+
+	return 1;
+}
+
+static 

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:49:37 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c mct.c mct_var.h

Log Message:
Add a proper MCT driver rather than relying on ARM Generic Timer (which
may not be functional or even present).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_platform.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/mct.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/mct_var.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/samsung

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:18:32 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c

Log Message:
Cleanup of combiner driver and make it work (at least for MCT).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_combiner.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/samsung/exynos_combiner.c
diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.7 src/sys/arch/arm/samsung/exynos_combiner.c:1.8
--- src/sys/arch/arm/samsung/exynos_combiner.c:1.7	Sun Jun 11 16:19:27 2017
+++ src/sys/arch/arm/samsung/exynos_combiner.c	Mon Jul  2 12:18:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_combiner.c,v 1.7 2017/06/11 16:19:27 jmcneill Exp $ */
+/*	$NetBSD: exynos_combiner.c,v 1.8 2018/07/02 12:18:32 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.7 2017/06/11 16:19:27 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.8 2018/07/02 12:18:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,14 +50,13 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_combi
 
 #include 
 
-#define COMBINER_IESR_OFFSET   0x00
-#define COMBINER_IECR_OFFSET   0x04
-#define COMBINER_ISTR_OFFSET   0x08
-#define COMBINER_IMSR_OFFSET   0x0C
-#define COMBINER_GROUP_SIZE0x10
-#define COMBINER_IRQS_PER_BLOCK   8
-#define COMBINER_BLOCKS_PER_GROUP 4
-#define COMBINER_N_BLOCKS32
+#define	COMBINER_GROUP_BASE(group)	(((group) / 4) * 0x10)
+#define	COMBINER_GROUP_MASK(group)	(0xff << (((group) % 4) * 8))
+
+#define	COMBINER_IESR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x00)
+#define	COMBINER_IECR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x04)
+#define	COMBINER_ISTR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x08)
+#define	COMBINER_IMSR_REG(group)	(COMBINER_GROUP_BASE(group) + 0x0c)
 
 struct exynos_combiner_softc;
 
@@ -69,12 +68,13 @@ struct exynos_combiner_irq_entry {
 	boolirq_mpsafe;
 };
 
-struct exynos_combiner_irq_block {
-	int irq_block_no;
+struct exynos_combiner_irq_group {
+	int irq_group_no;
 	struct exynos_combiner_softc	*irq_sc;
 	struct exynos_combiner_irq_entry *irq_entries;
-	struct exynos_combiner_irq_block *irq_block_next;
+	struct exynos_combiner_irq_group *irq_group_next;
 	void *irq_ih;
+	int irq_ipl;
 };
 
 struct exynos_combiner_softc {
@@ -82,7 +82,7 @@ struct exynos_combiner_softc {
 	bus_space_tag_t		sc_bst;
 	bus_space_handle_t	sc_bsh;
 	int			sc_phandle;
-	struct exynos_combiner_irq_block *irq_blocks;
+	struct exynos_combiner_irq_group *irq_groups;
 };
 
 static int exynos_combiner_match(device_t, cfdata_t, void *);
@@ -129,7 +129,6 @@ exynos_combiner_attach(device_t parent, 
 	sc->sc_dev = self;
 	sc->sc_phandle = faa->faa_phandle;
 	sc->sc_bst = faa->faa_bst;
-	sc->irq_blocks = NULL;
 
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh);
 	if (error) {
@@ -145,53 +144,53 @@ exynos_combiner_attach(device_t parent, 
 		return;
 	}
 
-	aprint_normal(" @ 0x%08x: interrupt combiner", (uint)addr);
 	aprint_naive("\n");
-	aprint_normal("\n");
+	aprint_normal(" @ 0x%08x: interrupt combiner\n", (uint)addr);
 
 }
 
-static struct exynos_combiner_irq_block *
-exynos_combiner_new_block(struct exynos_combiner_softc *sc, int block_no)
+static struct exynos_combiner_irq_group *
+exynos_combiner_new_group(struct exynos_combiner_softc *sc, int group_no)
 {
-	struct exynos_combiner_irq_block *n = kmem_zalloc(sizeof(*n),
+	struct exynos_combiner_irq_group *n = kmem_zalloc(sizeof(*n),
 			  KM_SLEEP);
-	n->irq_block_no = block_no;
-	n->irq_block_next = sc->irq_blocks;
-	sc->irq_blocks = n;
+	n->irq_group_no = group_no;
+	n->irq_group_next = sc->irq_groups;
+	n->irq_sc = sc;
+	sc->irq_groups = n;
 	return n;
 }
 			  
-static struct exynos_combiner_irq_block *
-exynos_combiner_get_block(struct exynos_combiner_softc *sc, int block)
+static struct exynos_combiner_irq_group *
+exynos_combiner_get_group(struct exynos_combiner_softc *sc, int group_no)
 {
-	for (struct exynos_combiner_irq_block *b = sc->irq_blocks;
-	 b; b = b->irq_block_next) {
-		if (b->irq_block_no == block)
-			return b;
+	for (struct exynos_combiner_irq_group *g = sc->irq_groups;
+	 g; g = g->irq_group_next) {
+		if (g->irq_group_no == group_no)
+			return g;
 	}
 	return NULL;
 }
 
 static struct exynos_combiner_irq_entry *
-exynos_combiner_new_irq(struct exynos_combiner_irq_block *block,
+exynos_combiner_new_irq(struct exynos_combiner_irq_group *group,
 			int irq, bool mpsafe, int (*func)(void *), void *arg)
 {
 	struct exynos_combiner_irq_entry * n = kmem_zalloc(sizeof(*n),
 			   KM_SLEEP);
 	n->irq_no = irq;
 	n->irq_handler = func;
-	n->irq_next = block->irq_entries;
+	n->irq_next = group->irq_entries;
 	n->irq_arg = arg;
 	n->irq_mpsafe = mpsafe;
-	block->irq_entries = n;
+	

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

2018-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  2 12:18:32 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c

Log Message:
Cleanup of combiner driver and make it work (at least for MCT).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_combiner.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/samsung

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:28:40 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
Removed Files:
src/sys/arch/arm/samsung: exynos_chipid.c exynos_sysmmu.c

Log Message:
Delete chipid and sysmmu drivers, they don't do anything but print that
they are not implemented at attach time.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/samsung/exynos_chipid.c \
src/sys/arch/arm/samsung/exynos_sysmmu.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/files.exynos

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/samsung/files.exynos
diff -u src/sys/arch/arm/samsung/files.exynos:1.25 src/sys/arch/arm/samsung/files.exynos:1.26
--- src/sys/arch/arm/samsung/files.exynos:1.25	Sat Mar 17 18:34:09 2018
+++ src/sys/arch/arm/samsung/files.exynos	Sun Jul  1 23:28:40 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.exynos,v 1.25 2018/03/17 18:34:09 ryo Exp $
+#	$NetBSD: files.exynos,v 1.26 2018/07/01 23:28:40 jmcneill Exp $
 #
 # Configuration info for Samsung Exynos SoC ARM Peripherals
 #
@@ -50,16 +50,6 @@ device  exyointr
 attach  exyointr at fdt with exynos_intr
 file	arch/arm/samsung/exynos_combiner.c	exynos_intr
 
-# CHIP ID register
-device	chipid : fdtbus
-attach	chipid at fdt with exynos_chipid
-file	arch/arm/samsung/exynos_chipid.c	exynos_chipid
-
-# SYSMMU
-device	sysmmu : fdtbus
-attach	sysmmu at fdt with exynos_sysmmu
-file	arch/arm/samsung/exynos_sysmmu.c	exynos_sysmmu
-
 # real time clock
 device  exyortc : fdtbus
 attach  exyortc at fdt with exynos_rtc



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:28:40 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: files.exynos
Removed Files:
src/sys/arch/arm/samsung: exynos_chipid.c exynos_sysmmu.c

Log Message:
Delete chipid and sysmmu drivers, they don't do anything but print that
they are not implemented at attach time.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/samsung/exynos_chipid.c \
src/sys/arch/arm/samsung/exynos_sysmmu.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/files.exynos

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/samsung

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:21:43 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: mct.c

Log Message:
Add missing call to arm_fdt_timer_register


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/mct.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/samsung/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.12 src/sys/arch/arm/samsung/mct.c:1.13
--- src/sys/arch/arm/samsung/mct.c:1.12	Sun Jun 11 16:21:41 2017
+++ src/sys/arch/arm/samsung/mct.c	Sun Jul  1 23:21:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mct.c,v 1.12 2017/06/11 16:21:41 jmcneill Exp $	*/
+/*	$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.12 2017/06/11 16:21:41 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.13 2018/07/01 23:21:43 jmcneill Exp $");
 
 #include 
 #include 
@@ -176,4 +176,5 @@ mct_attach(device_t parent, device_t sel
 	config_found(self, , NULL);
 
 	arm_fdt_cpu_hatch_register(self, mct_fdt_cpu_hatch);
+	arm_fdt_timer_register(gtmr_cpu_initclocks);
 }



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

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 23:21:43 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: mct.c

Log Message:
Add missing call to arm_fdt_timer_register


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/mct.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/samsung

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:22:16 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_i2c.c

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_i2c.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/samsung

2018-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  1 21:22:16 UTC 2018

Modified Files:
src/sys/arch/arm/samsung: exynos_i2c.c

Log Message:
Use fdtbus_attach_i2cbus


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_i2c.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/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.14 src/sys/arch/arm/samsung/exynos_i2c.c:1.15
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.14	Wed May  9 02:53:00 2018
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Sun Jul  1 21:22:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.14 2018/05/09 02:53:00 thorpej Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.15 2018/07/01 21:22:16 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.14 2018/05/09 02:53:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.15 2018/07/01 21:22:16 jmcneill Exp $");
 
 #include 
 #include 
@@ -67,7 +67,6 @@ struct exynos_i2c_softc {
 	struct i2c_controller 	sc_ic;
 	kmutex_t		sc_lock;
 	kcondvar_t		sc_cv;
-	device_t		sc_i2cdev;
 };
 
 static int	exynos_i2c_intr(void *);
@@ -137,9 +136,6 @@ exynos_i2c_attach(device_t parent, devic
 struct exynos_i2c_softc * const sc =  device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	struct i2cbus_attach_args iba;
-	prop_dictionary_t devs;
-	uint32_t address_cells;
 	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
@@ -188,19 +184,7 @@ exynos_i2c_attach(device_t parent, devic
 
 	fdtbus_register_i2c_controller(self, phandle, _i2c_funcs);
 
-	devs = prop_dictionary_create();
-	if (of_getprop_uint32(phandle, "#address-cells", _cells))
-		address_cells = 1;
-	of_enter_i2c_devs(devs, phandle, address_cells * 4, 0);
-
-	memset(, 0, sizeof(iba));
-	iba.iba_tag = >sc_ic;
-	iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
-	if (iba.iba_child_devices != NULL)
-		prop_object_retain(iba.iba_child_devices);
-	prop_object_release(devs);
-
-	sc->sc_i2cdev = config_found_ia(self, "i2cbus", , iicbus_print);
+	fdtbus_attach_i2cbus(self, phandle, >sc_ic, iicbus_print);
 }
 
 static i2c_tag_t



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:27:45 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_i2c.c

Log Message:
No need to explicitly set pinctrl config 0 now


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_i2c.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/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.12 src/sys/arch/arm/samsung/exynos_i2c.c:1.13
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.12	Sun Jun 11 00:54:26 2017
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Sun Jul  2 18:27:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.12 2017/06/11 00:54:26 jmcneill Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.13 2017/07/02 18:27:45 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.12 2017/06/11 00:54:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.13 2017/07/02 18:27:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -177,8 +177,6 @@ exynos_i2c_attach(device_t parent, devic
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 	
-	fdtbus_pinctrl_set_config_index(phandle, 0);
-
 	sc->sc_ic.ic_cookie = sc;
 	sc->sc_ic.ic_acquire_bus = exynos_i2c_acquire_bus;
 	sc->sc_ic.ic_release_bus = exynos_i2c_release_bus;



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:27:45 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_i2c.c

Log Message:
No need to explicitly set pinctrl config 0 now


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_i2c.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/samsung

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:21:52 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_pinctrl.c

Log Message:
Configure pin defaults at attach


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:21:52 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_pinctrl.c

Log Message:
Configure pin defaults at attach


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.11 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.12
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.11	Sun Jul  2 16:19:46 2017
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Sun Jul  2 18:21:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.12 2017/07/02 18:21:52 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.12 2017/07/02 18:21:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -131,6 +131,8 @@ exynos_pinctrl_attach(device_t parent, d
 		   _pinctrl_controller_func);
 		}
 	}
+
+	fdtbus_pinctrl_configure();
 }
 
 static void



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 16:19:47 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_pinctrl.c

Log Message:
Adjust to new pinctrl API


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 16:19:47 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_pinctrl.c

Log Message:
Adjust to new pinctrl API


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.10 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.11
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.10	Thu Jun 22 06:42:38 2017
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Sun Jul  2 16:19:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.10 2017/06/22 06:42:38 skrll Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.10 2017/06/22 06:42:38 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,16 +55,15 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_pinct
 
 struct exynos_pinctrl_config {
 	int pc_phandle;
-	struct exynos_gpio_pin_cfg *pc_pincfg;
+	struct exynos_gpio_pin_cfg pc_pincfg;
 	struct exynos_pinctrl_softc *pc_sc;
 };
 
 static int exynos_pinctrl_match(device_t, cfdata_t, void *);
 static void exynos_pinctrl_attach(device_t, device_t, void *);
 
-static int  exynos_pinctrl_set_cfg(void *);
-static struct exynos_gpio_pin_cfg *
-exynos_parse_config(struct exynos_pinctrl_config *pc);
+static int  exynos_pinctrl_set_cfg(device_t, const void *, size_t);
+static void exynos_parse_config(int, struct exynos_gpio_pin_cfg *);
 
 static struct fdtbus_pinctrl_controller_func exynos_pinctrl_controller_func = {
 	.set_config = exynos_pinctrl_set_cfg
@@ -128,90 +127,59 @@ exynos_pinctrl_attach(device_t parent, d
 		}
 
 		if (is_pinctrl(child)) {
-			struct exynos_pinctrl_config *pc;
-			pc = kmem_alloc(sizeof(*pc), KM_SLEEP);
-			pc->pc_phandle = child;
-			pc->pc_sc = sc;
-			pc->pc_pincfg = exynos_parse_config(pc);
-			fdtbus_register_pinctrl_config(pc, child,
+			fdtbus_register_pinctrl_config(self, child,
 		   _pinctrl_controller_func);
 		}
 	}
 }
 
-static struct exynos_gpio_pin_cfg *
-exynos_parse_config(struct exynos_pinctrl_config *pc)
+static void
+exynos_parse_config(int phandle, struct exynos_gpio_pin_cfg *gc)
 {
-	struct exynos_gpio_pin_cfg *gc = kmem_zalloc(sizeof(*gc), KM_SLEEP);
-	int len;
-	int value;
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-function",
-			 , sizeof(value));
-	if (len > 0) {
-		gc->cfg = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-pud", ,
-			 sizeof());
-	if (len > 0) {
-		gc->pud = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-drv", ,
-			 sizeof());
-	if (len > 0) {
-		gc->drv = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-conpwd", ,
-			 sizeof());
-	if (len > 0) {
-		gc->conpwd = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-pudpwd", ,
-			 sizeof());
-	if (len > 0) {
-		gc->pudpwd = be32toh(value);
-	}
-	return gc;
+	of_getprop_uint32(phandle, "samsung,pin-function", >cfg);
+	of_getprop_uint32(phandle, "samsung,pin-pud", >pud);
+	of_getprop_uint32(phandle, "samsung,pin-drv", >drv);
+	of_getprop_uint32(phandle, "samsung,pin-conpwd", >conpwd);
+	of_getprop_uint32(phandle, "samsung,pin-pudpwd", >pudpwd);
 }
 
 static int
 exynos_do_config(struct exynos_pinctrl_config *pc)
 {
-	struct exynos_gpio_pin_cfg *gc = pc->pc_pincfg;
+	struct exynos_gpio_pin_cfg *gc = >pc_pincfg;
 	struct exynos_gpio_bank *bank;
-	int len;
-	char result[20];
+	const char *pins;
 
-	if (gc == NULL) {
-		printf("%s: No configuration available\n", __func__);
+	int pins_len = OF_getproplen(pc->pc_phandle, "samsung,pins");
+	if (pins_len <= 0)
 		return -1;
-	}
 
-	len = OF_getprop(pc->pc_phandle, "samsung,pins", result,
-			 sizeof(result));
-	if (len <= 0) {
-		printf("%s: couldn't get pins. (%d)\n", __func__,
-			pc->pc_phandle);
-		return -1;
-	}
-
-	bank = exynos_gpio_bank_lookup([0]);
-	if (!bank) {
-		printf("%s: Couldn't get bank \"%s\".\n", __func__, result);
-		return -1;
+	for (pins = fdtbus_get_string(pc->pc_phandle, "samsung,pins");
+	 pins_len > 0;
+	 pins_len -= strlen(pins) + 1, pins += strlen(pins) + 1) {
+		bank = exynos_gpio_bank_lookup(pins);
+		if (bank == NULL) {
+			aprint_error_dev(pc->pc_sc->sc_dev,
+			"unknown pin name '%s'\n", pins);
+			continue;
+		}
+		exynos_gpio_pin_ctl_write(bank, gc);
 	}
 
-	exynos_gpio_pin_ctl_write(bank, gc);
 	return 0;
 }
 	
 static int
-exynos_pinctrl_set_cfg(void *cookie)
+exynos_pinctrl_set_cfg(device_t dev, const void *data, size_t len)
 {
-	struct exynos_pinctrl_config *pc = cookie;
-	return exynos_do_config(pc);
+	struct 

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

2017-06-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jun 22 06:42:38 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c exynos_pinctrl.c

Log Message:
Add some compat strings


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung

2017-06-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jun 22 06:42:38 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c exynos_pinctrl.c

Log Message:
Add some compat strings


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/samsung/exynos_dwcmmc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.4 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.5
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.4	Mon Jun 19 22:03:50 2017
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Thu Jun 22 06:42:38 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.4 2017/06/19 22:03:50 jmcneill Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.5 2017/06/22 06:42:38 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.4 2017/06/19 22:03:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.5 2017/06/22 06:42:38 skrll Exp $");
 
 #include 
 #include 
@@ -68,6 +68,7 @@ CFATTACH_DECL_NEW(exynos_dwcmmc, sizeof(
 	exynos_dwcmmc_match, exynos_dwcmmc_attach, NULL, NULL);
 
 static const char * const exynos_dwcmmc_compat[] = {
+	"samsung,exynos5250-dw-mshc",
 	"samsung,exynos5420-dw-mshc-smu",
 	"samsung,exynos5420-dw-mshc",
 	NULL

Index: src/sys/arch/arm/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.9 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.10
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.9	Fri Jan  1 22:37:07 2016
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Thu Jun 22 06:42:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.9 2016/01/01 22:37:07 marty Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.10 2017/06/22 06:42:38 skrll Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.9 2016/01/01 22:37:07 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.10 2017/06/22 06:42:38 skrll Exp $");
 
 #include 
 #include 
@@ -76,8 +76,10 @@ CFATTACH_DECL_NEW(exynos_pinctrl, sizeof
 static int
 exynos_pinctrl_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = { "samsung,exynos5420-pinctrl",
-	NULL };
+	const char * const compatible[] = {
+	"samsung,exynos5410-pinctrl",
+	"samsung,exynos5420-pinctrl",
+	NULL };
 	struct fdt_attach_args * const faa = aux;
 	return of_match_compatible(faa->faa_phandle, compatible);
 }



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

2017-06-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 20 19:13:34 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Implement platform reset for exynos5


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_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/samsung/exynos_platform.c
diff -u src/sys/arch/arm/samsung/exynos_platform.c:1.5 src/sys/arch/arm/samsung/exynos_platform.c:1.6
--- src/sys/arch/arm/samsung/exynos_platform.c:1.5	Sun Jun 11 16:21:41 2017
+++ src/sys/arch/arm/samsung/exynos_platform.c	Tue Jun 20 19:13:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_platform.c,v 1.5 2017/06/11 16:21:41 jmcneill Exp $ */
+/* $NetBSD: exynos_platform.c,v 1.6 2017/06/20 19:13:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -33,7 +33,7 @@
 #include "ukbd.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.5 2017/06/11 16:21:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.6 2017/06/20 19:13:34 jmcneill Exp $");
 
 #include 
 #include 
@@ -57,6 +57,8 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_platf
 
 #include 
 
+#define	EXYNOS5_SWRESET_REG	0x10040400
+
 #define	DEVMAP_ALIGN(a)	((a) & ~L1_S_OFFSET)
 #define	DEVMAP_SIZE(s)	roundup2((s), L1_S_SIZE)
 #define	DEVMAP_ENTRY(va, pa, sz)			\
@@ -124,9 +126,13 @@ exynos_platform_device_register(device_t
 }
 
 static void
-exynos_platform_reset(void)
+exynos5_platform_reset(void)
 {
-	printf("%s: not implemented\n", __func__);
+	bus_space_tag_t bst = _generic_bs_tag;
+	bus_space_handle_t bsh;
+
+	bus_space_map(bst, EXYNOS5_SWRESET_REG, 4, 0, );
+	bus_space_write_4(bst, bsh, 0, 1);
 }
 
 static void
@@ -147,7 +153,7 @@ static const struct arm_platform exynos5
 	.init_attach_args = exynos_platform_init_attach_args,
 	.early_putchar = exynos_platform_early_putchar,
 	.device_register = exynos_platform_device_register,
-	.reset = exynos_platform_reset,
+	.reset = exynos5_platform_reset,
 	.delay = exynos_platform_delay,
 	.uart_freq = exynos_platform_uart_freq,
 };



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

2017-06-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 20 19:13:34 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_platform.c

Log Message:
Implement platform reset for exynos5


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_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/samsung

2017-06-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jun 20 17:43:51 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c

Log Message:
Fix a few typos in clock parent names for mmc clocks.

>From jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos5410_clock.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/samsung/exynos5410_clock.c
diff -u src/sys/arch/arm/samsung/exynos5410_clock.c:1.1 src/sys/arch/arm/samsung/exynos5410_clock.c:1.2
--- src/sys/arch/arm/samsung/exynos5410_clock.c:1.1	Tue Jun 20 13:21:45 2017
+++ src/sys/arch/arm/samsung/exynos5410_clock.c	Tue Jun 20 17:43:51 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5410_clock.c,v 1.1 2017/06/20 13:21:45 jmcneill Exp $ */
+/* $NetBSD: exynos5410_clock.c,v 1.2 2017/06/20 17:43:51 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.1 2017/06/20 13:21:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.2 2017/06/20 17:43:51 skrll Exp $");
 
 #include 
 #include 
@@ -322,11 +322,11 @@ static struct exynos_clk exynos5410_cloc
 	CLK_DIV("dout_mmc1", "mout_mmc1", EXYNOS5410_DIV_FSYS1, __BITS(19,16)),
 	CLK_DIV("dout_mmc2", "mout_mmc2", EXYNOS5410_DIV_FSYS2, __BITS(3,0)),
 
-	CLK_DIVF("dout_mmc_pre0", "div_mmc0", EXYNOS5410_DIV_FSYS1, __BITS(15,8),
+	CLK_DIVF("dout_mmc_pre0", "dout_mmc0", EXYNOS5410_DIV_FSYS1, __BITS(15,8),
 	CLK_SET_RATE_PARENT),
-	CLK_DIVF("dout_mmc_pre1", "div_mmc1", EXYNOS5410_DIV_FSYS1, __BITS(31,24),
+	CLK_DIVF("dout_mmc_pre1", "dout_mmc1", EXYNOS5410_DIV_FSYS1, __BITS(31,24),
 	CLK_SET_RATE_PARENT),
-	CLK_DIVF("dout_mmc_pre2", "div_mmc2", EXYNOS5410_DIV_FSYS2, __BITS(15,8),
+	CLK_DIVF("dout_mmc_pre2", "dout_mmc2", EXYNOS5410_DIV_FSYS2, __BITS(15,8),
 	CLK_SET_RATE_PARENT),
 
 	CLK_DIV("div_uart0", "mout_uart0", EXYNOS5410_DIV_PERIC0, __BITS(3,0)),
@@ -347,11 +347,11 @@ static struct exynos_clk exynos5410_cloc
 	CLK_GATE("rtc", "aclk66", EXYNOS5410_GATE_IP_PERIS, __BIT(20), 0),
 	CLK_GATE("tmu", "aclk66", EXYNOS5410_GATE_IP_PERIS, __BIT(21), 0),
 
-	CLK_GATE("sclk_mmc0", "div_mmc_pre0", EXYNOS5410_SRC_MASK_FSYS,
+	CLK_GATE("sclk_mmc0", "dout_mmc_pre0", EXYNOS5410_SRC_MASK_FSYS,
 	__BIT(0), CLK_SET_RATE_PARENT),
-	CLK_GATE("sclk_mmc1", "div_mmc_pre1", EXYNOS5410_SRC_MASK_FSYS,
+	CLK_GATE("sclk_mmc1", "dout_mmc_pre1", EXYNOS5410_SRC_MASK_FSYS,
 	__BIT(4), CLK_SET_RATE_PARENT),
-	CLK_GATE("sclk_mmc2", "div_mmc_pre2", EXYNOS5410_SRC_MASK_FSYS,
+	CLK_GATE("sclk_mmc2", "dout_mmc_pre2", EXYNOS5410_SRC_MASK_FSYS,
 	__BIT(8), CLK_SET_RATE_PARENT),
 
 	CLK_GATE("mmc0", "aclk200", EXYNOS5410_GATE_BUS_FSYS0, __BIT(12), 0),



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

2017-06-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jun 20 17:43:51 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c

Log Message:
Fix a few typos in clock parent names for mmc clocks.

>From jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos5410_clock.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/samsung

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 23:08:05 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_sysmmu.c

Log Message:
Fix dmesg


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_sysmmu.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/samsung/exynos_sysmmu.c
diff -u src/sys/arch/arm/samsung/exynos_sysmmu.c:1.1 src/sys/arch/arm/samsung/exynos_sysmmu.c:1.2
--- src/sys/arch/arm/samsung/exynos_sysmmu.c:1.1	Sun Jan  3 04:10:58 2016
+++ src/sys/arch/arm/samsung/exynos_sysmmu.c	Mon Jun 19 23:08:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_sysmmu.c,v 1.1 2016/01/03 04:10:58 marty Exp $ */
+/*	$NetBSD: exynos_sysmmu.c,v 1.2 2017/06/19 23:08:05 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_sysmmu.c,v 1.1 2016/01/03 04:10:58 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_sysmmu.c,v 1.2 2017/06/19 23:08:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -102,6 +102,10 @@ exynos_sysmmu_attach(device_t parent, de
 		return;
 	}
 
+	aprint_normal(" @ 0x%08x: SYSMMU -  NOT IMPLEMENTED", (uint)addr);
+	aprint_naive("\n");
+	aprint_normal("\n");
+
 	if (!fdtbus_intr_str(faa->faa_phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error_dev(self, "failed to decode interrupt\n");
 		return;
@@ -116,9 +120,6 @@ exynos_sysmmu_attach(device_t parent, de
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 
-	aprint_normal(" @ 0x%08x: SYSMMU -  NOT IMPLEMENTED", (uint)addr);
-	aprint_naive("\n");
-	aprint_normal("\n");
 
 }
 



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

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 23:08:05 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_sysmmu.c

Log Message:
Fix dmesg


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

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



  1   2   3   4   >