Module Name:    src
Committed By:   marty
Date:           Mon Dec 21 00:54:35 UTC 2015

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

Log Message:
XU4 FDT missed files


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_sscom.c \
    src/sys/arch/arm/samsung/mct.c
cvs rdiff -u -r1.3 -r1.4 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_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.1 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.2
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.1	Sat Dec 19 21:42:31 2015
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Mon Dec 21 00:54:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.1 2015/12/19 21:42:31 marty Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.2 2015/12/21 00:54:35 marty Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.1 2015/12/19 21:42:31 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.2 2015/12/21 00:54:35 marty Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -84,7 +84,7 @@ exynos_pinctrl_attach(device_t parent, d
 		return;
 	}
 
-	printf(" pinctl @ 0x%08x\n", (uint)addr);
+	aprint_normal(" pinctl @ 0x%08x", (uint)addr);
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
 	error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh);

Index: src/sys/arch/arm/samsung/exynos_sscom.c
diff -u src/sys/arch/arm/samsung/exynos_sscom.c:1.6 src/sys/arch/arm/samsung/exynos_sscom.c:1.7
--- src/sys/arch/arm/samsung/exynos_sscom.c:1.6	Thu Dec 17 22:39:37 2015
+++ src/sys/arch/arm/samsung/exynos_sscom.c	Mon Dec 21 00:54:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_sscom.c,v 1.6 2015/12/17 22:39:37 marty Exp $ */
+/*	$NetBSD: exynos_sscom.c,v 1.7 2015/12/21 00:54:35 marty Exp $ */
 
 /*
  * Copyright (c) 2014 Reinoud Zandijk
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.6 2015/12/17 22:39:37 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.7 2015/12/21 00:54:35 marty Exp $");
 
 #include "opt_sscom.h"
 #include "opt_ddb.h"
@@ -190,10 +190,10 @@ sscom_attach(device_t parent, device_t s
 		}
 		sc->sc_ioh = bsh;
 	} else {
-		printf(" (console) ");
+		aprint_normal(" (console) ");
 	}
 
-	printf("\n");
+	aprint_normal("\n");
 
 #if 0
 	void *ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL,
Index: src/sys/arch/arm/samsung/mct.c
diff -u src/sys/arch/arm/samsung/mct.c:1.6 src/sys/arch/arm/samsung/mct.c:1.7
--- src/sys/arch/arm/samsung/mct.c:1.6	Fri Dec 11 04:03:44 2015
+++ src/sys/arch/arm/samsung/mct.c	Mon Dec 21 00:54:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mct.c,v 1.6 2015/12/11 04:03:44 marty Exp $	*/
+/*	$NetBSD: mct.c,v 1.7 2015/12/21 00:54:35 marty Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.6 2015/12/11 04:03:44 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.7 2015/12/21 00:54:35 marty Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -49,6 +49,7 @@ __KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.6 
 #include <arm/samsung/mct_reg.h>
 #include <arm/samsung/mct_var.h>
 
+#include <dev/fdt/fdtvar.h>
 
 static int  mct_match(device_t, cfdata_t, void *);
 static void mct_attach(device_t, device_t, void *);
@@ -132,52 +133,45 @@ mct_write_global(struct mct_softc *sc, b
 static int
 mct_match(device_t parent, cfdata_t cf, void *aux)
 {
-	/* not used if Generic Timer is Available */
-	if (armreg_pfr1_read() & ARM_PFR1_GTIMER_MASK)
-		return 0;
-
-	/* sanity check, something is mixed up! */
-	if (!device_is_a(parent, "exyo"))
-		return 1;
-
-	/* there can only be one */
-	if (mct_sc.sc_dev != NULL)
-		return 0;
+	const char * const compatible[] = { "samsung,exynos4210-mct",
+					    NULL };
 
-	return 1;
+	struct fdt_attach_args * const faa = aux;
+	return of_match_compatible(faa->faa_phandle, compatible);
 }
 
 
 static void
 mct_attach(device_t parent, device_t self, void *aux)
 {
-	struct exyo_attach_args *exyo = (struct exyo_attach_args *) aux;
 	struct mct_softc * const sc = &mct_sc;
-	prop_dictionary_t dict = device_properties(self);
-	char freqbuf[sizeof("XXX SHz")];
-	const char *pin_name;
+//	prop_dictionary_t dict = device_properties(self);
+//	char freqbuf[sizeof("XXX SHz")];
+	struct fdt_attach_args * const faa = aux;
+	bus_addr_t addr;
+	bus_size_t size;
+	int error;
+
+	if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) {
+		aprint_error(": couldn't get registers\n");
+		return;
+	}
 
 	self->dv_private = sc;
 	sc->sc_dev = self;
