All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m68k/atari: EtherNEC - Convert ETHER_ADDR_LEN uses to ETH_ALEN
@ 2012-01-20 18:57 Geert Uytterhoeven
  2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
  0 siblings, 1 reply; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-01-20 18:57 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, Geert Uytterhoeven

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

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/net/ethernet/8390/atari_ethernec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/8390/atari_ethernec.c b/drivers/net/ethernet/8390/atari_ethernec.c
index 4fb22ce..086d968 100644
--- a/drivers/net/ethernet/8390/atari_ethernec.c
+++ b/drivers/net/ethernet/8390/atari_ethernec.c
@@ -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];
 	}
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-01-20 18:57 [PATCH] m68k/atari: EtherNEC - Convert ETHER_ADDR_LEN uses to ETH_ALEN Geert Uytterhoeven
@ 2012-02-27  7:07 ` Michael Schmitz
  2012-03-07 10:09   ` Geert Uytterhoeven
                     ` (3 more replies)
  0 siblings, 4 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-02-27  7:07 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, netdev

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


diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index f92ea2a..28b8781 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -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;
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index af78731..3ff7231 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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);
diff --git a/arch/m68k/configs/atari_defconfig 
b/arch/m68k/configs/atari_defconfig
index 6e86de1..5f8e91f 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_defconfig
@@ -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
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
index d5e8882..548b73b 100644
--- a/drivers/net/Space.c
+++ b/drivers/net/Space.c
@@ -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 */
diff --git a/drivers/net/ethernet/8390/Kconfig 
b/drivers/net/ethernet/8390/Kconfig
index b801056..ca5adab 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/8390/Makefile 
b/drivers/net/ethernet/8390/Makefile
index d896466..e620355 100644
--- a/drivers/net/ethernet/8390/Makefile
+++ b/drivers/net/ethernet/8390/Makefile
@@ -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
diff --git a/drivers/net/ethernet/8390/atari_ethernec.c 
b/drivers/net/ethernet/8390/atari_ethernec.c
index 086d968..e051094 100644
--- a/drivers/net/ethernet/8390/atari_ethernec.c
+++ b/drivers/net/ethernet/8390/atari_ethernec.c
@@ -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

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
@ 2012-03-07 10:09   ` Geert Uytterhoeven
  2012-03-07 18:42     ` Michael Schmitz
                       ` (3 more replies)
  2012-03-09  3:11   ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Paul Gortmaker
                     ` (2 subsequent siblings)
  3 siblings, 4 replies; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-03-07 10:09 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, netdev

On Mon, 27 Feb 2012, Michael Schmitz wrote:
> 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
> 
> 
> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
> index f92ea2a..28b8781 100644
> --- a/drivers/net/ethernet/8390/ne.c
> +++ b/drivers/net/ethernet/8390/ne.c
> @@ -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;

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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-03-07 10:09   ` Geert Uytterhoeven
@ 2012-03-07 18:42     ` Michael Schmitz
  2012-04-01  3:02     ` [PATCH 3/5] m68k/atari: EtherNAT - register EtherNAT platform devices only when probed Michael Schmitz
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-03-07 18:42 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, netdev

Hi Geert,

> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
  2012-03-07 10:09   ` Geert Uytterhoeven
@ 2012-03-09  3:11   ` Paul Gortmaker
  2012-03-09  4:58     ` Michael Schmitz
  2012-03-09  6:35     ` Geert Uytterhoeven
  2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
  2012-04-01  2:58   ` [PATCH 2/5] m68k/atari: EtherNAT - add ISP1160 platform data Michael Schmitz
  3 siblings, 2 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-03-09  3:11 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Geert Uytterhoeven, linux-m68k, netdev

On Mon, Feb 27, 2012 at 2:07 AM, Michael Schmitz
<schmitzmic@googlemail.com> wrote:
> 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
>
>
> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
> index f92ea2a..28b8781 100644
> --- a/drivers/net/ethernet/8390/ne.c
> +++ b/drivers/net/ethernet/8390/ne.c
> @@ -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.

>
>  #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);
> +

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.
--

>     if (ret) {
>         printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
>         goto err_out;
> diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
> index af78731..3ff7231 100644
> --- a/arch/m68k/atari/config.c
> +++ b/arch/m68k/atari/config.c
> @@ -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);
> diff --git a/arch/m68k/configs/atari_defconfig
> b/arch/m68k/configs/atari_defconfig
> index 6e86de1..5f8e91f 100644
> --- a/arch/m68k/configs/atari_defconfig
> +++ b/arch/m68k/configs/atari_defconfig
> @@ -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
> diff --git a/drivers/net/Space.c b/drivers/net/Space.c
> index d5e8882..548b73b 100644
> --- a/drivers/net/Space.c
> +++ b/drivers/net/Space.c
> @@ -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 */
> diff --git a/drivers/net/ethernet/8390/Kconfig
> b/drivers/net/ethernet/8390/Kconfig
> index b801056..ca5adab 100644
> --- a/drivers/net/ethernet/8390/Kconfig
> +++ b/drivers/net/ethernet/8390/Kconfig
> @@ -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
> diff --git a/drivers/net/ethernet/8390/Makefile
> b/drivers/net/ethernet/8390/Makefile
> index d896466..e620355 100644
> --- a/drivers/net/ethernet/8390/Makefile
> +++ b/drivers/net/ethernet/8390/Makefile
> @@ -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
> diff --git a/drivers/net/ethernet/8390/atari_ethernec.c
> b/drivers/net/ethernet/8390/atari_ethernec.c
> index 086d968..e051094 100644
> --- a/drivers/net/ethernet/8390/atari_ethernec.c
> +++ b/drivers/net/ethernet/8390/atari_ethernec.c
> @@ -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
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-03-09  3:11   ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Paul Gortmaker
@ 2012-03-09  4:58     ` Michael Schmitz
  2012-03-09  6:35     ` Geert Uytterhoeven
  1 sibling, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-03-09  4:58 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Michael Schmitz, Geert Uytterhoeven, linux-m68k, netdev

Paul Gortmaker wrote:
>
>> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
>> index f92ea2a..28b8781 100644
>> --- a/drivers/net/ethernet/8390/ne.c
>> +++ b/drivers/net/ethernet/8390/ne.c
>> @@ -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.
>
>   
Looks like that one's unneeded.
>>  #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);
>> +
>>     
>
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-03-09  3:11   ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Paul Gortmaker
  2012-03-09  4:58     ` Michael Schmitz
@ 2012-03-09  6:35     ` Geert Uytterhoeven
  2012-03-09 13:32         ` Paul Gortmaker
  1 sibling, 1 reply; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-03-09  6:35 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Michael Schmitz, linux-m68k, netdev

On Fri, Mar 9, 2012 at 04:11, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
>> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
>> index f92ea2a..28b8781 100644
>> --- a/drivers/net/ethernet/8390/ne.c
>> +++ b/drivers/net/ethernet/8390/ne.c
>> @@ -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.

<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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-03-09  6:35     ` Geert Uytterhoeven
@ 2012-03-09 13:32         ` Paul Gortmaker
  0 siblings, 0 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-03-09 13:32 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Michael Schmitz, linux-m68k, netdev

On 12-03-09 01:35 AM, Geert Uytterhoeven wrote:
> On Fri, Mar 9, 2012 at 04:11, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>>> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
>>> index f92ea2a..28b8781 100644
>>> --- a/drivers/net/ethernet/8390/ne.c
>>> +++ b/drivers/net/ethernet/8390/ne.c
>>> @@ -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.
> 
> <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.
--

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
@ 2012-03-09 13:32         ` Paul Gortmaker
  0 siblings, 0 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-03-09 13:32 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Michael Schmitz, linux-m68k, netdev

On 12-03-09 01:35 AM, Geert Uytterhoeven wrote:
> On Fri, Mar 9, 2012 at 04:11, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>>> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
>>> index f92ea2a..28b8781 100644
>>> --- a/drivers/net/ethernet/8390/ne.c
>>> +++ b/drivers/net/ethernet/8390/ne.c
>>> @@ -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.
> 
> <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.
--

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
  2012-03-09 13:32         ` Paul Gortmaker
  (?)
@ 2012-03-11  6:31         ` Michael Schmitz
  -1 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-03-11  6:31 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Geert Uytterhoeven, Michael Schmitz, linux-m68k, netdev

Paul Gortmaker wrote:
>> <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?
>   
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.
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
  2012-03-07 10:09   ` Geert Uytterhoeven
  2012-03-09  3:11   ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Paul Gortmaker
@ 2012-04-01  2:49   ` Michael Schmitz
  2012-04-01 20:39     ` Geert Uytterhoeven
                       ` (2 more replies)
  2012-04-01  2:58   ` [PATCH 2/5] m68k/atari: EtherNAT - add ISP1160 platform data Michael Schmitz
  3 siblings, 3 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  2:49 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

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

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/include/asm/atariints.h |    2 +-
 arch/m68k/include/asm/irq.h       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/atariints.h 
b/arch/m68k/include/asm/atariints.h
index 656bbbf..4e82683 100644
--- a/arch/m68k/include/asm/atariints.h
+++ b/arch/m68k/include/asm/atariints.h
@@ -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)
 
diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h
index c1155f0..e905b3f 100644
--- a/arch/m68k/include/asm/irq.h
+++ b/arch/m68k/include/asm/irq.h
@@ -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

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 2/5] m68k/atari: EtherNAT - add ISP1160 platform data
  2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
                     ` (2 preceding siblings ...)
  2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
@ 2012-04-01  2:58   ` Michael Schmitz
  3 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  2:58 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

