blob: b0c9986d022d86649879fa68cf6bf0dab27ae453 [file] [log] [blame]
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -07001/*
2 * r8a7778 processor support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Sergei Shtylyov52421912013-04-04 18:55:46 +00006 * Copyright (C) 2013 Cogent Embedded, Inc.
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -07007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070016 */
17
Ulrich Hecht43cbec82015-02-16 17:58:49 +010018#include <linux/clk/shmobile.h>
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070019#include <linux/io.h>
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070020#include <linux/irqchip.h>
Geert Uytterhoeven02c94f32014-06-20 18:53:04 +020021
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070022#include <asm/mach/arch.h>
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070023
Magnus Dammfd44aa52014-06-17 16:47:37 +090024#include "common.h"
Magnus Dammb6bab122014-06-17 16:47:29 +090025#include "irqs.h"
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070026
Ulrich Hecht43cbec82015-02-16 17:58:49 +010027#define MODEMR 0xffcc0020
28
Ulrich Hecht43cbec82015-02-16 17:58:49 +010029static void __init r8a7778_timer_init(void)
30{
31 u32 mode;
32 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
33
34 BUG_ON(!modemr);
35 mode = ioread32(modemr);
36 iounmap(modemr);
37 r8a7778_clocks_init(mode);
38}
Ulrich Hecht43cbec82015-02-16 17:58:49 +010039
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070040#define INT2SMSKCR0 0x82288 /* 0xfe782288 */
41#define INT2SMSKCR1 0x8228c /* 0xfe78228c */
42
43#define INT2NTSR0 0x00018 /* 0xfe700018 */
44#define INT2NTSR1 0x0002c /* 0xfe70002c */
Kuninori Morimoto54aa4c42013-07-09 01:48:34 -070045void __init r8a7778_init_irq_dt(void)
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070046{
47 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000);
48
49 BUG_ON(!base);
50
Kuninori Morimoto54aa4c42013-07-09 01:48:34 -070051 irqchip_init();
Ulrich Hecht4baadb92015-08-14 15:51:03 +020052
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070053 /* route all interrupts to ARM */
54 __raw_writel(0x73ffffff, base + INT2NTSR0);
55 __raw_writel(0xffffffff, base + INT2NTSR1);
56
57 /* unmask all known interrupts in INTCS2 */
58 __raw_writel(0x08330773, base + INT2SMSKCR0);
59 __raw_writel(0x00311110, base + INT2SMSKCR1);
60
61 iounmap(base);
62}
63
Nicolas Pitre19c233b2015-07-27 18:27:52 -040064static const char *const r8a7778_compat_dt[] __initconst = {
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070065 "renesas,r8a7778",
66 NULL,
67};
68
69DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
Geert Uytterhoeven92ee3412014-10-17 14:24:38 +020070 .init_early = shmobile_init_delay,
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070071 .init_irq = r8a7778_init_irq_dt,
Magnus Damm7759a7a2014-07-31 08:32:50 +090072 .init_late = shmobile_init_late,
Ulrich Hecht43cbec82015-02-16 17:58:49 +010073 .init_time = r8a7778_timer_init,
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070074 .dt_compat = r8a7778_compat_dt,
Kuninori Morimotoccb7cc72013-03-21 03:01:36 -070075MACHINE_END