Message ID | 20211109040242.11615-4-schmitzmic@gmail.com (mailing list archive) |
---|---|
State | Deferred |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add APNE PCMCIA 100 Mbit support | expand |
On 11/8/21 8:02 PM, Michael Schmitz wrote: > diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig > index a4130e643342..b22c3cf96560 100644 > --- a/drivers/net/ethernet/8390/Kconfig > +++ b/drivers/net/ethernet/8390/Kconfig > @@ -136,6 +136,8 @@ config NE2K_PCI > config APNE > tristate "PCMCIA NE2000 support" > depends on AMIGA_PCMCIA > + select PCCARD > + select PCMCIA > select CRC32 Hi, There are no other drivers that "select PCCARD" or "select PCMCIA" in the entire kernel tree. I don't see any good justification to allow it here.
Hi Randy, On 09/11/21 17:09, Randy Dunlap wrote: > On 11/8/21 8:02 PM, Michael Schmitz wrote: >> diff --git a/drivers/net/ethernet/8390/Kconfig >> b/drivers/net/ethernet/8390/Kconfig >> index a4130e643342..b22c3cf96560 100644 >> --- a/drivers/net/ethernet/8390/Kconfig >> +++ b/drivers/net/ethernet/8390/Kconfig >> @@ -136,6 +136,8 @@ config NE2K_PCI >> config APNE >> tristate "PCMCIA NE2000 support" >> depends on AMIGA_PCMCIA >> + select PCCARD >> + select PCMCIA >> select CRC32 > > Hi, > > There are no other drivers that "select PCCARD" or > "select PCMCIA" in the entire kernel tree. > I don't see any good justification to allow it here. Amiga doesn't use anything from the core PCMCIA code, instead providing its own basic PCMCIA support code. I had initially duplicated some of the cis tuple parser code, but decided to use what's already there instead. I can drop these selects, and add instructions to manually select these options in the Kconfig help section. Seemed a little error prone to me. Cheers, Michael
On 11/8/21 8:55 PM, Michael Schmitz wrote: > Hi Randy, > > On 09/11/21 17:09, Randy Dunlap wrote: >> On 11/8/21 8:02 PM, Michael Schmitz wrote: >>> diff --git a/drivers/net/ethernet/8390/Kconfig >>> b/drivers/net/ethernet/8390/Kconfig >>> index a4130e643342..b22c3cf96560 100644 >>> --- a/drivers/net/ethernet/8390/Kconfig >>> +++ b/drivers/net/ethernet/8390/Kconfig >>> @@ -136,6 +136,8 @@ config NE2K_PCI >>> config APNE >>> tristate "PCMCIA NE2000 support" >>> depends on AMIGA_PCMCIA >>> + select PCCARD >>> + select PCMCIA >>> select CRC32 >> >> Hi, >> >> There are no other drivers that "select PCCARD" or >> "select PCMCIA" in the entire kernel tree. >> I don't see any good justification to allow it here. > > Amiga doesn't use anything from the core PCMCIA code, instead providing its own basic PCMCIA support code. > > I had initially duplicated some of the cis tuple parser code, but decided to use what's already there instead. > > I can drop these selects, and add instructions to manually select these options in the Kconfig help section. Seemed a little error prone to me. Just make it the same as other drivers in this respect, please.
Hi Randy, On 09/11/21 18:44, Randy Dunlap wrote: > On 11/8/21 8:55 PM, Michael Schmitz wrote: >> Hi Randy, >> >> On 09/11/21 17:09, Randy Dunlap wrote: >>> On 11/8/21 8:02 PM, Michael Schmitz wrote: >>>> diff --git a/drivers/net/ethernet/8390/Kconfig >>>> b/drivers/net/ethernet/8390/Kconfig >>>> index a4130e643342..b22c3cf96560 100644 >>>> --- a/drivers/net/ethernet/8390/Kconfig >>>> +++ b/drivers/net/ethernet/8390/Kconfig >>>> @@ -136,6 +136,8 @@ config NE2K_PCI >>>> config APNE >>>> tristate "PCMCIA NE2000 support" >>>> depends on AMIGA_PCMCIA >>>> + select PCCARD >>>> + select PCMCIA >>>> select CRC32 >>> >>> Hi, >>> >>> There are no other drivers that "select PCCARD" or >>> "select PCMCIA" in the entire kernel tree. >>> I don't see any good justification to allow it here. >> >> Amiga doesn't use anything from the core PCMCIA code, instead >> providing its own basic PCMCIA support code. >> >> I had initially duplicated some of the cis tuple parser code, but >> decided to use what's already there instead. >> >> I can drop these selects, and add instructions to manually select >> these options in the Kconfig help section. Seemed a little error prone >> to me. > > Just make it the same as other drivers in this respect, please. "depends on PCMCIA" is what I've seen for other drivers. That is not really appropriate for the APNE driver (8 bit cards work fine with just the support code from arch/m68k/amiga/pcmcia.c). Please confirm that "depends on PCMCIA" is what you want me to use? Cheers, Michael
On 11/9/21 11:19 AM, Michael Schmitz wrote: > Hi Randy, > > On 09/11/21 18:44, Randy Dunlap wrote: >> On 11/8/21 8:55 PM, Michael Schmitz wrote: >>> Hi Randy, >>> >>> On 09/11/21 17:09, Randy Dunlap wrote: >>>> On 11/8/21 8:02 PM, Michael Schmitz wrote: >>>>> diff --git a/drivers/net/ethernet/8390/Kconfig >>>>> b/drivers/net/ethernet/8390/Kconfig >>>>> index a4130e643342..b22c3cf96560 100644 >>>>> --- a/drivers/net/ethernet/8390/Kconfig >>>>> +++ b/drivers/net/ethernet/8390/Kconfig >>>>> @@ -136,6 +136,8 @@ config NE2K_PCI >>>>> config APNE >>>>> tristate "PCMCIA NE2000 support" >>>>> depends on AMIGA_PCMCIA >>>>> + select PCCARD >>>>> + select PCMCIA >>>>> select CRC32 >>>> >>>> Hi, >>>> >>>> There are no other drivers that "select PCCARD" or >>>> "select PCMCIA" in the entire kernel tree. >>>> I don't see any good justification to allow it here. >>> >>> Amiga doesn't use anything from the core PCMCIA code, instead >>> providing its own basic PCMCIA support code. >>> >>> I had initially duplicated some of the cis tuple parser code, but >>> decided to use what's already there instead. >>> >>> I can drop these selects, and add instructions to manually select >>> these options in the Kconfig help section. Seemed a little error prone >>> to me. >> >> Just make it the same as other drivers in this respect, please. > > "depends on PCMCIA" is what I've seen for other drivers. That is not really appropriate for the APNE driver (8 bit cards work fine with just the support code from arch/m68k/amiga/pcmcia.c). > > Please confirm that "depends on PCMCIA" is what you want me to use? Hi Michael, I don't want to see this driver using 'select', so that probably only leaves "depends on". But if you or Geert tell me that I am bonkers, so be it. :) Thanks.
Geert, On 10/11/21 08:25, Randy Dunlap wrote: >>>>> There are no other drivers that "select PCCARD" or >>>>> "select PCMCIA" in the entire kernel tree. >>>>> I don't see any good justification to allow it here. >>>> >>>> Amiga doesn't use anything from the core PCMCIA code, instead >>>> providing its own basic PCMCIA support code. >>>> >>>> I had initially duplicated some of the cis tuple parser code, but >>>> decided to use what's already there instead. >>>> >>>> I can drop these selects, and add instructions to manually select >>>> these options in the Kconfig help section. Seemed a little error prone >>>> to me. >>> >>> Just make it the same as other drivers in this respect, please. >> >> "depends on PCMCIA" is what I've seen for other drivers. That is not >> really appropriate for the APNE driver (8 bit cards work fine with >> just the support code from arch/m68k/amiga/pcmcia.c). >> >> Please confirm that "depends on PCMCIA" is what you want me to use? > > Hi Michael, > > I don't want to see this driver using 'select', so that probably only > leaves "depends on". > But if you or Geert tell me that I am bonkers, so be it. :) Are you OK with adding CONFIG_PCCARD=y and CONFIG_PCMCIA=y to amiga_defconfig to allow APNE to still be built when changed to depend on PCMCIA? Cheers, Michael > > Thanks.
Hi Michael, On Tue, Nov 9, 2021 at 8:39 PM Michael Schmitz <schmitzmic@gmail.com> wrote: > On 10/11/21 08:25, Randy Dunlap wrote: > >>>>> There are no other drivers that "select PCCARD" or > >>>>> "select PCMCIA" in the entire kernel tree. > >>>>> I don't see any good justification to allow it here. > >>>> > >>>> Amiga doesn't use anything from the core PCMCIA code, instead > >>>> providing its own basic PCMCIA support code. > >>>> > >>>> I had initially duplicated some of the cis tuple parser code, but > >>>> decided to use what's already there instead. > >>>> > >>>> I can drop these selects, and add instructions to manually select > >>>> these options in the Kconfig help section. Seemed a little error prone > >>>> to me. > >>> > >>> Just make it the same as other drivers in this respect, please. > >> > >> "depends on PCMCIA" is what I've seen for other drivers. That is not > >> really appropriate for the APNE driver (8 bit cards work fine with > >> just the support code from arch/m68k/amiga/pcmcia.c). > >> > >> Please confirm that "depends on PCMCIA" is what you want me to use? > > > > Hi Michael, > > > > I don't want to see this driver using 'select', so that probably only > > leaves "depends on". > > But if you or Geert tell me that I am bonkers, so be it. :) > > Are you OK with adding CONFIG_PCCARD=y and CONFIG_PCMCIA=y to > amiga_defconfig to allow APNE to still be built when changed to depend > on PCMCIA? Sure. When they become dependencies for APNE, I will update them in the next defconfig refresh. 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
diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig index a4130e643342..b22c3cf96560 100644 --- a/drivers/net/ethernet/8390/Kconfig +++ b/drivers/net/ethernet/8390/Kconfig @@ -136,6 +136,8 @@ config NE2K_PCI config APNE tristate "PCMCIA NE2000 support" depends on AMIGA_PCMCIA + select PCCARD + select PCMCIA select CRC32 help If you have a PCMCIA NE2000 compatible adapter, say Y. Otherwise, @@ -144,6 +146,13 @@ config APNE To compile this driver as a module, choose M here: the module will be called apne. + The driver also supports 10/100Mbit cards (e.g. Netgear FA411, + CNet Singlepoint). To activate 100 Mbit support, use the kernel + option apne.100mbit=1 (builtin) at boot time, or the apne.100mbit + module parameter. The driver will attempt to autoprobe 100 Mbit + mode, so this option may not be necessary. Use apne.100mbit=0 + should autoprobe mis-detect a 100 Mbit card. + 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 da1ae37a9d73..74dcad8563d4 100644 --- a/drivers/net/ethernet/8390/apne.c +++ b/drivers/net/ethernet/8390/apne.c @@ -87,6 +87,7 @@ static void apne_block_output(struct net_device *dev, const int count, static irqreturn_t apne_interrupt(int irq, void *dev_id); static int init_pcmcia(void); +static int pcmcia_is_16bit(void); /* IO base address used for nic */ @@ -119,6 +120,10 @@ 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)"); +static int apne_100_mbit = -1; +module_param_named(100_mbit, apne_100_mbit, int, 0444); +MODULE_PARM_DESC(100_mbit, "Enable 100 Mbit support"); + static struct net_device * __init apne_probe(void) { struct net_device *dev; @@ -140,6 +145,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"); @@ -167,6 +179,14 @@ static struct net_device * __init apne_probe(void) pr_cont("ethernet PCMCIA card inserted\n"); +#if IS_ENABLED(CONFIG_PCMCIA) + if (apne_100_mbit < 0 && pcmcia_is_16bit()) { + pr_info("16-bit PCMCIA card detected!\n"); + isa_type = ISA_TYPE_AG16; + apne_100_mbit = 1; + } +#endif + if (!init_pcmcia()) { /* XXX: shouldn't we re-enable irq here? */ free_netdev(dev); @@ -583,6 +603,16 @@ static int init_pcmcia(void) #endif u_long offset; + /* reset card (idea taken from CardReset by Artur Pogoda) */ + if (isa_type == ISA_TYPE_AG16) { + u_char tmp = 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); @@ -616,4 +646,42 @@ static int init_pcmcia(void) return 1; } +#if IS_ENABLED(CONFIG_PCMCIA) +static int pcmcia_is_16bit(void) +{ + u_char cftuple[258]; + int cftuple_len; + tuple_t cftable_tuple; + cistpl_cftable_entry_t cftable_entry; + + cftuple_len = pcmcia_copy_tuple(CISTPL_CFTABLE_ENTRY, cftuple, 256); + if (cftuple_len < 3) + return 0; +#ifdef DEBUG + else + print_hex_dump(KERN_WARNING, "cftable: ", DUMP_PREFIX_NONE, 8, + sizeof(char), cftuple, cftuple_len, false); +#endif + + /* build tuple_t struct and call pcmcia_parse_tuple */ + cftable_tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; + cftable_tuple.TupleCode = CISTPL_CFTABLE_ENTRY; + cftable_tuple.TupleData = &cftuple[2]; + cftable_tuple.TupleDataLen = cftuple_len - 2; + cftable_tuple.TupleDataMax = cftuple_len - 2; + + if (pcmcia_parse_tuple(&cftable_tuple, (cisparse_t *)&cftable_entry)) + return 0; + +#ifdef DEBUG + pr_info("IO flags: %x\n", cftable_entry.io.flags); +#endif + + if (cftable_entry.io.flags & CISTPL_IO_16BIT) + return 1; + + return 0; +} +#endif + MODULE_LICENSE("GPL");