linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH v2 05/19] MIPS: SEAD3: Probe ethernet controller using DT
Date: Fri, 26 Aug 2016 15:17:37 +0100	[thread overview]
Message-ID: <20160826141751.13121-6-paul.burton@imgtec.com> (raw)
In-Reply-To: <20160826141751.13121-1-paul.burton@imgtec.com>

Probe the smsc911x ethernet controller using device tree rather than
platform code, reducing the amount of the latter.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

Changes in v2: None

 arch/mips/boot/dts/mti/sead3.dts             | 12 ++++++++++
 arch/mips/include/asm/mips-boards/sead3int.h |  2 --
 arch/mips/mti-sead3/sead3-dtshim.c           | 15 ++++++++++++-
 arch/mips/mti-sead3/sead3-platform.c         | 33 ----------------------------
 4 files changed, 26 insertions(+), 36 deletions(-)

diff --git a/arch/mips/boot/dts/mti/sead3.dts b/arch/mips/boot/dts/mti/sead3.dts
index 3f681c5..29ed194 100644
--- a/arch/mips/boot/dts/mti/sead3.dts
+++ b/arch/mips/boot/dts/mti/sead3.dts
@@ -87,4 +87,16 @@
 
 		no-loopback-test;
 	};
+
+	eth@1f010000 {
+		compatible = "smsc,lan9115";
+		reg = <0x1f010000 0x10000>;
+		reg-io-width = <4>;
+
+		interrupts = <0>; /* GIC 0 or CPU 6 */
+
+		phy-mode = "mii";
+		smsc,irq-push-pull;
+		smsc,save-mac-address;
+	};
 };
diff --git a/arch/mips/include/asm/mips-boards/sead3int.h b/arch/mips/include/asm/mips-boards/sead3int.h
index 3a5e079..7fdb9d4 100644
--- a/arch/mips/include/asm/mips-boards/sead3int.h
+++ b/arch/mips/include/asm/mips-boards/sead3int.h
@@ -14,10 +14,8 @@
 
 /* CPU interrupt offsets */
 #define CPU_INT_EHCI		2
-#define CPU_INT_NET		6
 
 /* GIC interrupt offsets */
-#define GIC_INT_NET		GIC_SHARED_TO_HWIRQ(0)
 #define GIC_INT_EHCI		GIC_SHARED_TO_HWIRQ(5)
 
 #endif /* !(_MIPS_SEAD3INT_H) */
diff --git a/arch/mips/mti-sead3/sead3-dtshim.c b/arch/mips/mti-sead3/sead3-dtshim.c
index b462f65..279d8d4 100644
--- a/arch/mips/mti-sead3/sead3-dtshim.c
+++ b/arch/mips/mti-sead3/sead3-dtshim.c
@@ -25,7 +25,8 @@ static unsigned char fdt_buf[16 << 10] __initdata;
 static int remove_gic(void *fdt)
 {
 	const unsigned int cpu_uart_int = 4;
-	int gic_off, cpu_off, uart_off, err;
+	const unsigned int cpu_eth_int = 6;
+	int gic_off, cpu_off, uart_off, eth_off, err;
 	uint32_t cfg, cpu_phandle;
 
 	/* leave the GIC node intact if a GIC is present */
@@ -82,6 +83,18 @@ static int remove_gic(void *fdt)
 		return uart_off;
 	}
 
+	eth_off = fdt_node_offset_by_compatible(fdt, -1, "smsc,lan9115");
+	if (eth_off < 0) {
+		pr_err("unable to find ethernet DT node: %d\n", eth_off);
+		return eth_off;
+	}
+
+	err = fdt_setprop_u32(fdt, eth_off, "interrupts", cpu_eth_int);
+	if (err) {
+		pr_err("unable to set ethernet interrupts property: %d\n", err);
+		return err;
+	}
+
 	return 0;
 }
 
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index 538a6f8..9f9e914 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -14,37 +14,9 @@
 #include <linux/mtd/physmap.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
-#include <linux/smsc911x.h>
 
 #include <asm/mips-boards/sead3int.h>
 
