mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 07:16:15 +07:00
e79ab194d1
These are updates for platform specific code on 32-bit ARM machines, essentially anything that can not (yet) be expressed using DT files. Noteworthy changes include: - Added support for the TI DRA71x family of SoCs in mach-omap2, this is an new variant of the the DRA72x/DRA74x automotive infotainment chips we already supported for a while. - Added support for the ST STM32F746 SoC, the first Cortex-M7 based microcontroller we support, related to the smaller STM32F4 family. - Renesas adds support for r8a7743 and r8a7745 in mach-shmobile, see http://elinux.org/RZ-G - SMP is now supported on the OX820 platform - A lot of code in mach-omap2 gets removed as a follow-up to removing support for board files in the previous release - Davinci has some new work to improve USB support - For i.MX, the performance monitor now supports profiling the memory controller using 'perf' Conflicts: arch/arm/mach-shmobile/setup-rcar-gen2.c: rcar_gen2_clocks_init() is gone, calling of_clk_init(NULL) is sufficient now. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUAWFMS9WCrR//JCVInAQIG+Q/7BElvubqO/Cc/VEAyoB5iF9OB9wPD2t5p O0KwtrTtzqJZJNGTmPiesR4DMZH07O1XoW8HqvBPeXtB7/t0tmOegwK+WABbpkSE ZQgUjtrIGwteJXYqU2BbhooO8G6mEsfWaqdGX8ZiIk40fPhMN6536lG+JA8DV7uv ckAPHCZkIf34lDtwljN97Cvj1TT9lBFp04bx7alKqfg1IMV+iMSxvSRHuuFlxRCk kzwVXDmFlZLmueU2KbQXTuOUrvehIGlZ/X5QWlxfrjwCwnOvr54p8WDoVWu2UkHm Dc8BVfsBny8mCZJRzfDD1S0PD0mWn1msdOhRb4VRzsC9DnRI4qbL0/Hstu8A7yUQ kBtMyVtFTzvRSclABbHHN6Mnm37AyNwSIKIB8h2U1m7YHqZGwHLaflVT5sf3tl7m 4arTVqHtR8oSU5G5a2FTznMM2rfIx4LcCBbLQxWqzmO4Qrh4j6t7c2i7+VTfFAja 0bToLgTArKK/cep6PWeBnMH14nzlXoKtBf2T8qwQPuAmLKy9E0ZduLKZ01B/nqrj OXcsnG0OUuqU4RgbIaDssRU4ohKIk8JcAl60TdRFhzj+/LTbeMaWVwbWuQS+iHd3 zfzGUoUIhElx0vHt6ghR0BYQadszb1z9V0NEs3UM0v5cWlNodX//3okH8lZmSW6w +fO4dSnIKIA= =BF6Y -----END PGP SIGNATURE----- Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC platform updates from Arnd Bergmann: "These are updates for platform specific code on 32-bit ARM machines, essentially anything that can not (yet) be expressed using DT files. Noteworthy changes include: - Added support for the TI DRA71x family of SoCs in mach-omap2, this is an new variant of the the DRA72x/DRA74x automotive infotainment chips we already supported for a while. - Added support for the ST STM32F746 SoC, the first Cortex-M7 based microcontroller we support, related to the smaller STM32F4 family. - Renesas adds support for r8a7743 and r8a7745 in mach-shmobile, see http://elinux.org/RZ-G - SMP is now supported on the OX820 platform - A lot of code in mach-omap2 gets removed as a follow-up to removing support for board files in the previous release - Davinci has some new work to improve USB support - For i.MX, the performance monitor now supports profiling the memory controller using 'perf'" * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (95 commits) ARM: davinci: da830-evm: use gpio descriptor for mmc pins ARM: davinci: da850-evm: use gpio descriptor for mmc pins ARM: davinci: hawk: use gpio descriptor for mmc pins ARM: ARTPEC-6: add select MFD_SYSCON to MACH_ARTPEC6 ARM: davinci: da8xx: Fix ohci device name ARM: oxnas: Add OX820 config and makefile entry ARM: oxnas: Add OX820 SMP support ARM: davinci: PM: fix build when da850 not compiled in ARM: orion5x: remove legacy support of ls-chl ARM: integrator: drop EBI access use syscon ARM: BCM5301X: Add back handler ignoring external imprecise aborts ARM: davinci: PM: support da8xx DT platforms ARM: davinci: PM: cleanup: remove references to pdata ARM: davinci: PM: rework init, remove platform device ARM: Kconfig: Introduce MACH_STM32F746 flag ARM: mach-stm32: Add a new SOC - STM32F746 ARM: shmobile: document SK-RZG1E board ARM: shmobile: r8a7745: basic SoC support ARM: imx: mach-imx6ul: add imx6ull support ARM: zynq: Reserve correct amount of non-DMA RAM ...
239 lines
5.9 KiB
C
239 lines
5.9 KiB
C
/*
|
|
* R-Car Generation 2 support
|
|
*
|
|
* Copyright (C) 2013 Renesas Solutions Corp.
|
|
* Copyright (C) 2013 Magnus Damm
|
|
* Copyright (C) 2014 Ulrich Hecht
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/clocksource.h>
|
|
#include <linux/device.h>
|
|
#include <linux/dma-contiguous.h>
|
|
#include <linux/io.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/of_platform.h>
|
|
#include <asm/mach/arch.h>
|
|
#include "common.h"
|
|
#include "rcar-gen2.h"
|
|
|
|
#define MODEMR 0xe6160060
|
|
|
|
u32 rcar_gen2_read_mode_pins(void)
|
|
{
|
|
static u32 mode;
|
|
static bool mode_valid;
|
|
|
|
if (!mode_valid) {
|
|
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
|
|
BUG_ON(!modemr);
|
|
mode = ioread32(modemr);
|
|
iounmap(modemr);
|
|
mode_valid = true;
|
|
}
|
|
|
|
return mode;
|
|
}
|
|
|
|
static unsigned int __init get_extal_freq(void)
|
|
{
|
|
struct device_node *cpg, *extal;
|
|
u32 freq = 20000000;
|
|
|
|
cpg = of_find_compatible_node(NULL, NULL,
|
|
"renesas,rcar-gen2-cpg-clocks");
|
|
if (!cpg)
|
|
return freq;
|
|
|
|
extal = of_parse_phandle(cpg, "clocks", 0);
|
|
of_node_put(cpg);
|
|
if (!extal)
|
|
return freq;
|
|
|
|
of_property_read_u32(extal, "clock-frequency", &freq);
|
|
of_node_put(extal);
|
|
return freq;
|
|
}
|
|
|
|
#define CNTCR 0
|
|
#define CNTFID0 0x20
|
|
|
|
void __init rcar_gen2_timer_init(void)
|
|
{
|
|
#ifdef CONFIG_ARM_ARCH_TIMER
|
|
void __iomem *base;
|
|
u32 freq;
|
|
|
|
if (of_machine_is_compatible("renesas,r8a7792") ||
|
|
of_machine_is_compatible("renesas,r8a7794")) {
|
|
freq = 260000000 / 8; /* ZS / 8 */
|
|
/* CNTVOFF has to be initialized either from non-secure
|
|
* Hypervisor mode or secure Monitor mode with SCR.NS==1.
|
|
* If TrustZone is enabled then it should be handled by the
|
|
* secure code.
|
|
*/
|
|
asm volatile(
|
|
" cps 0x16\n"
|
|
" mrc p15, 0, r1, c1, c1, 0\n"
|
|
" orr r0, r1, #1\n"
|
|
" mcr p15, 0, r0, c1, c1, 0\n"
|
|
" isb\n"
|
|
" mov r0, #0\n"
|
|
" mcrr p15, 4, r0, r0, c14\n"
|
|
" isb\n"
|
|
" mcr p15, 0, r1, c1, c1, 0\n"
|
|
" isb\n"
|
|
" cps 0x13\n"
|
|
: : : "r0", "r1");
|
|
} else {
|
|
/* At Linux boot time the r8a7790 arch timer comes up
|
|
* with the counter disabled. Moreover, it may also report
|
|
* a potentially incorrect fixed 13 MHz frequency. To be
|
|
* correct these registers need to be updated to use the
|
|
* frequency EXTAL / 2.
|
|
*/
|
|
freq = get_extal_freq() / 2;
|
|
}
|
|
|
|
/* Remap "armgcnt address map" space */
|
|
base = ioremap(0xe6080000, PAGE_SIZE);
|
|
|
|
/*
|
|
* Update the timer if it is either not running, or is not at the
|
|
* right frequency. The timer is only configurable in secure mode
|
|
* so this avoids an abort if the loader started the timer and
|
|
* entered the kernel in non-secure mode.
|
|
*/
|
|
|
|
if ((ioread32(base + CNTCR) & 1) == 0 ||
|
|
ioread32(base + CNTFID0) != freq) {
|
|
/* Update registers with correct frequency */
|
|
iowrite32(freq, base + CNTFID0);
|
|
asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
|
|
|
|
/* make sure arch timer is started by setting bit 0 of CNTCR */
|
|
iowrite32(1, base + CNTCR);
|
|
}
|
|
|
|
iounmap(base);
|
|
#endif /* CONFIG_ARM_ARCH_TIMER */
|
|
|
|
of_clk_init(NULL);
|
|
clocksource_probe();
|
|
}
|
|
|
|
struct memory_reserve_config {
|
|
u64 reserved;
|
|
u64 base, size;
|
|
};
|
|
|
|
static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
|
|
int depth, void *data)
|
|
{
|
|
const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
|
|
const __be32 *reg, *endp;
|
|
int l;
|
|
struct memory_reserve_config *mrc = data;
|
|
u64 lpae_start = 1ULL << 32;
|
|
|
|
/* We are scanning "memory" nodes only */
|
|
if (type == NULL || strcmp(type, "memory"))
|
|
return 0;
|
|
|
|
reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
|
|
if (reg == NULL)
|
|
reg = of_get_flat_dt_prop(node, "reg", &l);
|
|
if (reg == NULL)
|
|
return 0;
|
|
|
|
endp = reg + (l / sizeof(__be32));
|
|
while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
|
|
u64 base, size;
|
|
|
|
base = dt_mem_next_cell(dt_root_addr_cells, ®);
|
|
size = dt_mem_next_cell(dt_root_size_cells, ®);
|
|
|
|
if (base >= lpae_start)
|
|
continue;
|
|
|
|
if ((base + size) >= lpae_start)
|
|
size = lpae_start - base;
|
|
|
|
if (size < mrc->reserved)
|
|
continue;
|
|
|
|
if (base < mrc->base)
|
|
continue;
|
|
|
|
/* keep the area at top near the 32-bit legacy limit */
|
|
mrc->base = base + size - mrc->reserved;
|
|
mrc->size = mrc->reserved;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void __init rcar_gen2_reserve(void)
|
|
{
|
|
struct memory_reserve_config mrc;
|
|
|
|
/* reserve 256 MiB at the top of the physical legacy 32-bit space */
|
|
memset(&mrc, 0, sizeof(mrc));
|
|
mrc.reserved = SZ_256M;
|
|
|
|
of_scan_flat_dt(rcar_gen2_scan_mem, &mrc);
|
|
#ifdef CONFIG_DMA_CMA
|
|
if (mrc.size && memblock_is_region_memory(mrc.base, mrc.size)) {
|
|
static struct cma *rcar_gen2_dma_contiguous;
|
|
|
|
dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
|
|
&rcar_gen2_dma_contiguous, true);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static const char * const rcar_gen2_boards_compat_dt[] __initconst = {
|
|
/*
|
|
* R8A7790 and R8A7791 can't be handled here as long as they need SMP
|
|
* initialization fallback.
|
|
*/
|
|
"renesas,r8a7792",
|
|
"renesas,r8a7793",
|
|
"renesas,r8a7794",
|
|
NULL,
|
|
};
|
|
|
|
DT_MACHINE_START(RCAR_GEN2_DT, "Generic R-Car Gen2 (Flattened Device Tree)")
|
|
.init_early = shmobile_init_delay,
|
|
.init_late = shmobile_init_late,
|
|
.init_time = rcar_gen2_timer_init,
|
|
.reserve = rcar_gen2_reserve,
|
|
.dt_compat = rcar_gen2_boards_compat_dt,
|
|
MACHINE_END
|
|
|
|
static const char * const rz_g1_boards_compat_dt[] __initconst = {
|
|
"renesas,r8a7743",
|
|
"renesas,r8a7745",
|
|
NULL,
|
|
};
|
|
|
|
DT_MACHINE_START(RZ_G1_DT, "Generic RZ/G1 (Flattened Device Tree)")
|
|
.init_early = shmobile_init_delay,
|
|
.init_late = shmobile_init_late,
|
|
.init_time = rcar_gen2_timer_init,
|
|
.reserve = rcar_gen2_reserve,
|
|
.dt_compat = rz_g1_boards_compat_dt,
|
|
MACHINE_END
|