Skip to contentSkip to conversation

m68k/atari: EtherNEC - Convert ETHER_ADDR_LEN uses to ETH_ALEN

PATCH New Geert Uytterhoeven 7 participants 40 messages Jan 20, 2012 – Aug 9, 2014

Subsystems (5)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH 1/1 m68k/atari: EtherNEC - Convert ETHER_ADDR_LEN uses to ETH_ALEN

Cfr. commit 104bf3fb963cbc39c6675b23d46d2c9ab3f311d8 ("ethernet: Convert ETHER_ADDR_LEN uses to ETH_ALEN")

---
 drivers/net/ethernet/8390/atari_ethernec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/8390/atari_ethernec.c +2 -2
index 4fb22ce..086d968 100644
@@ -645,12 +645,12 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
 #ifdef CONFIG_PLAT_MAPPI
 	outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
 		ioaddr + E8390_CMD); /* 0x61 */
-	for (i = 0; i < ETHER_ADDR_LEN; i++) {
+	for (i = 0; i < ETH_ALEN; i++) {
 		dev->dev_addr[i] = SA_prom[i] = inb_p(ioaddr + EN1_PHYS_SHIFT(i));
 		printk(" %2.2x", SA_prom[i]);
 	}
 #else
-	for (i = 0; i < ETHER_ADDR_LEN; i++) {
+	for (i = 0; i < ETH_ALEN; i++) {
 		printk(" %2.2x", SA_prom[i]);
 		dev->dev_addr[i] = SA_prom[i];
 	}
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 m68k/atari: EtherNEC - rewrite to use mainstream ne.c

Hi.

after much prodding from Geert, and a bit of bouncing ideas back and forth, I've rewritten the Atari EtherNEC ethercard driver to use work with only minimal patches to ne.c (instead of duplicating ne.c as atari_ethernec.c).

The EtherNEC adapter is a solution to use a RTL8019 ISA card on the cartridge (ROM) port of m68k Atari computers. The cartridge port does not support generating interrupts. To service card interrupts, the 8390 interrupt handler is called periodically from a dedicated hardware timer which needs to be shared with other users (the SMC91C111 EtherNAT driver, and a dummy handler dedicated to preventing interference from the interrupt watchdog if the card is idle).

netdev subscribers please focus on the patch to ne.c at the top. Changes to ne.c are twofold: to select 8-bit mode for the driver, and to ensure the interrupt can be shared with aforementioned other users if the driver is used on Atari.

This patch applies on top of Geert's current linux-m68k. It won't cleanly apply on top of, or work if built from Linus' tree, as it relies on further patches relating to bus access quirks that are pending in Geert's tree.

The old EtherNEC driver is retained as-is, to be removed from Geert's tree after this code has been accepted. It can still be built by selecting the CONFIG_ATARI_ETHERNEC_OLD option.

Comments to linux-m68k or me, please - I'm not subscribed to netdev.

Cheers,

Michael

drivers/net/ethernet/8390/ne.c +5 -1
index f92ea2a..28b8781 100644
@@ -55,6 +55,9 @@ static const char version2[] =
 
 #include <asm/system.h>
 #include <asm/io.h>
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#include <asm/atariints.h>
+#endif
 
 #include "8390.h"
 
@@ -165,7 +168,8 @@ bad_clone_list[] __initdata = {
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)
 #  define DCR_VAL 0x48        /* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
@@ -492,7 +496,16 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
 
     /* Snarf the interrupt now.  There's no point in waiting since we 

cannot
share and the board will usually be enabled. */
- ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+ if (MACH_IS_ATARI) {
+ /* Atari EtherNEC emulates the card interrupt via a timer -
+ this needs to be shared with the smc91C111 driver and with
+ a dummy handler to catch unhandled interrupts ! */
+ ret = request_irq(dev->irq, eip_interrupt, IRQF_SHARED, name, dev);
+ } else
+#endif
+ ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+

     if (ret) {
         printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
         goto err_out;
arch/m68k/atari/config.c +56 -2

69 lines not on this page · raw message

arch/m68k/configs/atari_defconfig +1 -1
index 6e86de1..5f8e91f 100644
@@ -201,7 +201,7 @@ CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
 CONFIG_ATARILANCE=y
 CONFIG_ATARI_ETHERNAT=m
-CONFIG_ATARI_ETHERNEC=y
+CONFIG_ATARI_ETHERNEC=m
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_PPP=m
drivers/net/Space.c +1 -1
index d5e8882..548b73b 100644
@@ -243,7 +243,7 @@ static struct devprobe2 m68k_probes[] __initdata = {
 #ifdef CONFIG_ATARILANCE    /* Lance-based Atari ethernet boards */
     {atarilance_probe, 0},
 #endif
-#ifdef CONFIG_ATARI_ETHERNEC    /* NE2000 based ROM port ethernet cards */
+#ifdef CONFIG_ATARI_ETHERNEC_OLD    /* NE2000 based ROM port ethernet cards */
     {atari_ethernec_probe, 0},
 #endif
 #ifdef CONFIG_SUN3LANCE         /* sun3 onboard Lance chip */
drivers/net/ethernet/8390/Kconfig +10 -1
index b801056..ca5adab 100644
@@ -223,9 +223,18 @@ config APNE
       To compile this driver as a module, choose M here: the module
       will be called apne.
 
+config ATARI_ETHERNEC_OLD
+    tristate "Atari EtherNEC Ethernet support - old driver"
+    depends on ATARI_ROM_ISA
+    help
+      Say Y to include support for the EtherNEC network adapter for the
+      ROM port. The driver works by polling instead of interrupts, so it
+      is quite slow.
+
 config ATARI_ETHERNEC
-    tristate "Atari EtherNEC Ethernet support"
+    tristate "Atari EtherNEC Ethernet support - mainstream NE2000 driver"
     depends on ATARI_ROM_ISA
+    select CRC32
     help
       Say Y to include support for the EtherNEC network adapter for the
       ROM port. The driver works by polling instead of interrupts, so it
drivers/net/ethernet/8390/Makefile +2 -1
index d896466..e620355 100644
@@ -6,7 +6,8 @@ obj-$(CONFIG_MAC8390) += mac8390.o
 obj-$(CONFIG_AC3200) += ac3200.o 8390.o
 obj-$(CONFIG_APNE) += apne.o 8390.o
 obj-$(CONFIG_ARM_ETHERH) += etherh.o
-obj-$(CONFIG_ATARI_ETHERNEC) += atari_ethernec.o 8390.o
+obj-$(CONFIG_ATARI_ETHERNEC_OLD) += atari_ethernec.o 8390.o
+obj-$(CONFIG_ATARI_ETHERNEC) += ne.o 8390p.o
 obj-$(CONFIG_AX88796) += ax88796.o
 obj-$(CONFIG_E2100) += e2100.o 8390.o
 obj-$(CONFIG_EL2) += 3c503.o 8390p.o
drivers/net/ethernet/8390/atari_ethernec.c +1 -0
index 086d968..e051094 100644
@@ -93,6 +93,7 @@ static const char version2[] =
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/platform_device.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/jiffies.h>
@@ -185,13 +186,13 @@ bad_clone_list[] __initdata = {
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
    defined(CONFIG_TOSHIBA_RBTX4927) || 

defined(CONFIG_TOSHIBA_RBTX4938) || \

-   defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE)
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
 #  define DCR_VAL 0x48        /* 8-bit mode */

#else
# define DCR_VAL 0x49
#endif

-#if defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE) +#if IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
# define ETHERNEC_RTL_8019_BASE 0x300
# define ETHERNEC_RTL_8019_IRQ IRQ_MFP_TIMD
#endif
@@ -229,7 +230,7 @@ irqreturn_t atari_ei_interrupt(int irq, void *dev_id)

     struct net_device *dev = dev_id;
     if (netif_running(dev))
         return ei_interrupt(dev->irq, dev);

- return IRQ_NONE;
+ return IRQ_HANDLED;
}

static void atari_ethernec_int(struct work_struct *work)
@@ -357,7 +358,7 @@ struct net_device * __init atari_ethernec_probe(int unit)

     sprintf(dev->name, "eth%d", unit);
     netdev_boot_setup_check(dev);

-#if defined(CONFIG_ATARI_ETHERNEC)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)

     dev->base_addr = ETHERNEC_RTL_8019_BASE;
     dev->irq = ETHERNEC_RTL_8019_IRQ;
 #endif
@@ -456,7 +457,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
     }

     if (ei_debug && version_printed++ == 0)

- printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2);
+ printk(KERN_INFO "%s%s", version1, version2);

     /* A user with a poor card that fails to ack the reset, or that
        does not have a valid 0x57,0x57 signature can still use this

@@ -941,9 +942,10 @@ module_param(use_poll, int, 0);
MODULE_PARM_DESC(io, "I/O base address(es),required"); MODULE_PARM_DESC(irq, "IRQ number(s)"); MODULE_PARM_DESC(bad, "Accept card(s) with bad signatures");
-MODULE_PARM_DESC(use_poll, "Use timer interrupt to poll driver"); +MODULE_PARM_DESC(use_poll, "Use system timer to poll driver");
MODULE_DESCRIPTION("NE1000/NE2000 ISA/PnP Ethernet driver"); MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:8390");

/* This is set up so that no ISA autoprobe takes place. We can't guarantee that the ne2k probe is the last 8390 based probe to take place (as it

author maintainer
#2 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

Quoted 74 lines · Michael Schmitz

after much prodding from Geert, and a bit of bouncing ideas back and forth, I've rewritten the Atari EtherNEC ethercard driver to use work with only minimal patches to ne.c (instead of duplicating ne.c as atari_ethernec.c).

The EtherNEC adapter is a solution to use a RTL8019 ISA card on the cartridge (ROM) port of m68k Atari computers. The cartridge port does not support generating interrupts. To service card interrupts, the 8390 interrupt handler is called periodically from a dedicated hardware timer which needs to be shared with other users (the SMC91C111 EtherNAT driver, and a dummy handler dedicated to preventing interference from the interrupt watchdog if the card is idle).

netdev subscribers please focus on the patch to ne.c at the top. Changes to ne.c are twofold: to select 8-bit mode for the driver, and to ensure the interrupt can be shared with aforementioned other users if the driver is used on Atari.

This patch applies on top of Geert's current linux-m68k. It won't cleanly apply on top of, or work if built from Linus' tree, as it relies on further patches relating to bus access quirks that are pending in Geert's tree.

The old EtherNEC driver is retained as-is, to be removed from Geert's tree after this code has been accepted. It can still be built by selecting the CONFIG_ATARI_ETHERNEC_OLD option.

Comments to linux-m68k or me, please - I'm not subscribed to netdev.

Cheers,

Michael

drivers/net/ethernet/8390/ne.c +15 -2
index f92ea2a..28b8781 100644
@@ -55,6 +55,9 @@ static const char version2[] =
 
 #include <asm/system.h>
 #include <asm/io.h>
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#include <asm/atariints.h>
+#endif
 
 #include "8390.h"
 
@@ -165,7 +168,8 @@ bad_clone_list[] __initdata = {
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)
 #  define DCR_VAL 0x48        /* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
@@ -492,7 +496,16 @@ static int __init ne_probe1(struct net_device *dev,
 unsigned long ioaddr)
 
     /* Snarf the interrupt now.  There's no point in waiting since we cannot
        share and the board will usually be enabled. */
-    ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+    if (MACH_IS_ATARI) {
+        /* Atari EtherNEC emulates the card interrupt via a timer -
+           this needs to be shared with the smc91C111 driver and with
+           a dummy handler to catch unhandled interrupts ! */
+        ret = request_irq(dev->irq, eip_interrupt, IRQF_SHARED, name, dev);
+    } else
+#endif
+        ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+
     if (ret) {
         printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
Quoted 1 line
         goto err_out;

Netdev people: are these changes to ne.c acceptable?

If yes, I'll split everything and queue it up (the ne.c part through netdev, the rest through m68k).
If not, do you have a better solution[*]?
Are there other network drivers using/requiring a similar approach?

Thanks!

[*] I can imagine an alternative, which could be generalized for other
platforms:
- Leave the irq at zero to indicate polling.
- In the driver, do

if (!dev->irq) {
ret = -E...;

#ifdef CONFIG_ATARI
		if (MACH_IS_ATARI) {
			ret = atari_request_poll(eip_interrupt, name, dev);
		}
#endif
	} else {
		ret = request_irq(dev->irq, ...);
		...
	}

	and a similar thing for free_irq().

This has the advantage that atari_request_poll() can decide to register the timer interrupt only when EtherNEC or EtherNAT are active.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

Hi Geert,

Quoted 6 lines

Netdev people: are these changes to ne.c acceptable?

If yes, I'll split everything and queue it up (the ne.c part through netdev, the rest through m68k).
If not, do you have a better solution[*]?
Are there other network drivers using/requiring a similar approach?

smc91x requires the same approach - the only changes necessary there are to smc91x.h (and Kconfig).

(no patch yet; the code is stuck on my devel PC which refuses to boot ATM).

Cheers,

Michael

#4 lore raw

PATCH 3/5 m68k/atari: EtherNAT - register EtherNAT platform devices only when probed

In reply to Geert Uytterhoeven

Hi All,

Part 3 in the EtherNAT series - only register platform devices if the card is present.

--
arch/m68k/atari/config.c | 13 ++++++++++++-

1 files changed, 12 insertions(+), 1 deletions(-)
arch/m68k/atari/config.c +0 -0
index 12a76ab..92bf83a 100644
@@ -752,7 +752,18 @@ static struct platform_device *atari_platform_devices[] __initdata = {
 

int __init atari_platform_init(void)
{

-       return platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+       int rv = -ENODEV;
+       unsigned char *enatc_virt;

+
+ if (!MACH_IS_ATARI)
+ return -ENODEV;
+
+ enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
+ if (hwreg_present(enatc_virt))
+ rv = platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+ iounmap(enatc_virt);
+
+ return rv; }

arch_initcall(atari_platform_init);

#5 lore raw

PATCH 4/5 m68k/atari: EtherNAT - fix dumb compile error

In reply to Geert Uytterhoeven

Hi All,

Part 4 in the EtherNAT series - forgot to include isp116x.h, oops.

--
arch/m68k/atari/config.c | 1 +

1 files changed, 1 insertions(+), 0 deletions(-)
arch/m68k/atari/config.c +0 -0
index 92bf83a..aceebc2 100644
@@ -32,6 +32,7 @@

#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
+#include <linux/usb/isp116x.h>
#include <linux/vt_kern.h>
#include <linux/module.h>

#6 lore raw

PATCH 5/5 m68k/atari: EtherNAT - enable USB HCD config option on Atari

In reply to Geert Uytterhoeven

Hi All,

Part 5 in the EtherNAT series: actually enable the necessary USB HCD support option to be able to chose the ISP116x USB driver on Atari.

--
arch/m68k/Kconfig.machine | 1 +

1 files changed, 1 insertions(+), 0 deletions(-)
arch/m68k/Kconfig.machine +1 -0
index 7cdf6b0..8c31cdf 100644
@@ -15,6 +15,7 @@ config ATARI
       bool "Atari support"
       depends on MMU
       select MMU_MOTOROLA if MMU
+       select USB_ARCH_HAS_OHCI if USB_SUPPORT
       help
         This option enables support for the 68000-based Atari series of
         computers (including the TT, Falcon and Medusa). If you plan 

to use

#7 lore raw

Re: [PATCH 6/5] m68k/atari: EtherNAT - use correct irq flag in atari_91C111

Quoted 2 lines · Michael Schmitz

Part 5 in the EtherNAT series: actually enable the necessary USB HCD support option to be able to chose the ISP116x USB driver on Atari.

And another one (I feel a Monty Python pun coming on): make sure the 91C111 driver is prepared to share the interrupt, otherwise it won't load if the EtherNEC driver has already claimed the timer interrupt (atari_91C111 still uses the timer as of now).

Further patches that deal with fixing a problem related to the unhandled interrupt watchdog as well as a rewrite of the EtherNEC driver based on ne.c follow.

--
drivers/net/ethernet/smsc/smc91x.h | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ethernet/smsc/smc91x.h +0 -0
index 799d494..987755c 100644
@@ -255,6 +255,8 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)

#define RPC_LSA_DEFAULT RPC_LED_100_10
#define RPC_LSB_DEFAULT RPC_LED_TX_RX

+#define SMC_IRQ_FLAGS (IRQF_SHARED)
+
#define SMC_DYNAMIC_BUS_CONFIG

#8 lore raw

Re: [PATCH 6/5] m68k/atari: set up timer D and register dummy handler if either EtherNEC or EtherNAT found

Hi Geert,

this may clash somewhat with the patch you sent a few days ago (return -ENODEV if not running on Atari), the last hunk probably needs manual merging.

Probe for EtherNEC as well by checking the base register is accessible. If either EtherNEC or EtherNAT are found, set up MFP timer D as 200 Hz timer, and register a dummy interrupt handler to ensure the unhandled interrupt watchdog does not kick in.

Without the dummy handler, your only chance of keeping the ethernet device alive is keeping traffic up (ping your router) or rely on CONFIG_NETPOLL being active (that operates off the 100 Hz jiffies timer so it's going to be slower).

Also, enable the EtherNAT 91C111 interrupt so we could switch to interrupt driven operation there (will happen on one of the next patches converting EtherNAT to use smc91x.c). Also enabling the ISP1160 interrupt will hang the system, alas.

I'd love to defer setting up the timer until the first timer D interrupt handler is registered, same with the EtherNAT interrupts. What's the best way to go about that?

Cheers,

Michael

--
arch/m68k/atari/config.c | 49 +++++++++++++++++++++++++++++++++++++++++----

1 files changed, 44 insertions(+), 5 deletions(-)
arch/m68k/atari/config.c +2 -0
index aceebc2..22375e0 100644
@@ -663,6 +663,8 @@ static void atari_get_hardware_list(struct seq_file *m)
 * MSch: initial platform device support for Atari, required for EtherNAT
 */
 
+#define ATARI_ETHERNEC_PHYS_ADDR    0xfffa0000
+

#define ATARI_ETHERNAT_PHYS_ADDR 0x80000000
#define ATARI_ETHERNAT_IRQ 196

@@ -746,24 +748,61 @@ static struct platform_device isp1160_device = {

};

-static struct platform_device *atari_platform_devices[] __initdata = {

+static struct platform_device *atari_ethernat_devices[] __initdata = {
    &smc91x_device,
    &isp1160_device
};

+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNAT) +irqreturn_t atari_timerd_interrupt(int irq, void *dev_id)
+{
+ return IRQ_HANDLED;
+}
+#endif
+
int __init atari_platform_init(void)
{

-    int rv = -ENODEV;
-    unsigned char *enatc_virt;
+    int rv = -ENODEV, ret, need_timer = 0;
+    unsigned char *enatc_virt, *enec_virt;
    if (!MACH_IS_ATARI)
        return -ENODEV;

+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+ enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
+ if (hwreg_present(enec_virt)) {
+ need_timer = 1;
+ }
+ iounmap(enec_virt);
+#endif
+
+#if IS_ENABLED(CONFIG_ATARI_ETHERNAT)
enatc_virt = (unsigned char
*)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
- if (hwreg_present(enatc_virt))
- rv = platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+ if (hwreg_present(enatc_virt)) {

+        need_timer = 1;        /* for now */
+        /* possibly defer until interrupt is registered ? */
+        *enatc_virt |= 0x2;    /* 91C111 int only, use 0x6 to enable both interrupts */
+        rv = platform_add_devices(atari_ethernat_devices, ARRAY_SIZE(atari_ethernat_devices));
+    }
    iounmap(enatc_virt);

+#endif
+
+ if (need_timer) {
+ const char *name = "Timer D dummy interrupt";
+

+        /* timer routine set up in atari_ethernec_probe() */
+        /* set Timer D data Register */
+        st_mfp.tim_dt_d = 123;    /* 200 Hz */
+        /* start timer D, div = 1:100 */
+        st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 0xf0) | 0x6;
+        /* Must make this shared in case other timer ints are needed */
+        ret = request_irq(IRQ_MFP_TIMD, atari_timerd_interrupt, IRQF_SHARED, name, atari_timerd_interrupt);
+        if (ret) {

+ printk(KERN_ERR "atari_platform_init: failed to register dummy timer interrupt for EtherNEC/EtherNAT!\n");
+ }
+ }

+    if (ret) return ret;
    return rv;   
}
#9 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

In reply to Michael Schmitz
Quoted 39 lines · Michael Schmitz

Hi.

after much prodding from Geert, and a bit of bouncing ideas back and forth, I've rewritten the Atari EtherNEC ethercard driver to use work with only minimal patches to ne.c (instead of duplicating ne.c as atari_ethernec.c).

The EtherNEC adapter is a solution to use a RTL8019 ISA card on the cartridge (ROM) port of m68k Atari computers. The cartridge port does not support generating interrupts. To service card interrupts, the 8390 interrupt handler is called periodically from a dedicated hardware timer which needs to be shared with other users (the SMC91C111 EtherNAT driver, and a dummy handler dedicated to preventing interference from the interrupt watchdog if the card is idle).

netdev subscribers please focus on the patch to ne.c at the top. Changes to ne.c are twofold: to select 8-bit mode for the driver, and to ensure the interrupt can be shared with aforementioned other users if the driver is used on Atari.

This patch applies on top of Geert's current linux-m68k. It won't cleanly apply on top of, or work if built from Linus' tree, as it relies on further patches relating to bus access quirks that are pending in Geert's tree.

The old EtherNEC driver is retained as-is, to be removed from Geert's tree after this code has been accepted. It can still be built by selecting the CONFIG_ATARI_ETHERNEC_OLD option.

Comments to linux-m68k or me, please - I'm not subscribed to netdev.

Cheers,

 Michael

drivers/net/ethernet/8390/ne.c +0 -0
index f92ea2a..28b8781 100644

drivers/net/ethernet/8390/ne.c static const char version2[] = · line 60

Quoted 6 lines
drivers/net/ethernet/8390/ne.c +3 -0
@@ -55,6 +55,9 @@ static const char version2[] =
 
  #include <asm/system.h>
  #include <asm/io.h>
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#include <asm/atariints.h>
+#endif

Do you really need the #if here? Should be avoidable.

Quoted 19 lines
drivers/net/ethernet/8390/ne.c +2 -1
  #include "8390.h"
 
@@ -165,7 +168,8 @@ bad_clone_list[] __initdata = {
  #if defined(CONFIG_PLAT_MAPPI)
  #  define DCR_VAL 0x4b
  #elif defined(CONFIG_PLAT_OAKS32R)  || \
-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)
  #  define DCR_VAL 0x48        /* 8-bit mode */
  #else
  #  define DCR_VAL 0x49
@@ -492,7 +496,16 @@ static int __init ne_probe1(struct net_device *dev,
 unsigned long ioaddr)
 
     /* Snarf the interrupt now.  There's no point in waiting since we cannot

       share and the board will usually be enabled. */
-    ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);

drivers/net/ethernet/8390/ne.c

Quoted 10 lines
drivers/net/ethernet/8390/ne.c +10 -0
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+    if (MACH_IS_ATARI) {
+        /* Atari EtherNEC emulates the card interrupt via a timer -
+           this needs to be shared with the smc91C111 driver and with
+           a dummy handler to catch unhandled interrupts ! */
+        ret = request_irq(dev->irq, eip_interrupt, IRQF_SHARED, name, dev);
+    } else
+#endif
+        ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+

There has to be a cleaner way than this. Something as simple as creating a platform specific 8380_IRQ_FLAGS would get rid of this ifdef'ery in the driver and that is with only 20s of thought invested.

Paul.
--

Quoted 224 lines

    if (ret) {
        printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret); goto err_out;

arch/m68k/atari/config.c +53 -2
index af78731..3ff7231 100644
@@ -687,13 +687,67 @@ static struct platform_device smc91x_device = {
     .resource    = smc91x_resources,
  };
 
+
+#define ATARI_ETHERNEC_BASE 0x300
+#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMD
+
+
+static struct resource rtl8019_resources[] = {
+    [0] = {
+        .name    = "rtl9019-regs",
+        .start    = ATARI_ETHERNEC_BASE,
+        .end    = ATARI_ETHERNEC_BASE + 0x20 - 1,
+        .flags    = IORESOURCE_IO,
+    },
+    [1] = {
+        .name    = "rtl9019-irq",
+        .start    = ATARI_ETHERNEC_IRQ,
+        .end    = ATARI_ETHERNEC_IRQ,
+        .flags    = IORESOURCE_IRQ,
+    },
+};
+
+static struct platform_device rtl8019_device = {
+    .name        = "ne",
+    .id        = -1,
+    .num_resources    = ARRAY_SIZE(rtl8019_resources),
+    .resource    = rtl8019_resources,
+};
+
+
  static struct platform_device *atari_platform_devices[] __initdata = {
- &smc91x_device
+ &smc91x_device,
+ &rtl8019_device
  };
 
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNAT)
+irqreturn_t atari_timerd_interrupt(int irq, void *dev_id)
+{
+    return IRQ_HANDLED;
+}
+#endif
+
  int __init atari_platform_init(void)
  {
-    return platform_add_devices(atari_platform_devices,
 ARRAY_SIZE(atari_platform_devices));
+
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNAT)
+    if (hwreg_present(0xfffa0000) || hwreg_present(0x80000000)) {
+        int ret;
+        const char *name = "Timer D dummy interrupt";
+        /* timer routine set up in atari_ethernec_probe() */
+        /* set Timer D data Register */
+        st_mfp.tim_dt_d = 123;    /* 200 Hz */
+        /* start timer D, div = 1:100 */
+        st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 0xf0) | 0x6;
+        /* Must make this shared in case other timer ints are needed */
+        ret = request_irq(IRQ_MFP_TIMD, atari_timerd_interrupt,
 IRQF_SHARED, name, atari_timerd_interrupt);
