summaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-sdk7786/fpga.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-20 15:08:36 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-01-20 15:08:36 +0900
commitefd590d57a5edddabaaf4cfaf532c0f674193b81 (patch)
tree62832f461bcadfe662eb6cf6bb1e74fad90adca6 /arch/sh/boards/mach-sdk7786/fpga.c
parentbdc27300f5718626a3817e6478e339f6cca6b994 (diff)
downloadop-kernel-dev-efd590d57a5edddabaaf4cfaf532c0f674193b81.zip
op-kernel-dev-efd590d57a5edddabaaf4cfaf532c0f674193b81.tar.gz
sh: mach-sdk7786: FPGA updates.
This does a bit of refactoring of the FPGA management code. The primary FPGA initialization is moved out to its own file in preparation for implementing some of the more complex capabilities, a complete set of register definitions is provided, and all of the existing users in the board code are moved over to use the new interface instead of setting up overlapping mappings. This also corrects the FPGA size, which previously was chomped off at the SDIF control register. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/mach-sdk7786/fpga.c')
-rw-r--r--arch/sh/boards/mach-sdk7786/fpga.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-sdk7786/fpga.c b/arch/sh/boards/mach-sdk7786/fpga.c
new file mode 100644
index 0000000..99f903c
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/fpga.c
@@ -0,0 +1,37 @@
+/*
+ * SDK7786 FPGA Support.
+ *
+ * Copyright (C) 2010 Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/bcd.h>
+#include <mach/fpga.h>
+
+#define FPGA_REGS_BASE 0x07fff800
+#define FPGA_REGS_SIZE 0x490
+
+void __iomem *sdk7786_fpga_base;
+
+void __init sdk7786_fpga_init(void)
+{
+ u16 version, date;
+
+ sdk7786_fpga_base = ioremap_nocache(FPGA_REGS_BASE, FPGA_REGS_SIZE);
+ if (unlikely(!sdk7786_fpga_base)) {
+ panic("FPGA remapping failed.\n");
+ return;
+ }
+
+ version = fpga_read_reg(FPGAVR);
+ date = fpga_read_reg(FPGADR);
+
+ pr_info("\tFPGA version:\t%d.%d (built on %d/%d/%d)\n",
+ bcd2bin(version >> 8) & 0xf, bcd2bin(version & 0xf),
+ ((date >> 12) & 0xf) + 2000,
+ (date >> 8) & 0xf, bcd2bin(date & 0xff));
+}
OpenPOWER on IntegriCloud