linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: netdev <netdev@vger.kernel.org>,
	Linux/m68k <linux-m68k@vger.kernel.org>,
	Michael Karcher <Michael.Karcher@fu-berlin.de>,
	Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Subject: Re: [PATCH 10/10] net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k)
Date: Wed, 18 Apr 2018 10:35:43 +1200	[thread overview]
Message-ID: <CAOmrzkJVPn+zpaJTGhCpc=sSSZhBtbO_2BTGaVDpmNVm+VzAEg@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdUnonyL93AmF3TdPcUPj5ZEuTb59ZgArH5BjLjcx8LcvA@mail.gmail.com>

Hi Geert,

thanks for your suggestions!

On Wed, Apr 18, 2018 at 1:53 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Michael,
>
> Thanks for your patch!
>
> On Tue, Apr 17, 2018 at 12:04 AM, Michael Schmitz <schmitzmic@gmail.com> wrote:
>> Add platform device driver to populate the ax88796 platform data from
>> information provided by the XSurf100 zorro device driver.
>> This driver will have to be loaded before loading the ax88796 module,
>> or compiled as built-in.
>
> Is that really true? The platform device should be probed when both the
> device and driver have been registered, but order shouldn't matter.

Loading the xsurf100 module will pull in the ax88796 module, so order
does not matter. I'll drop that.

>
>> Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
>
> Missing "From: Michael Karcher ..."?

Fixed the authorship now - probably got mangled when squashing in my
local edits.

>
>> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
>
>> --- a/drivers/net/ethernet/8390/Kconfig
>> +++ b/drivers/net/ethernet/8390/Kconfig
>> @@ -30,7 +30,7 @@ config PCMCIA_AXNET
>>
>>  config AX88796
>>         tristate "ASIX AX88796 NE2000 clone support"
>> -       depends on (ARM || MIPS || SUPERH)
>> +       depends on (ARM || MIPS || SUPERH || AMIGA)
>
> s/AMIGA/ZORRO/, for consistency with the below.

Will do.

>
>>         select CRC32
>>         select PHYLIB
>>         select MDIO_BITBANG
>> @@ -45,6 +45,18 @@ config AX88796_93CX6
>>         ---help---
>>           Select this if your platform comes with an external 93CX6 eeprom.
>>
>> +config XSURF100
>> +       tristate "Amiga XSurf 100 AX88796/NE2000 clone support"
>> +       depends on ZORRO
>> +       depends on AX88796
>
> It's a bit unfortunate the user has to enable _two_ config options to enable
> this driver.
>
> I see two solutions for that:
>
> 1) Hide the XSURF100 symbol, so it gets enabled automatically if AX88796 is
>    enabled on a Zorro bus system:
>
>     config XSURF100
>             tristate
>             depends on ZORRO
>             default AX88796
>
> 2) Hide the AX88796 symbol, and let it be selected by XSURF100:
>
>     config AX88796
>             tristate "ASIX AX88796 NE2000 clone support" if !ZORRO
>             depends on ARM || MIPS || SUPERH || ZORRO
>             ...
>
>     config XSURF100
>             tristate "Amiga XSurf 100 AX88796/NE2000 clone support"
>             depends on ZORRO
>             select AX88796

I'll use the latter -

