]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MIPS: SEAD3: Probe ethernet controller using DT
authorPaul Burton <paul.burton@imgtec.com>
Fri, 26 Aug 2016 14:17:37 +0000 (15:17 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 4 Oct 2016 23:31:20 +0000 (01:31 +0200)
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>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14050/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/boot/dts/mti/sead3.dts
arch/mips/include/asm/mips-boards/sead3int.h
arch/mips/mti-sead3/sead3-dtshim.c
arch/mips/mti-sead3/sead3-platform.c

index 3f681c5300824c5ff497a9f97debc248fdec2a3f..29ed194fc7622f784e98d6dce73e2bc12c10c29d 100644 (file)
 
                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;
+       };
 };
index 3a5e079fda7626640a341e1a2b5a83eb3c04ae03..7fdb9d4598bff41115a77ae5cc913776cd54ee59 100644 (file)
 
 /* 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) */
index b462f65b8ce07b9117b4be23fccdebf568ff33ba..279d8d464693269accfe26a45409d090496a50b1 100644 (file)
@@ -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;
 }
 
index 538a6f8f09175506ac18a19024d6900a2afec2bb..9f9e91471f178df97d2facc6d63824ae24b4e1ca 100644 (file)
 #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,