Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Add l2cc support.
details: https://anonhg.NetBSD.org/src/rev/6f0f18af88ac
branches: trunk
changeset: 320035:6f0f18af88ac
user: hkenken <hkenken%NetBSD.org@localhost>
date: Wed Jun 20 08:03:55 2018 +0000
description:
Add l2cc support.
diffstat:
sys/arch/arm/cortex/pl310.c | 7 +--
sys/arch/arm/fdt/files.fdt | 6 ++-
sys/arch/arm/fdt/l2cc_fdt.c | 88 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 96 insertions(+), 5 deletions(-)
diffs (147 lines):
diff -r 56889839cef9 -r 6f0f18af88ac sys/arch/arm/cortex/pl310.c
--- a/sys/arch/arm/cortex/pl310.c Wed Jun 20 07:08:35 2018 +0000
+++ b/sys/arch/arm/cortex/pl310.c Wed Jun 20 08:03:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pl310.c,v 1.17 2015/02/27 20:40:09 jmcneill Exp $ */
+/* $NetBSD: pl310.c,v 1.18 2018/06/20 08:03:55 hkenken Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.17 2015/02/27 20:40:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.18 2018/06/20 08:03:55 hkenken Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -47,7 +47,6 @@
static int arml2cc_match(device_t, cfdata_t, void *);
static void arml2cc_attach(device_t, device_t, void *);
-#define L2CC_BASE 0x2000
#define L2CC_SIZE 0x1000
struct arml2cc_softc {
@@ -150,7 +149,7 @@
aprint_normal(": not configured\n");
return;
}
- off = L2CC_BASE;
+ off = mpcaa->mpcaa_off1;
}
arml2cc_sc = sc;
diff -r 56889839cef9 -r 6f0f18af88ac sys/arch/arm/fdt/files.fdt
--- a/sys/arch/arm/fdt/files.fdt Wed Jun 20 07:08:35 2018 +0000
+++ b/sys/arch/arm/fdt/files.fdt Wed Jun 20 08:03:55 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.16 2018/06/05 08:03:28 hkenken Exp $
+# $NetBSD: files.fdt,v 1.17 2018/06/20 08:03:55 hkenken Exp $
include "dev/pckbport/files.pckbport"
@@ -25,6 +25,10 @@
attach gic at fdt with gic_fdt
file arch/arm/fdt/gic_fdt.c gic_fdt
+device l2cc: mpcorebus
+attach l2cc at fdt with l2cc_fdt
+file arch/arm/fdt/l2cc_fdt.c l2cc_fdt
+
attach plcom at fdt with plcom_fdt
file arch/arm/fdt/plcom_fdt.c plcom_fdt
diff -r 56889839cef9 -r 6f0f18af88ac sys/arch/arm/fdt/l2cc_fdt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/fdt/l2cc_fdt.c Wed Jun 20 08:03:55 2018 +0000
@@ -0,0 +1,88 @@
+/* $NetBSD: l2cc_fdt.c,v 1.1 2018/06/20 08:03:55 hkenken Exp $ */
+/*
+ * Copyright (c) 2018 Genetec Corporation. All rights reserved.
+ * Written by Hashimoto Kenichi for Genetec Corporation.
+ *
+ * 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 GENETEC CORPORATION ``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 GENETEC CORPORATION
+ * 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: l2cc_fdt.c,v 1.1 2018/06/20 08:03:55 hkenken 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/mpcore_var.h>
+
+#include <dev/fdt/fdtvar.h>
+#include <arm/fdt/arm_fdtvar.h>
+
+static int l2cc_fdt_match(device_t, cfdata_t, void *);
+static void l2cc_fdt_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(l2cc_fdt, 0, l2cc_fdt_match, l2cc_fdt_attach, NULL, NULL);
+
+static int
+l2cc_fdt_match(device_t parent, cfdata_t cf, void *aux)
+{
+ const char * const compatible[] = {
+ "arm,pl310-cache",
+ NULL
+ };
+ struct fdt_attach_args * const faa = aux;
+
+ return of_compatible(faa->faa_phandle, compatible) >= 0;
+}
+
+static void
+l2cc_fdt_attach(device_t parent, device_t self, void *aux)
+{
+ struct fdt_attach_args * const faa = aux;
+ const int phandle = faa->faa_phandle;
+ bus_space_handle_t bsh;
+
+ bus_addr_t addr;
+ bus_size_t size;
+ if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
+ aprint_error(": couldn't get distributor address\n");
+ return;
+ }
+ if (bus_space_map(faa->faa_bst, addr, size, 0, &bsh)) {
+ aprint_error(": couldn't map registers\n");
+ return;
+ }
+
+ struct mpcore_attach_args mpcaa = {
+ .mpcaa_name = "arml2cc",
+ .mpcaa_memt = faa->faa_bst,
+ .mpcaa_memh = bsh,
+ .mpcaa_off1 = 0,
+ .mpcaa_off2 = 0,
+ };
+
+ config_found(self, &mpcaa, NULL);
+}
Home |
Main Index |
Thread Index |
Old Index