+        if (ret) {
+            printk(KERN_ERR "atari_platform_init: failed to register dummy
 timer interrupt for EtherNEC/EtherNAT!\n");
+        }
+        return platform_add_devices(atari_platform_devices,

ARRAY_SIZE(atari_platform_devices));
+    }
+#endif
+    return 0;
 }

 arch_initcall(atari_platform_init);

arch/m68k/configs/atari_defconfig +0 -0
index 6e86de1..5f8e91f 100644
@@ -201,7 +201,7 @@ CONFIG_NET_ETHERNET=y

 CONFIG_MII=y
 CONFIG_ATARILANCE=y
 CONFIG_ATARI_ETHERNAT=m

arch/m68k/configs/atari_defconfig +1 -1
-CONFIG_ATARI_ETHERNEC=y
+CONFIG_ATARI_ETHERNEC=m

 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 CONFIG_PPP=m

drivers/net/Space.c +1 -1
index d5e8882..548b73b 100644
@@ -243,7 +243,7 @@ static struct devprobe2 m68k_probes[] __initdata = {
  #ifdef CONFIG_ATARILANCE    /* Lance-based Atari ethernet boards */
     {atarilance_probe, 0},
  #endif
-#ifdef CONFIG_ATARI_ETHERNEC    /* NE2000 based ROM port ethernet cards */
+#ifdef CONFIG_ATARI_ETHERNEC_OLD    /* NE2000 based ROM port ethernet cards
 */
     {atari_ethernec_probe, 0},
  #endif

 #ifdef CONFIG_SUN3LANCE         /* sun3 onboard Lance chip */

drivers/net/ethernet/8390/Kconfig +0 -0
index b801056..ca5adab 100644
@@ -223,9 +223,18 @@ config APNE

      To compile this driver as a module, choose M here: the module will be called apne.

drivers/net/ethernet/8390/Kconfig +8 -0
+config ATARI_ETHERNEC_OLD
+    tristate "Atari EtherNEC Ethernet support - old driver"
+    depends on ATARI_ROM_ISA
+    help
+      Say Y to include support for the EtherNEC network adapter for the
+      ROM port. The driver works by polling instead of interrupts, so it
+      is quite slow.
+

 config ATARI_ETHERNEC
-    tristate "Atari EtherNEC Ethernet support"
+    tristate "Atari EtherNEC Ethernet support - mainstream NE2000 driver" depends on ATARI_ROM_ISA
+    select CRC32
    help
      Say Y to include support for the EtherNEC network adapter for the ROM port. The driver works by polling instead of interrupts, so it

drivers/net/ethernet/8390/Makefile +0 -0
index d896466..e620355 100644
@@ -6,7 +6,8 @@ obj-$(CONFIG_MAC8390) += mac8390.o

 obj-$(CONFIG_AC3200) += ac3200.o 8390.o
 obj-$(CONFIG_APNE) += apne.o 8390.o
 obj-$(CONFIG_ARM_ETHERH) += etherh.o

drivers/net/ethernet/8390/Makefile +2 -1
-obj-$(CONFIG_ATARI_ETHERNEC) += atari_ethernec.o 8390.o
+obj-$(CONFIG_ATARI_ETHERNEC_OLD) += atari_ethernec.o 8390.o
+obj-$(CONFIG_ATARI_ETHERNEC) += ne.o 8390p.o

 obj-$(CONFIG_AX88796) += ax88796.o
 obj-$(CONFIG_E2100) += e2100.o 8390.o
 obj-$(CONFIG_EL2) += 3c503.o 8390p.o

drivers/net/ethernet/8390/atari_ethernec.c +5 -4
index 086d968..e051094 100644
@@ -93,6 +93,7 @@ static const char version2[] =
  #include <linux/init.h>
  #include <linux/interrupt.h>
  #include <linux/delay.h>
+#include <linux/platform_device.h>
  #include <linux/netdevice.h>
  #include <linux/etherdevice.h>
  #include <linux/jiffies.h>
@@ -185,13 +186,13 @@ bad_clone_list[] __initdata = {
  #  define DCR_VAL 0x4b
  #elif defined(CONFIG_PLAT_OAKS32R)  || \
    defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) || \
-   defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE)
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
  #  define DCR_VAL 0x48        /* 8-bit mode */
  #else
  #  define DCR_VAL 0x49
  #endif
 