Hi All,

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

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/atari/config.c |   63 
++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index af78731..12a76ab 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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)

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 3/5] m68k/atari: EtherNAT - register EtherNAT platform devices only when probed
  2012-03-07 10:09   ` Geert Uytterhoeven
  2012-03-07 18:42     ` Michael Schmitz
@ 2012-04-01  3:02     ` Michael Schmitz
  2012-04-01  3:05     ` [PATCH 4/5] m68k/atari: EtherNAT - fix dumb compile error Michael Schmitz
  2012-04-01  3:10     ` [PATCH 5/5] m68k/atari: EtherNAT - enable USB HCD config option on Atari Michael Schmitz
  3 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  3:02 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

Hi All,

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

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/atari/config.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 12a76ab..92bf83a 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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);

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 4/5] m68k/atari: EtherNAT - fix dumb compile error
  2012-03-07 10:09   ` Geert Uytterhoeven
  2012-03-07 18:42     ` Michael Schmitz
  2012-04-01  3:02     ` [PATCH 3/5] m68k/atari: EtherNAT - register EtherNAT platform devices only when probed Michael Schmitz
@ 2012-04-01  3:05     ` Michael Schmitz
  2012-04-01  3:10     ` [PATCH 5/5] m68k/atari: EtherNAT - enable USB HCD config option on Atari Michael Schmitz
  3 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  3:05 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

Hi All,

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

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/atari/config.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 92bf83a..aceebc2 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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>
 

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 5/5] m68k/atari: EtherNAT - enable USB HCD config option on Atari
  2012-03-07 10:09   ` Geert Uytterhoeven
                       ` (2 preceding siblings ...)
  2012-04-01  3:05     ` [PATCH 4/5] m68k/atari: EtherNAT - fix dumb compile error Michael Schmitz
@ 2012-04-01  3:10     ` Michael Schmitz
  2012-04-01  4:57       ` [PATCH 6/5] m68k/atari: EtherNAT - use correct irq flag in atari_91C111 Michael Schmitz
  3 siblings, 1 reply; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  3:10 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

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.

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/Kconfig.machine |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 7cdf6b0..8c31cdf 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -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

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 6/5] m68k/atari: EtherNAT - use correct irq flag in atari_91C111
  2012-04-01  3:10     ` [PATCH 5/5] m68k/atari: EtherNAT - enable USB HCD config option on Atari Michael Schmitz
@ 2012-04-01  4:57       ` Michael Schmitz
  2012-04-01  5:57         ` [PATCH 6/5] m68k/atari: set up timer D and register dummy handler if either EtherNEC or EtherNAT found Michael Schmitz
  0 siblings, 1 reply; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  4:57 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

Michael Schmitz wrote:
> 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.

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 drivers/net/ethernet/smsc/smc91x.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc91x.h 
b/drivers/net/ethernet/smsc/smc91x.h
index 799d494..987755c 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -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
 

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 6/5] m68k/atari: set up timer D and register dummy handler if either EtherNEC or EtherNAT found
  2012-04-01  4:57       ` [PATCH 6/5] m68k/atari: EtherNAT - use correct irq flag in atari_91C111 Michael Schmitz
@ 2012-04-01  5:57         ` Michael Schmitz
  0 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  5:57 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k

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

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/atari/config.c |   49 
+++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index aceebc2..22375e0 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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;   
 }
 

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-03-09 13:32         ` Paul Gortmaker
  (?)
  (?)
@ 2012-04-01  8:49         ` Michael Schmitz
  2012-04-03 22:52           ` David Miller
  2012-04-04 20:46             ` Paul Gortmaker
  -1 siblings, 2 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01  8:49 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Geert Uytterhoeven, linux-m68k, netdev

Hi Paul, Geert,
> 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

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 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(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 22375e0..6cff09f 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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;   
 }
 
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
index d5e8882..548b73b 100644
--- a/drivers/net/Space.c
+++ b/drivers/net/Space.c
@@ -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 */
diff --git a/drivers/net/ethernet/8390/8390.h 
b/drivers/net/ethernet/8390/8390.h
index ef325ff..9416245 100644
--- a/drivers/net/ethernet/8390/8390.h
+++ b/drivers/net/ethernet/8390/8390.h
@@ -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);
diff --git a/drivers/net/ethernet/8390/Kconfig 
b/drivers/net/ethernet/8390/Kconfig
index b801056..75875f2 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/8390/Makefile 
b/drivers/net/ethernet/8390/Makefile
index d896466..e620355 100644
--- a/drivers/net/ethernet/8390/Makefile
+++ b/drivers/net/ethernet/8390/Makefile
@@ -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
diff --git a/drivers/net/ethernet/8390/atari_ethernec.c 
b/drivers/net/ethernet/8390/atari_ethernec.c
index 086d968..5e8fb97 100644
--- a/drivers/net/ethernet/8390/atari_ethernec.c
+++ b/drivers/net/ethernet/8390/atari_ethernec.c
@@ -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
diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index f92ea2a..39678fc 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -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;

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
@ 2012-04-01 20:39     ` Geert Uytterhoeven
  2012-04-01 22:44       ` Michael Schmitz
  2012-04-01 21:00     ` Andreas Schwab
  2012-04-02  1:15     ` [PATCH] m68k/atari: EtherNAT patch series - resent as attachments Michael Schmitz
  2 siblings, 1 reply; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-04-01 20:39 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, debian-68k

