Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/samsung XU4 FDT missed files



details:   https://anonhg.NetBSD.org/src/rev/4563ef3d3842
branches:  trunk
changeset: 342412:4563ef3d3842
user:      marty <marty%NetBSD.org@localhost>
date:      Mon Dec 21 00:54:35 2015 +0000

description:
XU4 FDT missed files

diffstat:

 sys/arch/arm/samsung/exynos_pinctrl.c |   6 +-
 sys/arch/arm/samsung/exynos_sscom.c   |   8 +-
 sys/arch/arm/samsung/mct.c            |  89 +++++++++++-----------------------
 sys/arch/arm/samsung/mct_var.h        |   7 +--
 4 files changed, 36 insertions(+), 74 deletions(-)

diffs (224 lines):

diff -r 4fb3675ee5de -r 4563ef3d3842 sys/arch/arm/samsung/exynos_pinctrl.c
--- a/sys/arch/arm/samsung/exynos_pinctrl.c     Mon Dec 21 00:52:50 2015 +0000
+++ b/sys/arch/arm/samsung/exynos_pinctrl.c     Mon Dec 21 00:54:35 2015 +0000
@@ -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 @@
                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);
diff -r 4fb3675ee5de -r 4563ef3d3842 sys/arch/arm/samsung/exynos_sscom.c
--- a/sys/arch/arm/samsung/exynos_sscom.c       Mon Dec 21 00:52:50 2015 +0000
+++ b/sys/arch/arm/samsung/exynos_sscom.c       Mon Dec 21 00:54:35 2015 +0000
@@ -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 @@
                }
                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,
diff -r 4fb3675ee5de -r 4563ef3d3842 sys/arch/arm/samsung/mct.c
--- a/sys/arch/arm/samsung/mct.c        Mon Dec 21 00:52:50 2015 +0000
+++ b/sys/arch/arm/samsung/mct.c        Mon Dec 21 00:54:35 2015 +0000
@@ -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 @@
 #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 @@
 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;
+       const char * const compatible[] = { "samsung,exynos4210-mct",
+                                           NULL };
 
-       /* 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;
-
-       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);
+       sc->sc_bst = faa->faa_bst;
+       /* MJF: Need to get irq from the dtd */
+//     sc->sc_irq = exyo->exyo_loc.loc_intr;
 
-       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);
+       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 @@
        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 @@
        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;
 }
diff -r 4fb3675ee5de -r 4563ef3d3842 sys/arch/arm/samsung/mct_var.h
--- a/sys/arch/arm/samsung/mct_var.h    Mon Dec 21 00:52:50 2015 +0000
+++ b/sys/arch/arm/samsung/mct_var.h    Mon Dec 21 00:54:35 2015 +0000
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index