Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181135
b: refs/heads/master
c: d9116d0
h: refs/heads/master
i:
  181133: 85c7661
  181131: f31e22d
  181127: 0654d22
  181119: e118208
v: v3
  • Loading branch information
Paul Mundt committed Jan 20, 2010
1 parent 1e79348 commit 6ba93af
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 920efaabcbd34e6b8dc05c5b777df3e936af5812
refs/heads/master: d9116d07f60383cef134c43a0ba15ec4375310fc
43 changes: 39 additions & 4 deletions trunk/arch/sh/boards/mach-sdk7786/fpga.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,54 @@
#include <linux/io.h>
#include <linux/bcd.h>
#include <mach/fpga.h>
#include <asm/sizes.h>

#define FPGA_REGS_BASE 0x07fff800
#define FPGA_REGS_SIZE 0x490
#define FPGA_REGS_OFFSET 0x03fff800
#define FPGA_REGS_SIZE 0x490

/*
* The FPGA can be mapped in any of the generally available areas,
* so we attempt to scan for it using the fixed SRSTR read magic.
*
* Once the FPGA is located, the rest of the mapping data for the other
* components can be determined dynamically from its section mapping
* registers.
*/
static void __iomem *sdk7786_fpga_probe(void)
{
unsigned long area;
void __iomem *base;

/*
* Iterate over all of the areas where the FPGA could be mapped.
* The possible range is anywhere from area 0 through 6, area 7
* is reserved.
*/
for (area = PA_AREA0; area < PA_AREA7; area += SZ_64M) {
base = ioremap_nocache(area + FPGA_REGS_OFFSET, FPGA_REGS_SIZE);
if (!base) {
/* Failed to remap this area, move along. */
continue;
}

if (ioread16(base + SRSTR) == SRSTR_MAGIC)
return base; /* Found it! */

iounmap(base);
}

return NULL;
}

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);
sdk7786_fpga_base = sdk7786_fpga_probe();
if (unlikely(!sdk7786_fpga_base)) {
panic("FPGA remapping failed.\n");
panic("FPGA detection failed.\n");
return;
}

Expand Down
9 changes: 9 additions & 0 deletions trunk/arch/sh/include/cpu-sh4/cpu/addrspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
#define P4SEG_TLB_DATA 0xf7000000
#define P4SEG_REG_BASE 0xff000000

#define PA_AREA0 0x00000000
#define PA_AREA1 0x04000000
#define PA_AREA2 0x08000000
#define PA_AREA3 0x0c000000
#define PA_AREA4 0x10000000
#define PA_AREA5 0x14000000
#define PA_AREA6 0x18000000
#define PA_AREA7 0x1c000000

#define PA_AREA5_IO 0xb4000000 /* Area 5 IO Memory */
#define PA_AREA6_IO 0xb8000000 /* Area 6 IO Memory */

Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/sh/include/mach-sdk7786/mach/fpga.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <linux/bitops.h>

#define SRSTR 0x000
#define SRSTR_MAGIC 0x1971 /* Fixed magical read value */

#define INTASR 0x010
#define INTAMR 0x020
#define MODSWR 0x030
Expand Down

0 comments on commit 6ba93af

Please sign in to comment.