18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * r8a7779 processor support
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2011, 2013  Renesas Solutions Corp.
68c2ecf20Sopenharmony_ci * Copyright (C) 2011  Magnus Damm
78c2ecf20Sopenharmony_ci * Copyright (C) 2013  Cogent Embedded, Inc.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#include <linux/init.h>
108c2ecf20Sopenharmony_ci#include <linux/irqchip.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
138c2ecf20Sopenharmony_ci#include <asm/mach/map.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "common.h"
168c2ecf20Sopenharmony_ci#include "r8a7779.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistatic struct map_desc r8a7779_io_desc[] __initdata = {
198c2ecf20Sopenharmony_ci	/* 2M identity mapping for 0xf0000000 (MPCORE) */
208c2ecf20Sopenharmony_ci	{
218c2ecf20Sopenharmony_ci		.virtual	= 0xf0000000,
228c2ecf20Sopenharmony_ci		.pfn		= __phys_to_pfn(0xf0000000),
238c2ecf20Sopenharmony_ci		.length		= SZ_2M,
248c2ecf20Sopenharmony_ci		.type		= MT_DEVICE_NONSHARED
258c2ecf20Sopenharmony_ci	},
268c2ecf20Sopenharmony_ci	/* 16M identity mapping for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
278c2ecf20Sopenharmony_ci	{
288c2ecf20Sopenharmony_ci		.virtual	= 0xfe000000,
298c2ecf20Sopenharmony_ci		.pfn		= __phys_to_pfn(0xfe000000),
308c2ecf20Sopenharmony_ci		.length		= SZ_16M,
318c2ecf20Sopenharmony_ci		.type		= MT_DEVICE_NONSHARED
328c2ecf20Sopenharmony_ci	},
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistatic void __init r8a7779_map_io(void)
368c2ecf20Sopenharmony_ci{
378c2ecf20Sopenharmony_ci	debug_ll_io_init();
388c2ecf20Sopenharmony_ci	iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* IRQ */
428c2ecf20Sopenharmony_ci#define INT2SMSKCR0 IOMEM(0xfe7822a0)
438c2ecf20Sopenharmony_ci#define INT2SMSKCR1 IOMEM(0xfe7822a4)
448c2ecf20Sopenharmony_ci#define INT2SMSKCR2 IOMEM(0xfe7822a8)
458c2ecf20Sopenharmony_ci#define INT2SMSKCR3 IOMEM(0xfe7822ac)
468c2ecf20Sopenharmony_ci#define INT2SMSKCR4 IOMEM(0xfe7822b0)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define INT2NTSR0 IOMEM(0xfe700060)
498c2ecf20Sopenharmony_ci#define INT2NTSR1 IOMEM(0xfe700064)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistatic void __init r8a7779_init_irq_dt(void)
528c2ecf20Sopenharmony_ci{
538c2ecf20Sopenharmony_ci	irqchip_init();
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	/* route all interrupts to ARM */
568c2ecf20Sopenharmony_ci	__raw_writel(0xffffffff, INT2NTSR0);
578c2ecf20Sopenharmony_ci	__raw_writel(0x3fffffff, INT2NTSR1);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	/* unmask all known interrupts in INTCS2 */
608c2ecf20Sopenharmony_ci	__raw_writel(0xfffffff0, INT2SMSKCR0);
618c2ecf20Sopenharmony_ci	__raw_writel(0xfff7ffff, INT2SMSKCR1);
628c2ecf20Sopenharmony_ci	__raw_writel(0xfffbffdf, INT2SMSKCR2);
638c2ecf20Sopenharmony_ci	__raw_writel(0xbffffffc, INT2SMSKCR3);
648c2ecf20Sopenharmony_ci	__raw_writel(0x003fee3f, INT2SMSKCR4);
658c2ecf20Sopenharmony_ci}
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistatic const char *const r8a7779_compat_dt[] __initconst = {
688c2ecf20Sopenharmony_ci	"renesas,r8a7779",
698c2ecf20Sopenharmony_ci	NULL,
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciDT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
738c2ecf20Sopenharmony_ci	.smp		= smp_ops(r8a7779_smp_ops),
748c2ecf20Sopenharmony_ci	.map_io		= r8a7779_map_io,
758c2ecf20Sopenharmony_ci	.init_irq	= r8a7779_init_irq_dt,
768c2ecf20Sopenharmony_ci	.init_late	= shmobile_init_late,
778c2ecf20Sopenharmony_ci	.dt_compat	= r8a7779_compat_dt,
788c2ecf20Sopenharmony_ciMACHINE_END
79