Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch XU4 FDT Enable the minimum device tree
details: https://anonhg.NetBSD.org/src/rev/5b16e308508c
branches: trunk
changeset: 342285:5b16e308508c
user: marty <marty%NetBSD.org@localhost>
date: Mon Dec 14 22:06:57 2015 +0000
description:
XU4 FDT Enable the minimum device tree
This enables the use of FDT on the XU4 but doesn't add any drivers. However,
with this check in, XU4 becomes useless without a device tree blob from the
Linux tree, which isn't checked in anywhere.
diffstat:
sys/arch/arm/samsung/files.exynos | 7 ++++++-
sys/arch/evbarm/conf/ODROID-XU4 | 15 ++++++++++++++-
sys/arch/evbarm/conf/files.exynos | 8 +++++++-
sys/arch/evbarm/exynos/exynos_machdep.c | 31 +++++++++++++++++++++++++++++--
4 files changed, 56 insertions(+), 5 deletions(-)
diffs (145 lines):
diff -r 534fa11fecea -r 5b16e308508c sys/arch/arm/samsung/files.exynos
--- a/sys/arch/arm/samsung/files.exynos Mon Dec 14 21:41:42 2015 +0000
+++ b/sys/arch/arm/samsung/files.exynos Mon Dec 14 22:06:57 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.exynos,v 1.10 2015/12/12 21:56:54 marty Exp $
+# $NetBSD: files.exynos,v 1.11 2015/12/14 22:06:57 marty Exp $
#
# Configuration info for Samsung Exynos SoC ARM Peripherals
#
@@ -44,6 +44,11 @@
defflag opt_exynos.h EXYNOS5440: EXYNOS5
defflag opt_exynos.h EXYNOS5422: EXYNOS5
+# On-board I/O
+device exynosfdt : bus_space_generic, fdtbus
+attach exynosfdt at mainbus with exynos_fdt
+file arch/arm/samsung/exynos_fdt.c exynos_fdt
+
# SoC I/O attach point
device exyo { [port=-1], [intr=-1] } : bus_space_generic
attach exyo at mainbus with exyo_io
diff -r 534fa11fecea -r 5b16e308508c sys/arch/evbarm/conf/ODROID-XU4
--- a/sys/arch/evbarm/conf/ODROID-XU4 Mon Dec 14 21:41:42 2015 +0000
+++ b/sys/arch/evbarm/conf/ODROID-XU4 Mon Dec 14 22:06:57 2015 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: ODROID-XU4,v 1.4 2015/12/14 00:00:22 marty Exp $
+# $NetBSD: ODROID-XU4,v 1.5 2015/12/14 22:06:57 marty Exp $
#
# ODROID-XU -- ODROID-XU4 Exynos5422 based kernel
#
@@ -33,6 +33,11 @@
options EXYNOS5422
#options MULTIPROCESSOR
+options FDT # not really but soon
+pseudo-device openfirm # jmcneill: oops, fdtbus should depend on
+ # openfirm. don't let me forget.
+
+
options PMAPCOUNTERS
options BUSDMA_COUNTERS
options EXYNOS_CONSOLE_EARLY
@@ -196,6 +201,14 @@
armgic0 at armperiph? # Interrupt Controller
armgtmr0 at armperiph? # Generic Timer
+# On-board I/O
+exynosfdt0 at mainbus?
+fdt0 at exynosfdt0
+simplebus* at fdt?
+fdt* at simplebus?
+
+fregulator* at fdt?
+
# Exynos SoC
exyo0 at mainbus?
diff -r 534fa11fecea -r 5b16e308508c sys/arch/evbarm/conf/files.exynos
--- a/sys/arch/evbarm/conf/files.exynos Mon Dec 14 21:41:42 2015 +0000
+++ b/sys/arch/evbarm/conf/files.exynos Mon Dec 14 22:06:57 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.exynos,v 1.1 2015/12/06 00:31:24 marty Exp $
+# $NetBSD: files.exynos,v 1.2 2015/12/14 22:06:57 marty Exp $
#
# EXYNOS 5422 board configuration info
#
@@ -8,5 +8,11 @@
# Kernel boot arguments
defparam opt_machdep.h BOOT_ARGS
+# FDT
+
+include "dev/ofw/files.ofw"
+include "dev/fdt/files.fdt"
+include "arch/arm/fdt/files.fdt"
+
# Pull in Exynos SoC default
include "arch/arm/samsung/files.exynos"
diff -r 534fa11fecea -r 5b16e308508c sys/arch/evbarm/exynos/exynos_machdep.c
--- a/sys/arch/evbarm/exynos/exynos_machdep.c Mon Dec 14 21:41:42 2015 +0000
+++ b/sys/arch/evbarm/exynos/exynos_machdep.c Mon Dec 14 22:06:57 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_machdep.c,v 1.3 2015/12/13 22:28:09 marty Exp $ */
+/* $NetBSD: exynos_machdep.c,v 1.4 2015/12/14 22:06:57 marty Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.3 2015/12/13 22:28:09 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.4 2015/12/14 22:06:57 marty Exp $");
#include "opt_evbarm_boardtype.h"
#include "opt_exynos.h"
@@ -101,6 +101,16 @@
#include <arm/samsung/sscom_var.h>
#include <arm/samsung/sscom_reg.h>
+/* so we can load the device tree. NOTE: This requires the kernel to be
+ * made into a linux (not netbsd) uboot image.
+ */
+#include <libfdt.h>
+#include <dev/fdt/fdt_openfirm.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/fdt/fdtvar.h>
+#define FDT_BUF_SIZE (128*1024)
+static uint8_t fdt_data[FDT_BUF_SIZE];
+
extern const int num_exynos_uarts_entries;
extern const struct sscom_uart_info exynos_uarts[];
@@ -368,6 +378,7 @@
char mi_bootargs[] = BOOT_ARGS;
parse_mi_bootargs(mi_bootargs);
#endif
+
boot_args = bootargs;
parse_mi_bootargs(boot_args);
exynos_extract_mac_adress();
@@ -390,6 +401,22 @@
const bool mapallmem_p = false;
#endif
+ /* Load the dtb */
+ const uint8_t *fdt_addr_r = (const uint8_t *)uboot_args[2];
+ printf("fdt addr 0x%08x\n", (uint)fdt_addr_r);
+ int error = fdt_check_header(fdt_addr_r);
+ printf("fdt check header returns %d\n", error);
+ if (error == 0) {
+ error = fdt_move(fdt_addr_r, fdt_data, sizeof(fdt_data));
+ printf("fdt move returns %d\n", error);
+ if (error != 0) {
+ panic("fdt_move failed: %s", fdt_strerror(error));
+ }
+ fdt_openfirm_set_data(fdt_data);
+ } else {
+ panic("fdt_check_header failed: %s", fdt_strerror(error));
+ }
+
/* Fake bootconfig structure for the benefit of pmap.c. */
bootconfig.dramblocks = 1;
bootconfig.dram[0].address = rambase;
Home |
Main Index |
Thread Index |
Old Index