blob: 38e5e50fb3180fb6d8db907ddea4680da8966e30 [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
21#include <linux/platform_device.h>
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070022#include <linux/smsc911x.h>
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070023#include <mach/common.h>
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070024#include <mach/irqs.h>
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070025#include <mach/r8a7778.h>
26#include <asm/mach/arch.h>
27
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070028static struct smsc911x_platform_config smsc911x_data = {
29 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
30 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
31 .flags = SMSC911X_USE_32BIT,
32 .phy_interface = PHY_INTERFACE_MODE_MII,
33};
34
35static struct resource smsc911x_resources[] = {
36 DEFINE_RES_MEM(0x18300000, 0x1000),
37 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
38};
39
40#define IRQ0MR 0x30
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070041static void __init bockw_init(void)
42{
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070043 void __iomem *fpga;
44
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070045 r8a7778_clock_init();
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070046 r8a7778_init_irq_extpin(1);
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070047 r8a7778_add_standard_devices();
Kuninori Morimoto27d5f27e2013-04-01 21:20:02 -070048
49 fpga = ioremap_nocache(0x18200000, SZ_1M);
50 if (fpga) {
51 /*
52 * CAUTION
53 *
54 * IRQ0/1 is cascaded interrupt from FPGA.
55 * it should be cared in the future
56 * Now, it is assuming IRQ0 was used only from SMSC.
57 */
58 u16 val = ioread16(fpga + IRQ0MR);
59 val &= ~(1 << 4); /* enable SMSC911x */
60 iowrite16(val, fpga + IRQ0MR);
61 iounmap(fpga);
62
63 platform_device_register_resndata(
64 &platform_bus, "smsc911x", -1,
65 smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
66 &smsc911x_data, sizeof(smsc911x_data));
67 }
Kuninori Morimoto53e42c22013-03-21 03:03:38 -070068}
69
70static const char *bockw_boards_compat_dt[] __initdata = {
71 "renesas,bockw",
72 NULL,
73};
74
75DT_MACHINE_START(BOCKW_DT, "bockw")
76 .init_early = r8a7778_init_delay,
77 .init_irq = r8a7778_init_irq_dt,
78 .init_machine = bockw_init,
79 .init_time = shmobile_timer_init,
80 .dt_compat = bockw_boards_compat_dt,
81MACHINE_END