-	sc->sc_bst = exyo->exyo_core_bst;
-	sc->sc_irq = exyo->exyo_loc.loc_intr;
-
-	bus_space_subregion(sc->sc_bst, exyo->exyo_core_bsh,
-		exyo->exyo_loc.loc_offset, exyo->exyo_loc.loc_size, &sc->sc_bsh);
-
-	KASSERTMSG(sc->sc_bsh,
-		"%s: can't map in registers for %#x + %#x for device %s\n",
-		__func__,
-		(uint32_t) exyo->exyo_loc.loc_offset,
-		(uint32_t) exyo->exyo_loc.loc_size,
-		device_xname(sc->sc_dev));
-
-	prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq);
-
-	humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);
+	sc->sc_bst = faa->faa_bst;
+	/* MJF: Need to get irq from the dtd */
+//	sc->sc_irq = exyo->exyo_loc.loc_intr;
+
+	error = bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh);
+	if (error) {
+		aprint_error(": couldn't map %#llx: %d",
+			     (uint64_t)addr, error);
+		return;
+	}
 
 	aprint_naive("\n");
-	aprint_normal(": Exynos SoC multi core timer (64 bits) (%s)\n", freqbuf);
+	aprint_normal(": Exynos SoC multi core timer (64 bits)\n");
 
 	evcnt_attach_dynamic(&sc->sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL,
 		device_xname(self), "missing interrupts");
@@ -187,21 +181,6 @@ mct_attach(device_t parent, device_t sel
 	if (sc->sc_global_ih == NULL)
 		panic("%s: unable to register timer interrupt", __func__);
 	aprint_normal_dev(sc->sc_dev, "interrupting on irq %d\n", sc->sc_irq);
-
-#if 0
-	/* blink led */
-	if (prop_dictionary_get_cstring_nocopy(dict, "heartbeat", &pin_name)) {
-		if (!exynos_gpio_pin_reserve(pin_name, &sc->sc_gpio_led)) {
-			aprint_error_dev(self,
-				"failed to reserve GPIO \"%s\" "
-				"for heartbeat led\n", pin_name);
-		} else {
-			sc->sc_has_blink_led = true;
-			sc->sc_led_state = false;
-			sc->sc_led_timer = hz;
-		}
-	}
-#endif
 }
 
 
@@ -240,18 +219,6 @@ clockhandler(void *arg)
 	sc->sc_lastintr = now;
 	hardclock(cf);
 
-	if (sc->sc_has_blink_led) {
-		/* we could subtract `periods' here */
-		sc->sc_led_timer = sc->sc_led_timer - 1;
-		if (sc->sc_led_timer <= 0) {
-			sc->sc_led_state = !sc->sc_led_state;
-			exynos_gpio_pindata_write(&sc->sc_gpio_led,
-				sc->sc_led_state);
-			while (sc->sc_led_timer <= 0)
-				sc->sc_led_timer += hz;
-		}
-	}
-
 	/* handled */
 	return 1;
 }

Index: src/sys/arch/arm/samsung/mct_var.h
diff -u src/sys/arch/arm/samsung/mct_var.h:1.3 src/sys/arch/arm/samsung/mct_var.h:1.4
--- src/sys/arch/arm/samsung/mct_var.h:1.3	Fri Sep  5 08:01:05 2014
+++ src/sys/arch/arm/samsung/mct_var.h	Mon Dec 21 00:54:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mct_var.h,v 1.3 2014/09/05 08:01:05 skrll Exp $	*/
+/*	$NetBSD: mct_var.h,v 1.4 2015/12/21 00:54:35 marty Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -49,11 +49,6 @@ static struct mct_softc {
 	uint32_t		 sc_autoinc;
 	struct evcnt		 sc_ev_missing_ticks;
 
-	/* blinking led */
-	bool			 sc_has_blink_led;
-	struct exynos_gpio_pindata sc_gpio_led;
-	bool			 sc_led_state;
-	int			 sc_led_timer;
 } mct_sc;
 
 void mct_init_cpu_clock(struct cpu_info *ci);

Reply via email to