Hi Michael,

On Sun, Apr 1, 2012 at 04:49, Michael Schmitz <schmitzmic@googlemail.com> wrote:
> 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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
  2012-04-01 20:39     ` Geert Uytterhoeven
@ 2012-04-01 21:00     ` Andreas Schwab
  2012-04-01 21:46       ` Thorsten Glaser
  2012-04-02  1:15     ` [PATCH] m68k/atari: EtherNAT patch series - resent as attachments Michael Schmitz
  2 siblings, 1 reply; 43+ messages in thread
From: Andreas Schwab @ 2012-04-01 21:00 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Geert Uytterhoeven, linux-m68k, debian-68k

Never send patches with format=flowed.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-01 21:00     ` Andreas Schwab
@ 2012-04-01 21:46       ` Thorsten Glaser
  2012-04-01 22:27         ` Michael Schmitz
  0 siblings, 1 reply; 43+ messages in thread
From: Thorsten Glaser @ 2012-04-01 21:46 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, debian-68k

Andreas Schwab dixit:

>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
-- 
> 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]

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-01 21:46       ` Thorsten Glaser
@ 2012-04-01 22:27         ` Michael Schmitz
  0 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01 22:27 UTC (permalink / raw)
  To: Thorsten Glaser; +Cc: linux-m68k, debian-68k

Hi Guys,

2012/4/2 Thorsten Glaser <tg@mirbsd.de>:
> Andreas Schwab dixit:
>
>>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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-01 20:39     ` Geert Uytterhoeven
@ 2012-04-01 22:44       ` Michael Schmitz
  2012-04-02  7:35         ` Geert Uytterhoeven
  0 siblings, 1 reply; 43+ messages in thread
From: Michael Schmitz @ 2012-04-01 22:44 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

Hi Geert,

>> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH] m68k/atari: EtherNAT patch series - resent as attachments
  2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
  2012-04-01 20:39     ` Geert Uytterhoeven
  2012-04-01 21:00     ` Andreas Schwab
@ 2012-04-02  1:15     ` Michael Schmitz
  2 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-02  1:15 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]

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

>
> 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
>
> Signed-off-by: Michael Schmitz <schmitz@debian.org>
>


[-- Attachment #2: 3.3.0-ethernat-1.diff --]
[-- Type: text/x-patch, Size: 1180 bytes --]

 arch/m68k/include/asm/atariints.h |    2 +-
 arch/m68k/include/asm/irq.h       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h
index 656bbbf..4e82683 100644
--- a/arch/m68k/include/asm/atariints.h
+++ b/arch/m68k/include/asm/atariints.h
@@ -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)
 
diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h
index c1155f0..e905b3f 100644
--- a/arch/m68k/include/asm/irq.h
+++ b/arch/m68k/include/asm/irq.h
@@ -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

[-- Attachment #3: 3.3.0-ethernat-2.diff --]
[-- Type: text/x-patch, Size: 2256 bytes --]

 arch/m68k/atari/config.c |   63 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index af78731..12a76ab 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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)

[-- Attachment #4: 3.3.0-ethernat-3.diff --]
[-- Type: text/x-patch, Size: 861 bytes --]

 arch/m68k/atari/config.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 12a76ab..92bf83a 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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);

[-- Attachment #5: 3.3.0-ethernat-4.diff --]
[-- Type: text/x-patch, Size: 439 bytes --]

 arch/m68k/atari/config.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 92bf83a..aceebc2 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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>
 

[-- Attachment #6: 3.3.0-ethernat-5.diff --]
[-- Type: text/x-patch, Size: 537 bytes --]

 arch/m68k/Kconfig.machine |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 7cdf6b0..8c31cdf 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -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

[-- Attachment #7: 3.3.0-ethernat-6.diff --]
[-- Type: text/x-patch, Size: 566 bytes --]

 drivers/net/ethernet/smsc/smc91x.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 799d494..987755c 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -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)

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-01 22:44       ` Michael Schmitz
@ 2012-04-02  7:35         ` Geert Uytterhoeven
  2012-04-02 22:29           ` Michael Schmitz
  0 siblings, 1 reply; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-04-02  7:35 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, debian-68k

