All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add APNE PCMCIA 100 Mbit support
@ 2021-06-17  5:28 Michael Schmitz
  2021-06-17  5:28 ` [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support Michael Schmitz
  2021-06-17  5:28 ` [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver Michael Schmitz
  0 siblings, 2 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-06-17  5:28 UTC (permalink / raw)
  To: linux-m68k, geert; +Cc: alex

Add another ISA type for these cards, and switch to that type from the
APNE probe code in response to a module parameter. 

I've addressed review comments received so far, to the best of my ability.
Patch 1 not changed in v3, only fixes to patch 2 by Alex Kazik included.

v3 is the first version of this patch series sent to net-next (apne.c part
only).

Tested by Alex on his Amiga 1200.

Cheers,

   Michael
   

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

* [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support
  2021-06-17  5:28 [PATCH v3 0/2] Add APNE PCMCIA 100 Mbit support Michael Schmitz
@ 2021-06-17  5:28 ` Michael Schmitz
  2021-06-17  6:58   ` Finn Thain
  2021-06-17  5:28 ` [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver Michael Schmitz
  1 sibling, 1 reply; 11+ messages in thread
From: Michael Schmitz @ 2021-06-17  5:28 UTC (permalink / raw)
  To: linux-m68k, geert; +Cc: alex, Michael Schmitz

Add code to support 10 Mbit and 100 Mbit mode for APNE driver.

A new ISA type ISA_TYPE_AG16 dynamically switches the Amiga
ISA inb accessor to word access as required by the 100 Mbit cards.

Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
100 MBit card support" submitted to netdev 2018/09/16 by Alex
Kazik <alex@kazik.de>.

Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>

--
Changes from v1:

Andreas Schwab:
- remove redundant fallthrough annotations

Changes from RFC:

Geert Uytterhoeven:
- rename ISA_TYPE_AG100 to ISA_TYPE_AG16 (16 bit cards)
- move ISA_TYPE_AG16 case inside #ifdef CONFIG_AMIGA_PCMCIA
- change #if defined(CONFIG_APNE_100MBIT) to #ifdef
- fix parentheses in isa_inb() define
- omit comment about compiler optimization

- add ISA_TYPE_AG16 case to isa_delay()

fixup - review comment Andreas Schwab (fallthrough)
---
 arch/m68k/include/asm/io_mm.h | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index 9c521b0..3ab2f1d 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -101,6 +101,11 @@
 #define ISA_TYPE_Q40  (1)
 #define ISA_TYPE_AG   (2)
 #define ISA_TYPE_ENEC (3)
+#define ISA_TYPE_AG16 (4)	/* for 100 MBit APNE card */
+
+#if defined(CONFIG_APNE100MBIT)
+#define MULTI_ISA 1
+#endif
 
 #if defined(CONFIG_Q40) && !defined(MULTI_ISA)
 #define ISA_TYPE ISA_TYPE_Q40
@@ -136,6 +141,9 @@ static inline u8 __iomem *isa_itb(unsigned long addr)
     case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_IO_B(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
+#ifdef CONFIG_APNE100MBIT
+    case ISA_TYPE_AG16:
+#endif
     case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
 #endif
 #ifdef CONFIG_ATARI_ROM_ISA
@@ -155,6 +163,9 @@ static inline u16 __iomem *isa_itw(unsigned long addr)
     case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_IO_W(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
+#ifdef CONFIG_APNE100MBIT
+    case ISA_TYPE_AG16:
+#endif
     case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
 #endif
 #ifdef CONFIG_ATARI_ROM_ISA
@@ -171,6 +182,9 @@ static inline u32 __iomem *isa_itl(unsigned long addr)
   switch(ISA_TYPE)
     {
 #ifdef CONFIG_AMIGA_PCMCIA
+#ifdef CONFIG_APNE100MBIT
+    case ISA_TYPE_AG16:
+#endif
     case ISA_TYPE_AG: return (u32 __iomem *)AG_ISA_IO_W(addr);
 #endif
     }
@@ -184,6 +198,9 @@ static inline u8 __iomem *isa_mtb(unsigned long addr)
     case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
+#ifdef CONFIG_APNE100MBIT
+    case ISA_TYPE_AG16:
+#endif
     case ISA_TYPE_AG: return (u8 __iomem *)addr;
 #endif
 #ifdef CONFIG_ATARI_ROM_ISA
@@ -203,6 +220,9 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
     case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
+#ifdef CONFIG_APNE100MBIT
+    case ISA_TYPE_AG16:
+#endif
     case ISA_TYPE_AG: return (u16 __iomem *)addr;
 #endif
 #ifdef CONFIG_ATARI_ROM_ISA
@@ -216,13 +236,14 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
 }
 
 
-#define isa_inb(port)      in_8(isa_itb(port))
 #define isa_inw(port)      (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
 #define isa_inl(port)      (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
 #define isa_outb(val,port) out_8(isa_itb(port),(val))
 #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
 #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
 
+#define isa_inb(port)      ((ISA_TYPE == ISA_TYPE_AG16) ? ((port) & 1 ? isa_inw((port) - 1) & 0xff : isa_inw(port) >> 8) : in_8(isa_itb(port)))
+
 #define isa_readb(p)       in_8(isa_mtb((unsigned long)(p)))
 #define isa_readw(p)       \
 	(ISA_SEX ? in_be16(isa_mtw((unsigned long)(p)))	\
@@ -270,6 +291,9 @@ static inline void isa_delay(void)
     case ISA_TYPE_Q40: isa_outb(0,0x80); break;
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
+#ifdef CONFIG_APNE100MBIT
+    case ISA_TYPE_AG16: break;
+#endif
     case ISA_TYPE_AG: break;
 #endif
 #ifdef CONFIG_ATARI_ROM_ISA
-- 
2.7.4


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

* [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-17  5:28 [PATCH v3 0/2] Add APNE PCMCIA 100 Mbit support Michael Schmitz
  2021-06-17  5:28 ` [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support Michael Schmitz
@ 2021-06-17  5:28 ` Michael Schmitz
  2021-06-17  6:51   ` Finn Thain
  1 sibling, 1 reply; 11+ messages in thread
From: Michael Schmitz @ 2021-06-17  5:28 UTC (permalink / raw)
  To: linux-m68k, geert; +Cc: alex, Michael Schmitz, netdev

Add Kconfig option, module parameter 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.
A module parameter switches Amiga ISA IO accessors to word
access by changing isa_type at runtime. Additional code to
reset the PCMCIA hardware is also added to the driver probe.

Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
100 MBit card support" submitted to netdev 2018/09/16 by Alex
Kazik <alex@kazik.de>.

CC: netdev@vger.kernel.org
Tested-by: Alex Kazik <alex@kazik.de>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>

--
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 | 12 ++++++++++++
 drivers/net/ethernet/8390/apne.c  | 21 +++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
index 9f4b302..6e4db63 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -143,6 +143,18 @@ config APNE
 	  To compile this driver as a module, choose M here: the module
 	  will be called apne.
 
+config APNE100MBIT
+	bool "PCMCIA NE2000 100MBit support"
+	depends on APNE
+	default n
+	help
+	  This changes the driver to support 10/100Mbit cards (e.g. Netgear
+	  FA411, CNet Singlepoint). 10 MBit cards and 100 MBit cards are
+	  supported by the same driver.
+
+	  To activate 100 Mbit support at runtime or from the kernel
+	  command line, use the apne.100mbit module parameter.
+
 config PCMCIA_PCNET
 	tristate "NE2000 compatible PCMCIA support"
 	depends on PCMCIA
diff --git a/drivers/net/ethernet/8390/apne.c b/drivers/net/ethernet/8390/apne.c
index fe6c834..59e41ad 100644
--- a/drivers/net/ethernet/8390/apne.c
+++ b/drivers/net/ethernet/8390/apne.c
@@ -120,6 +120,12 @@ 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)");
 
+#ifdef CONFIG_APNE100MBIT
+static bool apne_100_mbit;
+module_param_named(apne_100_mbit_msg, apne_100_mbit, bool, 0444);
+MODULE_PARM_DESC(apne_100_mbit_msg, "Enable 100 Mbit support");
+#endif
+
 struct net_device * __init apne_probe(int unit)
 {
 	struct net_device *dev;
@@ -139,6 +145,11 @@ struct net_device * __init apne_probe(int unit)
 	if ( !(AMIGAHW_PRESENT(PCMCIA)) )
 		return ERR_PTR(-ENODEV);
 
+#ifdef CONFIG_APNE100MBIT
+	if (apne_100_mbit)
+		isa_type = ISA_TYPE_AG16;
+#endif
+
 	pr_info("Looking for PCMCIA ethernet card : ");
 
 	/* check if a card is inserted */
@@ -590,6 +601,16 @@ static int init_pcmcia(void)
 #endif
 	u_long offset;
 
+#ifdef CONFIG_APNE100MBIT
+	/* reset card (idea taken from CardReset by Artur Pogoda) */
+	{
+		u_char  tmp = gayle.intreq;
+
+		gayle.intreq = 0xff;    mdelay(1);
+		gayle.intreq = tmp;     mdelay(300);
+	}
+#endif
+
 	pcmcia_reset();
 	pcmcia_program_voltage(PCMCIA_0V);
 	pcmcia_access_speed(PCMCIA_SPEED_250NS);
-- 
2.7.4


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

* Re: [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-17  5:28 ` [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver Michael Schmitz
@ 2021-06-17  6:51   ` Finn Thain
  2021-06-17 19:33     ` Michael Schmitz
  0 siblings, 1 reply; 11+ messages in thread
From: Finn Thain @ 2021-06-17  6:51 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, geert, alex, netdev

On Thu, 17 Jun 2021, Michael Schmitz wrote:

> Add Kconfig option, module parameter 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.
> A module parameter switches Amiga ISA IO accessors to word
> access by changing isa_type at runtime. Additional code to
> reset the PCMCIA hardware is also added to the driver probe.
> 
> Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
> 100 MBit card support" submitted to netdev 2018/09/16 by Alex
> Kazik <alex@kazik.de>.
> 
> CC: netdev@vger.kernel.org
> Tested-by: Alex Kazik <alex@kazik.de>
> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
> 
> --
> 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 | 12 ++++++++++++
>  drivers/net/ethernet/8390/apne.c  | 21 +++++++++++++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
> index 9f4b302..6e4db63 100644
> --- a/drivers/net/ethernet/8390/Kconfig
> +++ b/drivers/net/ethernet/8390/Kconfig
> @@ -143,6 +143,18 @@ config APNE
>  	  To compile this driver as a module, choose M here: the module
>  	  will be called apne.
>  
> +config APNE100MBIT
> +	bool "PCMCIA NE2000 100MBit support"
> +	depends on APNE
> +	default n
> +	help
> +	  This changes the driver to support 10/100Mbit cards (e.g. Netgear
> +	  FA411, CNet Singlepoint). 10 MBit cards and 100 MBit cards are
> +	  supported by the same driver.
> +
> +	  To activate 100 Mbit support at runtime or from the kernel
> +	  command line, use the apne.100mbit module parameter.
> +
>  config PCMCIA_PCNET
>  	tristate "NE2000 compatible PCMCIA support"
>  	depends on PCMCIA
> diff --git a/drivers/net/ethernet/8390/apne.c b/drivers/net/ethernet/8390/apne.c
> index fe6c834..59e41ad 100644
> --- a/drivers/net/ethernet/8390/apne.c
> +++ b/drivers/net/ethernet/8390/apne.c
> @@ -120,6 +120,12 @@ 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)");
>  
> +#ifdef CONFIG_APNE100MBIT
> +static bool apne_100_mbit;
> +module_param_named(apne_100_mbit_msg, apne_100_mbit, bool, 0444);
> +MODULE_PARM_DESC(apne_100_mbit_msg, "Enable 100 Mbit support");
> +#endif
> +
>  struct net_device * __init apne_probe(int unit)
>  {
>  	struct net_device *dev;
> @@ -139,6 +145,11 @@ struct net_device * __init apne_probe(int unit)
>  	if ( !(AMIGAHW_PRESENT(PCMCIA)) )
>  		return ERR_PTR(-ENODEV);
>  
> +#ifdef CONFIG_APNE100MBIT
> +	if (apne_100_mbit)
> +		isa_type = ISA_TYPE_AG16;
> +#endif
> +

I think isa_type has to be assigned unconditionally otherwise it can't be 
reset for 10 mbit cards. Therefore, the AMIGAHW_PRESENT(PCMCIA) logic in 
arch/m68k/kernel/setup_mm.c probably should move here.

>  	pr_info("Looking for PCMCIA ethernet card : ");
>  
>  	/* check if a card is inserted */
> @@ -590,6 +601,16 @@ static int init_pcmcia(void)
>  #endif
>  	u_long offset;
>  
> +#ifdef CONFIG_APNE100MBIT
> +	/* reset card (idea taken from CardReset by Artur Pogoda) */
> +	{
> +		u_char  tmp = gayle.intreq;
> +
> +		gayle.intreq = 0xff;    mdelay(1);
> +		gayle.intreq = tmp;     mdelay(300);
> +	}
> +#endif
> +

The indentation/alignment here doesn't conform to the kernel coding style. 

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

* Re: [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support
  2021-06-17  5:28 ` [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support Michael Schmitz
@ 2021-06-17  6:58   ` Finn Thain
  2021-06-17 21:42     ` Michael Schmitz
  0 siblings, 1 reply; 11+ messages in thread
From: Finn Thain @ 2021-06-17  6:58 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, geert, alex

On Thu, 17 Jun 2021, Michael Schmitz wrote:

> Add code to support 10 Mbit and 100 Mbit mode for APNE driver.
> 
> A new ISA type ISA_TYPE_AG16 dynamically switches the Amiga
> ISA inb accessor to word access as required by the 100 Mbit cards.
> 
> Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
> 100 MBit card support" submitted to netdev 2018/09/16 by Alex
> Kazik <alex@kazik.de>.
> 
> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
> 
> --
> Changes from v1:
> 
> Andreas Schwab:
> - remove redundant fallthrough annotations
> 
> Changes from RFC:
> 
> Geert Uytterhoeven:
> - rename ISA_TYPE_AG100 to ISA_TYPE_AG16 (16 bit cards)
> - move ISA_TYPE_AG16 case inside #ifdef CONFIG_AMIGA_PCMCIA
> - change #if defined(CONFIG_APNE_100MBIT) to #ifdef
> - fix parentheses in isa_inb() define
> - omit comment about compiler optimization
> 
> - add ISA_TYPE_AG16 case to isa_delay()
> 
> fixup - review comment Andreas Schwab (fallthrough)
> ---
>  arch/m68k/include/asm/io_mm.h | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
> index 9c521b0..3ab2f1d 100644
> --- a/arch/m68k/include/asm/io_mm.h
> +++ b/arch/m68k/include/asm/io_mm.h
> @@ -101,6 +101,11 @@
>  #define ISA_TYPE_Q40  (1)
>  #define ISA_TYPE_AG   (2)
>  #define ISA_TYPE_ENEC (3)
> +#define ISA_TYPE_AG16 (4)	/* for 100 MBit APNE card */
> +
> +#if defined(CONFIG_APNE100MBIT)
> +#define MULTI_ISA 1
> +#endif
>  
>  #if defined(CONFIG_Q40) && !defined(MULTI_ISA)
>  #define ISA_TYPE ISA_TYPE_Q40
> @@ -136,6 +141,9 @@ static inline u8 __iomem *isa_itb(unsigned long addr)
>      case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_IO_B(addr);
>  #endif
>  #ifdef CONFIG_AMIGA_PCMCIA
> +#ifdef CONFIG_APNE100MBIT
> +    case ISA_TYPE_AG16:
> +#endif
>      case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
>  #endif
>  #ifdef CONFIG_ATARI_ROM_ISA
> @@ -155,6 +163,9 @@ static inline u16 __iomem *isa_itw(unsigned long addr)
>      case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_IO_W(addr);
>  #endif
>  #ifdef CONFIG_AMIGA_PCMCIA
> +#ifdef CONFIG_APNE100MBIT
> +    case ISA_TYPE_AG16:
> +#endif
>      case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
>  #endif
>  #ifdef CONFIG_ATARI_ROM_ISA
> @@ -171,6 +182,9 @@ static inline u32 __iomem *isa_itl(unsigned long addr)
>    switch(ISA_TYPE)
>      {
>  #ifdef CONFIG_AMIGA_PCMCIA
> +#ifdef CONFIG_APNE100MBIT
> +    case ISA_TYPE_AG16:
> +#endif
>      case ISA_TYPE_AG: return (u32 __iomem *)AG_ISA_IO_W(addr);
>  #endif
>      }
> @@ -184,6 +198,9 @@ static inline u8 __iomem *isa_mtb(unsigned long addr)
>      case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
>  #endif
>  #ifdef CONFIG_AMIGA_PCMCIA
> +#ifdef CONFIG_APNE100MBIT
> +    case ISA_TYPE_AG16:
> +#endif
>      case ISA_TYPE_AG: return (u8 __iomem *)addr;
>  #endif
>  #ifdef CONFIG_ATARI_ROM_ISA
> @@ -203,6 +220,9 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
>      case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
>  #endif
>  #ifdef CONFIG_AMIGA_PCMCIA
> +#ifdef CONFIG_APNE100MBIT
> +    case ISA_TYPE_AG16:
> +#endif
>      case ISA_TYPE_AG: return (u16 __iomem *)addr;
>  #endif
>  #ifdef CONFIG_ATARI_ROM_ISA
> @@ -216,13 +236,14 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
>  }
>  
>  
> -#define isa_inb(port)      in_8(isa_itb(port))
>  #define isa_inw(port)      (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
>  #define isa_inl(port)      (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
>  #define isa_outb(val,port) out_8(isa_itb(port),(val))
>  #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
>  #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
>  
> +#define isa_inb(port)      ((ISA_TYPE == ISA_TYPE_AG16) ? ((port) & 1 ? isa_inw((port) - 1) & 0xff : isa_inw(port) >> 8) : in_8(isa_itb(port)))
> +
>  #define isa_readb(p)       in_8(isa_mtb((unsigned long)(p)))
>  #define isa_readw(p)       \
>  	(ISA_SEX ? in_be16(isa_mtw((unsigned long)(p)))	\

Was the re-ordering of definitions deliberate?


> @@ -270,6 +291,9 @@ static inline void isa_delay(void)
>      case ISA_TYPE_Q40: isa_outb(0,0x80); break;
>  #endif
>  #ifdef CONFIG_AMIGA_PCMCIA
> +#ifdef CONFIG_APNE100MBIT
> +    case ISA_TYPE_AG16: break;
> +#endif
>      case ISA_TYPE_AG: break;
>  #endif
>  #ifdef CONFIG_ATARI_ROM_ISA
> 

I think most of these "#ifdef CONFIG_APNE100MBIT" conditionals are 
redundant. case ISA_TYPE_AG16 should be optimized away as dead code in the 
MULTI_ISA == 0 configuration. And in the MULTI_ISA == 1 configuration, the 
logic used to assign isa_type already depends on 
defined(CONFIG_APNE100MBIT).

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

* Re: [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-17  6:51   ` Finn Thain
@ 2021-06-17 19:33     ` Michael Schmitz
  2021-06-18  7:16       ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Schmitz @ 2021-06-17 19:33 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, geert, alex, netdev

Hi Finn,

thanks for your review!

On 17/06/21 6:51 pm, Finn Thain wrote:
> On Thu, 17 Jun 2021, Michael Schmitz wrote:
>
>> Add Kconfig option, module parameter 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.
>> A module parameter switches Amiga ISA IO accessors to word
>> access by changing isa_type at runtime. Additional code to
>> reset the PCMCIA hardware is also added to the driver probe.
>>
>> Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
>> 100 MBit card support" submitted to netdev 2018/09/16 by Alex
>> Kazik <alex@kazik.de>.
>>
>> CC: netdev@vger.kernel.org
>> Tested-by: Alex Kazik <alex@kazik.de>
>> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
>>
>> --
>> 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 | 12 ++++++++++++
>>   drivers/net/ethernet/8390/apne.c  | 21 +++++++++++++++++++++
>>   2 files changed, 33 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
>> index 9f4b302..6e4db63 100644
>> --- a/drivers/net/ethernet/8390/Kconfig
>> +++ b/drivers/net/ethernet/8390/Kconfig
>> @@ -143,6 +143,18 @@ config APNE
>>   	  To compile this driver as a module, choose M here: the module
>>   	  will be called apne.
>>   
>> +config APNE100MBIT
>> +	bool "PCMCIA NE2000 100MBit support"
>> +	depends on APNE
>> +	default n
>> +	help
>> +	  This changes the driver to support 10/100Mbit cards (e.g. Netgear
>> +	  FA411, CNet Singlepoint). 10 MBit cards and 100 MBit cards are
>> +	  supported by the same driver.
>> +
>> +	  To activate 100 Mbit support at runtime or from the kernel
>> +	  command line, use the apne.100mbit module parameter.
>> +
>>   config PCMCIA_PCNET
>>   	tristate "NE2000 compatible PCMCIA support"
>>   	depends on PCMCIA
>> diff --git a/drivers/net/ethernet/8390/apne.c b/drivers/net/ethernet/8390/apne.c
>> index fe6c834..59e41ad 100644
>> --- a/drivers/net/ethernet/8390/apne.c
>> +++ b/drivers/net/ethernet/8390/apne.c
>> @@ -120,6 +120,12 @@ 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)");
>>   
>> +#ifdef CONFIG_APNE100MBIT
>> +static bool apne_100_mbit;
>> +module_param_named(apne_100_mbit_msg, apne_100_mbit, bool, 0444);
>> +MODULE_PARM_DESC(apne_100_mbit_msg, "Enable 100 Mbit support");
>> +#endif
>> +
>>   struct net_device * __init apne_probe(int unit)
>>   {
>>   	struct net_device *dev;
>> @@ -139,6 +145,11 @@ struct net_device * __init apne_probe(int unit)
>>   	if ( !(AMIGAHW_PRESENT(PCMCIA)) )
>>   		return ERR_PTR(-ENODEV);
>>   
>> +#ifdef CONFIG_APNE100MBIT
>> +	if (apne_100_mbit)
>> +		isa_type = ISA_TYPE_AG16;
>> +#endif
>> +
> I think isa_type has to be assigned unconditionally otherwise it can't be
> reset for 10 mbit cards. Therefore, the AMIGAHW_PRESENT(PCMCIA) logic in
> arch/m68k/kernel/setup_mm.c probably should move here.

Good catch! I am uncertain though as to whether replacing a 100 Mbit 
card by a 10 Mbit one at run time is a common use case (or even 
possible, given constraints of the Amiga PCMCIA interface?), but it 
ought to work even if rarely used.

The comment there says isa_type must be set as early as possible, so I'd 
rather leave that alone, and add an 'else' clause here.

This of course raise the question whether we ought to move the entire 
isa_type handling into arch code instead - make it a generic 
amiga_pcmcia_16bit option settable via sysfs. There may be other 16 bit 
cards that require the same treatment, and duplicating PCMCIA mode 
switching all over the place could be avoided. Opinions?

>
>>   	pr_info("Looking for PCMCIA ethernet card : ");
>>   
>>   	/* check if a card is inserted */
>> @@ -590,6 +601,16 @@ static int init_pcmcia(void)
>>   #endif
>>   	u_long offset;
>>   
>> +#ifdef CONFIG_APNE100MBIT
>> +	/* reset card (idea taken from CardReset by Artur Pogoda) */
>> +	{
>> +		u_char  tmp = gayle.intreq;
>> +
>> +		gayle.intreq = 0xff;    mdelay(1);
>> +		gayle.intreq = tmp;     mdelay(300);
>> +	}
>> +#endif
>> +
> The indentation/alignment here doesn't conform to the kernel coding style.

Good one. Checkpatch missed that for some reason...

I'll respin ...

Cheers,

     Michael



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

* Re: [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support
  2021-06-17  6:58   ` Finn Thain
@ 2021-06-17 21:42     ` Michael Schmitz
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-06-17 21:42 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, geert, alex

Hi Finn,

thanks for your comments!

On 17/06/21 6:58 pm, Finn Thain wrote:
>> -#define isa_inb(port)      in_8(isa_itb(port))
>>   #define isa_inw(port)      (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port)))
>>   #define isa_inl(port)      (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port)))
>>   #define isa_outb(val,port) out_8(isa_itb(port),(val))
>>   #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
>>   #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
>>   
>> +#define isa_inb(port)      ((ISA_TYPE == ISA_TYPE_AG16) ? ((port) & 1 ? isa_inw((port) - 1) & 0xff : isa_inw(port) >> 8) : in_8(isa_itb(port)))
>> +
>>   #define isa_readb(p)       in_8(isa_mtb((unsigned long)(p)))
>>   #define isa_readw(p)       \
>>   	(ISA_SEX ? in_be16(isa_mtw((unsigned long)(p)))	\
> Was the re-ordering of definitions deliberate?

Yes, it was. I remembered looking at a bug report for curl on the m68k 
kernel that was due to ordering of #defines.

On second thought, there is no prior definition of isa_inw in our case, 
so even this won't really be an issue.

>
>
>> @@ -270,6 +291,9 @@ static inline void isa_delay(void)
>>       case ISA_TYPE_Q40: isa_outb(0,0x80); break;
>>   #endif
>>   #ifdef CONFIG_AMIGA_PCMCIA
>> +#ifdef CONFIG_APNE100MBIT
>> +    case ISA_TYPE_AG16: break;
>> +#endif
>>       case ISA_TYPE_AG: break;
>>   #endif
>>   #ifdef CONFIG_ATARI_ROM_ISA
>>
> I think most of these "#ifdef CONFIG_APNE100MBIT" conditionals are
> redundant. case ISA_TYPE_AG16 should be optimized away as dead code in the
> MULTI_ISA == 0 configuration. And in the MULTI_ISA == 1 configuration, the
> logic used to assign isa_type already depends on
> defined(CONFIG_APNE100MBIT).

You're right there, too. I'll drop those.

Cheers,

     Michael



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

* Re: [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-17 19:33     ` Michael Schmitz
@ 2021-06-18  7:16       ` Geert Uytterhoeven
  2021-06-18  8:06         ` Michael Schmitz
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2021-06-18  7:16 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Finn Thain, Linux/m68k, ALeX Kazik, netdev

Hi Michael,

On Thu, Jun 17, 2021 at 9:33 PM Michael Schmitz <schmitzmic@gmail.com> wrote:
> On 17/06/21 6:51 pm, Finn Thain wrote:
> > On Thu, 17 Jun 2021, Michael Schmitz wrote:
> >> Add Kconfig option, module parameter 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.
> >> A module parameter switches Amiga ISA IO accessors to word
> >> access by changing isa_type at runtime. Additional code to
> >> reset the PCMCIA hardware is also added to the driver probe.
> >>
> >> Patch modified after patch "[PATCH RFC net-next] Amiga PCMCIA
> >> 100 MBit card support" submitted to netdev 2018/09/16 by Alex
> >> Kazik <alex@kazik.de>.
> >>
> >> CC: netdev@vger.kernel.org
> >> Tested-by: Alex Kazik <alex@kazik.de>
> >> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
> >> --- a/drivers/net/ethernet/8390/apne.c
> >> +++ b/drivers/net/ethernet/8390/apne.c
> >> @@ -120,6 +120,12 @@ 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)");
> >>
> >> +#ifdef CONFIG_APNE100MBIT
> >> +static bool apne_100_mbit;
> >> +module_param_named(apne_100_mbit_msg, apne_100_mbit, bool, 0444);
> >> +MODULE_PARM_DESC(apne_100_mbit_msg, "Enable 100 Mbit support");
> >> +#endif
> >> +
> >>   struct net_device * __init apne_probe(int unit)
> >>   {
> >>      struct net_device *dev;
> >> @@ -139,6 +145,11 @@ struct net_device * __init apne_probe(int unit)
> >>      if ( !(AMIGAHW_PRESENT(PCMCIA)) )
> >>              return ERR_PTR(-ENODEV);
> >>
> >> +#ifdef CONFIG_APNE100MBIT
> >> +    if (apne_100_mbit)
> >> +            isa_type = ISA_TYPE_AG16;
> >> +#endif
> >> +
> > I think isa_type has to be assigned unconditionally otherwise it can't be
> > reset for 10 mbit cards. Therefore, the AMIGAHW_PRESENT(PCMCIA) logic in
> > arch/m68k/kernel/setup_mm.c probably should move here.
>
> Good catch! I am uncertain though as to whether replacing a 100 Mbit
> card by a 10 Mbit one at run time is a common use case (or even
> possible, given constraints of the Amiga PCMCIA interface?), but it
> ought to work even if rarely used.

Given it's PCMCIA, I guess that's a possibility.
Furthermore, always setting isa_type means the user can recover from
a mistake by unloading the module, and modprobe'ing again with the
correct parameter.
For the builtin-case, that needs a s/0444/0644/ change, though.

> The comment there says isa_type must be set as early as possible, so I'd
> rather leave that alone, and add an 'else' clause here.
>
> This of course raise the question whether we ought to move the entire
> isa_type handling into arch code instead - make it a generic
> amiga_pcmcia_16bit option settable via sysfs. There may be other 16 bit
> cards that require the same treatment, and duplicating PCMCIA mode
> switching all over the place could be avoided. Opinions?

Indeed.

Still, can we autodetect in the driver?

I'm wondering how this is handled on PCs with PCMCIA, or if there
really is something special about Amiga PCMCIA hardware...

And I'd really like to get rid of the CONFIG_APNE100MBIT option,
i.e. always include the support, if possible.

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] 11+ messages in thread

* Re: [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-18  7:16       ` Geert Uytterhoeven
@ 2021-06-18  8:06         ` Michael Schmitz
  2021-06-18  8:13           ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Schmitz @ 2021-06-18  8:06 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Finn Thain, Linux/m68k, ALeX Kazik, netdev

Hi Geert,

Am 18.06.2021 um 19:16 schrieb Geert Uytterhoeven:
>>>> +#ifdef CONFIG_APNE100MBIT
>>>> +    if (apne_100_mbit)
>>>> +            isa_type = ISA_TYPE_AG16;
>>>> +#endif
>>>> +
>>> I think isa_type has to be assigned unconditionally otherwise it can't be
>>> reset for 10 mbit cards. Therefore, the AMIGAHW_PRESENT(PCMCIA) logic in
>>> arch/m68k/kernel/setup_mm.c probably should move here.
>>
>> Good catch! I am uncertain though as to whether replacing a 100 Mbit
>> card by a 10 Mbit one at run time is a common use case (or even
>> possible, given constraints of the Amiga PCMCIA interface?), but it
>> ought to work even if rarely used.
>
> Given it's PCMCIA, I guess that's a possibility.
> Furthermore, always setting isa_type means the user can recover from
> a mistake by unloading the module, and modprobe'ing again with the
> correct parameter.
> For the builtin-case, that needs a s/0444/0644/ change, though.

How does re-probing after a card change for a builtin driver work? 
Changing the permission bits is a minor issue.

>
>> The comment there says isa_type must be set as early as possible, so I'd
>> rather leave that alone, and add an 'else' clause here.
>>
>> This of course raise the question whether we ought to move the entire
>> isa_type handling into arch code instead - make it a generic
>> amiga_pcmcia_16bit option settable via sysfs. There may be other 16 bit
>> cards that require the same treatment, and duplicating PCMCIA mode
>> switching all over the place could be avoided. Opinions?
>
> Indeed.

The only downside I can see is that setting isa_type needs to be done 
ahead of modprobe, through sysfs. That might be a little error prone.

> Still, can we autodetect in the driver?

Guess we'll have to find out how the 16 bit cards behave if first poked 
in 8 bit mode, attempting to force a reset of the 8390 chip, and 
switching to 16 bit mode if this fails. That's normally done in 
apne_probe1() which runs after init_pcmcia(), so we can't rely on the 
result of a 8390 reset autoprobe to do the PCMCIA software reset there.

The 8390 reset part does not rely on anything else in apne_probe1(), so 
that code can be lifted out of apne_probe1() and run early in 
apne_probe() (after the check for an inserted PCMCIA card). I'll try and 
prepare a patch for Alex to test that method.

>
> I'm wondering how this is handled on PCs with PCMCIA, or if there
> really is something special about Amiga PCMCIA hardware...

What's special about Amiga PCMCIA hardware is that the card reset isn't 
connected for those 16 bit cards, so pcmcia_reset() does not work.

Whether the software reset workaround hurts for 8 bit cards is something 
I don't know and cannot test. But

> And I'd really like to get rid of the CONFIG_APNE100MBIT option,
> i.e. always include the support, if possible.

I can't see why that wouldn't be possible - the only downside is that we 
force MULTI_ISA=1 always for Amiga, and lose the optimizations done for 
MUTLI_ISA=0 in io_mm.h. Unless we autoprobe, we can use isa_type to 
guard against running a software reset on 8 bit cards ...

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
>

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

* Re: [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-18  8:06         ` Michael Schmitz
@ 2021-06-18  8:13           ` Geert Uytterhoeven
  2021-06-18  8:28             ` Michael Schmitz
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2021-06-18  8:13 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Finn Thain, Linux/m68k, ALeX Kazik, netdev

Hi Michael,

On Fri, Jun 18, 2021 at 10:06 AM Michael Schmitz <schmitzmic@gmail.com> wrote:
> Am 18.06.2021 um 19:16 schrieb Geert Uytterhoeven:
> >>>> +#ifdef CONFIG_APNE100MBIT
> >>>> +    if (apne_100_mbit)
> >>>> +            isa_type = ISA_TYPE_AG16;
> >>>> +#endif
> >>>> +
> >>> I think isa_type has to be assigned unconditionally otherwise it can't be
> >>> reset for 10 mbit cards. Therefore, the AMIGAHW_PRESENT(PCMCIA) logic in
> >>> arch/m68k/kernel/setup_mm.c probably should move here.
> >>
> >> Good catch! I am uncertain though as to whether replacing a 100 Mbit
> >> card by a 10 Mbit one at run time is a common use case (or even
> >> possible, given constraints of the Amiga PCMCIA interface?), but it
> >> ought to work even if rarely used.
> >
> > Given it's PCMCIA, I guess that's a possibility.
> > Furthermore, always setting isa_type means the user can recover from
> > a mistake by unloading the module, and modprobe'ing again with the
> > correct parameter.
> > For the builtin-case, that needs a s/0444/0644/ change, though.
>
> How does re-probing after a card change for a builtin driver work?
> Changing the permission bits is a minor issue.

Oh right, this driver predates the driver framework, and doesn't support
PCMCIA hotplug.  So auto-unregister on removal doesn't work.
Even using unbind/bind in sysfs won't work.

So rmmod/modprobe is the only thing that has a chance to work...

> >> The comment there says isa_type must be set as early as possible, so I'd
> >> rather leave that alone, and add an 'else' clause here.
> >>
> >> This of course raise the question whether we ought to move the entire
> >> isa_type handling into arch code instead - make it a generic
> >> amiga_pcmcia_16bit option settable via sysfs. There may be other 16 bit
> >> cards that require the same treatment, and duplicating PCMCIA mode
> >> switching all over the place could be avoided. Opinions?
> >
> > Indeed.
>
> The only downside I can see is that setting isa_type needs to be done
> ahead of modprobe, through sysfs. That might be a little error prone.
>
> > Still, can we autodetect in the driver?
>
> Guess we'll have to find out how the 16 bit cards behave if first poked
> in 8 bit mode, attempting to force a reset of the 8390 chip, and
> switching to 16 bit mode if this fails. That's normally done in
> apne_probe1() which runs after init_pcmcia(), so we can't rely on the
> result of a 8390 reset autoprobe to do the PCMCIA software reset there.
>
> The 8390 reset part does not rely on anything else in apne_probe1(), so
> that code can be lifted out of apne_probe1() and run early in
> apne_probe() (after the check for an inserted PCMCIA card). I'll try and
> prepare a patch for Alex to test that method.
>
> > I'm wondering how this is handled on PCs with PCMCIA, or if there
> > really is something special about Amiga PCMCIA hardware...
>
> What's special about Amiga PCMCIA hardware is that the card reset isn't
> connected for those 16 bit cards, so pcmcia_reset() does not work.

I was mostly thinking about the difference between 8-bit and 16-bit
accesses.

> Whether the software reset workaround hurts for 8 bit cards is something
> I don't know and cannot test. But
>
> > And I'd really like to get rid of the CONFIG_APNE100MBIT option,
> > i.e. always include the support, if possible.
>
> I can't see why that wouldn't be possible - the only downside is that we
> force MULTI_ISA=1 always for Amiga, and lose the optimizations done for
> MUTLI_ISA=0 in io_mm.h. Unless we autoprobe, we can use isa_type to
> guard against running a software reset on 8 bit cards ...

The latter sounds like a neat trick...

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] 11+ messages in thread

* Re: [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver
  2021-06-18  8:13           ` Geert Uytterhoeven
@ 2021-06-18  8:28             ` Michael Schmitz
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-06-18  8:28 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Finn Thain, Linux/m68k, ALeX Kazik, netdev

Hi Geert,

Am 18.06.2021 um 20:13 schrieb Geert Uytterhoeven:
>>
>> How does re-probing after a card change for a builtin driver work?
>> Changing the permission bits is a minor issue.
>
> Oh right, this driver predates the driver framework, and doesn't support
> PCMCIA hotplug.  So auto-unregister on removal doesn't work.
> Even using unbind/bind in sysfs won't work.
>
> So rmmod/modprobe is the only thing that has a chance to work...
>
>>>> The comment there says isa_type must be set as early as possible, so I'd
>>>> rather leave that alone, and add an 'else' clause here.
>>>>
>>>> This of course raise the question whether we ought to move the entire
>>>> isa_type handling into arch code instead - make it a generic
>>>> amiga_pcmcia_16bit option settable via sysfs. There may be other 16 bit
>>>> cards that require the same treatment, and duplicating PCMCIA mode
>>>> switching all over the place could be avoided. Opinions?
>>>
>>> Indeed.
>>
>> The only downside I can see is that setting isa_type needs to be done
>> ahead of modprobe, through sysfs. That might be a little error prone.
>>
>>> Still, can we autodetect in the driver?
>>
>> Guess we'll have to find out how the 16 bit cards behave if first poked
>> in 8 bit mode, attempting to force a reset of the 8390 chip, and
>> switching to 16 bit mode if this fails. That's normally done in
>> apne_probe1() which runs after init_pcmcia(), so we can't rely on the
>> result of a 8390 reset autoprobe to do the PCMCIA software reset there.
>>
>> The 8390 reset part does not rely on anything else in apne_probe1(), so
>> that code can be lifted out of apne_probe1() and run early in
>> apne_probe() (after the check for an inserted PCMCIA card). I'll try and
>> prepare a patch for Alex to test that method.

I just realized that might not work - ínit_pcmcia() enables the PCMCIA 
interface for us, so the early 8390 reset may not go through at all... 
The module parameter may have to stay as a fallback option at least.

>>
>>> I'm wondering how this is handled on PCs with PCMCIA, or if there
>>> really is something special about Amiga PCMCIA hardware...
>>
>> What's special about Amiga PCMCIA hardware is that the card reset isn't
>> connected for those 16 bit cards, so pcmcia_reset() does not work.
>
> I was mostly thinking about the difference between 8-bit and 16-bit
> accesses.

No idea. I've never even seen an 8 bit PCMCIA card - I have a few old 
16/32 bit ones around that were great for crashing my PowerBook, nothing 
else...

>>> And I'd really like to get rid of the CONFIG_APNE100MBIT option,
>>> i.e. always include the support, if possible.
>>
>> I can't see why that wouldn't be possible - the only downside is that we
>> force MULTI_ISA=1 always for Amiga, and lose the optimizations done for
>> MUTLI_ISA=0 in io_mm.h. Unless we autoprobe, we can use isa_type to
>> guard against running a software reset on 8 bit cards ...
>
> The latter sounds like a neat trick...

Yes, we can at least get rid of the APNE100MBIT option that way. I'll 
have to think about the autoprobe a bit more.

Cheers,

	Michael

> Gr{oetje,eeting}s,
>
>                         Geert
>

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

end of thread, other threads:[~2021-06-18  8:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  5:28 [PATCH v3 0/2] Add APNE PCMCIA 100 Mbit support Michael Schmitz
2021-06-17  5:28 ` [PATCH v3 1/2] m68k: io_mm.h - add APNE 100 MBit support Michael Schmitz
2021-06-17  6:58   ` Finn Thain
2021-06-17 21:42     ` Michael Schmitz
2021-06-17  5:28 ` [PATCH net-next v3 2/2] net/8390: apne.c - add 100 Mbit support to apne.c driver Michael Schmitz
2021-06-17  6:51   ` Finn Thain
2021-06-17 19:33     ` Michael Schmitz
2021-06-18  7:16       ` Geert Uytterhoeven
2021-06-18  8:06         ` Michael Schmitz
2021-06-18  8:13           ` Geert Uytterhoeven
2021-06-18  8:28             ` Michael Schmitz

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