blob: a46aec1ddb44d91b351905c1f0396ea8914bde34 [file] [log] [blame]
Kuninori Morimoto9b93e242012-04-10 20:57:31 -07001/*
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 Morimotoc15c4252012-04-10 20:57:58 -070023#include <linux/smsc911x.h>
24#include <mach/irqs.h>
Kuninori Morimoto9b93e242012-04-10 20:57:31 -070025#include <mach/sh73a0.h>
26#include <mach/common.h>
27#include <asm/hardware/cache-l2x0.h>
28#include <asm/hardware/gic.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31
Kuninori Morimotoc15c4252012-04-10 20:57:58 -070032/* SMSC 9221 */
33static struct resource smsc9221_resources[] = {
34 [0] = {
35 .start = 0x10000000, /* CS4 */
36 .end = 0x100000ff,
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
40 .start = intcs_evt2irq(0x260), /* IRQ3 */
41 .flags = IORESOURCE_IRQ,
42 },
43};
44
45static struct smsc911x_platform_config smsc9221_platdata = {
46 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
47 .phy_interface = PHY_INTERFACE_MODE_MII,
48 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
49 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
50};
51
52static struct platform_device smsc_device = {
53 .name = "smsc911x",
54 .dev = {
55 .platform_data = &smsc9221_platdata,
56 },
57 .resource = smsc9221_resources,
58 .num_resources = ARRAY_SIZE(smsc9221_resources),
59};
60
Kuninori Morimoto9b93e242012-04-10 20:57:31 -070061static struct platform_device *kzm_devices[] __initdata = {
Kuninori Morimotoc15c4252012-04-10 20:57:58 -070062 &smsc_device,
Kuninori Morimoto9b93e242012-04-10 20:57:31 -070063};
64
65static void __init kzm_init(void)
66{
67 sh73a0_pinmux_init();
68
69 /* enable SCIFA4 */
70 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
71 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
72 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
73 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
74
Kuninori Morimotoc15c4252012-04-10 20:57:58 -070075 /* CS4 for SMSC/USB */
76 gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
77
78 /* SMSC */
79 gpio_request(GPIO_PORT224, NULL); /* IRQ3 */
80 gpio_direction_input(GPIO_PORT224);
81
Kuninori Morimoto9b93e242012-04-10 20:57:31 -070082#ifdef CONFIG_CACHE_L2X0
83 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
84 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
85#endif
86
87 sh73a0_add_standard_devices();
88 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
89}
90
91MACHINE_START(KZM9G, "kzm9g")
92 .map_io = sh73a0_map_io,
93 .init_early = sh73a0_add_early_devices,
94 .nr_irqs = NR_IRQS_LEGACY,
95 .init_irq = sh73a0_init_irq,
96 .handle_irq = gic_handle_irq,
97 .init_machine = kzm_init,
98 .timer = &shmobile_timer,
99MACHINE_END