Hi Michael,

On Mon, Apr 2, 2012 at 00:44, Michael Schmitz <schmitzmic@googlemail.com> wrote:
>> 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.

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

> 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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-02  7:35         ` Geert Uytterhoeven
@ 2012-04-02 22:29           ` Michael Schmitz
  2012-04-03 21:15             ` Michael Schmitz
  0 siblings, 1 reply; 43+ messages in thread
From: Michael Schmitz @ 2012-04-02 22:29 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

Hi Geert,

>> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-02 22:29           ` Michael Schmitz
@ 2012-04-03 21:15             ` Michael Schmitz
  2012-04-03 21:54               ` Thorsten Glaser
  2012-04-06 21:43               ` Michael Schmitz
  0 siblings, 2 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-03 21:15 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, debian-68k

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]

Hi Geert,
> 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


[-- Attachment #2: 3.3.0-atari-cleanup-num-irqs.diff --]
[-- Type: text/x-patch, Size: 1171 bytes --]

diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h
index 4e82683..9229626 100644
--- a/arch/m68k/include/asm/atariints.h
+++ b/arch/m68k/include/asm/atariints.h
@@ -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)))
diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h
index e905b3f..8bd9c7f 100644
--- a/arch/m68k/include/asm/irq.h
+++ b/arch/m68k/include/asm/irq.h
@@ -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)

[-- Attachment #3: 3.3.0-ethernat-fix-irqs.diff --]
[-- Type: text/x-patch, Size: 650 bytes --]

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 6cff09f..af273d9 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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] = {

[-- Attachment #4: 3.3.0-ethernat-smc91x.diff --]
[-- Type: text/x-patch, Size: 2393 bytes --]

diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig
index 01893aa..c34f5ac 100644
--- a/drivers/net/ethernet/smsc/Kconfig
+++ b/drivers/net/ethernet/smsc/Kconfig
@@ -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)
diff --git a/drivers/net/ethernet/smsc/Makefile b/drivers/net/ethernet/smsc/Makefile
index ef228db..ac30abb 100644
--- a/drivers/net/ethernet/smsc/Makefile
+++ b/drivers/net/ethernet/smsc/Makefile
@@ -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
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 987755c..36c17c1 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -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

^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-03 21:15             ` Michael Schmitz
@ 2012-04-03 21:54               ` Thorsten Glaser
  2012-04-03 22:21                 ` Michael Schmitz
  2012-04-06 21:43               ` Michael Schmitz
  1 sibling, 1 reply; 43+ messages in thread
From: Thorsten Glaser @ 2012-04-03 21:54 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, debian-68k

Michael Schmitz dixit:

> 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?

> 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
-- 
  “Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool.”
						-- Edward Burr

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-03 21:54               ` Thorsten Glaser
@ 2012-04-03 22:21                 ` Michael Schmitz
  2012-04-03 22:31                   ` Thorsten Glaser
  0 siblings, 1 reply; 43+ messages in thread
From: Michael Schmitz @ 2012-04-03 22:21 UTC (permalink / raw)
  To: Thorsten Glaser; +Cc: Michael Schmitz, linux-m68k, debian-68k

Thorsten,
>> 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.
>> 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.
> 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 ragnar@chaosdorf.de?

