Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
| 7 | */ |
| 8 | #include <linux/module.h> |
| 9 | #include <linux/irq.h> |
Andrew Bresticker | 4060bbe | 2014-10-20 12:03:53 -0700 | [diff] [blame] | 10 | #include <linux/irqchip/mips-gic.h> |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 11 | #include <linux/platform_device.h> |
| 12 | #include <linux/smsc911x.h> |
| 13 | |
Andrew Bresticker | 18743d2 | 2014-09-18 14:47:24 -0700 | [diff] [blame] | 14 | #include <asm/mips-boards/sead3int.h> |
| 15 | |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 16 | static struct smsc911x_platform_config sead3_smsc911x_data = { |
| 17 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 18 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 19 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
| 20 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 21 | }; |
| 22 | |
Andrew Bresticker | 18743d2 | 2014-09-18 14:47:24 -0700 | [diff] [blame] | 23 | struct resource sead3_net_resources[] = { |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 24 | { |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 25 | .start = 0x1f010000, |
| 26 | .end = 0x1f01ffff, |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 27 | .flags = IORESOURCE_MEM |
| 28 | }, |
| 29 | { |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 30 | .flags = IORESOURCE_IRQ |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | static struct platform_device sead3_net_device = { |
| 35 | .name = "smsc911x", |
| 36 | .id = 0, |
| 37 | .dev = { |
| 38 | .platform_data = &sead3_smsc911x_data, |
| 39 | }, |
Andrew Bresticker | 18743d2 | 2014-09-18 14:47:24 -0700 | [diff] [blame] | 40 | .num_resources = ARRAY_SIZE(sead3_net_resources), |
| 41 | .resource = sead3_net_resources |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | static int __init sead3_net_init(void) |
| 45 | { |
Andrew Bresticker | 18743d2 | 2014-09-18 14:47:24 -0700 | [diff] [blame] | 46 | if (gic_present) |
| 47 | sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET; |
| 48 | else |
| 49 | sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET; |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 50 | return platform_device_register(&sead3_net_device); |
| 51 | } |
| 52 | |
| 53 | module_init(sead3_net_init); |
| 54 | |
| 55 | MODULE_AUTHOR("Chris Dearman <chris@mips.com>"); |
| 56 | MODULE_LICENSE("GPL"); |
| 57 | MODULE_DESCRIPTION("Network probe driver for SEAD-3"); |