blob: dac4365c515816dad7370d1064d8bac1015117b0 [file] [log] [blame]
Kuninori Morimoto53e42c22013-03-21 03:03:38 -07001/*
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
Kuninori Morimoto111ea172013-04-12 05:38:03 +000021#include <linux/pinctrl/machine.h>
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070022#include <linux/platform_device.h>
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070023#include <linux/smsc911x.h>
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070024#include <mach/common.h>
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070025#include <mach/irqs.h>
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070026#include <mach/r8a7778.h>
27#include <asm/mach/arch.h>
28
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070029static struct smsc911x_platform_config smsc911x_data = {
30 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
31 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
32 .flags = SMSC911X_USE_32BIT,
33 .phy_interface = PHY_INTERFACE_MODE_MII,
34};
35
36static struct resource smsc911x_resources[] = {
37 DEFINE_RES_MEM(0x18300000, 0x1000),
38 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
39};
40
Kuninori Morimoto111ea172013-04-12 05:38:03 +000041static const struct pinctrl_map bockw_pinctrl_map[] = {
42 /* SCIF0 */
43 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
44 "scif0_data_a", "scif0"),
45 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
46 "scif0_ctrl", "scif0"),
47};
48
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070049#define IRQ0MR 0x30
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070050static void __init bockw_init(void)
51{
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070052 void __iomem *fpga;
53
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070054 r8a7778_clock_init();
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070055 r8a7778_init_irq_extpin(1);
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070056 r8a7778_add_standard_devices();
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070057
Kuninori Morimoto111ea172013-04-12 05:38:03 +000058 pinctrl_register_mappings(bockw_pinctrl_map,
59 ARRAY_SIZE(bockw_pinctrl_map));
60 r8a7778_pinmux_init();
61
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070062 fpga = ioremap_nocache(0x18200000, SZ_1M);
63 if (fpga) {
64 /*
65 * CAUTION
66 *
67 * IRQ0/1 is cascaded interrupt from FPGA.
68 * it should be cared in the future
69 * Now, it is assuming IRQ0 was used only from SMSC.
70 */
71 u16 val = ioread16(fpga + IRQ0MR);
72 val &= ~(1 << 4); /* enable SMSC911x */
73 iowrite16(val, fpga + IRQ0MR);
74 iounmap(fpga);
75
76 platform_device_register_resndata(
77 &platform_bus, "smsc911x", -1,
78 smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
79 &smsc911x_data, sizeof(smsc911x_data));
80 }
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070081}
82
83static const char *bockw_boards_compat_dt[] __initdata = {
84 "renesas,bockw",
85 NULL,
86};
87
88DT_MACHINE_START(BOCKW_DT, "bockw")
89 .init_early = r8a7778_init_delay,
90 .init_irq = r8a7778_init_irq_dt,
91 .init_machine = bockw_init,
92 .init_time = shmobile_timer_init,
93 .dt_compat = bockw_boards_compat_dt,
94MACHINE_END