mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-24 11:49:45 +07:00
efd590d57a
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>
38 lines
908 B
C
38 lines
908 B
C
/*
|
|
* 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));
|
|
}
|