-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sh: add support for J-Core J2 processor
At the CPU/ISA level, the J2 is compatible with SH-2, and thus the changes to add J2 support build on existing SH-2 support. However, J2 does not duplicate the memory-mapped SH-2 features like the cache interface. Instead, the cache interfaces is described in the device tree, and new code is added to be able to access the flat device tree at early boot before it is unflattened. Support is also added for receiving interrupts on trap numbers in the range 16 to 31, since the J-Core aic1 interrupt controller generates these traps. This range was unused but nominally for hardware exceptions on SH-2, and a few values in this range were used for exceptions on SH-2A, but SH-2A has its own version of the relevant code. No individual cpu subtypes are added for J2 since the intent moving forward is to represent SoCs with device tree rather than as hard-coded subtypes in the kernel. The CPU_SUBTYPE_J2 Kconfig item exists only to fit into the existing cpu selection mechanism until it is overhauled. Signed-off-by: Rich Felker <dalias@libc.org>
- Loading branch information
Rich Felker
committed
Aug 5, 2016
1 parent
03767da
commit 5a846ab
Showing
10 changed files
with
127 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* arch/sh/mm/cache-j2.c | ||
* | ||
* Copyright (C) 2015-2016 Smart Energy Instruments, Inc. | ||
* | ||
* Released under the terms of the GNU GPL v2.0. | ||
*/ | ||
|
||
#include <linux/init.h> | ||
#include <linux/mm.h> | ||
#include <linux/cpumask.h> | ||
|
||
#include <asm/cache.h> | ||
#include <asm/addrspace.h> | ||
#include <asm/processor.h> | ||
#include <asm/cacheflush.h> | ||
#include <asm/io.h> | ||
|
||
#define ICACHE_ENABLE 0x1 | ||
#define DCACHE_ENABLE 0x2 | ||
#define CACHE_ENABLE (ICACHE_ENABLE | DCACHE_ENABLE) | ||
#define ICACHE_FLUSH 0x100 | ||
#define DCACHE_FLUSH 0x200 | ||
#define CACHE_FLUSH (ICACHE_FLUSH | DCACHE_FLUSH) | ||
|
||
u32 __iomem *j2_ccr_base; | ||
|
||
static void j2_flush_icache(void *args) | ||
{ | ||
unsigned cpu; | ||
for_each_possible_cpu(cpu) | ||
__raw_writel(CACHE_ENABLE | ICACHE_FLUSH, j2_ccr_base + cpu); | ||
} | ||
|
||
static void j2_flush_dcache(void *args) | ||
{ | ||
unsigned cpu; | ||
for_each_possible_cpu(cpu) | ||
__raw_writel(CACHE_ENABLE | DCACHE_FLUSH, j2_ccr_base + cpu); | ||
} | ||
|
||
static void j2_flush_both(void *args) | ||
{ | ||
unsigned cpu; | ||
for_each_possible_cpu(cpu) | ||
__raw_writel(CACHE_ENABLE | CACHE_FLUSH, j2_ccr_base + cpu); | ||
} | ||
|
||
void __init j2_cache_init(void) | ||
{ | ||
if (!j2_ccr_base) | ||
return; | ||
|
||
local_flush_cache_all = j2_flush_both; | ||
local_flush_cache_mm = j2_flush_both; | ||
local_flush_cache_dup_mm = j2_flush_both; | ||
local_flush_cache_page = j2_flush_both; | ||
local_flush_cache_range = j2_flush_both; | ||
local_flush_dcache_page = j2_flush_dcache; | ||
local_flush_icache_range = j2_flush_icache; | ||
local_flush_icache_page = j2_flush_icache; | ||
local_flush_cache_sigtramp = j2_flush_icache; | ||
|
||
pr_info("Initial J2 CCR is %.8x\n", __raw_readl(j2_ccr_base)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters