Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Bock-W board support |
| 3 | * |
| 4 | * Copyright (C) 2013 Renesas Solutions Corp. |
| 5 | * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include <linux/of_platform.h> |
Geert Uytterhoeven | 02c94f3 | 2014-06-20 18:53:04 +0200 | [diff] [blame^] | 22 | |
Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 23 | #include <asm/mach/arch.h> |
Geert Uytterhoeven | 02c94f3 | 2014-06-20 18:53:04 +0200 | [diff] [blame^] | 24 | |
Magnus Damm | fd44aa5 | 2014-06-17 16:47:37 +0900 | [diff] [blame] | 25 | #include "common.h" |
Geert Uytterhoeven | 02c94f3 | 2014-06-20 18:53:04 +0200 | [diff] [blame^] | 26 | #include "r8a7778.h" |
Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 27 | |
| 28 | /* |
| 29 | * see board-bock.c for checking detail of dip-switch |
| 30 | */ |
| 31 | |
Kuninori Morimoto | 90357fc | 2013-10-02 01:33:36 -0700 | [diff] [blame] | 32 | #define FPGA 0x18200000 |
| 33 | #define IRQ0MR 0x30 |
| 34 | #define COMCTLR 0x101c |
Kuninori Morimoto | 79990c1 | 2013-10-10 23:35:34 -0700 | [diff] [blame] | 35 | |
| 36 | #define PFC 0xfffc0000 |
| 37 | #define PUPR4 0x110 |
Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 38 | static void __init bockw_init(void) |
| 39 | { |
Kuninori Morimoto | b6d3eba | 2013-10-10 23:35:06 -0700 | [diff] [blame] | 40 | void __iomem *fpga; |
Kuninori Morimoto | 79990c1 | 2013-10-10 23:35:34 -0700 | [diff] [blame] | 41 | void __iomem *pfc; |
Kuninori Morimoto | 90357fc | 2013-10-02 01:33:36 -0700 | [diff] [blame] | 42 | |
Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 43 | r8a7778_clock_init(); |
Kuninori Morimoto | 90357fc | 2013-10-02 01:33:36 -0700 | [diff] [blame] | 44 | r8a7778_init_irq_extpin_dt(1); |
Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 45 | r8a7778_add_dt_devices(); |
| 46 | |
Kuninori Morimoto | 90357fc | 2013-10-02 01:33:36 -0700 | [diff] [blame] | 47 | fpga = ioremap_nocache(FPGA, SZ_1M); |
| 48 | if (fpga) { |
| 49 | /* |
| 50 | * CAUTION |
| 51 | * |
| 52 | * IRQ0/1 is cascaded interrupt from FPGA. |
| 53 | * it should be cared in the future |
| 54 | * Now, it is assuming IRQ0 was used only from SMSC. |
| 55 | */ |
| 56 | u16 val = ioread16(fpga + IRQ0MR); |
| 57 | val &= ~(1 << 4); /* enable SMSC911x */ |
| 58 | iowrite16(val, fpga + IRQ0MR); |
Kuninori Morimoto | b6d3eba | 2013-10-10 23:35:06 -0700 | [diff] [blame] | 59 | |
| 60 | iounmap(fpga); |
Kuninori Morimoto | 90357fc | 2013-10-02 01:33:36 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Kuninori Morimoto | 79990c1 | 2013-10-10 23:35:34 -0700 | [diff] [blame] | 63 | pfc = ioremap_nocache(PFC, 0x200); |
| 64 | if (pfc) { |
| 65 | /* |
| 66 | * FIXME |
| 67 | * |
| 68 | * SDHI CD/WP pin needs pull-up |
| 69 | */ |
| 70 | iowrite32(ioread32(pfc + PUPR4) | (3 << 26), pfc + PUPR4); |
| 71 | iounmap(pfc); |
Kuninori Morimoto | cfa66a8 | 2013-07-24 00:36:51 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 75 | } |
| 76 | |
| 77 | static const char *bockw_boards_compat_dt[] __initdata = { |
| 78 | "renesas,bockw-reference", |
| 79 | NULL, |
| 80 | }; |
| 81 | |
| 82 | DT_MACHINE_START(BOCKW_DT, "bockw") |
| 83 | .init_early = r8a7778_init_delay, |
| 84 | .init_irq = r8a7778_init_irq_dt, |
| 85 | .init_machine = bockw_init, |
| 86 | .dt_compat = bockw_boards_compat_dt, |
| 87 | MACHINE_END |