Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/arch Pull up following revision(s) (requested by skrl...
details: https://anonhg.NetBSD.org/src/rev/17d2f348e576
branches: netbsd-9
changeset: 1000673:17d2f348e576
user: martin <martin%NetBSD.org@localhost>
date: Thu Aug 15 09:49:49 2019 +0000
description:
Pull up following revision(s) (requested by skrll in ticket #55):
sys/arch/arm/cortex/a9wdt.c: revision 1.10
sys/arch/evbarm/conf/HUMMINGBOARD: revision 1.9
sys/arch/evbarm/conf/GENERIC: revision 1.50
sys/arch/evbarm/conf/NITROGEN6X: revision 1.24
sys/arch/arm/cortex/a9tmr_var.h: revision 1.7
sys/arch/arm/fdt/files.fdt: revision 1.29
sys/arch/arm/amlogic/meson_platform.c: revision 1.12
sys/arch/arm/amlogic/meson8b_pinctrl.c: revision 1.2
sys/arch/arm/amlogic/meson_platform.c: revision 1.13
sys/arch/evbarm/conf/BCM5301X: revision 1.34
sys/arch/arm/dts/meson8b.dtsi: revision 1.6
sys/arch/arm/fdt/a9ptmr_fdt.c: revision 1.1
sys/arch/arm/dts/meson8b.dtsi: revision 1.7
sys/arch/arm/cortex/a9ptmr_var.h: revision 1.1
sys/arch/evbarm/conf/PANDABOARD: revision 1.30
sys/arch/evbarm/conf/DUOVERO: revision 1.14
sys/arch/arm/cortex/a9ptmr.c: revision 1.1
sys/arch/arm/cortex/a9ptmr.c: revision 1.2
sys/arch/arm/fdt/a9wdt_fdt.c: revision 1.1
sys/arch/evbarm/conf/BCM56340: revision 1.19
sys/arch/evbarm/conf/CUBOX-I: revision 1.23
sys/arch/arm/amlogic/meson8b_clkc.c: revision 1.4
sys/arch/evbarm/conf/PARALLELLA: revision 1.7
sys/arch/arm/cortex/files.cortex: revision 1.12
sys/arch/arm/dts/meson8b-odroidc1.dts: revision 1.4
sys/arch/arm/cortex/a9wdt.c: revision 1.9
sys/arch/evbarm/conf/ZEDBOARD: revision 1.6
spaces to tab
-
Add a driver for the A5/A9 Private timer.
While here FDTise the Watchdog driver.
-
Update for recent a9wdt changes
-
Trailing whitespace
-
Updates to get Odroid-C1 in better shape since the last DTS import
-
Various fixes / changes
- don't use prescaler
- improve AB_DEBUG output
- fix a9ptmr_delay to work with a decrementing counter!
Thanks to jmcneill@ for proving I'm an idiot
-
Add eth_rxd3 and eth_rxd2 pinctrl groups
-
Catch up to recent mainline dts changes
diffstat:
sys/arch/arm/amlogic/meson8b_clkc.c | 17 +-
sys/arch/arm/amlogic/meson8b_pinctrl.c | 6 +-
sys/arch/arm/amlogic/meson_platform.c | 8 +-
sys/arch/arm/cortex/a9ptmr.c | 267 +++++++++++++++++++++++++++++++++
sys/arch/arm/cortex/a9ptmr_var.h | 45 +++++
sys/arch/arm/cortex/a9tmr_var.h | 5 +-
sys/arch/arm/cortex/a9wdt.c | 10 +-
sys/arch/arm/cortex/files.cortex | 13 +-
sys/arch/arm/dts/meson8b-odroidc1.dts | 12 +-
sys/arch/arm/dts/meson8b.dtsi | 89 +----------
sys/arch/arm/fdt/a9ptmr_fdt.c | 141 +++++++++++++++++
sys/arch/arm/fdt/a9wdt_fdt.c | 122 +++++++++++++++
sys/arch/arm/fdt/files.fdt | 10 +-
sys/arch/evbarm/conf/BCM5301X | 4 +-
sys/arch/evbarm/conf/BCM56340 | 4 +-
sys/arch/evbarm/conf/CUBOX-I | 4 +-
sys/arch/evbarm/conf/DUOVERO | 4 +-
sys/arch/evbarm/conf/GENERIC | 4 +-
sys/arch/evbarm/conf/HUMMINGBOARD | 4 +-
sys/arch/evbarm/conf/NITROGEN6X | 4 +-
sys/arch/evbarm/conf/PANDABOARD | 4 +-
sys/arch/evbarm/conf/PARALLELLA | 4 +-
sys/arch/evbarm/conf/ZEDBOARD | 4 +-
23 files changed, 649 insertions(+), 136 deletions(-)
diffs (truncated from 1137 to 300 lines):
diff -r 38cee1fca78f -r 17d2f348e576 sys/arch/arm/amlogic/meson8b_clkc.c
--- a/sys/arch/arm/amlogic/meson8b_clkc.c Tue Aug 13 14:59:01 2019 +0000
+++ b/sys/arch/arm/amlogic/meson8b_clkc.c Thu Aug 15 09:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson8b_clkc.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson8b_clkc.c,v 1.3.6.1 2019/08/15 09:49:49 martin Exp $ */
/*-
* Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: meson8b_clkc.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: meson8b_clkc.c,v 1.3.6.1 2019/08/15 09:49:49 martin Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -74,6 +74,7 @@
static void meson8b_clkc_attach(device_t, device_t, void *);
static const char * const compatible[] = {
+ "amlogic,meson8-clkc",
"amlogic,meson8b-clkc",
NULL
};
@@ -333,18 +334,12 @@
{
struct meson_clk_softc * const sc = device_private(self);
struct fdt_attach_args * const faa = aux;
- bus_addr_t addr;
- bus_size_t size;
sc->sc_dev = self;
sc->sc_phandle = faa->faa_phandle;
- sc->sc_bst = faa->faa_bst;
- if (fdtbus_get_reg(sc->sc_phandle, MESON8B_CLKC_REG_INDEX, &addr, &size) != 0) {
- aprint_error(": couldn't get registers\n");
- return;
- }
- if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
- aprint_error(": couldn't map registers\n");
+ sc->sc_syscon = fdtbus_syscon_lookup(OF_parent(sc->sc_phandle));
+ if (sc->sc_syscon == NULL) {
+ aprint_error(": couldn't get syscon registers\n");
return;
}
diff -r 38cee1fca78f -r 17d2f348e576 sys/arch/arm/amlogic/meson8b_pinctrl.c
--- a/sys/arch/arm/amlogic/meson8b_pinctrl.c Tue Aug 13 14:59:01 2019 +0000
+++ b/sys/arch/arm/amlogic/meson8b_pinctrl.c Thu Aug 15 09:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson8b_pinctrl.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $ */
+/* $NetBSD: meson8b_pinctrl.c,v 1.1.8.1 2019/08/15 09:49:49 martin Exp $ */
/*-
* Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson8b_pinctrl.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson8b_pinctrl.c,v 1.1.8.1 2019/08/15 09:49:49 martin Exp $");
#include <sys/param.h>
@@ -481,6 +481,8 @@
{ "eth_ref_clk", REG6, 8, { DIF_3_N }, 1 },
{ "eth_mdc", REG6, 9, { DIF_4_P }, 1 },
{ "eth_mdio_en", REG6, 10, { DIF_4_N }, 1 },
+ { "eth_rxd3", REG7, 22, { DIF_2_P }, 1 },
+ { "eth_rxd2", REG7, 23, { DIF_2_N }, 1 },
};
static const struct meson_pinctrl_group meson8b_aobus_groups[] = {
diff -r 38cee1fca78f -r 17d2f348e576 sys/arch/arm/amlogic/meson_platform.c
--- a/sys/arch/arm/amlogic/meson_platform.c Tue Aug 13 14:59:01 2019 +0000
+++ b/sys/arch/arm/amlogic/meson_platform.c Thu Aug 15 09:49:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.11 2019/04/21 15:57:33 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.11.4.1 2019/08/15 09:49:49 martin Exp $ */
/*-
* Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
#include "arml2cc.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.11 2019/04/21 15:57:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.11.4.1 2019/08/15 09:49:49 martin Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -256,7 +256,7 @@
strcat(boot_args, rootarg);
}
}
-
+
meson_platform_device_register(self, aux);
}
#endif
@@ -447,7 +447,7 @@
.ap_init_attach_args = meson_platform_init_attach_args,
.ap_device_register = meson8b_platform_device_register,
.ap_reset = meson8b_platform_reset,
- .ap_delay = a9tmr_delay,
+ .ap_delay = a9ptmr_delay,
.ap_uart_freq = meson_platform_uart_freq,
.ap_mpstart = meson8b_mpstart,
};
diff -r 38cee1fca78f -r 17d2f348e576 sys/arch/arm/cortex/a9ptmr.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/cortex/a9ptmr.c Thu Aug 15 09:49:49 2019 +0000
@@ -0,0 +1,267 @@
+/* $NetBSD: a9ptmr.c,v 1.2.2.2 2019/08/15 09:49:49 martin Exp $ */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: a9ptmr.c,v 1.2.2.2 2019/08/15 09:49:49 martin Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/cpu.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+
+#include <prop/proplib.h>
+
+#include <arm/cortex/a9tmr_reg.h>
+#include <arm/cortex/a9ptmr_var.h>
+
+#include <arm/cortex/mpcore_var.h>
+
+static struct a9ptmr_softc *a9ptmr_sc;
+
+static int a9ptmr_match(device_t, cfdata_t, void *);
+static void a9ptmr_attach(device_t, device_t, void *);
+
+struct a9ptmr_softc {
+ device_t sc_dev;
+ bus_space_tag_t sc_memt;
+ bus_space_handle_t sc_memh;
+
+ uint32_t sc_ctl;
+ uint32_t sc_freq;
+ uint32_t sc_load;
+
+ uint32_t sc_prescaler;
+};
+
+
+CFATTACH_DECL_NEW(arma9ptmr, sizeof(struct a9ptmr_softc),
+ a9ptmr_match, a9ptmr_attach, NULL, NULL);
+
+static bool attached;
+
+static inline uint32_t
+a9ptmr_read(struct a9ptmr_softc *sc, bus_size_t o)
+{
+ return bus_space_read_4(sc->sc_memt, sc->sc_memh, o);
+}
+
+static inline void
+a9ptmr_write(struct a9ptmr_softc *sc, bus_size_t o, uint32_t v)
+{
+ bus_space_write_4(sc->sc_memt, sc->sc_memh, o, v);
+}
+
+/* ARGSUSED */
+static int
+a9ptmr_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct mpcore_attach_args * const mpcaa = aux;
+
+ if (attached)
+ return 0;
+
+ if (!CPU_ID_CORTEX_A9_P(curcpu()->ci_arm_cpuid) &&
+ !CPU_ID_CORTEX_A5_P(curcpu()->ci_arm_cpuid))
+ return 0;
+
+ if (strcmp(mpcaa->mpcaa_name, cf->cf_name) != 0)
+ return 0;
+
+#if 0
+ /*
+ * This isn't present on UP A9s (since CBAR isn't present).
+ */
+ uint32_t mpidr = armreg_mpidr_read();
+ if (mpidr == 0 || (mpidr & MPIDR_U))
+ return 0;
+#endif
+
+ return 1;
+}
+
+
+static void
+a9ptmr_attach(device_t parent, device_t self, void *aux)
+{
+ struct a9ptmr_softc * const sc = device_private(self);
+ struct mpcore_attach_args * const mpcaa = aux;
+ prop_dictionary_t dict = device_properties(self);
+ char freqbuf[sizeof("XXX SHz")];
+ const char *cpu_type;
+
+
+ sc->sc_dev = self;
+ sc->sc_memt = mpcaa->mpcaa_memt;
+
+ bus_space_subregion(sc->sc_memt, mpcaa->mpcaa_memh,
+ mpcaa->mpcaa_off1, TMR_PRIVATE_SIZE, &sc->sc_memh);
+
+ /*
+ * This runs at the ARM PERIPHCLOCK.
+ * The MD code should have setup our frequency for us.
+ */
+ if (!prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq)) {
+ dict = device_properties(parent);
+ prop_dictionary_get_uint32(dict, "frequency", &sc->sc_freq);
+ }
+
+ humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);
+
+ a9ptmr_sc = sc;
+ sc->sc_dev = self;
+ sc->sc_memt = mpcaa->mpcaa_memt;
+ sc->sc_memh = mpcaa->mpcaa_memh;
+
+ sc->sc_ctl = a9ptmr_read(sc, TMR_CTL);
+
+ sc->sc_prescaler = 1;
+#if 0
+ /*
+ * Let's hope the timer frequency isn't prime.
+ */
+ for (size_t div = 256; div >= 2; div--) {
+ if (sc->sc_freq % div == 0) {
+ sc->sc_prescaler = div;
+ break;
+ }
+ }
+ sc->sc_freq /= sc->sc_prescaler;
+#endif
+
+ aprint_debug(": freq %d prescaler %d", sc->sc_freq,
+ sc->sc_prescaler);
+ sc->sc_ctl = TMR_CTL_INT_ENABLE | TMR_CTL_AUTO_RELOAD | TMR_CTL_ENABLE;
+ sc->sc_ctl |= __SHIFTIN(sc->sc_prescaler - 1, TMR_CTL_PRESCALER);
+
+ sc->sc_load = (sc->sc_freq / hz) - 1;
+
+ aprint_debug(": load %d ", sc->sc_load);
+
+ a9ptmr_init_cpu_clock(curcpu());
+
+ aprint_naive("\n");
+ if (CPU_ID_CORTEX_A5_P(curcpu()->ci_arm_cpuid)) {
+ cpu_type = "A5";
+ } else {
+ cpu_type = "A9";
+ }
+ aprint_normal(": %s Private Timer (%s)\n", cpu_type, freqbuf);
+
+ attached = true;
+}
+
+
+
+void
+a9ptmr_delay(unsigned int n)
Home |
Main Index |
Thread Index |
Old Index