Module Name: src
Committed By: jmcneill
Date: Sun May 28 00:40:21 UTC 2017
Modified Files:
src/sys/arch/arm/fdt: files.fdt gic_fdt.c
src/sys/arch/arm/nvidia: files.tegra tegra_var.h
src/sys/arch/evbarm/conf: TEGRA
src/sys/arch/evbarm/tegra: tegra_machdep.c
Added Files:
src/sys/arch/arm/fdt: armv7_fdt.c cpu_fdt.c gtmr_fdt.c
Removed Files:
src/sys/arch/arm/nvidia: tegra_fdt.c
Log Message:
Enumerate CPUs, GIC, and generic timer using FDT data instead of relying
on hard-coded tables in mainbus.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/armv7_fdt.c \
src/sys/arch/arm/fdt/cpu_fdt.c src/sys/arch/arm/fdt/gtmr_fdt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/fdt/gic_fdt.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/nvidia/files.tegra \
src/sys/arch/arm/nvidia/tegra_var.h
cvs rdiff -u -r1.5 -r0 src/sys/arch/arm/nvidia/tegra_fdt.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbarm/tegra/tegra_machdep.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/fdt/files.fdt
diff -u src/sys/arch/arm/fdt/files.fdt:1.1 src/sys/arch/arm/fdt/files.fdt:1.2
--- src/sys/arch/arm/fdt/files.fdt:1.1 Sun Dec 13 17:45:37 2015
+++ src/sys/arch/arm/fdt/files.fdt Sun May 28 00:40:20 2017
@@ -1,5 +1,16 @@
-# $NetBSD: files.fdt,v 1.1 2015/12/13 17:45:37 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.2 2017/05/28 00:40:20 jmcneill Exp $
-device gic
+device armv7fdt { }: bus_space_generic, fdtbus
+attach armv7fdt at root with armv7_fdt
+file arch/arm/fdt/armv7_fdt.c armv7_fdt
+
+attach cpu at cpus with cpu_fdt
+file arch/arm/fdt/cpu_fdt.c cpu_fdt
+
+device gtmr: mpcorebus
+attach gtmr at fdt with gtmr_fdt
+file arch/arm/fdt/gtmr_fdt.c gtmr_fdt
+
+device gic: mpcorebus
attach gic at fdt with gic_fdt
file arch/arm/fdt/gic_fdt.c gic_fdt
Index: src/sys/arch/arm/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.2 src/sys/arch/arm/fdt/gic_fdt.c:1.3
--- src/sys/arch/arm/fdt/gic_fdt.c:1.2 Tue Jan 5 21:53:48 2016
+++ src/sys/arch/arm/fdt/gic_fdt.c Sun May 28 00:40:20 2017
@@ -1,7 +1,7 @@
-/* $NetBSD: gic_fdt.c,v 1.2 2016/01/05 21:53:48 marty Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.3 2017/05/28 00:40:20 jmcneill Exp $ */
/*-
- * Copyright (c) 2015 Jared D. McNeill <[email protected]>
+ * Copyright (c) 2015-2017 Jared McNeill <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.2 2016/01/05 21:53:48 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.3 2017/05/28 00:40:20 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v
#include <sys/kmem.h>
#include <arm/cortex/gic_intr.h>
+#include <arm/cortex/mpcore_var.h>
#include <dev/fdt/fdtvar.h>
@@ -83,6 +84,9 @@ gic_fdt_attach(device_t parent, device_t
{
struct gic_fdt_softc * const sc = device_private(self);
struct fdt_attach_args * const faa = aux;
+ bus_addr_t addr_d, addr_c;
+ bus_size_t size_d, size_c;
+ bus_space_handle_t bsh;
int error;
sc->sc_dev = self;
@@ -97,6 +101,34 @@ gic_fdt_attach(device_t parent, device_t
aprint_naive("\n");
aprint_normal(": GIC\n");
+
+ if (fdtbus_get_reg(sc->sc_phandle, 0, &addr_d, &size_d) != 0) {
+ aprint_error(": couldn't get distributor address\n");
+ return;
+ }
+ if (fdtbus_get_reg(sc->sc_phandle, 1, &addr_c, &size_c) != 0) {
+ aprint_error(": couldn't get cpu interface address\n");
+ return;
+ }
+
+ const bus_addr_t addr = addr_d;
+ const bus_size_t size = (addr_c + size_c) - addr_d;
+
+ error = bus_space_map(faa->faa_bst, addr, size, 0, &bsh);
+ if (error) {
+ aprint_error(": couldn't map registers: %d\n", error);
+ return;
+ }
+
+ struct mpcore_attach_args mpcaa = {
+ .mpcaa_name = "armgic",
+ .mpcaa_memt = faa->faa_bst,
+ .mpcaa_memh = bsh,
+ .mpcaa_off1 = 0,
+ .mpcaa_off2 = addr_c - addr_d
+ };
+
+ config_found(self, &mpcaa, NULL);
}
static void *
Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.36 src/sys/arch/arm/nvidia/files.tegra:1.37
--- src/sys/arch/arm/nvidia/files.tegra:1.36 Thu May 25 23:26:48 2017
+++ src/sys/arch/arm/nvidia/files.tegra Sun May 28 00:40:20 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.tegra,v 1.36 2017/05/25 23:26:48 jmcneill Exp $
+# $NetBSD: files.tegra,v 1.37 2017/05/28 00:40:20 jmcneill Exp $
#
# Configuration info for NVIDIA Tegra ARM Peripherals
#
@@ -11,13 +11,9 @@ file arch/arm/arm32/arm32_kvminit.c
file arch/arm/arm32/arm32_reboot.c
file arch/arm/arm32/irq_dispatch.S
file arch/arm/arm32/armv7_generic_space.c
+file arch/arm/arm32/armv7_generic_dma.c
file arch/arm/arm/bus_space_a4x.S
-# Devicetree
-device tegrafdt : bus_space_generic, fdtbus
-attach tegrafdt at mainbus with tegra_fdt
-file arch/arm/nvidia/tegra_fdt.c tegra_fdt
-
file arch/arm/nvidia/tegra_soc.c
file arch/arm/nvidia/tegra_cpufreq.c
Index: src/sys/arch/arm/nvidia/tegra_var.h
diff -u src/sys/arch/arm/nvidia/tegra_var.h:1.36 src/sys/arch/arm/nvidia/tegra_var.h:1.37
--- src/sys/arch/arm/nvidia/tegra_var.h:1.36 Sat May 27 20:26:44 2017
+++ src/sys/arch/arm/nvidia/tegra_var.h Sun May 28 00:40:20 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_var.h,v 1.36 2017/05/27 20:26:44 jmcneill Exp $ */
+/* $NetBSD: tegra_var.h,v 1.37 2017/05/28 00:40:20 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <[email protected]>
@@ -39,7 +39,6 @@ extern struct bus_space armv7_generic_bs
extern struct bus_space armv7_generic_a4x_bs_tag;
extern bus_space_handle_t tegra_ppsb_bsh;
extern bus_space_handle_t tegra_apb_bsh;
-extern struct arm32_bus_dma_tag tegra_dma_tag;
#define CHIP_ID_TEGRA20 0x20
#define CHIP_ID_TEGRA30 0x30
Index: src/sys/arch/evbarm/conf/TEGRA
diff -u src/sys/arch/evbarm/conf/TEGRA:1.19 src/sys/arch/evbarm/conf/TEGRA:1.20
--- src/sys/arch/evbarm/conf/TEGRA:1.19 Sat Apr 29 11:02:17 2017
+++ src/sys/arch/evbarm/conf/TEGRA Sun May 28 00:40:21 2017
@@ -1,5 +1,5 @@
#
-# $NetBSD: TEGRA,v 1.19 2017/04/29 11:02:17 jmcneill Exp $
+# $NetBSD: TEGRA,v 1.20 2017/05/28 00:40:21 jmcneill Exp $
#
# NVIDIA Tegra K1 (T124)
#
@@ -27,18 +27,14 @@ makeoptions COPY_SYMTAB=1
config netbsd root on ? type ?
-mainbus0 at root
-cpu* at mainbus?
-
-# A15 core devices
-armperiph0 at mainbus?
-armgic0 at armperiph? # Interrupt Controller
-armgtmr0 at armperiph? # ARM Generic Timer
-
-# On-board I/O
-tegrafdt0 at mainbus?
+# Device tree support
+armv7fdt0 at root
fdt* at fdtbus?
+# CPUs
+cpus* at fdt? pass 0
+cpu* at cpus?
+
# CPU frequency scaling
tegra124cpu* at fdt?
@@ -46,9 +42,15 @@ fclock* at fdt? pass 4
fregulator* at fdt? pass 4
gpiokeys* at fdt?
+# Timer
+gtmr* at fdt? pass 1 # ARM Generic Timer
+armgtmr0 at gtmr?
+tegratimer* at fdt? # Timers
+
# Interrupt controller
tegralic* at fdt? pass 1 # LIC
gic* at fdt? pass 1 # GIC
+armgic0 at gic?
# Memory controller
tegramc* at fdt? pass 4 # MC
@@ -69,9 +71,6 @@ tegra124car* at fdt? pass 3 # CAR
tegragpio* at fdt? pass 2 # GPIO
gpio* at gpiobus?
-# Timers
-tegratimer* at fdt? # Timers
-
# MPIO / Pinmux
tegrampio* at fdt? # MPIO
Index: src/sys/arch/evbarm/tegra/tegra_machdep.c
diff -u src/sys/arch/evbarm/tegra/tegra_machdep.c:1.43 src/sys/arch/evbarm/tegra/tegra_machdep.c:1.44
--- src/sys/arch/evbarm/tegra/tegra_machdep.c:1.43 Sat May 27 20:26:27 2017
+++ src/sys/arch/evbarm/tegra/tegra_machdep.c Sun May 28 00:40:21 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.43 2017/05/27 20:26:27 jmcneill Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.44 2017/05/28 00:40:21 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.43 2017/05/27 20:26:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.44 2017/05/28 00:40:21 jmcneill Exp $");
#include "opt_tegra.h"
#include "opt_machdep.h"
@@ -73,7 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machde
#include <arm/undefined.h>
#include <arm/arm32/machdep.h>
-#include <arm/mainbus/mainbus.h>
#include <arm/nvidia/tegra_reg.h>
#include <arm/nvidia/tegra_var.h>
@@ -452,18 +451,6 @@ tegra_device_register(device_t self, voi
{
prop_dictionary_t dict = device_properties(self);
- if (device_is_a(self, "armperiph")
- && device_is_a(device_parent(self), "mainbus")) {
- struct mainbus_attach_args * const mb = aux;
- mb->mb_iot = &armv7_generic_bs_tag;
- return;
- }
-
- if (device_is_a(self, "armgtmr")) {
- prop_dictionary_set_uint32(dict, "frequency", TEGRA_REF_FREQ);
- return;
- }
-
if (device_is_a(self, "tegrafb")
&& tegra_bootconf_match("console", "fb")) {
prop_dictionary_set_bool(dict, "is_console", true);
Added files:
Index: src/sys/arch/arm/fdt/armv7_fdt.c
diff -u /dev/null src/sys/arch/arm/fdt/armv7_fdt.c:1.1
--- /dev/null Sun May 28 00:40:21 2017
+++ src/sys/arch/arm/fdt/armv7_fdt.c Sun May 28 00:40:20 2017
@@ -0,0 +1,78 @@
+/* $NetBSD: armv7_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared D. McNeill <[email protected]>
+ * 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 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: armv7_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/cpu.h>
+#include <sys/bus.h>
+
+#include <dev/fdt/fdtvar.h>
+#include <dev/ofw/openfirm.h>
+
+static int armv7_fdt_match(device_t, cfdata_t, void *);
+static void armv7_fdt_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(armv7_fdt, 0,
+ armv7_fdt_match, armv7_fdt_attach, NULL, NULL);
+
+static bool armv7_fdt_found = false;
+
+extern struct bus_space armv7_generic_bs_tag;
+extern struct bus_space armv7_generic_a4x_bs_tag;
+extern struct arm32_bus_dma_tag armv7_generic_dma_tag;
+
+int
+armv7_fdt_match(device_t parent, cfdata_t cf, void *aux)
+{
+ if (armv7_fdt_found)
+ return 0;
+ return 1;
+}
+
+void
+armv7_fdt_attach(device_t parent, device_t self, void *aux)
+{
+ armv7_fdt_found = true;
+
+ aprint_naive("\n");
+ aprint_normal("\n");
+
+ struct fdt_attach_args faa = {
+ .faa_name = "",
+ .faa_bst = &armv7_generic_bs_tag,
+ .faa_a4x_bst = &armv7_generic_a4x_bs_tag,
+ .faa_dmat = &armv7_generic_dma_tag,
+ .faa_phandle = OF_peer(0),
+ };
+ config_found(self, &faa, NULL);
+}
Index: src/sys/arch/arm/fdt/cpu_fdt.c
diff -u /dev/null src/sys/arch/arm/fdt/cpu_fdt.c:1.1
--- /dev/null Sun May 28 00:40:21 2017
+++ src/sys/arch/arm/fdt/cpu_fdt.c Sun May 28 00:40:20 2017
@@ -0,0 +1,91 @@
+/* $NetBSD: cpu_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <[email protected]>
+ * 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 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+
+#include <dev/fdt/fdtvar.h>
+
+#include <arm/cpu.h>
+
+static int cpu_fdt_match(device_t, cfdata_t, void *);
+static void cpu_fdt_attach(device_t, device_t, void *);
+
+struct cpu_fdt_softc {
+ device_t sc_dev;
+ int sc_phandle;
+};
+
+CFATTACH_DECL_NEW(cpu_fdt, sizeof(struct cpu_fdt_softc),
+ cpu_fdt_match, cpu_fdt_attach, NULL, NULL);
+
+static int
+cpu_fdt_match(device_t parent, cfdata_t cf, void *aux)
+{
+ const char * const compatible[] = {
+ "arm,cortex-a5",
+ "arm,cortex-a7",
+ "arm,cortex-a8",
+ "arm,cortex-a9",
+ "arm,cortex-a12",
+ "arm,cortex-a15",
+ "arm,cortex-a17",
+ "arm,cortex-a53",
+ "arm,cortex-a57",
+ "arm,cortex-a72",
+ "arm,cortex-a73",
+ NULL
+ };
+ struct fdt_attach_args * const faa = aux;
+
+ return of_compatible(faa->faa_phandle, compatible) >= 0;
+}
+
+static void
+cpu_fdt_attach(device_t parent, device_t self, void *aux)
+{
+ struct cpu_fdt_softc * const sc = device_private(self);
+ struct fdt_attach_args * const faa = aux;
+ bus_addr_t mpidr;
+
+ sc->sc_dev = self;
+ sc->sc_phandle = faa->faa_phandle;
+
+ if (fdtbus_get_reg(sc->sc_phandle, 0, &mpidr, NULL) != 0) {
+ aprint_error(": missing 'reg' property\n");
+ return;
+ }
+
+ cpu_attach(self, mpidr);
+}
Index: src/sys/arch/arm/fdt/gtmr_fdt.c
diff -u /dev/null src/sys/arch/arm/fdt/gtmr_fdt.c:1.1
--- /dev/null Sun May 28 00:40:21 2017
+++ src/sys/arch/arm/fdt/gtmr_fdt.c Sun May 28 00:40:20 2017
@@ -0,0 +1,74 @@
+/* $NetBSD: gtmr_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <[email protected]>
+ * 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 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.1 2017/05/28 00:40:20 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/device.h>
+#include <sys/intr.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/kmem.h>
+
+#include <arm/cortex/gic_intr.h>
+#include <arm/cortex/mpcore_var.h>
+
+#include <dev/fdt/fdtvar.h>
+
+static int gtmr_fdt_match(device_t, cfdata_t, void *);
+static void gtmr_fdt_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(gtmr_fdt, 0, gtmr_fdt_match, gtmr_fdt_attach, NULL, NULL);
+
+static int
+gtmr_fdt_match(device_t parent, cfdata_t cf, void *aux)
+{
+ const char * const compatible[] = {
+ "arm,armv7-timer",
+ NULL
+ };
+ struct fdt_attach_args * const faa = aux;
+
+ return of_compatible(faa->faa_phandle, compatible) >= 0;
+}
+
+static void
+gtmr_fdt_attach(device_t parent, device_t self, void *aux)
+{
+ aprint_naive("\n");
+ aprint_normal(": Generic Timer\n");
+
+ struct mpcore_attach_args mpcaa = {
+ .mpcaa_name = "armgtmr",
+ .mpcaa_irq = IRQ_GTMR_PPI_VTIMER
+ };
+
+ config_found(self, &mpcaa, NULL);
+}