Magnus Damm | c050fb1 | 2012-05-16 15:45:16 +0900 | [diff] [blame] | 1 | /* |
| 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 Damm | 0c73f7b | 2012-05-16 15:45:42 +0900 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
Guennadi Liakhovetski | faa661b | 2012-06-27 00:32:30 +0200 | [diff] [blame] | 24 | #include <linux/regulator/fixed.h> |
| 25 | #include <linux/regulator/machine.h> |
Magnus Damm | 0c73f7b | 2012-05-16 15:45:42 +0900 | [diff] [blame] | 26 | #include <linux/smsc911x.h> |
Magnus Damm | c050fb1 | 2012-05-16 15:45:16 +0900 | [diff] [blame] | 27 | #include <mach/common.h> |
| 28 | #include <mach/emev2.h> |
| 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
Magnus Damm | c050fb1 | 2012-05-16 15:45:16 +0900 | [diff] [blame] | 31 | |
Guennadi Liakhovetski | faa661b | 2012-06-27 00:32:30 +0200 | [diff] [blame] | 32 | /* Dummy supplies, where voltage doesn't matter */ |
| 33 | static struct regulator_consumer_supply dummy_supplies[] = { |
| 34 | REGULATOR_SUPPLY("vddvario", "smsc911x"), |
| 35 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), |
| 36 | }; |
| 37 | |
Magnus Damm | 0c73f7b | 2012-05-16 15:45:42 +0900 | [diff] [blame] | 38 | /* Ether */ |
| 39 | static struct resource smsc911x_resources[] = { |
| 40 | [0] = { |
| 41 | .start = 0x20000000, |
| 42 | .end = 0x2000ffff, |
| 43 | .flags = IORESOURCE_MEM, |
| 44 | }, |
| 45 | [1] = { |
| 46 | .start = EMEV2_GPIO_IRQ(1), |
| 47 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static struct smsc911x_platform_config smsc911x_platdata = { |
| 52 | .flags = SMSC911X_USE_32BIT, |
| 53 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 54 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 55 | }; |
| 56 | |
| 57 | static struct platform_device smsc91x_device = { |
| 58 | .name = "smsc911x", |
Simon Horman | df53721 | 2013-04-04 11:20:33 +0900 | [diff] [blame] | 59 | .id = -1, |
Magnus Damm | 0c73f7b | 2012-05-16 15:45:42 +0900 | [diff] [blame] | 60 | .dev = { |
| 61 | .platform_data = &smsc911x_platdata, |
| 62 | }, |
| 63 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 64 | .resource = smsc911x_resources, |
| 65 | }; |
| 66 | |
| 67 | static struct platform_device *kzm9d_devices[] __initdata = { |
| 68 | &smsc91x_device, |
| 69 | }; |
| 70 | |
| 71 | void __init kzm9d_add_standard_devices(void) |
| 72 | { |
Guennadi Liakhovetski | faa661b | 2012-06-27 00:32:30 +0200 | [diff] [blame] | 73 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); |
| 74 | |
Magnus Damm | 0c73f7b | 2012-05-16 15:45:42 +0900 | [diff] [blame] | 75 | emev2_add_standard_devices(); |
| 76 | |
| 77 | platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices)); |
| 78 | } |
| 79 | |
Magnus Damm | 450cca4 | 2012-05-16 15:46:03 +0900 | [diff] [blame] | 80 | static const char *kzm9d_boards_compat_dt[] __initdata = { |
| 81 | "renesas,kzm9d", |
| 82 | NULL, |
| 83 | }; |
| 84 | |
| 85 | DT_MACHINE_START(KZM9D_DT, "kzm9d") |
Marc Zyngier | a62580e | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 86 | .smp = smp_ops(emev2_smp_ops), |
Magnus Damm | bd5a875 | 2012-05-16 15:45:25 +0900 | [diff] [blame] | 87 | .map_io = emev2_map_io, |
Magnus Damm | 4146fa8 | 2013-07-02 18:27:33 +0900 | [diff] [blame] | 88 | .init_early = emev2_init_delay, |
Magnus Damm | 0c73f7b | 2012-05-16 15:45:42 +0900 | [diff] [blame] | 89 | .init_machine = kzm9d_add_standard_devices, |
Kuninori Morimoto | c207d2d | 2012-06-20 22:41:34 -0700 | [diff] [blame] | 90 | .init_late = shmobile_init_late, |
Magnus Damm | 450cca4 | 2012-05-16 15:46:03 +0900 | [diff] [blame] | 91 | .dt_compat = kzm9d_boards_compat_dt, |
Magnus Damm | c050fb1 | 2012-05-16 15:45:16 +0900 | [diff] [blame] | 92 | MACHINE_END |