Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 1 | /* |
| 2 | * KZM-A9-GT board support |
| 3 | * |
| 4 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | #include <linux/gpio.h> |
| 20 | #include <linux/io.h> |
| 21 | #include <linux/irq.h> |
| 22 | #include <linux/platform_device.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 23 | #include <linux/smsc911x.h> |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame^] | 24 | #include <linux/usb/r8a66597.h> |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 25 | #include <mach/irqs.h> |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 26 | #include <mach/sh73a0.h> |
| 27 | #include <mach/common.h> |
| 28 | #include <asm/hardware/cache-l2x0.h> |
| 29 | #include <asm/hardware/gic.h> |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 33 | /* SMSC 9221 */ |
| 34 | static struct resource smsc9221_resources[] = { |
| 35 | [0] = { |
| 36 | .start = 0x10000000, /* CS4 */ |
| 37 | .end = 0x100000ff, |
| 38 | .flags = IORESOURCE_MEM, |
| 39 | }, |
| 40 | [1] = { |
| 41 | .start = intcs_evt2irq(0x260), /* IRQ3 */ |
| 42 | .flags = IORESOURCE_IRQ, |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | static struct smsc911x_platform_config smsc9221_platdata = { |
| 47 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
| 48 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 49 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 50 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 51 | }; |
| 52 | |
| 53 | static struct platform_device smsc_device = { |
| 54 | .name = "smsc911x", |
| 55 | .dev = { |
| 56 | .platform_data = &smsc9221_platdata, |
| 57 | }, |
| 58 | .resource = smsc9221_resources, |
| 59 | .num_resources = ARRAY_SIZE(smsc9221_resources), |
| 60 | }; |
| 61 | |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame^] | 62 | /* USB external chip */ |
| 63 | static struct r8a66597_platdata usb_host_data = { |
| 64 | .on_chip = 0, |
| 65 | .xtal = R8A66597_PLATDATA_XTAL_48MHZ, |
| 66 | }; |
| 67 | |
| 68 | static struct resource usb_resources[] = { |
| 69 | [0] = { |
| 70 | .start = 0x10010000, |
| 71 | .end = 0x1001ffff - 1, |
| 72 | .flags = IORESOURCE_MEM, |
| 73 | }, |
| 74 | [1] = { |
| 75 | .start = intcs_evt2irq(0x220), /* IRQ1 */ |
| 76 | .flags = IORESOURCE_IRQ, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | static struct platform_device usb_host_device = { |
| 81 | .name = "r8a66597_hcd", |
| 82 | .dev = { |
| 83 | .platform_data = &usb_host_data, |
| 84 | .dma_mask = NULL, |
| 85 | .coherent_dma_mask = 0xffffffff, |
| 86 | }, |
| 87 | .num_resources = ARRAY_SIZE(usb_resources), |
| 88 | .resource = usb_resources, |
| 89 | }; |
| 90 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 91 | static struct platform_device *kzm_devices[] __initdata = { |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 92 | &smsc_device, |
Kuninori Morimoto | dd81818 | 2012-04-10 20:58:10 -0700 | [diff] [blame^] | 93 | &usb_host_device, |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 94 | }; |
| 95 | |
| 96 | static void __init kzm_init(void) |
| 97 | { |
| 98 | sh73a0_pinmux_init(); |
| 99 | |
| 100 | /* enable SCIFA4 */ |
| 101 | gpio_request(GPIO_FN_SCIFA4_TXD, NULL); |
| 102 | gpio_request(GPIO_FN_SCIFA4_RXD, NULL); |
| 103 | gpio_request(GPIO_FN_SCIFA4_RTS_, NULL); |
| 104 | gpio_request(GPIO_FN_SCIFA4_CTS_, NULL); |
| 105 | |
Kuninori Morimoto | c15c425 | 2012-04-10 20:57:58 -0700 | [diff] [blame] | 106 | /* CS4 for SMSC/USB */ |
| 107 | gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */ |
| 108 | |
| 109 | /* SMSC */ |
| 110 | gpio_request(GPIO_PORT224, NULL); /* IRQ3 */ |
| 111 | gpio_direction_input(GPIO_PORT224); |
| 112 | |
Kuninori Morimoto | 9b93e24 | 2012-04-10 20:57:31 -0700 | [diff] [blame] | 113 | #ifdef CONFIG_CACHE_L2X0 |
| 114 | /* Early BRESP enable, Shared attribute override enable, 64K*8way */ |
| 115 | l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); |
| 116 | #endif |
| 117 | |
| 118 | sh73a0_add_standard_devices(); |
| 119 | platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices)); |
| 120 | } |
| 121 | |
| 122 | MACHINE_START(KZM9G, "kzm9g") |
| 123 | .map_io = sh73a0_map_io, |
| 124 | .init_early = sh73a0_add_early_devices, |
| 125 | .nr_irqs = NR_IRQS_LEGACY, |
| 126 | .init_irq = sh73a0_init_irq, |
| 127 | .handle_irq = gic_handle_irq, |
| 128 | .init_machine = kzm_init, |
| 129 | .timer = &shmobile_timer, |
| 130 | MACHINE_END |