Skip to contentSkip to conversation

ne: Add h8300 support.

PATCH Superseded Yoshinori Sato 2 participants 4 messages Sep 27, 2015 – Oct 2, 2015

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ne: Add h8300 support.

---
 drivers/net/ethernet/8390/Kconfig | 2 +-
 drivers/net/ethernet/8390/ne.c    | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/8390/Kconfig +1 -1
index edf7225..44d7167 100644
@@ -88,7 +88,7 @@ config MCF8390
 config NE2000
 	tristate "NE2000/NE1000 support"
 	depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX || \
-		    ATARI_ETHERNEC)
+		    ATARI_ETHERNEC || H8300)
 	select CRC32
 	---help---
 	  If you have a network (Ethernet) card of this type, say Y here.
drivers/net/ethernet/8390/ne.c +2 -1
index c063b41..576917c 100644
@@ -422,7 +422,8 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
 		stop_page  = NE1SM_STOP_PG;
 	}
 
-#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
+#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) || \
+	defined(CONFIG_H8300_KANEBEBE) || defined(CONFIG_H8300_AE3069)
 	neX000 = ((SA_prom[14] == 0x57  &&  SA_prom[15] == 0x57)
 		|| (SA_prom[14] == 0x42 && SA_prom[15] == 0x42));
 #else
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 ne: DeviceTree support.

---
 Documentation/devicetree/bindings/net/ne2000.txt | 17 +++++++++++++++++
 drivers/net/ethernet/8390/ne.c                   | 20 +++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/ne2000.txt
Documentation/devicetree/bindings/net/ne2000.txt new file +17 -0
new file mode 100644
index 0000000..69b68dfb
@@ -0,0 +1,17 @@
+NE2000 compatible network controller
+
+Required properties:
+- compatible: "novell,ne2000"
+- reg: base address and length of NE2000.
+- interrupts: interrupt specifier for the sole interrupt.
+- novell,dcr: DCR setting value.
+
+Example
+
+	ne2000: ethernet@200000 {
+		compatible = "realtek,rtl8019as", "novell,ne2000";
+		reg = <0x200000 32>;
+		interrupts = <17 0>;
+		novell,dcr = <0x48>;
+	};
+
drivers/net/ethernet/8390/ne.c +19 -1
index 576917c..f0a0400 100644
@@ -52,6 +52,7 @@ static const char version2[] =
 #include <linux/etherdevice.h>
 #include <linux/jiffies.h>
 #include <linux/platform_device.h>
+#include <linux/of.h>
 
 #include <asm/io.h>
 
@@ -72,6 +73,7 @@ static int io[MAX_NE_CARDS];
 static int irq[MAX_NE_CARDS];
 static int bad[MAX_NE_CARDS];
 static u32 ne_msg_enable;
+static unsigned int of_dcr_val;
 
 #ifdef MODULE
 module_param_array(io, int, NULL, 0);
@@ -171,6 +173,8 @@ bad_clone_list[] __initdata = {
 #  define DCR_VAL 0x48		/* 8-bit mode */
 #elif defined(CONFIG_ATARI)	/* 8-bit mode on Atari, normal on Q40 */
 #  define DCR_VAL (MACH_IS_ATARI ? 0x48 : 0x49)
+#elif defined(CONFIG_OF_NET)
+#  define DCR_VAL of_dcr_val
 #else
 #  define DCR_VAL 0x49
 #endif
@@ -304,7 +308,8 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
 	struct ei_device *ei_local = netdev_priv(dev);
 
 	if (!request_region(ioaddr, NE_IO_EXTENT, DRV_NAME))
-		return -EBUSY;
+		if(!request_mem_region(ioaddr, NE_IO_EXTENT, DRV_NAME))
+			return -EBUSY;
 
 	reg0 = inb_p(ioaddr);
 	if (reg0 == 0xFF) {
@@ -809,11 +814,18 @@ static int __init ne_drv_probe(struct platform_device *pdev)
 	if (!dev)
 		return -ENOMEM;
 
+
+	if (dev->dev.of_node)
+		of_property_read_u32(dev->dev.of_node,
+				     "novell,dcr", &of_dcr_val);
+
 	/* ne.c doesn't populate resources in platform_device, but
 	 * rbtx4927_ne_init and rbtx4938_ne_init do register devices
 	 * with resources.
 	 */
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (res == NULL)
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res) {
 		dev->base_addr = res->start;
 		dev->irq = platform_get_irq(pdev, 0);
@@ -915,12 +927,18 @@ static int ne_drv_resume(struct platform_device *pdev)
 #define ne_drv_resume NULL
 #endif
 
+static const struct of_device_id ne2000_of_table[] __maybe_unused = {
+	{ .compatible = "novell,ne2000" },
+	{ }
+};
+
 static struct platform_driver ne_driver = {
 	.remove		= ne_drv_remove,
 	.suspend	= ne_drv_suspend,
 	.resume		= ne_drv_resume,
 	.driver		= {
 		.name	= DRV_NAME,
+		.of_match_table = of_match_ptr(ne2000_of_table),
 	},
 };
 
Signature · 1 line
2.1.4
maintainer
#2 lore raw
In reply to Yoshinori Sato

From: Yoshinori Sato <[email protected]>
Date: Sun, 27 Sep 2015 23:19:15 +0900

Quoted 6 lines
drivers/net/ethernet/8390/Kconfig +1 -1
@@ -88,7 +88,7 @@ config MCF8390
 config NE2000
 	tristate "NE2000/NE1000 support"
 	depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX || \
-		    ATARI_ETHERNEC)
+		    ATARI_ETHERNEC || H8300)

...

drivers/net/ethernet/8390/ne.c static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) · line 426

Quoted 4 lines
drivers/net/ethernet/8390/ne.c +2 -1
-#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
+#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) || \
+	defined(CONFIG_H8300_KANEBEBE) || defined(CONFIG_H8300_AE3069)

It makes no sense to test different config symbols for these two things.

Either both should use "H8300" or both should use
"H8300_KANEBEBE || H8300_AE3069".

#3 lore raw
Quoted 19 lines · David Miller

From: Yoshinori Sato <[email protected]>
Date: Sun, 27 Sep 2015 23:19:15 +0900

Quoted 6 lines
drivers/net/ethernet/8390/Kconfig +1 -1
@@ -88,7 +88,7 @@ config MCF8390
 config NE2000
 	tristate "NE2000/NE1000 support"
 	depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX || \
-		    ATARI_ETHERNEC)
+		    ATARI_ETHERNEC || H8300)

...

drivers/net/ethernet/8390/ne.c static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) · line 426

Quoted 4 lines
drivers/net/ethernet/8390/ne.c +2 -1
-#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
+#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) || \
+	defined(CONFIG_H8300_KANEBEBE) || defined(CONFIG_H8300_AE3069)

It makes no sense to test different config symbols for these two things.

Quoted 2 lines

Either both should use "H8300" or both should use
"H8300_KANEBEBE || H8300_AE3069".

OK.
I'll sent v2.

Signature · 2 lines
Yoshinori Sato
<[email protected]>