Cheers,

  Michael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-03 22:21                 ` Michael Schmitz
@ 2012-04-03 22:31                   ` Thorsten Glaser
  2012-04-03 23:16                     ` Michael Schmitz
  0 siblings, 1 reply; 43+ messages in thread
From: Thorsten Glaser @ 2012-04-03 22:31 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, debian-68k

Michael Schmitz dixit:

>>> 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.

> ragnar rings a bell, is that ragnar@chaosdorf.de?

Chaosdorf yes, so, probably yes.

bye,
//mirabilos
-- 
“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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-01  8:49         ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two Michael Schmitz
@ 2012-04-03 22:52           ` David Miller
  2012-04-04 20:46             ` Paul Gortmaker
  1 sibling, 0 replies; 43+ messages in thread
From: David Miller @ 2012-04-03 22:52 UTC (permalink / raw)
  To: schmitzmic; +Cc: paul.gortmaker, geert, linux-m68k, netdev

From: Michael Schmitz <schmitzmic@googlemail.com>
Date: Sun, 01 Apr 2012 20:49:52 +1200

> Hi Paul, Geert,
>> 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.

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-03 22:31                   ` Thorsten Glaser
@ 2012-04-03 23:16                     ` Michael Schmitz
  0 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-03 23:16 UTC (permalink / raw)
  To: Thorsten Glaser; +Cc: linux-m68k, debian-68k, ragnar

Thorsten,

>>> 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.

>> ragnar rings a bell, is that ragnar@chaosdorf.de?
>
> Chaosdorf yes, so, probably yes.

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

Cheers,

  Michael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-01  8:49         ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two Michael Schmitz
@ 2012-04-04 20:46             ` Paul Gortmaker
  2012-04-04 20:46             ` Paul Gortmaker
  1 sibling, 0 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-04-04 20:46 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Geert Uytterhoeven, linux-m68k, netdev

On 12-04-01 04:49 AM, Michael Schmitz wrote:
> Hi Paul, Geert,
>> 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.

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.

> 
> Comments?

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

P.

> 
> Cheers,
> 
>   Michael Schmitz
> 
> Signed-off-by: Michael Schmitz <schmitz@debian.org>
> 
> --
>  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(-)
> 

[...]

> diff --git a/drivers/net/ethernet/8390/8390.h 
> b/drivers/net/ethernet/8390/8390.h
> index ef325ff..9416245 100644
> --- a/drivers/net/ethernet/8390/8390.h
> +++ b/drivers/net/ethernet/8390/8390.h
> @@ -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

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

>  
>  /* Without I/O delay - non ISA or later chips */
>  extern void NS8390_init(struct net_device *dev, int startp);
> diff --git a/drivers/net/ethernet/8390/Kconfig 
> b/drivers/net/ethernet/8390/Kconfig
> index b801056..75875f2 100644
> --- a/drivers/net/ethernet/8390/Kconfig
> +++ b/drivers/net/ethernet/8390/Kconfig
> @@ -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
> diff --git a/drivers/net/ethernet/8390/Makefile 
> b/drivers/net/ethernet/8390/Makefile
> index d896466..e620355 100644
> --- a/drivers/net/ethernet/8390/Makefile
> +++ b/drivers/net/ethernet/8390/Makefile
> @@ -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
> diff --git a/drivers/net/ethernet/8390/atari_ethernec.c 
> b/drivers/net/ethernet/8390/atari_ethernec.c
> index 086d968..5e8fb97 100644
> --- a/drivers/net/ethernet/8390/atari_ethernec.c
> +++ b/drivers/net/ethernet/8390/atari_ethernec.c
> @@ -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
> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
> index f92ea2a..39678fc 100644
> --- a/drivers/net/ethernet/8390/ne.c
> +++ b/drivers/net/ethernet/8390/ne.c
> @@ -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.

>  #  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;
> 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
@ 2012-04-04 20:46             ` Paul Gortmaker
  0 siblings, 0 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-04-04 20:46 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Geert Uytterhoeven, linux-m68k, netdev

On 12-04-01 04:49 AM, Michael Schmitz wrote:
> Hi Paul, Geert,
>> 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.

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.

> 
> Comments?

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

P.

> 
> Cheers,
> 
>   Michael Schmitz
> 
> Signed-off-by: Michael Schmitz <schmitz@debian.org>
> 
> --
>  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(-)
> 

[...]

> diff --git a/drivers/net/ethernet/8390/8390.h 
> b/drivers/net/ethernet/8390/8390.h
> index ef325ff..9416245 100644
> --- a/drivers/net/ethernet/8390/8390.h
> +++ b/drivers/net/ethernet/8390/8390.h
> @@ -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

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

>  
>  /* Without I/O delay - non ISA or later chips */
>  extern void NS8390_init(struct net_device *dev, int startp);
> diff --git a/drivers/net/ethernet/8390/Kconfig 
> b/drivers/net/ethernet/8390/Kconfig
> index b801056..75875f2 100644
> --- a/drivers/net/ethernet/8390/Kconfig
> +++ b/drivers/net/ethernet/8390/Kconfig
> @@ -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
> diff --git a/drivers/net/ethernet/8390/Makefile 
> b/drivers/net/ethernet/8390/Makefile
> index d896466..e620355 100644
> --- a/drivers/net/ethernet/8390/Makefile
> +++ b/drivers/net/ethernet/8390/Makefile
> @@ -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
> diff --git a/drivers/net/ethernet/8390/atari_ethernec.c 
> b/drivers/net/ethernet/8390/atari_ethernec.c
> index 086d968..5e8fb97 100644
> --- a/drivers/net/ethernet/8390/atari_ethernec.c
> +++ b/drivers/net/ethernet/8390/atari_ethernec.c
> @@ -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
> diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
> index f92ea2a..39678fc 100644
> --- a/drivers/net/ethernet/8390/ne.c
> +++ b/drivers/net/ethernet/8390/ne.c
> @@ -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.

>  #  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;
> 

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-04 20:46             ` Paul Gortmaker
  (?)
@ 2012-04-05  9:28             ` Geert Uytterhoeven
  2012-04-05 13:24                 ` Paul Gortmaker
  2012-04-05 22:10               ` Michael Schmitz
  -1 siblings, 2 replies; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-04-05  9:28 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Michael Schmitz, linux-m68k, netdev

