blob: 2c986eaae7b4d5ec77e4394dd2826f8ec3f67354 [file] [log] [blame]
Magnus Dammc050fb12012-05-16 15:45:16 +09001/*
2 * kzm9d board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 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/interrupt.h>
Magnus Damm0c73f7b2012-05-16 15:45:42 +090023#include <linux/platform_device.h>
Guennadi Liakhovetskifaa661b2012-06-27 00:32:30 +020024#include <linux/regulator/fixed.h>
25#include <linux/regulator/machine.h>
Magnus Damm0c73f7b2012-05-16 15:45:42 +090026#include <linux/smsc911x.h>
Magnus Dammc050fb12012-05-16 15:45:16 +090027#include <mach/common.h>
28#include <mach/emev2.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/hardware/gic.h>
32
Guennadi Liakhovetskifaa661b2012-06-27 00:32:30 +020033/* Dummy supplies, where voltage doesn't matter */
34static struct regulator_consumer_supply dummy_supplies[] = {
35 REGULATOR_SUPPLY("vddvario", "smsc911x"),
36 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
37};
38
Magnus Damm0c73f7b2012-05-16 15:45:42 +090039/* Ether */
40static struct resource smsc911x_resources[] = {
41 [0] = {
42 .start = 0x20000000,
43 .end = 0x2000ffff,
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = EMEV2_GPIO_IRQ(1),
48 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
49 },
50};
51
52static struct smsc911x_platform_config smsc911x_platdata = {
53 .flags = SMSC911X_USE_32BIT,
54 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
55 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
56};
57
58static struct platform_device smsc91x_device = {
59 .name = "smsc911x",
60 .id = 0,
61 .dev = {
62 .platform_data = &smsc911x_platdata,
63 },
64 .num_resources = ARRAY_SIZE(smsc911x_resources),
65 .resource = smsc911x_resources,
66};
67
68static struct platform_device *kzm9d_devices[] __initdata = {
69 &smsc91x_device,
70};
71
72void __init kzm9d_add_standard_devices(void)
73{
Guennadi Liakhovetskifaa661b2012-06-27 00:32:30 +020074 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
75
Magnus Damm0c73f7b2012-05-16 15:45:42 +090076 emev2_add_standard_devices();
77
78 platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
79}
80
Magnus Damm450cca42012-05-16 15:46:03 +090081static const char *kzm9d_boards_compat_dt[] __initdata = {
82 "renesas,kzm9d",
83 NULL,
84};
85
86DT_MACHINE_START(KZM9D_DT, "kzm9d")
Magnus Dammbd5a8752012-05-16 15:45:25 +090087 .map_io = emev2_map_io,
Magnus Dammc050fb12012-05-16 15:45:16 +090088 .init_early = emev2_add_early_devices,
89 .nr_irqs = NR_IRQS_LEGACY,
90 .init_irq = emev2_init_irq,
91 .handle_irq = gic_handle_irq,
Magnus Damm0c73f7b2012-05-16 15:45:42 +090092 .init_machine = kzm9d_add_standard_devices,
Kuninori Morimotoc207d2d2012-06-20 22:41:34 -070093 .init_late = shmobile_init_late,
Magnus Dammc050fb12012-05-16 15:45:16 +090094 .timer = &shmobile_timer,
Magnus Damm450cca42012-05-16 15:46:03 +090095 .dt_compat = kzm9d_boards_compat_dt,
Magnus Dammc050fb12012-05-16 15:45:16 +090096MACHINE_END