Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * r8a7778 processor support |
| 3 | * |
| 4 | * Copyright (C) 2013 Renesas Solutions Corp. |
| 5 | * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
Sergei Shtylyov | 5242191 | 2013-04-04 18:55:46 +0000 | [diff] [blame] | 6 | * Copyright (C) 2013 Cogent Embedded, Inc. |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 7 | * |
| 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 Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 16 | */ |
| 17 | |
Ulrich Hecht | 43cbec8 | 2015-02-16 17:58:49 +0100 | [diff] [blame] | 18 | #include <linux/clk/shmobile.h> |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 19 | #include <linux/io.h> |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 20 | #include <linux/irqchip.h> |
Geert Uytterhoeven | 02c94f3 | 2014-06-20 18:53:04 +0200 | [diff] [blame] | 21 | |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 22 | #include <asm/mach/arch.h> |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 23 | |
Magnus Damm | fd44aa5 | 2014-06-17 16:47:37 +0900 | [diff] [blame] | 24 | #include "common.h" |
Magnus Damm | b6bab12 | 2014-06-17 16:47:29 +0900 | [diff] [blame] | 25 | #include "irqs.h" |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 26 | |
Ulrich Hecht | 43cbec8 | 2015-02-16 17:58:49 +0100 | [diff] [blame] | 27 | #define MODEMR 0xffcc0020 |
| 28 | |
Ulrich Hecht | 43cbec8 | 2015-02-16 17:58:49 +0100 | [diff] [blame] | 29 | static 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 Hecht | 43cbec8 | 2015-02-16 17:58:49 +0100 | [diff] [blame] | 39 | |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 40 | #define INT2SMSKCR0 0x82288 /* 0xfe782288 */ |
| 41 | #define INT2SMSKCR1 0x8228c /* 0xfe78228c */ |
| 42 | |
| 43 | #define INT2NTSR0 0x00018 /* 0xfe700018 */ |
| 44 | #define INT2NTSR1 0x0002c /* 0xfe70002c */ |
Geert Uytterhoeven | 20e7333 | 2015-09-30 17:50:19 +0200 | [diff] [blame] | 45 | |
| 46 | static void __init r8a7778_init_irq_dt(void) |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 47 | { |
| 48 | void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000); |
| 49 | |
| 50 | BUG_ON(!base); |
| 51 | |
Kuninori Morimoto | 54aa4c4 | 2013-07-09 01:48:34 -0700 | [diff] [blame] | 52 | irqchip_init(); |
Ulrich Hecht | 4baadb9 | 2015-08-14 15:51:03 +0200 | [diff] [blame] | 53 | |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 54 | /* route all interrupts to ARM */ |
| 55 | __raw_writel(0x73ffffff, base + INT2NTSR0); |
| 56 | __raw_writel(0xffffffff, base + INT2NTSR1); |
| 57 | |
| 58 | /* unmask all known interrupts in INTCS2 */ |
| 59 | __raw_writel(0x08330773, base + INT2SMSKCR0); |
| 60 | __raw_writel(0x00311110, base + INT2SMSKCR1); |
| 61 | |
| 62 | iounmap(base); |
| 63 | } |
| 64 | |
Nicolas Pitre | 19c233b | 2015-07-27 18:27:52 -0400 | [diff] [blame] | 65 | static const char *const r8a7778_compat_dt[] __initconst = { |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 66 | "renesas,r8a7778", |
| 67 | NULL, |
| 68 | }; |
| 69 | |
| 70 | DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)") |
Geert Uytterhoeven | 92ee341 | 2014-10-17 14:24:38 +0200 | [diff] [blame] | 71 | .init_early = shmobile_init_delay, |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 72 | .init_irq = r8a7778_init_irq_dt, |
Magnus Damm | 7759a7a | 2014-07-31 08:32:50 +0900 | [diff] [blame] | 73 | .init_late = shmobile_init_late, |
Ulrich Hecht | 43cbec8 | 2015-02-16 17:58:49 +0100 | [diff] [blame] | 74 | .init_time = r8a7778_timer_init, |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 75 | .dt_compat = r8a7778_compat_dt, |
Kuninori Morimoto | ccb7cc7 | 2013-03-21 03:01:36 -0700 | [diff] [blame] | 76 | MACHINE_END |