setup-r8a7778.c 1.93 KB
Newer Older
1 2 3 4 5
/*
 * r8a7778 processor support
 *
 * Copyright (C) 2013  Renesas Solutions Corp.
 * Copyright (C) 2013  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6
 * Copyright (C) 2013  Cogent Embedded, Inc.
7 8 9 10 11 12 13 14 15 16 17
 *
 * 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.
 */

18
#include <linux/clk/renesas.h>
19 20
#include <linux/io.h>
#include <linux/irqchip.h>
21

22 23
#include <asm/mach/arch.h>

Magnus Damm's avatar
Magnus Damm committed
24
#include "common.h"
25

26 27 28 29 30 31 32 33 34 35 36 37 38
#define MODEMR 0xffcc0020

static void __init r8a7778_timer_init(void)
{
	u32 mode;
	void __iomem *modemr = ioremap_nocache(MODEMR, 4);

	BUG_ON(!modemr);
	mode = ioread32(modemr);
	iounmap(modemr);
	r8a7778_clocks_init(mode);
}

39 40 41 42 43
#define INT2SMSKCR0	0x82288 /* 0xfe782288 */
#define INT2SMSKCR1	0x8228c /* 0xfe78228c */

#define INT2NTSR0	0x00018 /* 0xfe700018 */
#define INT2NTSR1	0x0002c /* 0xfe70002c */
44 45

static void __init r8a7778_init_irq_dt(void)
46 47 48 49 50
{
	void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000);

	BUG_ON(!base);

51
	irqchip_init();
52

53 54 55 56 57 58 59 60 61 62 63
	/* route all interrupts to ARM */
	__raw_writel(0x73ffffff, base + INT2NTSR0);
	__raw_writel(0xffffffff, base + INT2NTSR1);

	/* unmask all known interrupts in INTCS2 */
	__raw_writel(0x08330773, base + INT2SMSKCR0);
	__raw_writel(0x00311110, base + INT2SMSKCR1);

	iounmap(base);
}

64
static const char *const r8a7778_compat_dt[] __initconst = {
65 66 67 68 69
	"renesas,r8a7778",
	NULL,
};

DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
70
	.init_early	= shmobile_init_delay,
71
	.init_irq	= r8a7778_init_irq_dt,
72
	.init_late	= shmobile_init_late,
73
	.init_time	= r8a7778_timer_init,
74 75
	.dt_compat	= r8a7778_compat_dt,
MACHINE_END