aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-sdk7786/fpga.c
diff options
context:
space:
mode:
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 000000000000..99f903c8b238
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/fpga.c
@@ -0,0 +1,37 @@
1/*
2 * SDK7786 FPGA Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/io.h>
12#include <linux/bcd.h>
13#include <mach/fpga.h>
14
15#define FPGA_REGS_BASE 0x07fff800
16#define FPGA_REGS_SIZE 0x490
17
18void __iomem *sdk7786_fpga_base;
19
20void __init sdk7786_fpga_init(void)
21{
22 u16 version, date;
23
24 sdk7786_fpga_base = ioremap_nocache(FPGA_REGS_BASE, FPGA_REGS_SIZE);
25 if (unlikely(!sdk7786_fpga_base)) {
26 panic("FPGA remapping failed.\n");
27 return;
28 }
29
30 version = fpga_read_reg(FPGAVR);
31 date = fpga_read_reg(FPGADR);
32
33 pr_info("\tFPGA version:\t%d.%d (built on %d/%d/%d)\n",
34 bcd2bin(version >> 8) & 0xf, bcd2bin(version & 0xf),
35 ((date >> 12) & 0xf) + 2000,
36 (date >> 8) & 0xf, bcd2bin(date & 0xff));
37}