From: Michael Schmitz <schmitzmic@gmail.com> Date: 2021-11-14 23:40:39
The first patch enables the use of core PCMCIA code to parse
config table entries in Amiga drivers. The remaining two patches
add 16 bit IO support to the m68k low-level IO access code, and
add code to the APNE driver to autoprobe for 16 bit IO on cards
that support it (the 100 Mbit cards). The core PCMCIA config
table parser is utilized for this (may be built as a module;
must be selected manually for build in order to enable autoprobe).
Tested by Alex on a 100 Mbit card. Not yet tested on 10 Mbit
cards - if any of those also have the 16 bit IO feature set
in their config table, this patch series would break on those
cards.
Note that only patch 3 has been sent to netdev. Please CC
linux-m68k when providing comments.
v11 addresses review comments by Geert.
Cheers,
Michael
CC: netdev@vger.kernel.org
From: Michael Schmitz <schmitzmic@gmail.com> Date: 2021-11-14 23:41:22
Add module parameter, IO mode autoprobe and PCMCIA reset code
required to support 100 Mbit PCMCIA ethernet cards on Amiga.
10 Mbit and 100 Mbit mode are supported by the same module.
Use the core PCMCIA cftable parser to detect 16 bit cards,
and automatically enable 16 bit ISA IO access for those cards
by changing isa_type at runtime. The user must select PCCARD
and PCMCIA in the kernel config to make the necessary support
modules available
Code to reset the PCMCIA hardware required for 16 bit cards is
also added to the driver probe.
An optional module parameter switches Amiga ISA IO accessors
to 8 or 16 bit access in case autoprobe fails.
Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
100 MBit card support" submitted to netdev 2018/09/16 by Alex
Kazik [off-list ref].
CC: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/1622958877-2026-1-git-send-email-schmitzmic@gmail.com
Tested-by: Alex Kazik <redacted>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
--
Changes from v9:
- avoid pcmcia_is_16bit() forward declaration
Randy Dunlap:
- do not select PCCARD and PCMCIA options when selecting APNE
Changes from v8:
Geert Uytterhoeven:
- cistpl.h definitions now provided through amipcmcia.h
- really change module parameter to (signed) int
Changes from v7:
- move 'select' for PCCARD and PCMCIA to 8390 Kconfig, so
Amiga pcmcia.c may remain built-in while core PCMCIA
code can be built as modules if APNE driver is a module.
- move 16 bit mode autoprobe code from amiga/pcmcia.c to this
driver, to allow the core PCMCIA code we depend on to be
built as modules.
- change module parameter type from bool to int to allow for
tri-state semantics (autoprobe, 8 bit, 16 bit).
Changes from v6:
- use 16 bit mode autoprobe based on PCMCIA config table data
Changes from v5:
- move autoprobe code to new patch in this series
Geert Uytterhoeven:
- reword Kconfig help text
Finn Thain:
- style fixes, use msec_to_jiffies in timeout calc
Alex Kazik:
- revert module parameter permission change
Changes from v4:
Geert Uytterhoeven:
- remove APNE100MBIT config option, always include 16 bit support
- change module parameter permissions
- try autoprobing for 16 bit mode early on in device probe
Changes from v3:
- change module parameter name to match Kconfig help
Finn Thain:
- fix coding style in new card reset code block
- allow reset of isa_type by module parameter
Changes from v1:
- fix module parameter name in Kconfig help text
Alex Kazik:
- change module parameter type to bool, fix module parameter
permission
Changes from RFC:
Geert Uytterhoeven:
- change APNE_100MBIT to depend on APNE
- change '---help---' to 'help' (former no longer supported)
- fix whitespace errors
- fix module_param_named() arg count
- protect all added code by #ifdef CONFIG_APNE_100MBIT
---
drivers/net/ethernet/8390/Kconfig | 8 ++++
drivers/net/ethernet/8390/apne.c | 67 +++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+)
@@ -583,6 +640,16 @@ static int init_pcmcia(void)#endifu_longoffset;+/* reset card (idea taken from CardReset by Artur Pogoda) */+if(isa_type==ISA_TYPE_AG16){+u_chartmp=gayle.intreq;++gayle.intreq=0xff;+mdelay(1);+gayle.intreq=tmp;+mdelay(300);+}+pcmcia_reset();pcmcia_program_voltage(PCMCIA_0V);pcmcia_access_speed(PCMCIA_SPEED_250NS);
Hi Michael,
On Mon, Nov 15, 2021 at 12:40 AM Michael Schmitz [off-list ref] wrote:
Add module parameter, IO mode autoprobe and PCMCIA reset code
required to support 100 Mbit PCMCIA ethernet cards on Amiga.
10 Mbit and 100 Mbit mode are supported by the same module.
Use the core PCMCIA cftable parser to detect 16 bit cards,
and automatically enable 16 bit ISA IO access for those cards
by changing isa_type at runtime. The user must select PCCARD
and PCMCIA in the kernel config to make the necessary support
modules available
Code to reset the PCMCIA hardware required for 16 bit cards is
also added to the driver probe.
An optional module parameter switches Amiga ISA IO accessors
to 8 or 16 bit access in case autoprobe fails.
Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
100 MBit card support" submitted to netdev 2018/09/16 by Alex
Kazik [off-list ref].
CC: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/1622958877-2026-1-git-send-email-schmitzmic@gmail.com
Tested-by: Alex Kazik <redacted>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Can't you avoid the cast, by changing the type of cftable_entry?
Perhaps you don't want to do that, to avoid abusing it below, but
perhaps you can use container_of() instead of the cast?
I think you should reset apne_100_mbit to zero if apne_100_mbit < 0
&& !pcmcia_is_16bit(), so rmmod + switching card + modprobe
has a chance to work.
+#endif
+
if (!init_pcmcia()) {
/* XXX: shouldn't we re-enable irq here? */
free_netdev(dev);
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
From: Michael Schmitz <schmitzmic@gmail.com> Date: 2021-11-18 04:58:14
Hi Geert,
thanks for your review!
On 18/11/21 03:42, Geert Uytterhoeven wrote:
Hi Michael,
On Mon, Nov 15, 2021 at 12:40 AM Michael Schmitz [off-list ref] wrote:
quoted
Add module parameter, IO mode autoprobe and PCMCIA reset code
required to support 100 Mbit PCMCIA ethernet cards on Amiga.
10 Mbit and 100 Mbit mode are supported by the same module.
Use the core PCMCIA cftable parser to detect 16 bit cards,
and automatically enable 16 bit ISA IO access for those cards
by changing isa_type at runtime. The user must select PCCARD
and PCMCIA in the kernel config to make the necessary support
modules available
Code to reset the PCMCIA hardware required for 16 bit cards is
also added to the driver probe.
An optional module parameter switches Amiga ISA IO accessors
to 8 or 16 bit access in case autoprobe fails.
Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
100 MBit card support" submitted to netdev 2018/09/16 by Alex
Kazik [off-list ref].
CC: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/1622958877-2026-1-git-send-email-schmitzmic@gmail.com
Tested-by: Alex Kazik <redacted>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
@@ -119,6 +119,48 @@ static u32 apne_msg_enable;module_param_named(msg_enable,apne_msg_enable,uint,0444);MODULE_PARM_DESC(msg_enable,"Debug message level (see linux/netdevice.h for bitmap)");+staticintapne_100_mbit=-1;+module_param_named(100_mbit,apne_100_mbit,int,0444);+MODULE_PARM_DESC(100_mbit,"Enable 100 Mbit support");++#if IS_ENABLED(CONFIG_PCMCIA)
What if CONFIG_PCMIA=m, and CONFIG_APNE=y?
Fails to build (undefined reference to `pcmcia_parse_tuple').
That's what 'select PCMCIA' was avoiding before, but got vetoed. I can
add a dependency on PCMCIA in the APNE Kconfig entry which does force
APNE the same as what's selected for PCMCIA, but that means we can't
build APNE without PCMCIA anymore. Is there a way to express 'constrain
build type if PCMCIA is enabled, else leave choice to user' ??
I think you should reset apne_100_mbit to zero if apne_100_mbit < 0
&& !pcmcia_is_16bit(), so rmmod + switching card + modprobe
has a chance to work.
Good catch - though when switching to another card using this same
driver, the module parameter can be used again to select IO mode or
force autoprobe.
I'll wait for your response about the sysfs parameter issue before
sending out v12.
Cheers,
Michael
quoted
+#endif
+
if (!init_pcmcia()) {
/* XXX: shouldn't we re-enable irq here? */
free_netdev(dev);
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
Hi Michael,
On Thu, Nov 18, 2021 at 5:58 AM Michael Schmitz [off-list ref] wrote:
On 18/11/21 03:42, Geert Uytterhoeven wrote:
quoted
On Mon, Nov 15, 2021 at 12:40 AM Michael Schmitz [off-list ref] wrote:
quoted
Add module parameter, IO mode autoprobe and PCMCIA reset code
required to support 100 Mbit PCMCIA ethernet cards on Amiga.
10 Mbit and 100 Mbit mode are supported by the same module.
Use the core PCMCIA cftable parser to detect 16 bit cards,
and automatically enable 16 bit ISA IO access for those cards
by changing isa_type at runtime. The user must select PCCARD
and PCMCIA in the kernel config to make the necessary support
modules available
Code to reset the PCMCIA hardware required for 16 bit cards is
also added to the driver probe.
An optional module parameter switches Amiga ISA IO accessors
to 8 or 16 bit access in case autoprobe fails.
Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
100 MBit card support" submitted to netdev 2018/09/16 by Alex
Kazik [off-list ref].
CC: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/1622958877-2026-1-git-send-email-schmitzmic@gmail.com
Tested-by: Alex Kazik <redacted>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
@@ -119,6 +119,48 @@ static u32 apne_msg_enable;module_param_named(msg_enable,apne_msg_enable,uint,0444);MODULE_PARM_DESC(msg_enable,"Debug message level (see linux/netdevice.h for bitmap)");+staticintapne_100_mbit=-1;+module_param_named(100_mbit,apne_100_mbit,int,0444);+MODULE_PARM_DESC(100_mbit,"Enable 100 Mbit support");++#if IS_ENABLED(CONFIG_PCMCIA)
What if CONFIG_PCMIA=m, and CONFIG_APNE=y?
Fails to build (undefined reference to `pcmcia_parse_tuple').
That's what 'select PCMCIA' was avoiding before, but got vetoed. I can
add a dependency on PCMCIA in the APNE Kconfig entry which does force
APNE the same as what's selected for PCMCIA, but that means we can't
build APNE without PCMCIA anymore. Is there a way to express 'constrain
build type if PCMCIA is enabled, else leave choice to user' ??
#if IS_REACHABLE(CONFIG_PCMIA)
quoted
quoted
@@ -140,6 +182,13 @@ static struct net_device * __init apne_probe(void) pr_info("Looking for PCMCIA ethernet card : ");+ if (apne_100_mbit == 1)+ isa_type = ISA_TYPE_AG16;+ else if (apne_100_mbit == 0)+ isa_type = ISA_TYPE_AG;+ else+ pr_cont(" (autoprobing 16 bit mode) ");+ /* check if a card is inserted */ if (!(PCMCIA_INSERTED)) { pr_cont("NO PCMCIA card inserted\n");
I think you should reset apne_100_mbit to zero if apne_100_mbit < 0
&& !pcmcia_is_16bit(), so rmmod + switching card + modprobe
has a chance to work.
Good catch - though when switching to another card using this same
driver, the module parameter can be used again to select IO mode or
force autoprobe.
The autoprobe won't work if the new card is 8-bit.
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
@@ -119,6 +119,48 @@ static u32 apne_msg_enable;module_param_named(msg_enable,apne_msg_enable,uint,0444);MODULE_PARM_DESC(msg_enable,"Debug message level (see linux/netdevice.h for bitmap)");+staticintapne_100_mbit=-1;+module_param_named(100_mbit,apne_100_mbit,int,0444);+MODULE_PARM_DESC(100_mbit,"Enable 100 Mbit support");++#if IS_ENABLED(CONFIG_PCMCIA)
What if CONFIG_PCMIA=m, and CONFIG_APNE=y?
Fails to build (undefined reference to `pcmcia_parse_tuple').
That's what 'select PCMCIA' was avoiding before, but got vetoed. I can
add a dependency on PCMCIA in the APNE Kconfig entry which does force
APNE the same as what's selected for PCMCIA, but that means we can't
build APNE without PCMCIA anymore. Is there a way to express 'constrain
build type if PCMCIA is enabled, else leave choice to user' ??
#if IS_REACHABLE(CONFIG_PCMIA)
Thanks, I'll use that then.
quoted
quoted
quoted
@@ -140,6 +182,13 @@ static struct net_device * __init apne_probe(void) pr_info("Looking for PCMCIA ethernet card : ");+ if (apne_100_mbit == 1)+ isa_type = ISA_TYPE_AG16;+ else if (apne_100_mbit == 0)+ isa_type = ISA_TYPE_AG;+ else+ pr_cont(" (autoprobing 16 bit mode) ");+ /* check if a card is inserted */ if (!(PCMCIA_INSERTED)) { pr_cont("NO PCMCIA card inserted\n");
I think you should reset apne_100_mbit to zero if apne_100_mbit < 0
&& !pcmcia_is_16bit(), so rmmod + switching card + modprobe
has a chance to work.
Good catch - though when switching to another card using this same
driver, the module parameter can be used again to select IO mode or
force autoprobe.
The autoprobe won't work if the new card is 8-bit.
I see now - adding code to set isa_type to 8 bit if the autoprobe fails,
and reset isa_type and apne_100_mbit to defaults in module exit and the
probe error return path ...
Cheers,
Michael
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