Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -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 | |
Kuninori Morimoto | 111ea17 | 2013-04-12 05:38:03 +0000 | [diff] [blame] | 21 | #include <linux/pinctrl/machine.h> |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 22 | #include <linux/platform_device.h> |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 23 | #include <linux/smsc911x.h> |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 24 | #include <mach/common.h> |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 25 | #include <mach/irqs.h> |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 26 | #include <mach/r8a7778.h> |
| 27 | #include <asm/mach/arch.h> |
| 28 | |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 29 | static 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 | |
| 36 | static struct resource smsc911x_resources[] = { |
| 37 | DEFINE_RES_MEM(0x18300000, 0x1000), |
| 38 | DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */ |
| 39 | }; |
| 40 | |
Sergei Shtylyov | 1a87b01 | 2013-06-09 00:38:41 +0400 | [diff] [blame^] | 41 | static struct rcar_phy_platform_data usb_phy_platform_data __initdata; |
| 42 | |
Kuninori Morimoto | 111ea17 | 2013-04-12 05:38:03 +0000 | [diff] [blame] | 43 | static const struct pinctrl_map bockw_pinctrl_map[] = { |
| 44 | /* SCIF0 */ |
| 45 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778", |
| 46 | "scif0_data_a", "scif0"), |
| 47 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778", |
| 48 | "scif0_ctrl", "scif0"), |
Sergei Shtylyov | 1a87b01 | 2013-06-09 00:38:41 +0400 | [diff] [blame^] | 49 | PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", |
| 50 | "usb0", "usb0"), |
| 51 | PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778", |
| 52 | "usb1", "usb1"), |
Kuninori Morimoto | 111ea17 | 2013-04-12 05:38:03 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 55 | #define IRQ0MR 0x30 |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 56 | static void __init bockw_init(void) |
| 57 | { |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 58 | void __iomem *fpga; |
| 59 | |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 60 | r8a7778_clock_init(); |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 61 | r8a7778_init_irq_extpin(1); |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 62 | r8a7778_add_standard_devices(); |
Sergei Shtylyov | 1a87b01 | 2013-06-09 00:38:41 +0400 | [diff] [blame^] | 63 | r8a7778_add_usb_phy_device(&usb_phy_platform_data); |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 64 | |
Kuninori Morimoto | 111ea17 | 2013-04-12 05:38:03 +0000 | [diff] [blame] | 65 | pinctrl_register_mappings(bockw_pinctrl_map, |
| 66 | ARRAY_SIZE(bockw_pinctrl_map)); |
| 67 | r8a7778_pinmux_init(); |
| 68 | |
Kuninori Morimoto | 27d5f27 | 2013-04-01 21:20:02 -0700 | [diff] [blame] | 69 | fpga = ioremap_nocache(0x18200000, SZ_1M); |
| 70 | if (fpga) { |
| 71 | /* |
| 72 | * CAUTION |
| 73 | * |
| 74 | * IRQ0/1 is cascaded interrupt from FPGA. |
| 75 | * it should be cared in the future |
| 76 | * Now, it is assuming IRQ0 was used only from SMSC. |
| 77 | */ |
| 78 | u16 val = ioread16(fpga + IRQ0MR); |
| 79 | val &= ~(1 << 4); /* enable SMSC911x */ |
| 80 | iowrite16(val, fpga + IRQ0MR); |
| 81 | iounmap(fpga); |
| 82 | |
| 83 | platform_device_register_resndata( |
| 84 | &platform_bus, "smsc911x", -1, |
| 85 | smsc911x_resources, ARRAY_SIZE(smsc911x_resources), |
| 86 | &smsc911x_data, sizeof(smsc911x_data)); |
| 87 | } |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | static const char *bockw_boards_compat_dt[] __initdata = { |
| 91 | "renesas,bockw", |
| 92 | NULL, |
| 93 | }; |
| 94 | |
| 95 | DT_MACHINE_START(BOCKW_DT, "bockw") |
| 96 | .init_early = r8a7778_init_delay, |
| 97 | .init_irq = r8a7778_init_irq_dt, |
| 98 | .init_machine = bockw_init, |
| 99 | .init_time = shmobile_timer_init, |
| 100 | .dt_compat = bockw_boards_compat_dt, |
Sergei Shtylyov | 1a87b01 | 2013-06-09 00:38:41 +0400 | [diff] [blame^] | 101 | .init_late = r8a7778_init_late, |
Kuninori Morimoto | 53e42c2 | 2013-03-21 03:03:38 -0700 | [diff] [blame] | 102 | MACHINE_END |