Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: SEAD3: Probe ethernet controller using DT

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>

authored by

Paul Burton and committed by
Ralf Baechle
a34e9388 53f37d1d

+26 -36
+12
arch/mips/boot/dts/mti/sead3.dts
··· 87 87 88 88 no-loopback-test; 89 89 }; 90 + 91 + eth@1f010000 { 92 + compatible = "smsc,lan9115"; 93 + reg = <0x1f010000 0x10000>; 94 + reg-io-width = <4>; 95 + 96 + interrupts = <0>; /* GIC 0 or CPU 6 */ 97 + 98 + phy-mode = "mii"; 99 + smsc,irq-push-pull; 100 + smsc,save-mac-address; 101 + }; 90 102 };
-2
arch/mips/include/asm/mips-boards/sead3int.h
··· 14 14 15 15 /* CPU interrupt offsets */ 16 16 #define CPU_INT_EHCI 2 17 - #define CPU_INT_NET 6 18 17 19 18 /* GIC interrupt offsets */ 20 - #define GIC_INT_NET GIC_SHARED_TO_HWIRQ(0) 21 19 #define GIC_INT_EHCI GIC_SHARED_TO_HWIRQ(5) 22 20 23 21 #endif /* !(_MIPS_SEAD3INT_H) */
+14 -1
arch/mips/mti-sead3/sead3-dtshim.c
··· 25 25 static int remove_gic(void *fdt) 26 26 { 27 27 const unsigned int cpu_uart_int = 4; 28 - int gic_off, cpu_off, uart_off, err; 28 + const unsigned int cpu_eth_int = 6; 29 + int gic_off, cpu_off, uart_off, eth_off, err; 29 30 uint32_t cfg, cpu_phandle; 30 31 31 32 /* leave the GIC node intact if a GIC is present */ ··· 81 80 if (uart_off != -FDT_ERR_NOTFOUND) { 82 81 pr_err("error searching for UART DT node: %d\n", uart_off); 83 82 return uart_off; 83 + } 84 + 85 + eth_off = fdt_node_offset_by_compatible(fdt, -1, "smsc,lan9115"); 86 + if (eth_off < 0) { 87 + pr_err("unable to find ethernet DT node: %d\n", eth_off); 88 + return eth_off; 89 + } 90 + 91 + err = fdt_setprop_u32(fdt, eth_off, "interrupts", cpu_eth_int); 92 + if (err) { 93 + pr_err("unable to set ethernet interrupts property: %d\n", err); 94 + return err; 84 95 } 85 96 86 97 return 0;
-33
arch/mips/mti-sead3/sead3-platform.c
··· 14 14 #include <linux/mtd/physmap.h> 15 15 #include <linux/of.h> 16 16 #include <linux/platform_device.h> 17 - #include <linux/smsc911x.h> 18 17 19 18 #include <asm/mips-boards/sead3int.h> 20 - 21 - static struct smsc911x_platform_config sead3_smsc911x_data = { 22 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 23 - .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, 24 - .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 25 - .phy_interface = PHY_INTERFACE_MODE_MII, 26 - }; 27 - 28 - static struct resource sead3_net_resources[] = { 29 - { 30 - .start = 0x1f010000, 31 - .end = 0x1f01ffff, 32 - .flags = IORESOURCE_MEM 33 - }, { 34 - .flags = IORESOURCE_IRQ 35 - } 36 - }; 37 - 38 - static struct platform_device sead3_net_device = { 39 - .name = "smsc911x", 40 - .id = 0, 41 - .dev = { 42 - .platform_data = &sead3_smsc911x_data, 43 - }, 44 - .num_resources = ARRAY_SIZE(sead3_net_resources), 45 - .resource = sead3_net_resources 46 - }; 47 19 48 20 static struct mtd_partition sead3_mtd_partitions[] = { 49 21 { ··· 147 175 &fled_device, 148 176 &sead3_led_device, 149 177 &ehci_device, 150 - &sead3_net_device, 151 178 }; 152 179 153 180 static int __init sead3_platforms_device_init(void) ··· 175 204 if (gic_present) { 176 205 ehci_resources[1].start = 177 206 irq_create_mapping(irqd, GIC_INT_EHCI); 178 - sead3_net_resources[1].start = 179 - irq_create_mapping(irqd, GIC_INT_NET); 180 207 } else { 181 208 ehci_resources[1].start = 182 209 irq_create_mapping(irqd, CPU_INT_EHCI); 183 - sead3_net_resources[1].start = 184 - irq_create_mapping(irqd, CPU_INT_NET); 185 210 } 186 211 187 212 return platform_add_devices(sead3_platform_devices,