-static struct smsc911x_platform_config sead3_smsc911x_data = {
-	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
-	.flags		= SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
-	.phy_interface	= PHY_INTERFACE_MODE_MII,
-};
-
-static struct resource sead3_net_resources[] = {
-	{
-		.start			= 0x1f010000,
-		.end			= 0x1f01ffff,
-		.flags			= IORESOURCE_MEM
-	}, {
-		.flags			= IORESOURCE_IRQ
-	}
-};
-
-static struct platform_device sead3_net_device = {
-	.name			= "smsc911x",
-	.id			= 0,
-	.dev			= {
-		.platform_data	= &sead3_smsc911x_data,
-	},
-	.num_resources		= ARRAY_SIZE(sead3_net_resources),
-	.resource		= sead3_net_resources
-};
-
 static struct mtd_partition sead3_mtd_partitions[] = {
 	{
 		.name =		"User FS",
@@ -175,7 +147,6 @@ static struct platform_device *sead3_platform_devices[] __initdata = {
 	&fled_device,
 	&sead3_led_device,
 	&ehci_device,
-	&sead3_net_device,
 };
 
 static int __init sead3_platforms_device_init(void)
@@ -204,13 +175,9 @@ static int __init sead3_platforms_device_init(void)
 	if (gic_present) {
 		ehci_resources[1].start =
 			irq_create_mapping(irqd, GIC_INT_EHCI);
-		sead3_net_resources[1].start =
-			irq_create_mapping(irqd, GIC_INT_NET);
 	} else {
 		ehci_resources[1].start =
 			irq_create_mapping(irqd, CPU_INT_EHCI);
-		sead3_net_resources[1].start =
-			irq_create_mapping(irqd, CPU_INT_NET);
 	}
 
 	return platform_add_devices(sead3_platform_devices,
-- 
2.9.3

  parent reply	other threads:[~2016-08-26 14:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 14:17 [PATCH v2 00/19] MIPS: SEAD3 device tree conversion Paul Burton
2016-08-26 14:17 ` [PATCH v2 01/19] MIPS: SEAD3: Split obj-y entries across lines Paul Burton
2016-08-26 14:17 ` [PATCH v2 02/19] MIPS: SEAD3: Probe interrupt controllers using DT Paul Burton
2016-08-26 14:17 ` [PATCH v2 03/19] MIPS: SEAD3: Probe UARTs " Paul Burton
2016-08-26 14:17 ` [PATCH v2 04/19] MIPS: SEAD3: Use generic ns16550a earlycon support Paul Burton
2016-08-26 14:17 ` Paul Burton [this message]
2016-08-26 14:17 ` [PATCH v2 06/19] MIPS: SEAD3: Probe EHCI controller using DT Paul Burton
2016-08-26 14:17 ` [PATCH v2 07/19] usb: host: ehci-sead3: Remove SEAD-3 EHCI code Paul Burton
2016-08-26 15:55   ` Alan Stern
2016-08-26 14:17 ` [PATCH v2 08/19] SEAD3: Probe parallel flash via DT Paul Burton
2016-08-26 14:17 ` [PATCH v2 09/19] MIPS: SEAD3: Use register-bit-led driver via DT for LEDs Paul Burton
2016-08-26 14:17 ` [PATCH v2 10/19] leds: Remove SEAD3 driver Paul Burton
2016-08-29  8:55   ` Jacek Anaszewski
2016-08-30 14:42     ` Paul Burton
2016-08-26 14:17 ` [PATCH v2 11/19] MIPS: SEAD3: Reset via generic syscon-reboot driver & DT Paul Burton
2016-08-26 14:17 ` [PATCH v2 12/19] MIPS: SEAD3: Use generic restart-poweroff driver Paul Burton
2016-08-26 14:17 ` [PATCH v2 13/19] MIPS: SEAD3: Parse memsize in DT shim Paul Burton
2016-08-26 14:17 ` [PATCH v2 14/19] MIPS: SEAD3: Drop use of cobalt fbdev driver Paul Burton
2016-08-26 14:17 ` [PATCH v2 15/19] fbdev: cobalt_lcdfb: Drop SEAD3 support Paul Burton
2016-08-26 14:17 ` [PATCH v2 16/19] dt-bindings: img-ascii-lcd: Document a binding for simple ASCII LCDs Paul Burton
2016-08-31 16:18   ` Rob Herring
2016-08-26 14:17 ` [PATCH v2 17/19] auxdisplay: img-ascii-lcd: driver for simple ASCII LCD displays Paul Burton
2016-09-27 18:52   ` Ralf Baechle
2016-08-26 14:17 ` [PATCH v2 18/19] MIPS: SEAD3: Use img-ascii-lcd driver Paul Burton
2016-08-26 14:17 ` [PATCH v2 19/19] MIPS: SEAD3: Remove custom read_persistent_clock Paul Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160826141751.13121-6-paul.burton@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mark.rutland@arm.com \
    --cc=ralf@linux-mips.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).