On Wed, Apr 4, 2012 at 22:46, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> On 12-04-01 04:49 AM, Michael Schmitz wrote:
>>> 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.
>
> 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.

> 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.

>> diff --git a/drivers/net/ethernet/8390/8390.h
>> b/drivers/net/ethernet/8390/8390.h
>> index ef325ff..9416245 100644
>> --- a/drivers/net/ethernet/8390/8390.h
>> +++ b/drivers/net/ethernet/8390/8390.h
>> @@ -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
>
> 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

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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-04 20:46             ` Paul Gortmaker
  (?)
  (?)
@ 2012-04-05  9:44             ` Michael Schmitz
  -1 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-05  9:44 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Geert Uytterhoeven, linux-m68k, netdev

Hi Paul,

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

>> 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.
> 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.
>> diff --git a/drivers/net/ethernet/8390/8390.h 
>> b/drivers/net/ethernet/8390/8390.h
>> index ef325ff..9416245 100644
>> --- a/drivers/net/ethernet/8390/8390.h
>> +++ b/drivers/net/ethernet/8390/8390.h
>> @@ -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
>>     
>
> 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
>
>   
Pretty safe assumption - if we further assume no other arch has reason 
to resort to such a kludge, we can simplify it this way.
>> --- a/drivers/net/ethernet/8390/ne.c
>> +++ b/drivers/net/ethernet/8390/ne.c
>> @@ -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.
>   
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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-05  9:28             ` Geert Uytterhoeven
@ 2012-04-05 13:24                 ` Paul Gortmaker
  2012-04-05 22:10               ` Michael Schmitz
  1 sibling, 0 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-04-05 13:24 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Michael Schmitz, linux-m68k, netdev

On 12-04-05 05:28 AM, Geert Uytterhoeven wrote:
> On Wed, Apr 4, 2012 at 22:46, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>> On 12-04-01 04:49 AM, Michael Schmitz wrote:
>>>> 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.
>>
>> 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.
> 
>> 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.

> 
>>> diff --git a/drivers/net/ethernet/8390/8390.h
>>> b/drivers/net/ethernet/8390/8390.h
>>> index ef325ff..9416245 100644
>>> --- a/drivers/net/ethernet/8390/8390.h
>>> +++ b/drivers/net/ethernet/8390/8390.h
>>> @@ -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
>>
>> 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
> 
> 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 -- geert@linux-m68k.org
> 
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
@ 2012-04-05 13:24                 ` Paul Gortmaker
  0 siblings, 0 replies; 43+ messages in thread
From: Paul Gortmaker @ 2012-04-05 13:24 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Michael Schmitz, linux-m68k, netdev

On 12-04-05 05:28 AM, Geert Uytterhoeven wrote:
> On Wed, Apr 4, 2012 at 22:46, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>> On 12-04-01 04:49 AM, Michael Schmitz wrote:
>>>> 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.
>>
>> 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.
> 
>> 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.

> 
>>> diff --git a/drivers/net/ethernet/8390/8390.h
>>> b/drivers/net/ethernet/8390/8390.h
>>> index ef325ff..9416245 100644
>>> --- a/drivers/net/ethernet/8390/8390.h
>>> +++ b/drivers/net/ethernet/8390/8390.h
>>> @@ -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
>>
>> 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
> 
> 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 -- geert@linux-m68k.org
> 
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-05 13:24                 ` Paul Gortmaker
  (?)
@ 2012-04-05 14:21                 ` Geert Uytterhoeven
  -1 siblings, 0 replies; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-04-05 14:21 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Michael Schmitz, linux-m68k, netdev

Hi Paul,

On Thu, Apr 5, 2012 at 15:24, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> On 12-04-05 05:28 AM, Geert Uytterhoeven wrote:
>> On Wed, Apr 4, 2012 at 22:46, Paul Gortmaker
>> <paul.gortmaker@windriver.com> wrote:
>>> On 12-04-01 04:49 AM, Michael Schmitz wrote:
>>>>> 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.
>>>
>>> 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.
>>
>>> 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.

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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-05  9:28             ` Geert Uytterhoeven
  2012-04-05 13:24                 ` Paul Gortmaker
@ 2012-04-05 22:10               ` Michael Schmitz
  2012-04-06  8:28                 ` Geert Uytterhoeven
  1 sibling, 1 reply; 43+ messages in thread
From: Michael Schmitz @ 2012-04-05 22:10 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Paul Gortmaker, linux-m68k, netdev

