2011-11-11 10:45:52 +08:00
|
|
|
/*
|
|
|
|
* R8A7740 processor support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Renesas Solutions Corp.
|
|
|
|
* Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
|
|
|
*
|
|
|
|
* 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/kernel.h>
|
|
|
|
#include <linux/init.h>
|
2011-11-11 10:46:23 +08:00
|
|
|
#include <linux/io.h>
|
2013-08-02 14:39:44 +08:00
|
|
|
#include <linux/irqchip.h>
|
|
|
|
#include <linux/irqchip/arm-gic.h>
|
2012-07-06 16:08:07 +08:00
|
|
|
#include <linux/of_platform.h>
|
2014-06-21 00:53:03 +08:00
|
|
|
|
2012-02-29 20:37:35 +08:00
|
|
|
#include <asm/mach/map.h>
|
2011-11-11 10:45:52 +08:00
|
|
|
#include <asm/mach/arch.h>
|
2012-03-06 16:36:53 +08:00
|
|
|
#include <asm/mach/time.h>
|
2014-08-25 11:36:53 +08:00
|
|
|
#include <asm/hardware/cache-l2x0.h>
|
2014-06-21 00:53:03 +08:00
|
|
|
|
2014-06-17 15:47:37 +08:00
|
|
|
#include "common.h"
|
2011-11-11 10:45:52 +08:00
|
|
|
|
2012-02-29 20:37:35 +08:00
|
|
|
static struct map_desc r8a7740_io_desc[] __initdata = {
|
|
|
|
/*
|
|
|
|
* for CPGA/INTC/PFC
|
|
|
|
* 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
.virtual = 0xe6000000,
|
|
|
|
.pfn = __phys_to_pfn(0xe6000000),
|
|
|
|
.length = 160 << 20,
|
|
|
|
.type = MT_DEVICE_NONSHARED
|
|
|
|
},
|
|
|
|
#ifdef CONFIG_CACHE_L2X0
|
|
|
|
/*
|
|
|
|
* for l2x0_init()
|
|
|
|
* 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
.virtual = 0xf0002000,
|
|
|
|
.pfn = __phys_to_pfn(0xf0100000),
|
|
|
|
.length = PAGE_SIZE,
|
|
|
|
.type = MT_DEVICE_NONSHARED
|
|
|
|
},
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2015-06-17 17:31:24 +08:00
|
|
|
static void __init r8a7740_map_io(void)
|
2012-02-29 20:37:35 +08:00
|
|
|
{
|
ARM: shmobile: Add early debugging support using SCIF(A)
Add serial port debug macros for the SCIF(A) serial ports.
This includes all supported shmobile SoCs, except for EMEV2.
The configuration logic (both Kconfig and #ifdef) is more complicated than
one would expect, for several reasons:
1. Not all SoCs have the same serial devices, and they're not always
at the same addresses.
2. There are two different types: SCIF and SCIFA. Fortunately they can
easily be distinguished by physical address.
3. Not all boards use the same serial port for the console.
The defaults correspond to the boards that are supported in
mainline. If you want to use a different serial port, just change
the value of CONFIG_DEBUG_UART_PHYS, and the rest will auto-adapt.
4. debug_ll_io_init() maps the SCIF(A) registers to a fixed virtual
address. 0xfdxxxxxx was chosen, as it should lie below VMALLOC_END
= 0xff000000, and must not conflict with the 2 MiB reserved region
at PCI_IO_VIRT_BASE = 0xfee00000.
- On SoCs not using the legacy machine_desc.map_io(),
debug_ll_io_init() is called by the ARM core code.
- On SoCs using the legacy machine_desc.map_io(),
debug_ll_io_init() must be called explicitly. Calls are added
for r8a7740, r8a7779, sh7372, and sh73a0.
This was derived from the r8a7790 version by Laurent Pinchart.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2014-11-14 23:49:47 +08:00
|
|
|
debug_ll_io_init();
|
2012-02-29 20:37:35 +08:00
|
|
|
iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
|
|
|
|
}
|
|
|
|
|
2012-06-12 17:36:21 +08:00
|
|
|
/*
|
|
|
|
* r8a7740 chip has lasting errata on MERAM buffer.
|
|
|
|
* this is work-around for it.
|
|
|
|
* see
|
|
|
|
* "Media RAM (MERAM)" on r8a7740 documentation
|
|
|
|
*/
|
|
|
|
#define MEBUFCNTR 0xFE950098
|
2015-06-17 17:31:24 +08:00
|
|
|
static void __init r8a7740_meram_workaround(void)
|
2012-06-12 17:36:21 +08:00
|
|
|
{
|
|
|
|
void __iomem *reg;
|
|
|
|
|
|
|
|
reg = ioremap_nocache(MEBUFCNTR, 4);
|
|
|
|
if (reg) {
|
|
|
|
iowrite32(0x01600164, reg);
|
|
|
|
iounmap(reg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-17 17:31:24 +08:00
|
|
|
static void __init r8a7740_init_irq_of(void)
|
2013-08-02 14:39:44 +08:00
|
|
|
{
|
|
|
|
void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
|
|
|
|
void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
|
|
|
|
void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
|
|
|
|
|
|
|
|
irqchip_init();
|
|
|
|
|
|
|
|
/* route signals to GIC */
|
|
|
|
iowrite32(0x0, pfc_inta_ctrl);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To mask the shared interrupt to SPI 149 we must ensure to set
|
|
|
|
* PRIO *and* MASK. Else we run into IRQ floods when registering
|
|
|
|
* the intc_irqpin devices
|
|
|
|
*/
|
|
|
|
iowrite32(0x0, intc_prio_base + 0x0);
|
|
|
|
iowrite32(0x0, intc_prio_base + 0x4);
|
|
|
|
iowrite32(0x0, intc_prio_base + 0x8);
|
|
|
|
iowrite32(0x0, intc_prio_base + 0xc);
|
|
|
|
iowrite8(0xff, intc_msk_base + 0x0);
|
|
|
|
iowrite8(0xff, intc_msk_base + 0x4);
|
|
|
|
iowrite8(0xff, intc_msk_base + 0x8);
|
|
|
|
iowrite8(0xff, intc_msk_base + 0xc);
|
|
|
|
|
|
|
|
iounmap(intc_prio_base);
|
|
|
|
iounmap(intc_msk_base);
|
|
|
|
iounmap(pfc_inta_ctrl);
|
|
|
|
}
|
|
|
|
|
2013-04-17 18:34:05 +08:00
|
|
|
static void __init r8a7740_generic_init(void)
|
|
|
|
{
|
2014-08-25 11:36:53 +08:00
|
|
|
r8a7740_meram_workaround();
|
|
|
|
|
|
|
|
#ifdef CONFIG_CACHE_L2X0
|
|
|
|
/* Shared attribute override enable, 32K*8way */
|
|
|
|
l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
|
|
|
|
#endif
|
2014-08-12 08:04:42 +08:00
|
|
|
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
|
2013-04-17 18:34:05 +08:00
|
|
|
}
|
|
|
|
|
2015-07-28 06:27:52 +08:00
|
|
|
static const char *const r8a7740_boards_compat_dt[] __initconst = {
|
2012-07-06 16:08:07 +08:00
|
|
|
"renesas,r8a7740",
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2012-10-22 13:15:13 +08:00
|
|
|
DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
|
2012-07-06 16:08:07 +08:00
|
|
|
.map_io = r8a7740_map_io,
|
2014-05-08 07:32:38 +08:00
|
|
|
.init_early = shmobile_init_delay,
|
2013-04-17 18:34:05 +08:00
|
|
|
.init_irq = r8a7740_init_irq_of,
|
|
|
|
.init_machine = r8a7740_generic_init,
|
2014-05-12 07:10:50 +08:00
|
|
|
.init_late = shmobile_init_late,
|
2012-07-06 16:08:07 +08:00
|
|
|
.dt_compat = r8a7740_boards_compat_dt,
|
|
|
|
MACHINE_END
|