* [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
[not found] <1327085843-6980-1-git-send-email-geert@linux-m68k.org>
@ 2012-02-27 7:07 ` Michael Schmitz
2012-03-07 10:09 ` Geert Uytterhoeven
2012-03-09 3:11 ` Paul Gortmaker
0 siblings, 2 replies; 18+ 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] 18+ 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
2012-03-09 3:11 ` Paul Gortmaker
1 sibling, 1 reply; 18+ 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] 18+ 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
0 siblings, 0 replies; 18+ 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] 18+ 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
1 sibling, 2 replies; 18+ 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] 18+ messages in thread
* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
2012-03-09 3:11 ` Paul Gortmaker
@ 2012-03-09 4:58 ` Michael Schmitz
2012-03-09 6:35 ` Geert Uytterhoeven
1 sibling, 0 replies; 18+ 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] 18+ messages in thread
* Re: [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c
2012-03-09 3:11 ` 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; 18+ 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] 18+ 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
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
0 siblings, 2 replies; 18+ 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] 18+ 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
2012-04-01 8:49 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two Michael Schmitz
1 sibling, 0 replies; 18+ 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] 18+ messages in thread
* [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two
2012-03-09 13:32 ` Paul Gortmaker
2012-03-11 6:31 ` Michael Schmitz
@ 2012-04-01 8:49 ` Michael Schmitz
2012-04-03 22:52 ` David Miller
2012-04-04 20:46 ` Paul Gortmaker
1 sibling, 2 replies; 18+ 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] 18+ 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; 18+ 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] 18+ 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
2012-04-05 9:28 ` Geert Uytterhoeven
2012-04-05 9:44 ` Michael Schmitz
1 sibling, 2 replies; 18+ 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] 18+ 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
2012-04-05 9:44 ` Michael Schmitz
1 sibling, 2 replies; 18+ 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] 18+ 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 9:44 ` Michael Schmitz
1 sibling, 0 replies; 18+ 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] 18+ 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 14:21 ` Geert Uytterhoeven
2014-08-09 1:09 ` Michael Schmitz
2012-04-05 22:10 ` Michael Schmitz
1 sibling, 2 replies; 18+ 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] 18+ 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
2014-08-09 1:09 ` Michael Schmitz
1 sibling, 0 replies; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ 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
@ 2014-08-09 1:09 ` Michael Schmitz
1 sibling, 0 replies; 18+ 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] 18+ messages in thread
end of thread, other threads:[~2014-08-09 1:09 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1327085843-6980-1-git-send-email-geert@linux-m68k.org>
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-03-09 3:11 ` 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-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-05 9:28 ` Geert Uytterhoeven
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).