Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 1 | /* |
| 2 | * marzen board support |
| 3 | * |
| 4 | * Copyright (C) 2011 Renesas Solutions Corp. |
| 5 | * Copyright (C) 2011 Magnus Damm |
| 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/kernel.h> |
| 22 | #include <linux/init.h> |
| 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/irq.h> |
| 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/delay.h> |
| 27 | #include <linux/io.h> |
Magnus Damm | 14f691c | 2011-12-14 01:36:42 +0900 | [diff] [blame] | 28 | #include <linux/gpio.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 29 | #include <linux/dma-mapping.h> |
Magnus Damm | db5eb99 | 2011-12-14 01:36:51 +0900 | [diff] [blame] | 30 | #include <linux/smsc911x.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 31 | #include <mach/hardware.h> |
| 32 | #include <mach/r8a7779.h> |
| 33 | #include <mach/common.h> |
Rob Herring | 250a272 | 2012-01-03 16:57:33 -0600 | [diff] [blame] | 34 | #include <mach/irqs.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/mach/arch.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 37 | #include <asm/hardware/gic.h> |
| 38 | #include <asm/traps.h> |
| 39 | |
Magnus Damm | db5eb99 | 2011-12-14 01:36:51 +0900 | [diff] [blame] | 40 | /* SMSC LAN89218 */ |
| 41 | static struct resource smsc911x_resources[] = { |
| 42 | [0] = { |
| 43 | .start = 0x18000000, /* ExCS0 */ |
| 44 | .end = 0x180000ff, /* A1->A7 */ |
| 45 | .flags = IORESOURCE_MEM, |
| 46 | }, |
| 47 | [1] = { |
| 48 | .start = gic_spi(28), /* IRQ 1 */ |
| 49 | .flags = IORESOURCE_IRQ, |
| 50 | }, |
| 51 | }; |
| 52 | |
| 53 | static struct smsc911x_platform_config smsc911x_platdata = { |
| 54 | .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */ |
| 55 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 56 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 57 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 58 | }; |
| 59 | |
| 60 | static struct platform_device eth_device = { |
| 61 | .name = "smsc911x", |
| 62 | .id = 0, |
| 63 | .dev = { |
| 64 | .platform_data = &smsc911x_platdata, |
| 65 | }, |
| 66 | .resource = smsc911x_resources, |
| 67 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 68 | }; |
| 69 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 70 | static struct platform_device *marzen_devices[] __initdata = { |
Magnus Damm | db5eb99 | 2011-12-14 01:36:51 +0900 | [diff] [blame] | 71 | ð_device, |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 72 | }; |
| 73 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 74 | static void __init marzen_init(void) |
| 75 | { |
Magnus Damm | 19c43fc | 2011-12-14 01:36:22 +0900 | [diff] [blame] | 76 | r8a7779_pinmux_init(); |
| 77 | |
Magnus Damm | 14f691c | 2011-12-14 01:36:42 +0900 | [diff] [blame] | 78 | /* SCIF2 (CN18: DEBUG0) */ |
| 79 | gpio_request(GPIO_FN_TX2_C, NULL); |
| 80 | gpio_request(GPIO_FN_RX2_C, NULL); |
| 81 | |
| 82 | /* SCIF4 (CN19: DEBUG1) */ |
| 83 | gpio_request(GPIO_FN_TX4, NULL); |
| 84 | gpio_request(GPIO_FN_RX4, NULL); |
| 85 | |
Magnus Damm | db5eb99 | 2011-12-14 01:36:51 +0900 | [diff] [blame] | 86 | /* LAN89218 */ |
| 87 | gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */ |
| 88 | gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */ |
| 89 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 90 | r8a7779_add_standard_devices(); |
| 91 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); |
| 92 | } |
| 93 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 94 | MACHINE_START(MARZEN, "marzen") |
Magnus Damm | 3e353b87 | 2012-02-29 21:37:43 +0900 | [diff] [blame] | 95 | .map_io = r8a7779_map_io, |
| 96 | .init_early = r8a7779_add_early_devices, |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 97 | .nr_irqs = NR_IRQS_LEGACY, |
| 98 | .init_irq = r8a7779_init_irq, |
Paul Mundt | 77761b6 | 2012-01-10 13:33:23 +0900 | [diff] [blame] | 99 | .handle_irq = gic_handle_irq, |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 100 | .init_machine = marzen_init, |
Shawn Guo | 21cc1b7 | 2012-04-26 21:58:41 +0800 | [diff] [blame] | 101 | .init_late = shmobile_init_late, |
Magnus Damm | df27a2d | 2012-03-06 17:37:01 +0900 | [diff] [blame] | 102 | .timer = &shmobile_timer, |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 103 | MACHINE_END |