Geert,
>> 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?
>> 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.
>> 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
>>     
>
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-05 22:10               ` Michael Schmitz
@ 2012-04-06  8:28                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 43+ messages in thread
From: Geert Uytterhoeven @ 2012-04-06  8:28 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Paul Gortmaker, linux-m68k, netdev

On Fri, Apr 6, 2012 at 00:10, Michael Schmitz <schmitzmic@googlemail.com> wrote:
>> 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 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts
  2012-04-03 21:15             ` Michael Schmitz
  2012-04-03 21:54               ` Thorsten Glaser
@ 2012-04-06 21:43               ` Michael Schmitz
  1 sibling, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2012-04-06 21:43 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k

Hi Geert,
> 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

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
  2012-04-05 13:24                 ` Paul Gortmaker
  (?)
  (?)
@ 2014-08-09  1:09                 ` Michael Schmitz
  -1 siblings, 0 replies; 43+ messages in thread
From: Michael Schmitz @ 2014-08-09  1:09 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Geert Uytterhoeven, netdev, David S. Miller

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

> On 12-04-05 05:28 AM, Geert Uytterhoeven wrote:
>   
>> On Wed, Apr 4, 2012 at 22:46, Paul Gortmaker
>> <paul.gortmaker@windriver.com> wrote:
>>     
>>> On 12-04-01 04:49 AM, Michael Schmitz wrote:
>>>       
>>>>> 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.
>>>>         
>>> 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.
>>
>>     
>>> 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.
>
>   
>>>> diff --git a/drivers/net/ethernet/8390/8390.h
>>>> b/drivers/net/ethernet/8390/8390.h
>>>> index ef325ff..9416245 100644
>>>> --- a/drivers/net/ethernet/8390/8390.h
>>>> +++ b/drivers/net/ethernet/8390/8390.h
>>>> @@ -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
>>>>         
>>> 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
>>>       
>> 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 -- geert@linux-m68k.org
>>
>> 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
>>     

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2014-08-09  1:09 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20 18:57 [PATCH] m68k/atari: EtherNEC - Convert ETHER_ADDR_LEN uses to ETH_ALEN Geert Uytterhoeven
2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
2012-03-07 10:09   ` Geert Uytterhoeven
2012-03-07 18:42     ` Michael Schmitz
2012-04-01  3:02     ` [PATCH 3/5] m68k/atari: EtherNAT - register EtherNAT platform devices only when probed Michael Schmitz
2012-04-01  3:05     ` [PATCH 4/5] m68k/atari: EtherNAT - fix dumb compile error Michael Schmitz
2012-04-01  3:10     ` [PATCH 5/5] m68k/atari: EtherNAT - enable USB HCD config option on Atari Michael Schmitz
2012-04-01  4:57       ` [PATCH 6/5] m68k/atari: EtherNAT - use correct irq flag in atari_91C111 Michael Schmitz
2012-04-01  5:57         ` [PATCH 6/5] m68k/atari: set up timer D and register dummy handler if either EtherNEC or EtherNAT found Michael Schmitz
2012-03-09  3:11   ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Paul Gortmaker
2012-03-09  4:58     ` Michael Schmitz
2012-03-09  6:35     ` Geert Uytterhoeven
2012-03-09 13:32       ` Paul Gortmaker
2012-03-09 13:32         ` Paul Gortmaker
2012-03-11  6:31         ` Michael Schmitz
2012-04-01  8:49         ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two Michael Schmitz
2012-04-03 22:52           ` David Miller
2012-04-04 20:46           ` Paul Gortmaker
2012-04-04 20:46             ` Paul Gortmaker
2012-04-05  9:28             ` Geert Uytterhoeven
2012-04-05 13:24               ` Paul Gortmaker
2012-04-05 13:24                 ` Paul Gortmaker
2012-04-05 14:21                 ` Geert Uytterhoeven
2014-08-09  1:09                 ` Michael Schmitz
2012-04-05 22:10               ` Michael Schmitz
2012-04-06  8:28                 ` Geert Uytterhoeven
2012-04-05  9:44             ` Michael Schmitz
2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
2012-04-01 20:39     ` Geert Uytterhoeven
2012-04-01 22:44       ` Michael Schmitz
2012-04-02  7:35         ` Geert Uytterhoeven
2012-04-02 22:29           ` Michael Schmitz
2012-04-03 21:15             ` Michael Schmitz
2012-04-03 21:54               ` Thorsten Glaser
2012-04-03 22:21                 ` Michael Schmitz
2012-04-03 22:31                   ` Thorsten Glaser
2012-04-03 23:16                     ` Michael Schmitz
2012-04-06 21:43               ` Michael Schmitz
2012-04-01 21:00     ` Andreas Schwab
2012-04-01 21:46       ` Thorsten Glaser
2012-04-01 22:27         ` Michael Schmitz
2012-04-02  1:15     ` [PATCH] m68k/atari: EtherNAT patch series - resent as attachments Michael Schmitz
2012-04-01  2:58   ` [PATCH 2/5] m68k/atari: EtherNAT - add ISP1160 platform data Michael Schmitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.