-#if defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
  #  define ETHERNEC_RTL_8019_BASE 0x300
  #  define ETHERNEC_RTL_8019_IRQ IRQ_MFP_TIMD
  #endif
@@ -229,7 +230,7 @@ irqreturn_t atari_ei_interrupt(int irq, void *dev_id)
     struct net_device *dev = dev_id;
     if (netif_running(dev))
         return ei_interrupt(dev->irq, dev);
-    return IRQ_NONE;
+    return IRQ_HANDLED;
  }
 
  static void atari_ethernec_int(struct work_struct *work)
@@ -357,7 +358,7 @@ struct net_device * __init atari_ethernec_probe(int
 unit)
     sprintf(dev->name, "eth%d", unit);
     netdev_boot_setup_check(dev);
 
-#if defined(CONFIG_ATARI_ETHERNEC)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
     dev->base_addr = ETHERNEC_RTL_8019_BASE;
     dev->irq = ETHERNEC_RTL_8019_IRQ;

 #endif

drivers/net/ethernet/8390/atari_ethernec.c +1 -1
@@ -456,7 +457,7 @@ static int __init ne_probe1(struct net_device *dev, int
 ioaddr)
     }
 
     if (ei_debug && version_printed++ == 0)
-        printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2);
+        printk(KERN_INFO "%s%s", version1, version2);
 
     /* A user with a poor card that fails to ack the reset, or that

       does not have a valid 0x57,0x57 signature can still use this

drivers/net/ethernet/8390/atari_ethernec.c +2 -1
@@ -941,9 +942,10 @@ module_param(use_poll, int, 0);
  MODULE_PARM_DESC(io, "I/O base address(es),required");
  MODULE_PARM_DESC(irq, "IRQ number(s)");
  MODULE_PARM_DESC(bad, "Accept card(s) with bad signatures");
-MODULE_PARM_DESC(use_poll, "Use timer interrupt to poll driver");
+MODULE_PARM_DESC(use_poll, "Use system timer to poll driver");
  MODULE_DESCRIPTION("NE1000/NE2000 ISA/PnP Ethernet driver");
  MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:8390");
 
  /* This is set up so that no ISA autoprobe takes place. We can't guarantee

 that the ne2k probe is the last 8390 based probe to take place (as it

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

Quoted 7 lines · Paul Gortmaker
Quoted 7 lines
drivers/net/ethernet/8390/ne.c +0 -0
index f92ea2a..28b8781 100644
@@ -55,6 +55,9 @@ static const char version2[] =
 
Quoted 10 lines

drivers/net/ethernet/8390/ne.c static const char version2[] = · line 61

Quoted 6 lines
drivers/net/ethernet/8390/ne.c +3 -0
 #include <asm/system.h>
 #include <asm/io.h>
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#include <asm/atariints.h>
+#endif
 

Do you really need the #if here? Should be avoidable.

Looks like that one's unneeded.

Quoted 25 lines
Quoted 25 lines
drivers/net/ethernet/8390/ne.c +9 -2
 #include "8390.h"
 
@@ -165,7 +168,8 @@ bad_clone_list[] __initdata = {
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)
 #  define DCR_VAL 0x48        /* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
@@ -492,7 +496,16 @@ static int __init ne_probe1(struct net_device *dev,
 unsigned long ioaddr)
 
    /* Snarf the interrupt now.  There's no point in waiting since we cannot
       share and the board will usually be enabled. */
-    ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+    if (MACH_IS_ATARI) {
+        /* Atari EtherNEC emulates the card interrupt via a timer -
+           this needs to be shared with the smc91C111 driver and with
+           a dummy handler to catch unhandled interrupts ! */
+        ret = request_irq(dev->irq, eip_interrupt, IRQF_SHARED, name, dev);
+    } else
Quoted 9 lines