>> --- /dev/null
>> +++ b/drivers/net/ethernet/8390/xsurf100.c
>> @@ -0,0 +1,411 @@
>> +#include <linux/module.h>
>> +#include <linux/netdevice.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/zorro.h>
>> +#include <net/ax88796.h>
>> +#include <asm/amigaints.h>
>> +
>> +#define ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF100 \
>> +               ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x64, 0)
>
> Another long define to get rid of? ;-)
>
>> +/* Hard reset the card. This used to pause for the same period that a
>> + * 8390 reset command required, but that shouldn't be necessary.
>> + */
>> +static void ax_reset_8390(struct net_device *dev)
>> +{
>> +       struct ei_device *ei_local = netdev_priv(dev);
>> +       unsigned long reset_start_time = jiffies;
>> +       void __iomem *addr = (void __iomem *)dev->base_addr;
>> +
>> +       netif_dbg(ei_local, hw, dev, "resetting the 8390 t=%ld...\n", jiffies);
>> +
>> +       ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET);
>> +
>> +       ei_local->txing = 0;
>> +       ei_local->dmaing = 0;
>> +
>> +       /* This check _should_not_ be necessary, omit eventually. */
>> +       while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) {
>> +               if (time_after(jiffies, reset_start_time + 2 * HZ / 100)) {
>> +                       netdev_warn(dev, "%s: did not complete.\n", __func__);
>> +                       break;
>> +               }
>
> cpu_relax()?
>
> How long does this usually take? If > 1 ms, you can use e.g. msleep(1)
> instead of cpu_relax().

No idea how long this will take - the reset function is lifted
straight out of ax88796.c with no modifications whatsoever.

Come to think of it - it's exported as ei_local->reset_8390 there, so
there is no good reason for even duplicating the code that I can see.
I'lll drop it.

>
>> +       }
>> +
>> +       ei_outb(ENISR_RESET, addr + EN0_ISR);   /* Ack intr. */
>> +}
>
>> +       if (ei_local->dmaing) {
>> +               netdev_err(dev,
>> +                          "DMAing conflict in %s "
>> +                          "[DMAstat:%d][irqlock:%d].\n",
>
> Please don't split error messages, as that makes it more difficult to
> grep for them.

Again, found like that in ax88796.c. Will fix here (and eventually in
ax88796.c).

>> +                          __func__,
>> +                          ei_local->dmaing, ei_local->irqlock);
>> +               return;
>
>> +static int xsurf100_probe(struct zorro_dev *zdev,
>> +                         const struct zorro_device_id *ent)
>> +{
>
>> +       /* error handling for ioremap regs */
>> +       if (!ax88796_data.base_regs) {
>> +               dev_err(&zdev->dev, "Cannot ioremap area %p (registers)\n",
>> +                       (void *)zdev->resource.start);
>
> Please use %pR to format struct resource.
> Documentation/core-api/printk-formats.rst

The driver uses ioremap to map two subsections of the mem resource for
two different purposes - control register access, and ring buffer
access. The output of %pR may be misleading here (wrong size), and
even more so below.

>
>> +       /* error handling for ioremap data */
>> +       if (!ax88796_data.data_area) {
>> +               dev_err(&zdev->dev, "Cannot ioremap area %p (32-bit access)\n",
>> +                       (void *)zdev->resource.start + XS100_8390_DATA32_BASE);
>
> %pR

I've added the offset into the mem resource here to clarify what we've
tried to map.

>
>> +static void xsurf100_remove(struct zorro_dev *zdev)
>> +{
>> +       struct platform_device *pdev;
>> +       struct xsurf100_ax_plat_data *xs100;
>> +
>> +       pdev = zorro_get_drvdata(zdev);
>> +       xs100 = dev_get_platdata(&pdev->dev);
>
> struct platform_device *pdev = pdev = zorro_get_drvdata(zdev);
> struct xsurf100_ax_plat_data *xs100 = dev_get_platdata(&pdev->dev);

Of course.

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

  reply	other threads:[~2018-04-17 22:35 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 22:04 [PATCH 00/10] New network driver for Amiga X-Surf 100 (m68k) Michael Schmitz
2018-04-16 22:04 ` [PATCH 01/10] net: ax88796: Fix MAC address reading Michael Schmitz
2018-04-16 22:04 ` [PATCH 02/10] net: ax88796: Attach MII bus only when open Michael Schmitz
2018-04-16 22:59   ` Andrew Lunn
2018-04-16 23:53     ` Michael Schmitz
2018-04-16 22:04 ` [PATCH 03/10] net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()) Michael Schmitz
2018-04-17  9:15   ` Sergei Shtylyov
2018-04-16 22:04 ` [PATCH 04/10] net: ax88796: Add block_input/output hooks to ax_plat_data Michael Schmitz
2018-04-17 18:46   ` kbuild test robot
2018-04-18  0:53     ` Michael Schmitz
2018-04-18  1:19       ` Andrew Lunn
2018-04-18  3:39         ` Michael Schmitz
2018-04-18  1:23       ` Finn Thain
2018-04-18  3:46         ` Michael Schmitz
2018-04-16 22:04 ` [PATCH 05/10] net: ax88796: add interrupt status callback to platform data Michael Schmitz
2018-04-16 22:04 ` [PATCH 06/10] net: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable Michael Schmitz
2018-04-16 22:04 ` [PATCH 07/10] net: ax88796: unregister mdiobus on ax_mii_init() fail Michael Schmitz
2018-04-16 22:04 ` [PATCH 08/10] net: ax88796: Make reset more robust on AX88796B Michael Schmitz
2018-04-16 23:12   ` Andrew Lunn
2018-04-17  0:14     ` Michael Schmitz
2018-04-17  1:32       ` Andrew Lunn
2018-04-17  5:18         ` Michael Karcher
2018-04-17 13:01           ` Andrew Lunn
2018-04-17 18:08             ` Florian Fainelli
2018-04-17 19:25               ` Michael Schmitz
2018-04-16 22:04 ` [PATCH 09/10] net: ax88796: release platform device drvdata on probe error and module remove Michael Schmitz
2018-04-16 22:04 ` [PATCH 10/10] net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k) Michael Schmitz
2018-04-17 13:53   ` Geert Uytterhoeven
2018-04-17 22:35     ` Michael Schmitz [this message]
2018-04-18  7:54       ` Geert Uytterhoeven
2018-04-18  4:32     ` Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 0/8] New network driver for Amiga X-Surf 100 (m68k) Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 00/10] " Michael Schmitz
2018-04-18  5:10     ` Michael Schmitz
2018-04-18  5:45       ` Finn Thain
2018-04-18 21:26         ` Michael Schmitz
2018-04-18 12:19       ` Andrew Lunn
2018-04-18 21:34         ` Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 " Michael Schmitz
2018-04-19  3:17       ` Michael Schmitz
2018-04-19 20:11       ` David Miller
2018-04-19 21:36         ` Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 1/9] net-next: phy: new Asix Electronics PHY driver Michael Schmitz
2018-04-19 12:21       ` Andrew Lunn
2018-04-19 16:15       ` Florian Fainelli
2019-01-18 10:22       ` [v4,1/9] " Thomas Gleixner
2019-01-20 17:43         ` Andrew Lunn
2019-01-20 22:44           ` Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 2/9] net-next: ax88796: Fix MAC address reading Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 3/9] net-next: ax88796: Attach MII bus only when open Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 4/9] net-next: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()) Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 5/9] net-next: ax88796: Add block_input/output hooks to ax_plat_data Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 6/9] net-next: ax88796: add interrupt status callback to platform data Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 7/9] net-next: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 8/9] net-next: ax88796: release platform device drvdata on probe error and module remove Michael Schmitz
2018-04-19  2:05     ` [PATCH v4 9/9] net-next: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k) Michael Schmitz
2018-06-07 14:36       ` Geert Uytterhoeven
2018-06-08  7:31         ` Michael Schmitz
2018-06-08  9:28           ` Michael Karcher
2018-06-09  0:28             ` Michael Schmitz
2018-06-09  9:15               ` Michael Karcher
2018-06-09 20:09                 ` Michael Schmitz
2018-06-09  5:57         ` [RFC PATCH 0/2] net-next: cleanup use of lib8390.c code in xsurf100.c Michael Schmitz
2018-06-09  5:57         ` [RFC PATCH 1/2] net-next: ax88796: export ax_NS8390_init() hook Michael Schmitz
2018-06-09 14:31           ` Geert Uytterhoeven
2018-06-09  5:57         ` [RFC PATCH 2/2] net-next: xsurf100: drop include of lib8390.c Michael Schmitz
2018-06-09 14:33           ` Geert Uytterhoeven
2018-06-09 19:00             ` Michael Schmitz
2018-06-10  4:22             ` [PATCH 0/2] net-next: cleanup use of lib8390.c code in xsurf100.c Michael Schmitz
2018-06-10  4:22             ` [PATCH 1/2] net-next: ax88796: export ax_NS8390_init() hook Michael Schmitz
2018-06-10  9:34               ` Geert Uytterhoeven
2018-06-10  4:22             ` [PATCH 2/2] net-next: xsurf100: drop include of lib8390.c Michael Schmitz
2018-06-10  9:34               ` Geert Uytterhoeven
2021-05-16  9:52               ` Arnd Bergmann
2021-05-18  8:42                 ` Michael Schmitz
2021-05-18 13:56                   ` Arnd Bergmann
2021-05-18 20:33                     ` Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 1/9] net: phy: new Asix Electronics PHY driver Michael Schmitz
2018-04-18  7:04     ` John Paul Adrian Glaubitz
2018-04-18 12:13     ` Andrew Lunn
2018-04-18 22:26       ` Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 2/9] net: ax88796: Fix MAC address reading Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 3/9] net: ax88796: Attach MII bus only when open Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 4/9] net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()) Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 5/9] net: ax88796: Add block_input/output hooks to ax_plat_data Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 6/9] net: ax88796: add interrupt status callback to platform data Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 7/9] net: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 8/9] net: ax88796: release platform device drvdata on probe error and module remove Michael Schmitz
2018-04-18  4:26   ` [PATCH v3 9/9] net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k) Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 1/8] net: ax88796: Fix MAC address reading Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 2/8] net: ax88796: Attach MII bus only when open Michael Schmitz
2018-04-17 13:19   ` Andrew Lunn
2018-04-17  2:08 ` [PATCH v2 3/8] net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()) Michael Schmitz
2018-04-17  8:20   ` Geert Uytterhoeven
2018-04-17 13:51     ` David Miller
2018-04-17 20:36       ` Michael Schmitz
2018-04-17 11:40   ` John Paul Adrian Glaubitz
2018-04-17 20:32     ` Michael Schmitz
2018-04-17 20:42       ` John Paul Adrian Glaubitz
2018-04-17 21:13       ` Andrew Lunn
2018-04-17 21:53         ` Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 4/8] net: ax88796: Add block_input/output hooks to ax_plat_data Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 5/8] net: ax88796: add interrupt status callback to platform data Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 6/8] net: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable Michael Schmitz
2018-04-17 11:40   ` John Paul Adrian Glaubitz
2018-04-17  2:08 ` [PATCH v2 7/8] net: ax88796: release platform device drvdata on probe error and module remove Michael Schmitz
2018-04-17  2:08 ` [PATCH v2 8/8] net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k) Michael Schmitz
2018-04-17 13:26   ` Andrew Lunn
2018-04-17 23:00     ` Michael Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOmrzkJVPn+zpaJTGhCpc=sSSZhBtbO_2BTGaVDpmNVm+VzAEg@mail.gmail.com' \
    --to=schmitzmic@gmail.com \
    --cc=Michael.Karcher@fu-berlin.de \
    --cc=geert@linux-m68k.org \
    --cc=kernel@mkarcher.dialup.fu-berlin.de \
    --cc=linux-m68k@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).