drivers/net/ethernet/8390/ne.c static int __init ne_probe1(struct net_device *dev, · line 510

Quoted 4 lines
drivers/net/ethernet/8390/ne.c +3 -0
+#endif
+        ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+
 

There has to be a cleaner way than this. Something as simple as creating a platform specific 8380_IRQ_FLAGS would get rid of this ifdef'ery in the driver and that is with only 20s of thought invested.

That would have been the alternative - would you prefer to have this added in 8390.h or ne.c?

Thanks,

Michael

author maintainer
#11 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

In reply to Paul Gortmaker
Quoted 6 lines · Paul Gortmaker
Quoted 6 lines
drivers/net/ethernet/8390/ne.c +0 -0
index f92ea2a..28b8781 100644
@@ -55,6 +55,9 @@ static const char version2[] =
 
Quoted 7 lines

drivers/net/ethernet/8390/ne.c static const char version2[] = · line 60

Quoted 5 lines
drivers/net/ethernet/8390/ne.c +3 -0
  #include <asm/system.h>
  #include <asm/io.h>
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#include <asm/atariints.h>
+#endif

Do you really need the #if here?  Should be avoidable.

<asm/atariints.h> exists on m68k only, and is not included by any header in arch/m68k/include/.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#12 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

Quoted 16 lines · Geert Uytterhoeven
Quoted 6 lines · Paul Gortmaker
Quoted 6 lines
drivers/net/ethernet/8390/ne.c +0 -0
index f92ea2a..28b8781 100644
@@ -55,6 +55,9 @@ static const char version2[] =
 
Quoted 7 lines

drivers/net/ethernet/8390/ne.c static const char version2[] = · line 60

Quoted 5 lines
drivers/net/ethernet/8390/ne.c +3 -0
 #include <asm/system.h>
 #include <asm/io.h>
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#include <asm/atariints.h>
+#endif

Do you really need the #if here? Should be avoidable.

Quoted 2 lines

<asm/atariints.h> exists on m68k only, and is not included by any header in arch/m68k/include/.

This kind of arch specific stuff still shouldn't need to bubble right up to the driver level I'd think a driver should be able to include <asm/irq.h> and have whatever arch specific goo like this be present.

So maybe this kind of magic should be in arch/m68k/include/asm/irq* instead of here?

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Paul.
--

Quoted 11 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#13 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c

Quoted 4 lines · Paul Gortmaker
Quoted 3 lines

<asm/atariints.h> exists on m68k only, and is not included by any header in arch/m68k/include/.

Quoted 8 lines

This kind of arch specific stuff still shouldn't need to bubble right up to the driver level I'd think a driver should be able to include <asm/irq.h> and have whatever arch specific goo like this be present.

So maybe this kind of magic should be in arch/m68k/include/asm/irq* instead of here?

I've double checked - that hunk should not actually have been in the patch at all. My bad ...
With all arch-specific interrupt tweaks (aside from the interrupt flags) now removed from the driver, the definition wasn't actually used any longer in the main driver file.

The non-standard interrupt flag will still be required for those users that decide to wire up the card interrupt line to, for example, the modem serial port's ring input.

Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

I had in fact implemented that as a fallback option earlier, and it turned out to be quite a bit slower that way. If that's the preferred option, I'll add netpoll to the 8390 driver and resubmit.

Thanks,

Michael

#14 lore raw

PATCH 1/1 m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

In reply to Paul Gortmaker

Hi Paul, Geert,

Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

In particular:

Changes to core net code:
* add a platform specific IRQ flag, so ne.c can share a hardware or timer interrupt with some other interrupt source.

Changes to arch/m68k code:
* register the 8390 platform device on Atari only if the hardware is present
* retain the old driver (atari_ethernec.c in Geert's tree) under a different config option, to be removed soon.

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

Comments?

Cheers,

Michael Schmitz

--

arch/m68k/atari/config.c                   |   41 +++++++++++++++++++++++++---
drivers/net/Space.c                        |    2 +-
drivers/net/ethernet/8390/8390.h           |    8 +++++
drivers/net/ethernet/8390/Kconfig          |   18 +++++++++++-
drivers/net/ethernet/8390/Makefile         |    3 +-
drivers/net/ethernet/8390/atari_ethernec.c |    6 ++--
drivers/net/ethernet/8390/ne.c             |    5 ++-
7 files changed, 71 insertions(+), 12 deletions(-)
arch/m68k/atari/config.c +0 -0
index 22375e0..6cff09f 100644
@@ -664,6 +664,35 @@ static void atari_get_hardware_list(struct seq_file *m)
 */
 

#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000
+#define ATARI_ETHERNEC_BASE 0x300
+#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMD
+
+static struct resource rtl8019_resources[] = {
+ [0] = {

+        .name    = "rtl9019-regs",
+        .start    = ATARI_ETHERNEC_BASE,
+        .end    = ATARI_ETHERNEC_BASE + 0x20 - 1,
+        .flags    = IORESOURCE_IO,
+    },
+    [1] = {
+        .name    = "rtl9019-irq",
+        .start    = ATARI_ETHERNEC_IRQ,
+        .end    = ATARI_ETHERNEC_IRQ,
+        .flags    = IORESOURCE_IRQ,

+ },
+};
+
+static struct platform_device rtl8019_device = {

+    .name        = "ne",
+    .id        = -1,
+    .num_resources    = ARRAY_SIZE(rtl8019_resources),
+    .resource    = rtl8019_resources,

+};
+
+static struct platform_device *atari_ethernec_devices[] __initdata = {
+ &rtl8019_device
+};
+

#define ATARI_ETHERNAT_PHYS_ADDR 0x80000000
#define ATARI_ETHERNAT_IRQ 196
@@ -690,6 +719,7 @@ static struct platform_device smc91x_device = {
.resource = smc91x_resources,
};

+
#define ATARI_USB_PHYS_ADDR 0x80000010
#define ATARI_USB_IRQ 195

@@ -753,7 +783,8 @@ static struct platform_device *atari_ethernat_devices[] __initdata = {
    &isp1160_device
};
-#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNAT)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNAT) \
+ || IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
irqreturn_t atari_timerd_interrupt(int irq, void *dev_id)
{
    return IRQ_HANDLED;

@@ -762,16 +793,17 @@ irqreturn_t atari_timerd_interrupt(int irq, void *dev_id)

int __init atari_platform_init(void)
{
- int rv = -ENODEV, ret, need_timer = 0;

+    int rv = -ENODEV, rv1 = -ENODEV, need_timer = 0;
    unsigned char *enatc_virt, *enec_virt;

    if (!MACH_IS_ATARI)
        return -ENODEV;

-#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)

    enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
    if (hwreg_present(enec_virt)) {
        need_timer = 1;
+        rv1 = platform_add_devices(atari_ethernec_devices, ARRAY_SIZE(atari_ethernec_devices));
    }
    iounmap(enec_virt);

#endif
@@ -788,6 +820,7 @@ int __init atari_platform_init(void) #endif

    if (need_timer) {
+        int ret;
        const char *name = "Timer D dummy interrupt";

        /* timer routine set up in atari_ethernec_probe() */
@@ -802,7 +835,7 @@ int __init atari_platform_init(void)
        }
    }

- if (ret) return ret;

+    if (rv1) return rv1;
    return rv;   
}
drivers/net/Space.c +0 -0
index d5e8882..548b73b 100644
@@ -243,7 +243,7 @@ static struct devprobe2 m68k_probes[] __initdata = {
#ifdef CONFIG_ATARILANCE    /* Lance-based Atari ethernet boards */
    {atarilance_probe, 0},
#endif
-#ifdef CONFIG_ATARI_ETHERNEC    /* NE2000 based ROM port ethernet cards */
+#ifdef CONFIG_ATARI_ETHERNEC_OLD    /* NE2000 based ROM port ethernet cards */
    {atari_ethernec_probe, 0},

#endif
#ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */

drivers/net/ethernet/8390/8390.h +0 -0
index ef325ff..9416245 100644
@@ -32,6 +32,14 @@ extern void ei_poll(struct net_device *dev);

extern void eip_poll(struct net_device *dev);
#endif

+/* Some platforms may need special IRQ flags */
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+# define EI_IRQ_FLAGS IRQF_SHARED
+#endif
+
+#ifndef EI_IRQ_FLAGS
+# define EI_IRQ_FLAGS 0
+#endif

/* Without I/O delay - non ISA or later chips */ extern void NS8390_init(struct net_device *dev, int startp);

drivers/net/ethernet/8390/Kconfig +0 -0
index b801056..75875f2 100644
@@ -226,11 +226,27 @@ config APNE

config ATARI_ETHERNEC
tristate "Atari EtherNEC Ethernet support"
depends on ATARI_ROM_ISA

-    help
+    select CRC32
+    ---help---
+      Say Y to include support for the EtherNEC network adapter for the
+      ROM port. The driver works by polling instead of interrupts, so it
+      is quite slow.

+
+ To compile this driver as a module, choose M here: the module
+ will be called ne.
+
+config ATARI_ETHERNEC_OLD

+    tristate "Atari EtherNEC Ethernet support - obsolete driver"
+    depends on ATARI_ROM_ISA
+    select CRC32
+    ---help---

Say Y to include support for the EtherNEC network adapter for the ROM port. The driver works by polling instead of interrupts, so it is quite slow.

+ To compile this driver as a module, choose M here: the module
+ will be called atari_ethernec.
+
config NE3210
tristate "Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)" depends on PCI && EISA && EXPERIMENTAL

drivers/net/ethernet/8390/Makefile +0 -0
index d896466..e620355 100644
@@ -6,7 +6,8 @@ obj-$(CONFIG_MAC8390) += mac8390.o

obj-$(CONFIG_AC3200) += ac3200.o 8390.o obj-$(CONFIG_APNE) += apne.o 8390.o obj-$(CONFIG_ARM_ETHERH) += etherh.o -obj-$(CONFIG_ATARI_ETHERNEC) += atari_ethernec.o 8390.o +obj-$(CONFIG_ATARI_ETHERNEC_OLD) += atari_ethernec.o 8390.o +obj-$(CONFIG_ATARI_ETHERNEC) += ne.o 8390p.o obj-$(CONFIG_AX88796) += ax88796.o obj-$(CONFIG_E2100) += e2100.o 8390.o obj-$(CONFIG_EL2) += 3c503.o 8390p.o

drivers/net/ethernet/8390/atari_ethernec.c +0 -0
index 086d968..5e8fb97 100644
@@ -185,13 +185,13 @@ bad_clone_list[] __initdata = {

# define DCR_VAL 0x4b

#elif defined(CONFIG_PLAT_OAKS32R)  || \
   defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 
|| \
-   defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE)
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
#  define DCR_VAL 0x48        /* 8-bit mode */

#else
# define DCR_VAL 0x49
#endif

-#if defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE) +#if IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
# define ETHERNEC_RTL_8019_BASE 0x300
# define ETHERNEC_RTL_8019_IRQ IRQ_MFP_TIMD
#endif
@@ -357,7 +357,7 @@ struct net_device * __init atari_ethernec_probe(int unit)

    sprintf(dev->name, "eth%d", unit);
    netdev_boot_setup_check(dev);

-#if defined(CONFIG_ATARI_ETHERNEC)
+#if defined(CONFIG_ATARI_ETHERNEC_OLD)

    dev->base_addr = ETHERNEC_RTL_8019_BASE;
    dev->irq = ETHERNEC_RTL_8019_IRQ;

#endif

drivers/net/ethernet/8390/ne.c +0 -0
index f92ea2a..39678fc 100644
@@ -165,7 +165,8 @@ bad_clone_list[] __initdata = {

#if defined(CONFIG_PLAT_MAPPI)
# define DCR_VAL 0x4b
#elif defined(CONFIG_PLAT_OAKS32R) || \

-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)

# define DCR_VAL 0x48 /* 8-bit mode */
#else
# define DCR_VAL 0x49
@@ -492,7 +493,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)

    /* Snarf the interrupt now.  There's no point in waiting since we 
cannot
       share and the board will usually be enabled. */
-    ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+    ret = request_irq(dev->irq, eip_interrupt, EI_IRQ_FLAGS, name, dev);
    if (ret) {
        printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
        goto err_out;
maintainer
#15 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

From: Michael Schmitz <[email protected]>
Date: Sun, 01 Apr 2012 20:49:52 +1200

Quoted 10 lines

Hi Paul, Geert,

Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

Please fix your email client, it corrupts your outgoing patches by breaking up long lines with newlines amongst other things.

#16 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

In reply to Michael Schmitz
Quoted 22 lines · Michael Schmitz

Hi Paul, Geert,

Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

In particular:

Changes to core net code:
* add a platform specific IRQ flag, so ne.c can share a hardware or timer interrupt with some other interrupt source.

Changes to arch/m68k code:
* register the 8390 platform device on Atari only if the hardware is present
* retain the old driver (atari_ethernec.c in Geert's tree) under a different config option, to be removed soon.

Quoted 7 lines

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

How much lower? Enough to matter? Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

Also, the only advantage to modifying ne.c is to allow dumping the old driver. What is the "remove soon" plan? Any reason for it to not be synchronous? That would eliminate the Kconfig churn and the introduction of the _OLD option. Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

Quoted 2 lines

Comments?

Some specific to the non-atari network parts inline below.

P.

Quoted 18 lines

Cheers,

Michael Schmitz

--

 arch/m68k/atari/config.c                   |   41 
+++++++++++++++++++++++++---
 drivers/net/Space.c                        |    2 +-
 drivers/net/ethernet/8390/8390.h           |    8 +++++
 drivers/net/ethernet/8390/Kconfig          |   18 +++++++++++-
 drivers/net/ethernet/8390/Makefile         |    3 +-
 drivers/net/ethernet/8390/atari_ethernec.c |    6 ++--
 drivers/net/ethernet/8390/ne.c             |    5 ++-
 7 files changed, 71 insertions(+), 12 deletions(-)

[...]

Quoted 7 lines
drivers/net/ethernet/8390/8390.h +0 -0
index ef325ff..9416245 100644
@@ -32,6 +32,14 @@ extern void ei_poll(struct net_device *dev);
 extern void eip_poll(struct net_device *dev);

drivers/net/ethernet/8390/8390.h extern void ei_poll(struct net_device *dev); · line 42

Quoted 10 lines
drivers/net/ethernet/8390/8390.h +8 -0
 #endif
 
+/* Some platforms may need special IRQ flags */
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#  define EI_IRQ_FLAGS    IRQF_SHARED
+#endif
+
+#ifndef EI_IRQ_FLAGS
+#  define EI_IRQ_FLAGS    0
+#endif

This seems more klunky than it needs to be. If we assume that anyone building ne.c on atari is hence trying to drive an ethernec device than it can just be

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS IRQF_SHARED
#else
#define EI_IRQ_FLAGS 0
#endif

Quoted 89 lines
drivers/net/ethernet/8390/8390.h +0 -0
 /* Without I/O delay - non ISA or later chips */
 extern void NS8390_init(struct net_device *dev, int startp);
drivers/net/ethernet/8390/Kconfig +17 -1
index b801056..75875f2 100644
@@ -226,11 +226,27 @@ config APNE
 config ATARI_ETHERNEC
     tristate "Atari EtherNEC Ethernet support"
     depends on ATARI_ROM_ISA
-    help
+    select CRC32
+    ---help---
+      Say Y to include support for the EtherNEC network adapter for the
+      ROM port. The driver works by polling instead of interrupts, so it
+      is quite slow.
+
+      To compile this driver as a module, choose M here: the module
+      will be called ne.
+
+config ATARI_ETHERNEC_OLD
+    tristate "Atari EtherNEC Ethernet support - obsolete driver"
+    depends on ATARI_ROM_ISA
+    select CRC32
+    ---help---
       Say Y to include support for the EtherNEC network adapter for the
       ROM port. The driver works by polling instead of interrupts, so it
       is quite slow.
 
+      To compile this driver as a module, choose M here: the module
+      will be called atari_ethernec.
+
 config NE3210
     tristate "Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)"
     depends on PCI && EISA && EXPERIMENTAL
drivers/net/ethernet/8390/Makefile +2 -1
index d896466..e620355 100644
@@ -6,7 +6,8 @@ obj-$(CONFIG_MAC8390) += mac8390.o
 obj-$(CONFIG_AC3200) += ac3200.o 8390.o
 obj-$(CONFIG_APNE) += apne.o 8390.o
 obj-$(CONFIG_ARM_ETHERH) += etherh.o
-obj-$(CONFIG_ATARI_ETHERNEC) += atari_ethernec.o 8390.o
+obj-$(CONFIG_ATARI_ETHERNEC_OLD) += atari_ethernec.o 8390.o
+obj-$(CONFIG_ATARI_ETHERNEC) += ne.o 8390p.o
 obj-$(CONFIG_AX88796) += ax88796.o
 obj-$(CONFIG_E2100) += e2100.o 8390.o
 obj-$(CONFIG_EL2) += 3c503.o 8390p.o
drivers/net/ethernet/8390/atari_ethernec.c +2 -2
index 086d968..5e8fb97 100644
@@ -185,13 +185,13 @@ bad_clone_list[] __initdata = {
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
    defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 
 || \
-   defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE)
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
 #  define DCR_VAL 0x48        /* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
 #endif
 
-#if defined(CONFIG_ATARI_ETHERNEC) || defined(CONFIG_ATARI_ETHERNEC_MODULE)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
 #  define ETHERNEC_RTL_8019_BASE 0x300
 #  define ETHERNEC_RTL_8019_IRQ IRQ_MFP_TIMD

#endif

drivers/net/ethernet/8390/atari_ethernec.c +1 -1
@@ -357,7 +357,7 @@ struct net_device * __init atari_ethernec_probe(int 
 unit)
     sprintf(dev->name, "eth%d", unit);
     netdev_boot_setup_check(dev);
 
-#if defined(CONFIG_ATARI_ETHERNEC)
+#if defined(CONFIG_ATARI_ETHERNEC_OLD)
     dev->base_addr = ETHERNEC_RTL_8019_BASE;
     dev->irq = ETHERNEC_RTL_8019_IRQ;

#endif

drivers/net/ethernet/8390/ne.c +0 -0
index f92ea2a..39678fc 100644

drivers/net/ethernet/8390/ne.c bad_clone_list[] __initdata = { · line 169

Quoted 6 lines
drivers/net/ethernet/8390/ne.c +2 -1
@@ -165,7 +165,8 @@ bad_clone_list[] __initdata = {
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)

Rather than use IS_ENABLED on a driver setting, you can follow the surrounding context and use defined(CONFIG_ATARI) -- i.e. work off a platform setting.

Paul.

Quoted 15 lines
drivers/net/ethernet/8390/ne.c +0 -0
 #  define DCR_VAL 0x48        /* 8-bit mode */
 #else
 #  define DCR_VAL 0x49
@@ -492,7 +493,7 @@ static int __init ne_probe1(struct net_device *dev, 
 unsigned long ioaddr)
 
     /* Snarf the interrupt now.  There's no point in waiting since we 

cannot
share and the board will usually be enabled. */

drivers/net/ethernet/8390/ne.c +1 -1
-    ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
+    ret = request_irq(dev->irq, eip_interrupt, EI_IRQ_FLAGS, name, dev);
     if (ret) {
         printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
         goto err_out;
author maintainer
#17 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

Quoted 30 lines · Paul Gortmaker
Quoted 21 lines · Michael Schmitz
Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer"  --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll.  Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

In particular:

Changes to core net code:
* add a platform specific IRQ flag, so ne.c can share a hardware or timer interrupt with some other interrupt source.

Changes to arch/m68k code:
* register the 8390 platform device on Atari only if the hardware is present
* retain the old driver (atari_ethernec.c in Geert's tree) under a different config option, to be removed soon.

Quoted 7 lines

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

Quoted 3 lines

How much lower?  Enough to matter?  Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

One other thing we could do is increase CONFIG_HZ to 250.

Quoted 6 lines

Also, the only advantage to modifying ne.c is to allow dumping the old driver.  What is the "remove soon" plan?  Any reason for it to not be synchronous?  That would eliminate the Kconfig churn and the introduction of the _OLD option.  Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

From my point of view, "remove soon" means it will never hit mainline.

Quoted 22 lines
Quoted 7 lines
drivers/net/ethernet/8390/8390.h +0 -0
index ef325ff..9416245 100644
@@ -32,6 +32,14 @@ extern void ei_poll(struct net_device *dev);
  extern void eip_poll(struct net_device *dev);

drivers/net/ethernet/8390/8390.h extern void ei_poll(struct net_device *dev); · line 42

Quoted 10 lines
drivers/net/ethernet/8390/8390.h +8 -0
  #endif
 
+/* Some platforms may need special IRQ flags */
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#  define EI_IRQ_FLAGS    IRQF_SHARED
+#endif
+
+#ifndef EI_IRQ_FLAGS
+#  define EI_IRQ_FLAGS    0
+#endif

This seems more klunky than it needs to be.  If we assume that anyone building ne.c on atari is hence trying to drive an ethernec device than it can just be

Quoted 5 lines

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS    IRQF_SHARED
#else
#define EI_IRQ_FLAGS    0
#endif

Indeed, with a small modification (keep multi-platform kernels in mind):

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS    (MACH_IS_ATARI ? IRQF_SHARED : 0) #else
#define EI_IRQ_FLAGS    0
#endif

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#18 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

Quoted 38 lines · Geert Uytterhoeven
Quoted 30 lines · Paul Gortmaker
Quoted 21 lines · Michael Schmitz
Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

In particular:

Changes to core net code:
* add a platform specific IRQ flag, so ne.c can share a hardware or timer interrupt with some other interrupt source.

Changes to arch/m68k code:
* register the 8390 platform device on Atari only if the hardware is present
* retain the old driver (atari_ethernec.c in Geert's tree) under a different config option, to be removed soon.

Quoted 7 lines

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

Quoted 3 lines

How much lower? Enough to matter? Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

One other thing we could do is increase CONFIG_HZ to 250.

Quoted 8 lines
Quoted 6 lines

Also, the only advantage to modifying ne.c is to allow dumping the old driver. What is the "remove soon" plan? Any reason for it to not be synchronous? That would eliminate the Kconfig churn and the introduction of the _OLD option. Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

From my point of view, "remove soon" means it will never hit mainline.

Can you clarify what "it" is? It isn't clear to me if you
mean the _removal_ will never hit mainline, or the transient renamed "old" driver will never hit mainline.

If the former, then there is no point pursuing this any further as I said above.

If the latter, then the commit sent out for review should have no instances of this "renaming to old" related changes.

Thanks,
Paul.

Quoted 47 lines
Quoted 23 lines
Quoted 8 lines
drivers/net/ethernet/8390/8390.h +0 -0
index ef325ff..9416245 100644
@@ -32,6 +32,14 @@ extern void ei_poll(struct net_device *dev);
 extern void eip_poll(struct net_device *dev);

drivers/net/ethernet/8390/8390.h extern void ei_poll(struct net_device *dev); · line 42

Quoted 10 lines
drivers/net/ethernet/8390/8390.h +8 -0
 #endif
 
+/* Some platforms may need special IRQ flags */
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#  define EI_IRQ_FLAGS    IRQF_SHARED
+#endif
+
+#ifndef EI_IRQ_FLAGS
+#  define EI_IRQ_FLAGS    0
+#endif

This seems more klunky than it needs to be. If we assume that anyone building ne.c on atari is hence trying to drive an ethernec device than it can just be

Quoted 5 lines

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS IRQF_SHARED
#else
#define EI_IRQ_FLAGS 0
#endif

Indeed, with a small modification (keep multi-platform kernels in mind):

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS (MACH_IS_ATARI ? IRQF_SHARED : 0)
#else
#define EI_IRQ_FLAGS 0
#endif

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#19 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

Hi Paul,

Quoted 52 lines · Paul Gortmaker
Quoted 38 lines · Geert Uytterhoeven
Quoted 30 lines · Paul Gortmaker
Quoted 21 lines · Michael Schmitz
Quoted 6 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer"  --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll.  Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

In particular:

Changes to core net code:
* add a platform specific IRQ flag, so ne.c can share a hardware or timer interrupt with some other interrupt source.

Changes to arch/m68k code:
* register the 8390 platform device on Atari only if the hardware is present
* retain the old driver (atari_ethernec.c in Geert's tree) under a different config option, to be removed soon.

Quoted 7 lines

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

Quoted 3 lines

How much lower?  Enough to matter?  Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

One other thing we could do is increase CONFIG_HZ to 250.

Quoted 8 lines
Quoted 6 lines

Also, the only advantage to modifying ne.c is to allow dumping the old driver.  What is the "remove soon" plan?  Any reason for it to not be synchronous?  That would eliminate the Kconfig churn and the introduction of the _OLD option.  Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

From my point of view, "remove soon" means it will never hit mainline.

Can you clarify what "it" is?   It isn't clear to me if you mean the _removal_ will never hit mainline, or the transient renamed "old" driver will never hit mainline.

Quoted 5 lines

If the former, then there is no point pursuing this any further as I said above.

If the latter, then the commit sent out for review should have no instances of this "renaming to old" related changes.

Sorry for being unclear. The latter (i.e. the old driver will never hit mainline).

And Michael's patch against ne.c should indeed not touch the old driver, as it doesn't exist in mainline.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#20 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

In reply to Paul Gortmaker

Hi Paul,

I hate to bring this up again after such a long delay - my usual slackness is to blame, sorry.

Geert has reminded me that the IRQ-less ne.c driver is one of the few remaining unmerged patches in his queue.
We had resolved the polling from timer interrupt issues in the m68k interrupt code, with a little help from Thomas Gleixner (commit b39898cd4077f4b6ec706e717c938751c34e1dc4) so changes to ne.c are now minimal.

Are you willing to review this minimal patch again? Regards,

Michael Schmitz

Quoted 115 lines · Geert Uytterhoeven
Quoted 43 lines
Quoted 32 lines · Paul Gortmaker
Quoted 22 lines · Michael Schmitz
Quoted 7 lines

And on re-reading the comments in the other part of the patch, i.e. "...emulates the card interrupt via a timer" --perhaps the driver should be just fixed to support generic netpoll, instead of adding an arch specific thing that amounts to netpoll. Then anyone can attempt to limp along and use one of these ancient relics w/o IRQ.

Here's take two of my patch to convert the m68k Atari ROM port Ethernet driver to use mainstream ne.c, with minimal changes to the core NE2000 code.

In particular:

Changes to core net code:
* add a platform specific IRQ flag, so ne.c can share a hardware or timer interrupt with some other interrupt source.

Changes to arch/m68k code:
* register the 8390 platform device on Atari only if the hardware is present
* retain the old driver (atari_ethernec.c in Geert's tree) under a different config option, to be removed soon.

Quoted 8 lines

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

Quoted 4 lines

How much lower? Enough to matter? Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

One other thing we could do is increase CONFIG_HZ to 250.

Quoted 9 lines
Quoted 7 lines

Also, the only advantage to modifying ne.c is to allow dumping the old driver. What is the "remove soon" plan? Any reason for it to not be synchronous? That would eliminate the Kconfig churn and the introduction of the _OLD option. Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

From my point of view, "remove soon" means it will never hit mainline.

Can you clarify what "it" is? It isn't clear to me if you
mean the _removal_ will never hit mainline, or the transient renamed "old" driver will never hit mainline.

If the former, then there is no point pursuing this any further as I said above.

If the latter, then the commit sent out for review should have no instances of this "renaming to old" related changes.

Thanks,
Paul.

Quoted 47 lines
Quoted 22 lines
Quoted 8 lines
drivers/net/ethernet/8390/8390.h +0 -0
index ef325ff..9416245 100644
@@ -32,6 +32,14 @@ extern void ei_poll(struct net_device *dev);
 extern void eip_poll(struct net_device *dev);
 #endif

drivers/net/ethernet/8390/8390.h extern void ei_poll(struct net_device *dev); · line 43

Quoted 10 lines
drivers/net/ethernet/8390/8390.h +8 -0
 
+/* Some platforms may need special IRQ flags */
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#  define EI_IRQ_FLAGS    IRQF_SHARED
+#endif
+
+#ifndef EI_IRQ_FLAGS
+#  define EI_IRQ_FLAGS    0
+#endif
 

This seems more klunky than it needs to be. If we assume that anyone building ne.c on atari is hence trying to drive an ethernec device than it can just be

Quoted 6 lines

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS IRQF_SHARED
#else
#define EI_IRQ_FLAGS 0
#endif

Indeed, with a small modification (keep multi-platform kernels in mind):

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS (MACH_IS_ATARI ? IRQF_SHARED : 0)
#else
#define EI_IRQ_FLAGS 0
#endif

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#21 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

In reply to Geert Uytterhoeven

Geert,

Quoted 7 lines
Quoted 4 lines

How much lower? Enough to matter? Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

One other thing we could do is increase CONFIG_HZ to 250.

Making 3.x kernels run even more sluggish than they already do?

Quoted 10 lines
Quoted 7 lines

Also, the only advantage to modifying ne.c is to allow dumping the old driver. What is the "remove soon" plan? Any reason for it to not be synchronous? That would eliminate the Kconfig churn and the introduction of the _OLD option. Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

From my point of view, "remove soon" means it will never hit mainline.

That's what I meant to say - my patch is based on the m68k tree which currently has another driver for this hardware, based on an older version of ne.c which was never submitted to mainline. The old driver would be removed from the m68k tree as soon as possible.

Quoted 11 lines
Quoted 10 lines

This seems more klunky than it needs to be. If we assume that anyone building ne.c on atari is hence trying to drive an ethernec device than it can just be

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS IRQF_SHARED
#else
#define EI_IRQ_FLAGS 0
#endif

Quoted 8 lines

Indeed, with a small modification (keep multi-platform kernels in mind):

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS (MACH_IS_ATARI ? IRQF_SHARED : 0)
#else
#define EI_IRQ_FLAGS 0
#endif

Right you are. Is any other m68k platform using ne.c directly, or do you plan to convert all other NE2000 based drivers to ne.c now?

Cheers,

Michael

author maintainer
#22 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

Quoted 11 lines · Michael Schmitz
Quoted 8 lines

Indeed, with a small modification (keep multi-platform kernels in mind):

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS    (MACH_IS_ATARI ? IRQF_SHARED : 0) #else
#define EI_IRQ_FLAGS    0
#endif

Right you are. Is any other m68k platform using ne.c directly, or do you plan to convert all other NE2000 based drivers to ne.c now?

Plain ne is also used on Q40.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#23 lore raw

Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two

In reply to Paul Gortmaker

Hi Paul,

(Apologies to all for botching the patch format ...)

Quoted 7 lines
Quoted 2 lines

Regarding your suggestion that netpoll be used instead of a dedicated timer interrupt: no changes to ne.c or 8390p.c are required to use netpoll, it all works out of the box. All that is needed to use the driver with netpoll is setting the device interrupt to some source that can be registered, and enabling CONFIG_NETPOLL. Interrupt rate and hence throughput is lower with netpoll though, which is why I still prefer the dedicated timer option.

How much lower? Enough to matter? Implicit in that question is the assumption that this is largely a hobbyist platform and nobody is using it in a closet to route gigabytes of traffic.

I'd say about at least double latency. I can try and measure bulk data rates if it matters. My gut feeling is latency limits data rates even when say behind a DSL modem for downloads. It sure did when my Falcon was still hooked up to a university network, uploading and downloading source and binary packages for Debian/68k.

Of course you're not routing gigabytes of traffic with this (where to - a PPP connection? :). Whoever wants minimum latency better reach for the soldering iron and wire up the interrupt line to some suitable input.

Quoted 7 lines

Also, the only advantage to modifying ne.c is to allow dumping the old driver. What is the "remove soon" plan? Any reason for it to not be synchronous? That would eliminate the Kconfig churn and the introduction of the _OLD option. Modifying ne.c and then deciding to keep the old driver because it is "faster" would make this change pointless.

As soon as eventual changes to ne.c get accepted. If you want us to drop the old driver in the same patch, fine by me.

Quoted 22 lines
Quoted 7 lines
drivers/net/ethernet/8390/8390.h +0 -0
index ef325ff..9416245 100644
@@ -32,6 +32,14 @@ extern void ei_poll(struct net_device *dev);
 extern void eip_poll(struct net_device *dev);
 #endif

drivers/net/ethernet/8390/8390.h extern void ei_poll(struct net_device *dev); · line 43

Quoted 10 lines
drivers/net/ethernet/8390/8390.h +8 -0
 
+/* Some platforms may need special IRQ flags */
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+#  define EI_IRQ_FLAGS    IRQF_SHARED
+#endif
+
+#ifndef EI_IRQ_FLAGS
+#  define EI_IRQ_FLAGS    0
+#endif
 

This seems more klunky than it needs to be. If we assume that anyone building ne.c on atari is hence trying to drive an ethernec device than it can just be

Quoted 7 lines

#ifdef CONFIG_ATARI
#define EI_IRQ_FLAGS IRQF_SHARED
#else
#define EI_IRQ_FLAGS 0
#endif

Pretty safe assumption - if we further assume no other arch has reason to resort to such a kludge, we can simplify it this way.

Quoted 6 lines
Quoted 6 lines
drivers/net/ethernet/8390/ne.c +0 -0
@@ -165,7 +165,8 @@ bad_clone_list[] __initdata = {
 #if defined(CONFIG_PLAT_MAPPI)
 #  define DCR_VAL 0x4b
 #elif defined(CONFIG_PLAT_OAKS32R)  || \
Quoted 9 lines

drivers/net/ethernet/8390/ne.c bad_clone_list[] __initdata = { · line 170

Quoted 4 lines
drivers/net/ethernet/8390/ne.c +2 -1
-   defined(CONFIG_MACH_TX49XX)
+   defined(CONFIG_MACH_TX49XX) || \
+   IS_ENABLED(CONFIG_ATARI_ETHERNEC)
 

Rather than use IS_ENABLED on a driver setting, you can follow the surrounding context and use defined(CONFIG_ATARI) -- i.e. work off a platform setting.

True as well, point taken. Is the patch acceptable with these changes? If so, would you be OK with this going through Geert's tree?

Cheers,

Michael

#24 lore raw

PATCH 1/5 m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

In reply to Michael Schmitz

Hi All,

The following patch is one in a series of patches in relation to getting interrupt-driven Ethernet and USB drivers supported on the Atari Falcon EtherNAT board. Whoever does have a Falcon with EtherNAT (and CT60, preferably) running Linux please try out this patch series to help testing these drivers. For convenience of testing, build the Ethernet and USB drivers as modules please.

Patches are relative to Geert's v3.3.0 (commit 29c8d8820b6eba2fb6cb2702fd06095a48083595).

Part 1 (this): make room for the EtherNAT interrupts - they appear at vectors 0xc3 (USB ISP1160) and 0xc4 (SMC91C111)
Part 2: add platform data for the ISP1160 driver, fix the 91C111 interrupt source number (the 91C111 platform data had been added quite some time ago) Part 3: make sure the platform devices are added only if the EtherNAT card is actually present
Part 4: add usb/isp116x.h header to fix compile errors introduced in 2)
Part 5: add Kconfig flag necessary to enable compilation of the ISP1160 driver

Both functions of the EtherNAT are correctly detected with this patch series. Some mysterious hardware fault in my Falcon does prevent the card to function properly, however (though at least the 91C111 part with timer polling did use to work in thee past).

The card interrupts are not being enabled by these patches yet. I need to discuss with Geert the best way of enabling them as close to the module loading time as possible.

Cheers,

Michael

--

arch/m68k/include/asm/atariints.h |    2 +-
arch/m68k/include/asm/irq.h       |    4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/atariints.h +0 -0
index 656bbbf..4e82683 100644
@@ -30,7 +30,7 @@
#define TTMFP_SOURCE_BASE  24
#define SCC_SOURCE_BASE    40
#define VME_SOURCE_BASE    56

-#define VME_MAX_SOURCES 16
+#define VME_MAX_SOURCES 152

#define NUM_ATARI_SOURCES (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE)

arch/m68k/include/asm/irq.h +0 -0
index c1155f0..e905b3f 100644
@@ -9,9 +9,9 @@
 */

#if defined(CONFIG_COLDFIRE)
#define NR_IRQS 256

-#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
+#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) || defined(CONFIG_ATARI)

#define NR_IRQS 200
-#elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) +#elif defined(CONFIG_MAC)
#define NR_IRQS 72
#elif defined(CONFIG_Q40)
#define NR_IRQS 43

author maintainer
#25 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Hi Michael,

Quoted 2 lines · Michael Schmitz

Part 1 (this): make room for the EtherNAT interrupts - they appear at vectors 0xc3 (USB ISP1160) and 0xc4 (SMC91C111)

Is there any specific reason you cannot use atari_register_vme_int(), like drivers/net/ethernet/amd/atarilance.c, to avoid increasing NR_IRQS?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#26 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Hi Geert,

Quoted 7 lines
Quoted 2 lines

Part 1 (this): make room for the EtherNAT interrupts - they appear at vectors 0xc3 (USB ISP1160) and 0xc4 (SMC91C111)

Is there any specific reason you cannot use atari_register_vme_int(), like drivers/net/ethernet/amd/atarilance.c, to avoid increasing NR_IRQS?

From what I read in atari_register_vme_int(), it returns the next free

VME interrupt starting at VME_SOURCE_BASE. This required the vector number to be programmable in the correspomding VME device.

To the best of my knowledge, vector numbers are fixed (0xc3 and 0xc4) for the EtherNAT.

I definitely need to increase NR_IRQS - it might be better to leave VME_MAX_SOURCES unchanged and change the NUM_ATARI_SOURCES definition above instead.

I'm uncertain whether the complicated definition of NUM_ATARI_SOURCES is needed anymore - are the IRQ_VECTOR_TO_SOURCE and IRQ_SOURCE_TO_VECTOR macros still used anywhere?

Cheers,

Michael

author maintainer
#27 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Hi Michael,

Quoted 6 lines · Michael Schmitz
Quoted 5 lines

Part 1 (this): make room for the EtherNAT interrupts - they appear at

Quoted 1 line

vectors 0xc3 (USB ISP1160) and 0xc4 (SMC91C111)

Is there any specific reason you cannot use atari_register_vme_int(), like drivers/net/ethernet/amd/atarilance.c, to avoid increasing NR_IRQS?

Quoted 6 lines

From what I read in atari_register_vme_int(), it returns the next free VME interrupt starting at VME_SOURCE_BASE. This required the vector number to be programmable in the correspomding VME device.

To the best of my knowledge, vector numbers are fixed (0xc3 and 0xc4) for the EtherNAT.

OK. If they are fixed, there's nothing we can do about that.

Quoted 7 lines

I definitely need to increase NR_IRQS - it might be better to leave VME_MAX_SOURCES unchanged and change the NUM_ATARI_SOURCES definition above instead.

I'm uncertain whether the complicated definition of NUM_ATARI_SOURCES is needed anymore - are the IRQ_VECTOR_TO_SOURCE and IRQ_SOURCE_TO_VECTOR macros still used anywhere?

Only the latter:

drivers/net/ethernet/amd/atarilance.c: IO->ivec =
IRQ_SOURCE_TO_VECTOR(dev->irq);
drivers/net/ethernet/amd/atarilance.c: *RIEBL_IVEC_ADDR =
IRQ_SOURCE_TO_VECTOR(dev->irq);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#28 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Hi Geert,

Quoted 10 lines
Quoted 3 lines

I'm uncertain whether the complicated definition of NUM_ATARI_SOURCES is needed anymore - are the IRQ_VECTOR_TO_SOURCE and IRQ_SOURCE_TO_VECTOR macros still used anywhere?

Only the latter:

drivers/net/ethernet/amd/atarilance.c:          IO->ivec = IRQ_SOURCE_TO_VECTOR(dev->irq); drivers/net/ethernet/amd/atarilance.c:          *RIEBL_IVEC_ADDR = IRQ_SOURCE_TO_VECTOR(dev->irq);

OK, so we'll need to retain that.

The definition of NUM_ATARI_SOURCES will need to be changed again; we'd best hardcode it to 140:
For one, allowing for 152 VME interrupts will exceed the boundaries of the allocated bitmap (i.e. trash other memory).
We won't need the full 200 either (I seem to have got the EtherNAT source numbers wrong in my earlier patch).

I'll send patches for these fixes later.

Cheers,

Michael

#29 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Hi Geert,

Quoted 8 lines

The definition of NUM_ATARI_SOURCES will need to be changed again; we'd best hardcode it to 140:
For one, allowing for 152 VME interrupts will exceed the boundaries of the allocated bitmap (i.e. trash other memory).
We won't need the full 200 either (I seem to have got the EtherNAT source numbers wrong in my earlier patch).

See attached - the 3.3.0-ethernat patches implement switching over to the mainstream 91Cx driver (card detected on my Falcon, link brought up but not detected by the driver due to hardware problems). The 3.3.0-atari-cleanup-num-irqs.diff sets the number of interrupt sources to 141 on Atari, setting the number of VME sources back to 16 so we don't accidentially trash memory contiguous with the free_vme_irq bitmap.

For some reason, I have to set NUM_ATARI_SOURCES to 141 to actually get interrupt source 140 to register. Off-by-one error somewhere in the generic interrupt code I'd think, but I've not been able to spot it. (Just increasing the number of interrupts that are registered by atari_init_IRQ results in 'unexpected interrupt from 112' until the cows come home. And yes, it happens in ARAnyM, too.)

That pretty much wraps it up for EtherNEC and EtherNAT - EtherNEC is fully tested by me, EtherNAT needs testing on Christian's Falcon or by someone else with fully functional hardware. Next project : SCSI, SCC serial, or what?...

Cheers,

Michael

arch/m68k/include/asm/atariints.h +2 -2
index 4e82683..9229626 100644
@@ -30,9 +30,9 @@
 #define TTMFP_SOURCE_BASE  24
 #define SCC_SOURCE_BASE    40
 #define VME_SOURCE_BASE    56
-#define VME_MAX_SOURCES    152
+#define VME_MAX_SOURCES    16
 
-#define NUM_ATARI_SOURCES   (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE)
+#define NUM_ATARI_SOURCES  141
 
 /* convert vector number to int source number */
 #define IRQ_VECTOR_TO_SOURCE(v)	((v) - ((v) < 0x20 ? 0x18 : (0x40-8)))
arch/m68k/include/asm/irq.h +3 -1
index e905b3f..8bd9c7f 100644
@@ -9,8 +9,10 @@
  */
 #if defined(CONFIG_COLDFIRE)
 #define NR_IRQS 256
-#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) || defined(CONFIG_ATARI)
+#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) 
 #define NR_IRQS 200
+#elif defined(CONFIG_ATARI)
+#define NR_IRQS 141
 #elif defined(CONFIG_MAC)
 #define NR_IRQS 72
 #elif defined(CONFIG_Q40)
arch/m68k/atari/config.c +2 -2
index 6cff09f..af273d9 100644
@@ -695,7 +695,7 @@ static struct platform_device *atari_ethernec_devices[] __initdata = {
 
 
 #define ATARI_ETHERNAT_PHYS_ADDR	0x80000000
-#define ATARI_ETHERNAT_IRQ		196
+#define ATARI_ETHERNAT_IRQ		140
 
 static struct resource smc91x_resources[] = {
 	[0] = {
@@ -721,7 +721,7 @@ static struct platform_device smc91x_device = {
 
 
 #define ATARI_USB_PHYS_ADDR	0x80000010
-#define ATARI_USB_IRQ		195
+#define ATARI_USB_IRQ		139
 
 static struct resource isp1160_resources[] = {
 	[0] = {
drivers/net/ethernet/smsc/Kconfig +16 -0
index 01893aa..c34f5ac 100644
@@ -29,6 +29,22 @@ config ATARI_ETHERNAT
 	  CT/60 extension port. The driver works by polling instead of
 	  interrupts, so it is quite slow.
 
+	  To compile this driver as a module, choose M here. The module
+	  will be called smc91x.
+
+config ATARI_ETHERNAT_OLD
+	tristate "Atari EtherNAT Ethernet support - obsolete driver"
+	select CRC32
+	select MII
+	depends on ATARI
+	help
+	  Say Y to include support for the EtherNAT network adapter for the
+	  CT/60 extension port. The driver works by polling instead of
+	  interrupts, so it is quite slow.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called atari_91C111.
+
 config SMC9194
 	tristate "SMC 9194 support"
 	depends on (ISA || MAC && BROKEN)
drivers/net/ethernet/smsc/Makefile +2 -1
index ef228db..ac30abb 100644
@@ -2,7 +2,8 @@
 # Makefile for the SMSC network device drivers.
 #
 
-obj-$(CONFIG_ATARI_ETHERNAT) += atari_91C111.o
+obj-$(CONFIG_ATARI_ETHERNAT) += smc91x.o
+obj-$(CONFIG_ATARI_ETHERNAT_OLD) += atari_91C111.o
 obj-$(CONFIG_SMC9194) += smc9194.o
 obj-$(CONFIG_SMC91X) += smc91x.o
 obj-$(CONFIG_PCMCIA_SMC91C92) += smc91c92_cs.o
drivers/net/ethernet/smsc/smc91x.h +2 -2
index 987755c..36c17c1 100644
@@ -231,7 +231,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 
 #include <unit/smc91111.h>
 
-#elif defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNAT_MODULE)
+#elif IS_ENABLED(CONFIG_ATARI_ETHERNAT) || IS_ENABLED(CONFIG_ATARI_ETHERNAT_OLD)
 
 #define SMC_CAN_USE_8BIT        1
 #define SMC_CAN_USE_16BIT       1
@@ -1144,7 +1144,7 @@ static const char * chip_ids[ 16 ] =  {
 		}							\
 	} while (0)
 
-#if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNAT_MODULE)
+#if IS_ENABLED(CONFIG_ATARI_ETHERNAT) || IS_ENABLED(CONFIG_ATARI_ETHERNAT_OLD)
 /*
  * MSch: EtherNAT is 32 bit, so the misaligned data buffer hack applies.
  * This appears to hurt quite a lot ... we actually need to byte swap the
#30 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Michael Schmitz dixit:

Quoted 3 lines

For some reason, I have to set NUM_ATARI_SOURCES to 141 to actually get interrupt source 140 to register. Off-by-one error somewhere in the generic interrupt code I'd think, but I've not been able to spot it. (Just increasing

I think 141 interrupt sources covers sources #0 to #140, no?

Quoted 1 line

Next project : SCSI, SCC serial, or what?...

PCI bus. Then radeonfb. I got someone asking for that. ☺

They actually took Linux’ radeonfb and ported that to the other Atari OSes, so only the PCI bridge should remain.

#atari-home on OFTC, talk to ragnar76.

bye,
//mirabilos

Signature · 3 lines
  “Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool.”
						-- Edward Burr
#31 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Thorsten,

Quoted 7 lines
Quoted 4 lines

For some reason, I have to set NUM_ATARI_SOURCES to 141 to actually get interrupt source 140 to register. Off-by-one error somewhere in the generic interrupt code I'd think, but I've not been able to spot it. (Just increasing

I think 141 interrupt sources covers sources #0 to #140, no?

What's interrupt #0? #1 to #7 are level 1 to 7 autovector interrupts. #8 to #140 are the vectored ones starting with the ST-MFP.

Quoted 5 lines
Quoted 2 lines

Next project : SCSI, SCC serial, or what?...

PCI bus. Then radeonfb. I got someone asking for that. ☺

Throw hardware my way ... PCI bridge should not be that difficult really.

Seriously - at this stage I don't know whether my EtherNAT or the CT60's bus drivers are shot. So _don't_ throw hardware.

Quoted 5 lines

They actually took Linux’ radeonfb and ported that to the other Atari OSes, so only the PCI bridge should remain.

#atari-home on OFTC, talk to ragnar76.

ragnar rings a bell, is that [email protected]?

Cheers,

Michael

#32 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Michael Schmitz dixit:

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

For some reason, I have to set NUM_ATARI_SOURCES to 141 to actually get interrupt source 140 to register. Off-by-one error somewhere in the generic interrupt code I'd think, but I've not been able to spot it. (Just increasing

I think 141 interrupt sources covers sources #0 to #140, no?

What's interrupt #0? #1 to #7 are level 1 to 7 autovector interrupts. #8 to

I was just guessing. An all-uppercase identifier in a C context that expands to an integer and has NUMber in its name might just be used in the declarartion of a C array, that’s why.

Quoted 1 line

ragnar rings a bell, is that [email protected]?

Chaosdorf yes, so, probably yes.

bye,
//mirabilos

Signature · 4 lines
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
#33 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Thorsten,

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

I think 141 interrupt sources covers sources #0 to #140, no?

What's interrupt #0? #1 to #7 are level 1 to 7 autovector interrupts. #8 to

I was just guessing. An all-uppercase identifier in a C context that expands to an integer and has NUMber in its name might just be used in the declarartion of a C array, that’s why.

It's a bit more complicated - autovector 1-7 are vector numbers 25 to 31, user vectors start from 64 so there's a gap between them. No simple array.

Quoted 3 lines
Quoted 1 line

ragnar rings a bell, is that [email protected]?

Chaosdorf yes, so, probably yes.

Ping? Does anyone have technical specs on the PCI bridge in question?

Cheers,

Michael

#34 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

In reply to Michael Schmitz

Hi Geert,

Quoted 5 lines

See attached - the 3.3.0-ethernat patches implement switching over to the mainstream 91Cx driver (card detected on my Falcon, link brought up but not detected by the driver due to hardware problems). The 3.3.0-atari-cleanup-num-irqs.diff sets the number of interrupt sources to 141 on Atari, setting the number of VME sources back to 16 so we don't accidentially trash memory contiguous with the free_vme_irq bitmap.

For some reason, I have to set NUM_ATARI_SOURCES to 141 to actually get interrupt source 140 to register. Off-by-one error somewhere in the generic interrupt code I'd think, but I've not been able to spot it. (Just increasing the number of interrupts that are registered by atari_init_IRQ results in 'unexpected interrupt from 112' until the cows come home. And yes, it happens in ARAnyM, too.)

That pretty much wraps it up for EtherNEC and EtherNAT - EtherNEC is fully tested by me, EtherNAT needs testing on Christian's Falcon or by someone else with fully functional hardware. Next project : SCSI, SCC serial, or what?...

Forgot to add my Signed-off-by - I guess the same arguments apply here as Paul raised them for ne.c. Do you want a new patch set based on current m68k?

Cheers,

Michael

#35 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

In reply to Michael Schmitz

Never send patches with format=flowed.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#36 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Andreas Schwab dixit:

Quoted 1 line

Never send patches with format=flowed.

Some call it format=flawed… I had to patch my MUA when it started to pop up, to not default to it.

bye,
//mirabilos

Quoted 2 lines

emacs als auch vi zum Kotzen finde (joe rules) und pine für den einzig bedienbaren textmode-mailclient halte (und ich hab sie alle ausprobiert). ;)

Hallooooo, ich bin der Holger ("Hallo Holger!"), und ich bin ebenfalls ... pine-User, und das auch noch gewohnheitsmäßig ("Oooooooohhh"). [aus dasr]

#37 lore raw

Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts

Hi Guys,

2012/4/2 Thorsten Glaser <[email protected]>:

Quoted 6 lines

Andreas Schwab dixit:

Quoted 1 line

Never send patches with format=flowed.

Some call it format=flawed… I had to patch my MUA when it started to pop up, to not default to it.

Apologies for this mess - I'm using thunderbird and had to copy/paste the patches in order to avoid attachments. I'll resend as attachments
...

Floored,

Michael

#38 lore raw

PATCH 1/1 m68k/atari: EtherNAT patch series - resent as attachments

In reply to Michael Schmitz

Hi All,

due to patch file mangling in my previous mails, here's the whole series again, as attachments. Apply in order, to Geert's git tree as of March 20.

Cheers,

Michael

Quoted 13 lines

The following patch is one in a series of patches in relation to getting interrupt-driven Ethernet and USB drivers supported on the Atari Falcon EtherNAT board. Whoever does have a Falcon with EtherNAT (and CT60, preferably) running Linux please try out this patch series to help testing these drivers. For convenience of testing, build the Ethernet and USB drivers as modules please.

Patches are relative to Geert's v3.3.0 (commit 29c8d8820b6eba2fb6cb2702fd06095a48083595).

Part 1 (this): make room for the EtherNAT interrupts - they appear at vectors 0xc3 (USB ISP1160) and 0xc4 (SMC91C111)
Part 2: add platform data for the ISP1160 driver, fix the 91C111 interrupt source number (the 91C111 platform data had been added quite some time ago) Part 3: make sure the platform devices are added only if the EtherNAT card is actually present
Part 4: add usb/isp116x.h header to fix compile errors introduced in 2)
Part 5: add Kconfig flag necessary to enable compilation of the ISP1160 driver

Both functions of the EtherNAT are correctly detected with this patch series. Some mysterious hardware fault in my Falcon does prevent the card to function properly, however (though at least the 91C111 part with timer polling did use to work in thee past).

Quoted 8 lines

The card interrupts are not being enabled by these patches yet. I need to discuss with Geert the best way of enabling them as close to the module loading time as possible.

Cheers,

Michael

 arch/m68k/include/asm/atariints.h |    2 +-
 arch/m68k/include/asm/irq.h       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/atariints.h +1 -1
index 656bbbf..4e82683 100644
@@ -30,7 +30,7 @@
 #define TTMFP_SOURCE_BASE  24
 #define SCC_SOURCE_BASE    40
 #define VME_SOURCE_BASE    56
-#define VME_MAX_SOURCES    16
+#define VME_MAX_SOURCES    152
 
 #define NUM_ATARI_SOURCES   (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE)
 
arch/m68k/include/asm/irq.h +2 -2
index c1155f0..e905b3f 100644
@@ -9,9 +9,9 @@
  */
 #if defined(CONFIG_COLDFIRE)
 #define NR_IRQS 256
-#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
+#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) || defined(CONFIG_ATARI)
 #define NR_IRQS 200
-#elif defined(CONFIG_ATARI) || defined(CONFIG_MAC)
+#elif defined(CONFIG_MAC)
 #define NR_IRQS 72
 #elif defined(CONFIG_Q40)
 #define NR_IRQS	43
 arch/m68k/atari/config.c |   63 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 2 deletions(-)
arch/m68k/atari/config.c +61 -2

76 lines not on this page · raw message

 arch/m68k/atari/config.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
arch/m68k/atari/config.c +12 -1
index 12a76ab..92bf83a 100644
@@ -752,7 +752,18 @@ static struct platform_device *atari_platform_devices[] __initdata = {
 
 int __init atari_platform_init(void)
 {
-	return platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+	int rv = -ENODEV;
+	unsigned char *enatc_virt;
+
+	if (!MACH_IS_ATARI) 
+		return -ENODEV;
+
+	enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
+	if (hwreg_present(enatc_virt)) 
+		rv = platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+	iounmap(enatc_virt);
+
+	return rv;	
 }
 
 arch_initcall(atari_platform_init);
 arch/m68k/atari/config.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/m68k/atari/config.c +1 -0
index 92bf83a..aceebc2 100644
@@ -32,6 +32,7 @@
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
+#include <linux/usb/isp116x.h>
 #include <linux/vt_kern.h>
 #include <linux/module.h>
 
 arch/m68k/Kconfig.machine |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/m68k/Kconfig.machine +1 -0
index 7cdf6b0..8c31cdf 100644
@@ -15,6 +15,7 @@ config ATARI
 	bool "Atari support"
 	depends on MMU
 	select MMU_MOTOROLA if MMU
+	select USB_ARCH_HAS_OHCI if USB_SUPPORT
 	help
 	  This option enables support for the 68000-based Atari series of
 	  computers (including the TT, Falcon and Medusa). If you plan to use
 drivers/net/ethernet/smsc/smc91x.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ethernet/smsc/smc91x.h +2 -0
index 799d494..987755c 100644
@@ -255,6 +255,8 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define RPC_LSA_DEFAULT         RPC_LED_100_10
 #define RPC_LSB_DEFAULT         RPC_LED_TX_RX
 
+#define SMC_IRQ_FLAGS		(IRQF_SHARED)
+
 #define SMC_DYNAMIC_BUS_CONFIG
 
 #elif defined(CONFIG_ARCH_MSM)
#39 lore raw

PATCH 2/5 m68k/atari: EtherNAT - add ISP1160 platform data

In reply to Michael Schmitz

Hi All,

Part 2 in the EtherNAT patch series - USB host controller platform data.

--
arch/m68k/atari/config.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-

1 files changed, 61 insertions(+), 2 deletions(-)
arch/m68k/atari/config.c +0 -0
index af78731..12a76ab 100644
@@ -663,7 +663,7 @@ static void atari_get_hardware_list(struct seq_file *m)
 */
 

#define ATARI_ETHERNAT_PHYS_ADDR 0x80000000
-#define ATARI_ETHERNAT_IRQ 0xc3
+#define ATARI_ETHERNAT_IRQ 196

static struct resource smc91x_resources[] = {
       [0] = {

@@ -687,8 +687,67 @@ static struct platform_device smc91x_device = {
.resource = smc91x_resources,
};

+#define ATARI_USB_PHYS_ADDR 0x80000010
+#define ATARI_USB_IRQ 195
+
+static struct resource isp1160_resources[] = {
+ [0] = {

+               .name   = "isp1160-data",
+               .start  = ATARI_USB_PHYS_ADDR,
+               .end    = ATARI_USB_PHYS_ADDR + 0x1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .name   = "isp1160-regs",
+               .start  = ATARI_USB_PHYS_ADDR + 0x2,
+               .end    = ATARI_USB_PHYS_ADDR + 0x3,
+               .flags  = IORESOURCE_MEM,
+       },
+       [2] = {
+               .name   = "isp1160-irq",
+               .start  = ATARI_USB_IRQ,
+               .end    = ATARI_USB_IRQ,
+               .flags  = IORESOURCE_IRQ,

+ },
+};
+
+static void isp1160_delay(struct device *dev, int delay)
+{
+ ndelay(delay);
+}
+
+/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ +static struct isp116x_platform_data isp1160_platform_data = {

+       /* Enable internal resistors on downstream ports */
+       .sel15Kres              = 1,
+       /* On-chip overcurrent protection */
+       .oc_enable              = 1,
+       /* INT output polarity */
+       .int_act_high           = 1,
+       /* INT edge or level triggered */
+       .int_edge_triggered     = 0,
+
+       /* WAKEUP pin connected - NOT SUPPORTED  */
+       /* .remote_wakeup_connected = 0, */
+       /* Wakeup by devices on usb bus enabled */
+       .remote_wakeup_enable   = 0,
+       .delay                  = isp1160_delay,
+};
+
+static struct platform_device isp1160_device = {
+       .name           = "isp116x-hcd",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(isp1160_resources),
+       .resource       = isp1160_resources,
+       .dev                    = {

+ .platform_data = &isp1160_platform_data,
+ },
+
+};
+
static struct platform_device *atari_platform_devices[] __initdata = {

-       &smc91x_device
+       &smc91x_device,
+       &isp1160_device

};

int __init atari_platform_init(void)