Re: [PATCH 08/10] net: ax88796: Make reset more robust on AX88796B
[Andrew, sorry for the dup. I did hit reply-to-auhor instead of reply-to-all first.] Andrew Lunn schrieb: >> > This should really be fixed in the PHY driver, not the MAC. >> >> OK - do you want this separate, or as part of this series? Might have >> a few side effects on more commonly used hardware, perhaps? > > Hi Michael > > What PHY driver is used? The ax88796b comes with its own integrated (buggy) PHY needing this workaround. This PHY has its own ID which is not known by Linux, so it is using the genphy driver as fallback. > In the driver you can implement a .soft_reset > function which first does the dummy write, and then uses > genphy_soft_reset() to do the actual reset. We could do that - but I dont't see the point in creating a PHY driver that is only ever used by this MAC driver, just to add a single line to the genphy driver. If the same PHY might be used with a different MAC, you definitely would have a point there, though. Kind regards, Michael Karcher -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 00/10] SWIM driver fixes
On Tue, Apr 17 2018, Finn Thain wrote: > On Wed, 11 Apr 2018, I wrote: > > > This patch series has fixes for bugs in the SWIM floppy disk controller > > driver, including an oops and a soft lockup. > > > > Apparently no-one is authorized to push this series intact. > > Geert, would you please take just the first two patches? > > Jens, would you please take the remaining 8 patches? > > I have confirmed that no merge conflicts or bisection issues arise from > splitting up this series in this way. However, I can re-send these patches > as separate submission(s) if need be... I've picked up 3-10, thanks. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/8] net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()).
From: John Paul Adrian GlaubitzThis complements the fix in 82533ad9a1c that removed the free_irq call in the error path of probe, to also not call free_irq when remove is called to revert the effects of probe. Signed-off-by: Michael Karcher --- drivers/net/ethernet/8390/ax88796.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 83e59ae..ecf104c 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -793,7 +793,6 @@ static int ax_remove(struct platform_device *pdev) struct resource *mem; unregister_netdev(dev); - free_irq(dev->irq, dev); iounmap(ei_local->mem); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/8] net: ax88796: Add block_input/output hooks to ax_plat_data
Add platform specific hooks for block transfer reads/writes of packet buffer data, superseding the default provided ax_block_input/output. Currently used for m68k Amiga XSurf100. Signed-off-by: Michael KarcherSigned-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c | 10 -- include/net/ax88796.h |9 - 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index ecf104c..29cde38 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -760,8 +760,14 @@ static int ax_init_dev(struct net_device *dev) #endif ei_local->reset_8390 = _reset_8390; - ei_local->block_input = _block_input; - ei_local->block_output = _block_output; + if (ax->plat->block_input) + ei_local->block_input = ax->plat->block_input; + else + ei_local->block_input = _block_input; + if (ax->plat->block_output) + ei_local->block_output = ax->plat->block_output; + else + ei_local->block_output = _block_output; ei_local->get_8390_hdr = _get_8390_hdr; ei_local->priv = 0; ei_local->msg_enable = ax_msg_enable; diff --git a/include/net/ax88796.h b/include/net/ax88796.h index b9a3bec..26cc459 100644 --- a/include/net/ax88796.h +++ b/include/net/ax88796.h @@ -8,10 +8,11 @@ * published by the Free Software Foundation. * */ - #ifndef __NET_AX88796_PLAT_H #define __NET_AX88796_PLAT_H +struct net_device; + #define AXFLG_HAS_EEPROM (1<<0) #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ #define AXFLG_HAS_93CX6(1<<2) /* use eeprom_93cx6 driver */ @@ -26,6 +27,12 @@ struct ax_plat_data { u32 *reg_offsets; /* register offsets */ u8 *mac_addr; /* MAC addr (only used when AXFLG_MAC_FROMPLATFORM is used */ + + /* uses default ax88796 buffer if set to NULL */ + void (*block_output)(struct net_device *dev, int count, + const unsigned char *buf, int star_page); + void (*block_input)(struct net_device *dev, int count, + struct sk_buff *skb, int ring_offset); }; #endif /* __NET_AX88796_PLAT_H */ -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/8] net: ax88796: Attach MII bus only when open
From: Michael KarcherCall ax_mii_init in ax_open(), and unregister/remove mdiobus resources in ax_close(). This is needed to be able to unload the module, as the module is busy while the MII bus is attached. Signed-off-by: Michael Karcher Signed-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c | 183 ++- 1 files changed, 95 insertions(+), 88 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 2a256aa..83e59ae 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -389,6 +389,90 @@ static void ax_phy_switch(struct net_device *dev, int on) ei_outb(reg_gpoc, ei_local->mem + EI_SHIFT(0x17)); } +static void ax_bb_mdc(struct mdiobb_ctrl *ctrl, int level) +{ + struct ax_device *ax = container_of(ctrl, struct ax_device, bb_ctrl); + + if (level) + ax->reg_memr |= AX_MEMR_MDC; + else + ax->reg_memr &= ~AX_MEMR_MDC; + + ei_outb(ax->reg_memr, ax->addr_memr); +} + +static void ax_bb_dir(struct mdiobb_ctrl *ctrl, int output) +{ + struct ax_device *ax = container_of(ctrl, struct ax_device, bb_ctrl); + + if (output) + ax->reg_memr &= ~AX_MEMR_MDIR; + else + ax->reg_memr |= AX_MEMR_MDIR; + + ei_outb(ax->reg_memr, ax->addr_memr); +} + +static void ax_bb_set_data(struct mdiobb_ctrl *ctrl, int value) +{ + struct ax_device *ax = container_of(ctrl, struct ax_device, bb_ctrl); + + if (value) + ax->reg_memr |= AX_MEMR_MDO; + else + ax->reg_memr &= ~AX_MEMR_MDO; + + ei_outb(ax->reg_memr, ax->addr_memr); +} + +static int ax_bb_get_data(struct mdiobb_ctrl *ctrl) +{ + struct ax_device *ax = container_of(ctrl, struct ax_device, bb_ctrl); + int reg_memr = ei_inb(ax->addr_memr); + + return reg_memr & AX_MEMR_MDI ? 1 : 0; +} + +static const struct mdiobb_ops bb_ops = { + .owner = THIS_MODULE, + .set_mdc = ax_bb_mdc, + .set_mdio_dir = ax_bb_dir, + .set_mdio_data = ax_bb_set_data, + .get_mdio_data = ax_bb_get_data, +}; + +static int ax_mii_init(struct net_device *dev) +{ + struct platform_device *pdev = to_platform_device(dev->dev.parent); + struct ei_device *ei_local = netdev_priv(dev); + struct ax_device *ax = to_ax_dev(dev); + int err; + + ax->bb_ctrl.ops = _ops; + ax->addr_memr = ei_local->mem + AX_MEMR; + ax->mii_bus = alloc_mdio_bitbang(>bb_ctrl); + if (!ax->mii_bus) { + err = -ENOMEM; + goto out; + } + + ax->mii_bus->name = "ax88796_mii_bus"; + ax->mii_bus->parent = dev->dev.parent; + snprintf(ax->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", + pdev->name, pdev->id); + + err = mdiobus_register(ax->mii_bus); + if (err) + goto out_free_mdio_bitbang; + + return 0; + + out_free_mdio_bitbang: + free_mdio_bitbang(ax->mii_bus); + out: + return err; +} + static int ax_open(struct net_device *dev) { struct ax_device *ax = to_ax_dev(dev); @@ -396,6 +480,10 @@ static int ax_open(struct net_device *dev) netdev_dbg(dev, "open\n"); + ret = ax_mii_init(dev); + if (ret) + goto failed_mii; + ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, dev->name, dev); if (ret) @@ -423,6 +511,10 @@ static int ax_open(struct net_device *dev) ax_phy_switch(dev, 0); free_irq(dev->irq, dev); failed_request_irq: + /* unregister mdiobus */ + mdiobus_unregister(ax->mii_bus); + free_mdio_bitbang(ax->mii_bus); + failed_mii: return ret; } @@ -442,6 +534,9 @@ static int ax_close(struct net_device *dev) phy_disconnect(dev->phydev); free_irq(dev->irq, dev); + + mdiobus_unregister(ax->mii_bus); + free_mdio_bitbang(ax->mii_bus); return 0; } @@ -541,92 +636,8 @@ static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom) #endif }; -static void ax_bb_mdc(struct mdiobb_ctrl *ctrl, int level) -{ - struct ax_device *ax = container_of(ctrl, struct ax_device, bb_ctrl); - - if (level) - ax->reg_memr |= AX_MEMR_MDC; - else - ax->reg_memr &= ~AX_MEMR_MDC; - - ei_outb(ax->reg_memr, ax->addr_memr); -} - -static void ax_bb_dir(struct mdiobb_ctrl *ctrl, int output) -{ - struct ax_device *ax = container_of(ctrl, struct ax_device, bb_ctrl); - - if (output) - ax->reg_memr &= ~AX_MEMR_MDIR; - else - ax->reg_memr |= AX_MEMR_MDIR; - - ei_outb(ax->reg_memr, ax->addr_memr); -} - -static void ax_bb_set_data(struct mdiobb_ctrl *ctrl, int value) -{ - struct ax_device *ax = container_of(ctrl,
[PATCH v2 0/8] New network driver for Amiga X-Surf 100 (m68k)
This patch series adds support for the Individual Computers X-Surf 100 network card for m68k Amiga, a network adapter based on the AX88796 chip set. The driver was originally written for kernel version 3.19 by Michael Karcher (see CC:), and adapted to 4.16 for submission to netdev by me. Questions regarding motivation for some of the changes are probably best directed at Michael Karcher. The driver has been tested by Adrianwho will send his Tested-by tag separately. A few changes to the ax88796 driver were required: - to read the MAC address, some setup of the ax99796 chip must be done, - attach to the MII bus only on device open to allow module unloading, - allow to supersede ax_block_input/ax_block_output by card-specific optimized code, - use an optional interrupt status callback to allow easier sharing of the card interrupt, - set IRQF_SHARED if platform IRQ resource is marked shareable, Some additional cleanup: - do not attempt to free IRQ in ax_remove (complements 82533ad9a1c), - clear platform drvdata on probe fail and module remove. Changes since v1: Raised in review by Andrew Lunn: - move MII code around to avoid need for forward declaration - combine patches 2 and 7 to add cleanup in error path The patch series, in order: 1/8 net: ax88796: Fix MAC address reading 2/8 net: ax88796: Attach MII bus only when open 3/8 net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()). 4/8 net: ax88796: Add block_input/output hooks to ax_plat_data 5/8 net: ax88796: add interrupt status callback to platform data 6/8 net: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable 7/8 net: ax88796: release platform device drvdata on probe error and module remove 8/8 net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k) drivers/net/ethernet/8390/Kconfig| 14 +- drivers/net/ethernet/8390/Makefile |1 + drivers/net/ethernet/8390/ax88796.c | 228 +++ drivers/net/ethernet/8390/xsurf100.c | 411 ++ include/net/ax88796.h| 14 +- 5 files changed, 573 insertions(+), 95 deletions(-) Cheers, Michael -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/8] net: ax88796: add interrupt status callback to platform data
To be able to tell the ax88796 driver whether it is sensible to enter the 8390 interrupt handler, an "is this interrupt caused by the 88796" callback has been added to the ax_plat_data structure (with NULL being compatible to the previous behaviour). Signed-off-by: Michael KarcherSigned-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c | 23 +-- include/net/ax88796.h |5 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 29cde38..c799441 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -165,6 +165,21 @@ static void ax_reset_8390(struct net_device *dev) ei_outb(ENISR_RESET, addr + EN0_ISR); /* Ack intr. */ } +/* Wrapper for __ei_interrupt for platforms that have a platform-specific + * way to find out whether the interrupt request might be caused by + * the ax88796 chip. + */ +static irqreturn_t ax_ei_interrupt_filtered(int irq, void *dev_id) +{ + struct net_device *dev = dev_id; + struct ax_device *ax = to_ax_dev(dev); + struct platform_device *pdev = to_platform_device(dev->dev.parent); + + if (!ax->plat->check_irq(pdev)) + return IRQ_NONE; + + return ax_ei_interrupt(irq, dev_id); +} static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) @@ -484,8 +499,12 @@ static int ax_open(struct net_device *dev) if (ret) goto failed_mii; - ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, - dev->name, dev); + if (ax->plat->check_irq) + ret = request_irq(dev->irq, ax_ei_interrupt_filtered, + ax->irqflags, dev->name, dev); + else + ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, + dev->name, dev); if (ret) goto failed_request_irq; diff --git a/include/net/ax88796.h b/include/net/ax88796.h index 26cc459..26412cd 100644 --- a/include/net/ax88796.h +++ b/include/net/ax88796.h @@ -12,6 +12,7 @@ #define __NET_AX88796_PLAT_H struct net_device; +struct platform_device; #define AXFLG_HAS_EEPROM (1<<0) #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ @@ -33,6 +34,10 @@ struct ax_plat_data { const unsigned char *buf, int star_page); void (*block_input)(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset); + /* returns nonzero if a pending interrupt request might by caused by +* the ax88786. Handles all interrupts if set to NULL +*/ + int (*check_irq)(struct platform_device *pdev); }; #endif /* __NET_AX88796_PLAT_H */ -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 7/8] net: ax88796: release platform device drvdata on probe error and module remove
The net device struct pointer is stored as platform device drvdata on module probe - clear the drvdata entry on probe fail there, as well as when unloading the module. Signed-off-by: Michael Schmitz--- drivers/net/ethernet/8390/ax88796.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index a72dfbc..eb72282 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -829,6 +829,7 @@ static int ax_remove(struct platform_device *pdev) release_mem_region(mem->start, resource_size(mem)); } + platform_set_drvdata(pdev, NULL); free_netdev(dev); return 0; @@ -962,6 +963,7 @@ static int ax_probe(struct platform_device *pdev) release_mem_region(mem->start, mem_size); exit_mem: + platform_set_drvdata(pdev, NULL); free_netdev(dev); return ret; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/8] net: ax88796: Fix MAC address reading
From: Michael KarcherTo read the MAC address from the (virtual) SAprom, the remote DMA unit needs to be set up like for every other process access to card-local memory. Signed-off-by: Michael Karcher Signed-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 2455547..2a256aa 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -671,10 +671,16 @@ static int ax_init_dev(struct net_device *dev) if (ax->plat->flags & AXFLG_HAS_EEPROM) { unsigned char SA_prom[32]; + ei_outb(6, ioaddr + EN0_RCNTLO); + ei_outb(0, ioaddr + EN0_RCNTHI); + ei_outb(0, ioaddr + EN0_RSARLO); + ei_outb(0, ioaddr + EN0_RSARHI); + ei_outb(E8390_RREAD + E8390_START, ioaddr + NE_CMD); for (i = 0; i < sizeof(SA_prom); i += 2) { SA_prom[i] = ei_inb(ioaddr + NE_DATAPORT); SA_prom[i + 1] = ei_inb(ioaddr + NE_DATAPORT); } + ei_outb(ENISR_RDC, ioaddr + EN0_ISR); /* Ack intr. */ if (ax->plat->wordlength == 2) for (i = 0; i < 16; i++) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 8/8] net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k)
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. Signed-off-by: Michael KarcherSigned-off-by: Michael Schmitz --- drivers/net/ethernet/8390/Kconfig| 14 +- drivers/net/ethernet/8390/Makefile |1 + drivers/net/ethernet/8390/xsurf100.c | 411 ++ 3 files changed, 425 insertions(+), 1 deletions(-) create mode 100644 drivers/net/ethernet/8390/xsurf100.c diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig index fdc6734..0cadd45 100644 --- 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) 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 + ---help--- + This driver is for the Individual Computers X-Surf 100 Ethernet + card (based on the Asix AX88796 chip). If you have such a card, + say Y. Otherwise, say N. + + To compile this driver as a module, choose M here: the module + will be called xsurf100. + config HYDRA tristate "Hydra support" depends on ZORRO diff --git a/drivers/net/ethernet/8390/Makefile b/drivers/net/ethernet/8390/Makefile index f975c2f..3715f8d 100644 --- a/drivers/net/ethernet/8390/Makefile +++ b/drivers/net/ethernet/8390/Makefile @@ -16,4 +16,5 @@ obj-$(CONFIG_PCMCIA_PCNET) += pcnet_cs.o 8390.o obj-$(CONFIG_STNIC) += stnic.o 8390.o obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o obj-$(CONFIG_WD80x3) += wd.o 8390.o +obj-$(CONFIG_XSURF100) += xsurf100.o obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o diff --git a/drivers/net/ethernet/8390/xsurf100.c b/drivers/net/ethernet/8390/xsurf100.c new file mode 100644 index 000..3caece0 --- /dev/null +++ b/drivers/net/ethernet/8390/xsurf100.c @@ -0,0 +1,411 @@ +#include +#include +#include +#include +#include +#include + +#define ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF100 \ + ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x64, 0) + +#define XS100_IRQSTATUS_BASE 0x40 +#define XS100_8390_BASE 0x800 + +/* Longword-access area. Translated to 2 16-bit access cycles by the + * X-Surf 100 FPGA + */ +#define XS100_8390_DATA32_BASE 0x8000 +#define XS100_8390_DATA32_SIZE 0x2000 +/* Sub-Areas for fast data register access; addresses relative to area begin */ +#define XS100_8390_DATA_READ32_BASE 0x0880 +#define XS100_8390_DATA_WRITE32_BASE 0x0C80 +#define XS100_8390_DATA_AREA_SIZE 0x80 + +#define __NS8390_init ax_NS8390_init + +/* force unsigned long back to 'void __iomem *' */ +#define ax_convert_addr(_a) ((void __force __iomem *)(_a)) + +#define ei_inb(_a) z_readb(ax_convert_addr(_a)) +#define ei_outb(_v, _a) z_writeb(_v, ax_convert_addr(_a)) + +#define ei_inw(_a) z_readw(ax_convert_addr(_a)) +#define ei_outw(_v, _a) z_writew(_v, ax_convert_addr(_a)) + +#define ei_inb_p(_a) ei_inb(_a) +#define ei_outb_p(_v, _a) ei_outb(_v, _a) + +/* define EI_SHIFT() to take into account our register offsets */ +#define EI_SHIFT(x) (ei_local->reg_offset[(x)]) + +/* Ensure we have our RCR base value */ +#define AX88796_PLATFORM + +static unsigned char version[] = + "ax88796.c: Copyright 2005,2007 Simtec Electronics\n"; + +#include "lib8390.c" + +/* from ne.c */ +#define NE_CMD EI_SHIFT(0x00) +#define NE_RESET EI_SHIFT(0x1f) +#define NE_DATAPORTEI_SHIFT(0x10) + +/* 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; + } + } + + ei_outb(ENISR_RESET, addr + EN0_ISR); /* Ack intr. */ +} + +struct xsurf100_ax_plat_data { +
Re: [PATCH 08/10] net: ax88796: Make reset more robust on AX88796B
> > This should really be fixed in the PHY driver, not the MAC. > > OK - do you want this separate, or as part of this series? Might have > a few side effects on more commonly used hardware, perhaps? Hi Michael What PHY driver is used? In the driver you can implement a .soft_reset function which first does the dummy write, and then uses genphy_soft_reset() to do the actual reset. Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/10] net: ax88796: Make reset more robust on AX88796B
Hi Andrew, On Tue, Apr 17, 2018 at 11:12 AM, Andrew Lunnwrote: > On Tue, Apr 17, 2018 at 10:04:43AM +1200, Michael Schmitz wrote: >> From: John Paul Adrian Glaubitz >> >> The AX88796B as installed on the X-Surf-100 does not recognize a MII reset >> request if the previous write to the MII control register also was a reset >> request. So a dummy write to the control register makes the soft reset in >> the PHY initialization code work. >> >> Signed-off-by: Michael Karcher >> --- >> drivers/net/ethernet/8390/ax88796.c |4 >> 1 files changed, 4 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/net/ethernet/8390/ax88796.c >> b/drivers/net/ethernet/8390/ax88796.c >> index 6af9aca..a2f9a09 100644 >> --- a/drivers/net/ethernet/8390/ax88796.c >> +++ b/drivers/net/ethernet/8390/ax88796.c >> @@ -374,6 +374,10 @@ static int ax_mii_probe(struct net_device *dev) >> return -ENODEV; >> } >> >> + /* write a non-reset pattern to the control register to >> + * re-arm the reset request detection logic (needed on AX88796B) >> + */ >> + phy_write(phy_dev, MII_BMCR, 0); > > This should really be fixed in the PHY driver, not the MAC. OK - do you want this separate, or as part of this series? Might have a few side effects on more commonly used hardware, perhaps? Cheers, Michael > > Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/10] net: ax88796: Attach MII bus only when open
Hi Andrew, thank you for reviewing this series! On Tue, Apr 17, 2018 at 10:59 AM, Andrew Lunnwrote: > On Tue, Apr 17, 2018 at 10:04:37AM +1200, Michael Schmitz wrote: >> From: Michael Karcher >> >> Call ax_mii_init in ax_open(), and unregister/remove mdiobus resources >> in ax_close(). >> >> This is needed to be able to unload the module, as the module is busy >> while the MII bus is attached. >> >> Signed-off-by: Michael Karcher >> Signed-off-by: Michael Schmitz >> --- >> drivers/net/ethernet/8390/ax88796.c | 13 + >> 1 files changed, 9 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/net/ethernet/8390/ax88796.c >> b/drivers/net/ethernet/8390/ax88796.c >> index 2a256aa..f7b8911 100644 >> --- a/drivers/net/ethernet/8390/ax88796.c >> +++ b/drivers/net/ethernet/8390/ax88796.c >> @@ -79,6 +79,8 @@ >> >> static u32 ax_msg_enable; >> >> +static int ax_mii_init(struct net_device *dev); > > Hi Michael > > We try to avoid forward declarations. Please can you move > ax_mii_init() so this is not needed. Done that - had to move the entire bitbang stuff along with ax_mii_init() though. >> + >> /* device private data */ >> >> struct ax_device { >> @@ -396,6 +398,10 @@ static int ax_open(struct net_device *dev) >> >> netdev_dbg(dev, "open\n"); >> >> + ret = ax_mii_init(dev); >> + if (ret) >> + goto failed_request_irq; >> + >> ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, >> dev->name, dev); >> if (ret) > > You are missing some cleanup on error at the end of ax_open(). > It was also missing before. Yep, that's addressed in patch 7 of this series. I'll fold that into this one for clarity. Cheers, Michael > >Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 00/10] SWIM driver fixes
On Wed, 11 Apr 2018, I wrote: > This patch series has fixes for bugs in the SWIM floppy disk controller > driver, including an oops and a soft lockup. > Apparently no-one is authorized to push this series intact. Geert, would you please take just the first two patches? Jens, would you please take the remaining 8 patches? I have confirmed that no merge conflicts or bisection issues arise from splitting up this series in this way. However, I can re-send these patches as separate submission(s) if need be... -- -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/10] net: ax88796: Make reset more robust on AX88796B
On Tue, Apr 17, 2018 at 10:04:43AM +1200, Michael Schmitz wrote: > From: John Paul Adrian Glaubitz> > The AX88796B as installed on the X-Surf-100 does not recognize a MII reset > request if the previous write to the MII control register also was a reset > request. So a dummy write to the control register makes the soft reset in > the PHY initialization code work. > > Signed-off-by: Michael Karcher > --- > drivers/net/ethernet/8390/ax88796.c |4 > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/ethernet/8390/ax88796.c > b/drivers/net/ethernet/8390/ax88796.c > index 6af9aca..a2f9a09 100644 > --- a/drivers/net/ethernet/8390/ax88796.c > +++ b/drivers/net/ethernet/8390/ax88796.c > @@ -374,6 +374,10 @@ static int ax_mii_probe(struct net_device *dev) > return -ENODEV; > } > > + /* write a non-reset pattern to the control register to > + * re-arm the reset request detection logic (needed on AX88796B) > + */ > + phy_write(phy_dev, MII_BMCR, 0); This should really be fixed in the PHY driver, not the MAC. Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/10] net: ax88796: Attach MII bus only when open
On Tue, Apr 17, 2018 at 10:04:37AM +1200, Michael Schmitz wrote: > From: Michael Karcher> > Call ax_mii_init in ax_open(), and unregister/remove mdiobus resources > in ax_close(). > > This is needed to be able to unload the module, as the module is busy > while the MII bus is attached. > > Signed-off-by: Michael Karcher > Signed-off-by: Michael Schmitz > --- > drivers/net/ethernet/8390/ax88796.c | 13 + > 1 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/8390/ax88796.c > b/drivers/net/ethernet/8390/ax88796.c > index 2a256aa..f7b8911 100644 > --- a/drivers/net/ethernet/8390/ax88796.c > +++ b/drivers/net/ethernet/8390/ax88796.c > @@ -79,6 +79,8 @@ > > static u32 ax_msg_enable; > > +static int ax_mii_init(struct net_device *dev); Hi Michael We try to avoid forward declarations. Please can you move ax_mii_init() so this is not needed. > + > /* device private data */ > > struct ax_device { > @@ -396,6 +398,10 @@ static int ax_open(struct net_device *dev) > > netdev_dbg(dev, "open\n"); > > + ret = ax_mii_init(dev); > + if (ret) > + goto failed_request_irq; > + > ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, > dev->name, dev); > if (ret) You are missing some cleanup on error at the end of ax_open(). It was also missing before. Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/10] net: ax88796: Add block_input/output hooks to ax_plat_data
Add platform specific hooks for block transfer reads/writes of packet buffer data, superseding the default provided ax_block_input/output. Currently used for m68k Amiga XSurf100. Signed-off-by: Michael KarcherSigned-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c | 10 -- include/net/ax88796.h |9 - 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index a4f23ba..9159235 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -758,8 +758,14 @@ static int ax_init_dev(struct net_device *dev) #endif ei_local->reset_8390 = _reset_8390; - ei_local->block_input = _block_input; - ei_local->block_output = _block_output; + if (ax->plat->block_input) + ei_local->block_input = ax->plat->block_input; + else + ei_local->block_input = _block_input; + if (ax->plat->block_output) + ei_local->block_output = ax->plat->block_output; + else + ei_local->block_output = _block_output; ei_local->get_8390_hdr = _get_8390_hdr; ei_local->priv = 0; ei_local->msg_enable = ax_msg_enable; diff --git a/include/net/ax88796.h b/include/net/ax88796.h index b9a3bec..26cc459 100644 --- a/include/net/ax88796.h +++ b/include/net/ax88796.h @@ -8,10 +8,11 @@ * published by the Free Software Foundation. * */ - #ifndef __NET_AX88796_PLAT_H #define __NET_AX88796_PLAT_H +struct net_device; + #define AXFLG_HAS_EEPROM (1<<0) #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ #define AXFLG_HAS_93CX6(1<<2) /* use eeprom_93cx6 driver */ @@ -26,6 +27,12 @@ struct ax_plat_data { u32 *reg_offsets; /* register offsets */ u8 *mac_addr; /* MAC addr (only used when AXFLG_MAC_FROMPLATFORM is used */ + + /* uses default ax88796 buffer if set to NULL */ + void (*block_output)(struct net_device *dev, int count, + const unsigned char *buf, int star_page); + void (*block_input)(struct net_device *dev, int count, + struct sk_buff *skb, int ring_offset); }; #endif /* __NET_AX88796_PLAT_H */ -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/10] net: ax88796: unregister mdiobus on ax_mii_init() fail
From: Michael SchmitzUnregister and free up mdiobus resources if ax_mii_init() failed. Signed-off-by: Michael Karcher Signed-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index b09cdc6..6af9aca 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -415,7 +415,7 @@ static int ax_open(struct net_device *dev) ret = ax_mii_init(dev); if (ret) - goto failed_request_irq; + goto failed_mii; if (ax->plat->check_irq) ret = request_irq(dev->irq, ax_ei_interrupt_filtered, @@ -448,6 +448,10 @@ static int ax_open(struct net_device *dev) ax_phy_switch(dev, 0); free_irq(dev->irq, dev); failed_request_irq: + /* unregister mdiobus */ + mdiobus_unregister(ax->mii_bus); + free_mdio_bitbang(ax->mii_bus); + failed_mii: return ret; } -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/10] net: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable
From: John Paul Adrian GlaubitzOn the Amiga X-Surf100, the network card interrupt is shared with many other interrupt sources, so requires the IRQF_SHARED flag to register. Signed-off-by: Michael Karcher Signed-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index b6d5bec..b09cdc6 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -873,6 +873,9 @@ static int ax_probe(struct platform_device *pdev) dev->irq = irq->start; ax->irqflags = irq->flags & IRQF_TRIGGER_MASK; + if (irq->flags & IORESOURCE_IRQ_SHAREABLE) + ax->irqflags |= IRQF_SHARED; + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(>dev, "no MEM specified\n"); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/10] net: ax88796: release platform device drvdata on probe error and module remove
The net device struct pointer is stored as platform device drvdata on module probe - clear the drvdata entry on probe fail there, as well as when unloading the module. Signed-off-by: Michael Schmitz--- drivers/net/ethernet/8390/ax88796.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index a2f9a09..8db6592 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -835,6 +835,7 @@ static int ax_remove(struct platform_device *pdev) release_mem_region(mem->start, resource_size(mem)); } + platform_set_drvdata(pdev, NULL); free_netdev(dev); return 0; @@ -968,6 +969,7 @@ static int ax_probe(struct platform_device *pdev) release_mem_region(mem->start, mem_size); exit_mem: + platform_set_drvdata(pdev, NULL); free_netdev(dev); return ret; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/10] net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()).
From: John Paul Adrian GlaubitzThis complements the fix in 82533ad9a1c that removed the free_irq call in the error path of probe, to also not call free_irq when remove is called to revert the effects of probe. Signed-off-by: Michael Karcher --- drivers/net/ethernet/8390/ax88796.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index f7b8911..a4f23ba 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -791,7 +791,6 @@ static int ax_remove(struct platform_device *pdev) struct resource *mem; unregister_netdev(dev); - free_irq(dev->irq, dev); iounmap(ei_local->mem); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/10] net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k)
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. Signed-off-by: Michael KarcherSigned-off-by: Michael Schmitz --- drivers/net/ethernet/8390/Kconfig| 14 +- drivers/net/ethernet/8390/Makefile |1 + drivers/net/ethernet/8390/xsurf100.c | 411 ++ 3 files changed, 425 insertions(+), 1 deletions(-) create mode 100644 drivers/net/ethernet/8390/xsurf100.c diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig index fdc6734..0cadd45 100644 --- 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) 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 + ---help--- + This driver is for the Individual Computers X-Surf 100 Ethernet + card (based on the Asix AX88796 chip). If you have such a card, + say Y. Otherwise, say N. + + To compile this driver as a module, choose M here: the module + will be called xsurf100. + config HYDRA tristate "Hydra support" depends on ZORRO diff --git a/drivers/net/ethernet/8390/Makefile b/drivers/net/ethernet/8390/Makefile index f975c2f..3715f8d 100644 --- a/drivers/net/ethernet/8390/Makefile +++ b/drivers/net/ethernet/8390/Makefile @@ -16,4 +16,5 @@ obj-$(CONFIG_PCMCIA_PCNET) += pcnet_cs.o 8390.o obj-$(CONFIG_STNIC) += stnic.o 8390.o obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o obj-$(CONFIG_WD80x3) += wd.o 8390.o +obj-$(CONFIG_XSURF100) += xsurf100.o obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o diff --git a/drivers/net/ethernet/8390/xsurf100.c b/drivers/net/ethernet/8390/xsurf100.c new file mode 100644 index 000..3caece0 --- /dev/null +++ b/drivers/net/ethernet/8390/xsurf100.c @@ -0,0 +1,411 @@ +#include +#include +#include +#include +#include +#include + +#define ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF100 \ + ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x64, 0) + +#define XS100_IRQSTATUS_BASE 0x40 +#define XS100_8390_BASE 0x800 + +/* Longword-access area. Translated to 2 16-bit access cycles by the + * X-Surf 100 FPGA + */ +#define XS100_8390_DATA32_BASE 0x8000 +#define XS100_8390_DATA32_SIZE 0x2000 +/* Sub-Areas for fast data register access; addresses relative to area begin */ +#define XS100_8390_DATA_READ32_BASE 0x0880 +#define XS100_8390_DATA_WRITE32_BASE 0x0C80 +#define XS100_8390_DATA_AREA_SIZE 0x80 + +#define __NS8390_init ax_NS8390_init + +/* force unsigned long back to 'void __iomem *' */ +#define ax_convert_addr(_a) ((void __force __iomem *)(_a)) + +#define ei_inb(_a) z_readb(ax_convert_addr(_a)) +#define ei_outb(_v, _a) z_writeb(_v, ax_convert_addr(_a)) + +#define ei_inw(_a) z_readw(ax_convert_addr(_a)) +#define ei_outw(_v, _a) z_writew(_v, ax_convert_addr(_a)) + +#define ei_inb_p(_a) ei_inb(_a) +#define ei_outb_p(_v, _a) ei_outb(_v, _a) + +/* define EI_SHIFT() to take into account our register offsets */ +#define EI_SHIFT(x) (ei_local->reg_offset[(x)]) + +/* Ensure we have our RCR base value */ +#define AX88796_PLATFORM + +static unsigned char version[] = + "ax88796.c: Copyright 2005,2007 Simtec Electronics\n"; + +#include "lib8390.c" + +/* from ne.c */ +#define NE_CMD EI_SHIFT(0x00) +#define NE_RESET EI_SHIFT(0x1f) +#define NE_DATAPORTEI_SHIFT(0x10) + +/* 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; + } + } + + ei_outb(ENISR_RESET, addr + EN0_ISR); /* Ack intr. */ +} + +struct xsurf100_ax_plat_data { +
[PATCH 02/10] net: ax88796: Attach MII bus only when open
From: Michael KarcherCall ax_mii_init in ax_open(), and unregister/remove mdiobus resources in ax_close(). This is needed to be able to unload the module, as the module is busy while the MII bus is attached. Signed-off-by: Michael Karcher Signed-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 2a256aa..f7b8911 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -79,6 +79,8 @@ static u32 ax_msg_enable; +static int ax_mii_init(struct net_device *dev); + /* device private data */ struct ax_device { @@ -396,6 +398,10 @@ static int ax_open(struct net_device *dev) netdev_dbg(dev, "open\n"); + ret = ax_mii_init(dev); + if (ret) + goto failed_request_irq; + ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, dev->name, dev); if (ret) @@ -442,6 +448,9 @@ static int ax_close(struct net_device *dev) phy_disconnect(dev->phydev); free_irq(dev->irq, dev); + + mdiobus_unregister(ax->mii_bus); + free_mdio_bitbang(ax->mii_bus); return 0; } @@ -758,10 +767,6 @@ static int ax_init_dev(struct net_device *dev) dev->netdev_ops = _netdev_ops; dev->ethtool_ops = _ethtool_ops; - ret = ax_mii_init(dev); - if (ret) - goto err_out; - ax_NS8390_init(dev, 0); ret = register_netdev(dev); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/10] net: ax88796: Fix MAC address reading
From: Michael KarcherTo read the MAC address from the (virtual) SAprom, the remote DMA unit needs to be set up like for every other process access to card-local memory. Signed-off-by: Michael Karcher Signed-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 2455547..2a256aa 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -671,10 +671,16 @@ static int ax_init_dev(struct net_device *dev) if (ax->plat->flags & AXFLG_HAS_EEPROM) { unsigned char SA_prom[32]; + ei_outb(6, ioaddr + EN0_RCNTLO); + ei_outb(0, ioaddr + EN0_RCNTHI); + ei_outb(0, ioaddr + EN0_RSARLO); + ei_outb(0, ioaddr + EN0_RSARHI); + ei_outb(E8390_RREAD + E8390_START, ioaddr + NE_CMD); for (i = 0; i < sizeof(SA_prom); i += 2) { SA_prom[i] = ei_inb(ioaddr + NE_DATAPORT); SA_prom[i + 1] = ei_inb(ioaddr + NE_DATAPORT); } + ei_outb(ENISR_RDC, ioaddr + EN0_ISR); /* Ack intr. */ if (ax->plat->wordlength == 2) for (i = 0; i < 16; i++) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/10] net: ax88796: add interrupt status callback to platform data
To be able to tell the ax88796 driver whether it is sensible to enter the 8390 interrupt handler, an "is this interrupt caused by the 88796" callback has been added to the ax_plat_data structure (with NULL being compatible to the previous behaviour). Signed-off-by: Michael KarcherSigned-off-by: Michael Schmitz --- drivers/net/ethernet/8390/ax88796.c | 23 +-- include/net/ax88796.h |5 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c index 9159235..b6d5bec 100644 --- a/drivers/net/ethernet/8390/ax88796.c +++ b/drivers/net/ethernet/8390/ax88796.c @@ -167,6 +167,21 @@ static void ax_reset_8390(struct net_device *dev) ei_outb(ENISR_RESET, addr + EN0_ISR); /* Ack intr. */ } +/* Wrapper for __ei_interrupt for platforms that have a platform-specific + * way to find out whether the interrupt request might be caused by + * the ax88796 chip. + */ +static irqreturn_t ax_ei_interrupt_filtered(int irq, void *dev_id) +{ + struct net_device *dev = dev_id; + struct ax_device *ax = to_ax_dev(dev); + struct platform_device *pdev = to_platform_device(dev->dev.parent); + + if (!ax->plat->check_irq(pdev)) + return IRQ_NONE; + + return ax_ei_interrupt(irq, dev_id); +} static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) @@ -402,8 +417,12 @@ static int ax_open(struct net_device *dev) if (ret) goto failed_request_irq; - ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, - dev->name, dev); + if (ax->plat->check_irq) + ret = request_irq(dev->irq, ax_ei_interrupt_filtered, + ax->irqflags, dev->name, dev); + else + ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags, + dev->name, dev); if (ret) goto failed_request_irq; diff --git a/include/net/ax88796.h b/include/net/ax88796.h index 26cc459..26412cd 100644 --- a/include/net/ax88796.h +++ b/include/net/ax88796.h @@ -12,6 +12,7 @@ #define __NET_AX88796_PLAT_H struct net_device; +struct platform_device; #define AXFLG_HAS_EEPROM (1<<0) #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ @@ -33,6 +34,10 @@ struct ax_plat_data { const unsigned char *buf, int star_page); void (*block_input)(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset); + /* returns nonzero if a pending interrupt request might by caused by +* the ax88786. Handles all interrupts if set to NULL +*/ + int (*check_irq)(struct platform_device *pdev); }; #endif /* __NET_AX88796_PLAT_H */ -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/10] New network driver for Amiga X-Surf 100 (m68k)
This patch series adds support for the Individual Computers X-Surf 100 network card for m68k Amiga, a network adapter based on the AX88796 chip set. The driver was originally written for kernel version 3.19 by Michael Karcher (see CC:), and adapted to 4.16 for submission to netdev by me. Questions regarding motivation for some of the changes are probably best directed at Michael Karcher. The driver has been tested by Adrianwho will send his Tested-by tag separately. A few changes to the ax88796 driver were required: - to read the MAC address, some setup of the ax99796 chip must be done, - attach to the MII bus only on device open to allow module unloading, - allow to supersede ax_block_input/ax_block_output by card-specific optimized code, - use an optional interrupt status callback to allow easier sharing of the card interrupt, - set IRQF_SHARED if platform IRQ resource is marked shareable, - add a dummy control register write to MII reset code so back-to-back reset requests work. Some additional cleanup: - do not attempt to free IRQ in ax_remove (complements 82533ad9a1c), - unregister and free mdiobus resources in ax_mii_init error path, - clear platform drvdata on probe fail and module remove. The patch series, in order: 01/10 net: ax88796: Fix MAC address reading 02/10 net: ax88796: Attach MII bus only when open 03/10 net: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()). 04/10 net: ax88796: Add block_input/output hooks to ax_plat_data 05/10 net: ax88796: add interrupt status callback to platform data 06/10 net: ax88796: set IRQF_SHARED flag when IRQ resource is marked as shareable 07/10 net: ax88796: unregister mdiobus on ax_mii_init() fail 08/10 net: ax88796: Make reset more robust on AX88796B 09/10 net: ax88796: release platform device drvdata on probe error and module remove 10/10 net: New ax88796 platform driver for Amiga X-Surf 100 Zorro board (m68k) drivers/net/ethernet/8390/Kconfig| 14 +- drivers/net/ethernet/8390/Makefile |1 + drivers/net/ethernet/8390/ax88796.c | 66 +- drivers/net/ethernet/8390/xsurf100.c | 411 ++ include/net/ax88796.h| 14 +- 5 files changed, 495 insertions(+), 11 deletions(-) Cheers, Michael Schmitz -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9] scsi: new zorro_esp.c for Amiga Zorro NCR53C9x boards
Thanks guys! Anything else needed for linux-scsi? Cheers, Michael On Mon, Apr 16, 2018 at 10:34 PM, John Paul Adrian Glaubitzwrote: > On 04/16/2018 11:26 AM, Christian T. Steigies wrote: >> >> On Thu, Apr 12, 2018 at 01:53:26PM +1200, Michael Schmitz wrote: >>> >>> From: Michael Schmitz >>> >>> New combined SCSI driver for all ESP based Zorro SCSI boards for >>> m68k Amiga. >>> >>> Code largely based on board specific parts of the old drivers (blz1230.c, >>> blz2060.c, cyberstorm.c, cyberstormII.c, fastlane.c which were removed >>> after the 2.6 kernel series for lack of maintenance) with contributions >>> by Tuomas Vainikka (TCQ bug tests and workaround) and Finn Thain (TCQ >>> bugfix by use of PIO in extended message in transfer). >>> >>> New Kconfig option and Makefile entries for new Amiga Zorro ESP SCSI >>> driver included in this patch. >>> >>> Use DMA transfers wherever possible, with board-specific DMA set-up >>> functions copied from the old driver code. Three byte reselection >>> messages >>> do appear to cause DMA timeouts. So wire up a PIO transfer routine for >>> these instead. esp_reselect_with_tag explicitly sets esp->cmd_block_dma >>> as >>> target address for the message bytes but PIO requires a virtual address. >>> Substiute kernel virtual address esp->cmd_block in PIO transfer call if >>> DMA address is esp->cmd_block_dma and phase is message in. >>> >>> PIO code taken from mac_esp.c where the reselection timeout issue was >>> debugged and fixed first, with minor macro and function rename. >>> >>> Signed-off-by: Michael Schmitz >>> Reviewed-by: Finn Thain >>> Reviewed-by: Christoph Hellwig >> >> Tested-by: Christian T. Steigies >> > > Also here on an Amiga 4000 with Cyberstorm I: > > Tested-by: John Paul Adrian Glaubitz > > -- > .''`. John Paul Adrian Glaubitz > : :' : Debian Developer - glaub...@debian.org > `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de > `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9] scsi: new zorro_esp.c for Amiga Zorro NCR53C9x boards
On 04/16/2018 11:26 AM, Christian T. Steigies wrote: On Thu, Apr 12, 2018 at 01:53:26PM +1200, Michael Schmitz wrote: From: Michael SchmitzNew combined SCSI driver for all ESP based Zorro SCSI boards for m68k Amiga. Code largely based on board specific parts of the old drivers (blz1230.c, blz2060.c, cyberstorm.c, cyberstormII.c, fastlane.c which were removed after the 2.6 kernel series for lack of maintenance) with contributions by Tuomas Vainikka (TCQ bug tests and workaround) and Finn Thain (TCQ bugfix by use of PIO in extended message in transfer). New Kconfig option and Makefile entries for new Amiga Zorro ESP SCSI driver included in this patch. Use DMA transfers wherever possible, with board-specific DMA set-up functions copied from the old driver code. Three byte reselection messages do appear to cause DMA timeouts. So wire up a PIO transfer routine for these instead. esp_reselect_with_tag explicitly sets esp->cmd_block_dma as target address for the message bytes but PIO requires a virtual address. Substiute kernel virtual address esp->cmd_block in PIO transfer call if DMA address is esp->cmd_block_dma and phase is message in. PIO code taken from mac_esp.c where the reselection timeout issue was debugged and fixed first, with minor macro and function rename. Signed-off-by: Michael Schmitz Reviewed-by: Finn Thain Reviewed-by: Christoph Hellwig Tested-by: Christian T. Steigies Also here on an Amiga 4000 with Cyberstorm I: Tested-by: John Paul Adrian Glaubitz -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[m68knommu:for-next 14/15] arch/m68k/include/asm/m525xsim.h:200:31: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git for-next head: a9f947bb3dc755158f69eea147d2ea92e3e4dcfe commit: c7088cea971e9fff1027861025778ab016a16c30 [14/15] m68k: remove local __raw_read/__raw_write macros for non-MMU config: m68k-m5249evb_defconfig (attached as .config) compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout c7088cea971e9fff1027861025778ab016a16c30 # save the attached .config to linux build tree make.cross ARCH=m68k All warnings (new ones prefixed by >>): In file included from arch/m68k/include/asm/mcfsim.h:29:0, from arch/m68k/include/asm/gpio.h:21, from include/linux/gpio.h:59, from arch/m68k/coldfire/device.c:15: arch/m68k/coldfire/device.c: In function 'mcf_uart_set_irq': >> arch/m68k/include/asm/m525xsim.h:46:22: warning: passing argument 2 of >> 'writeb' makes pointer from integer without a cast [-Wint-conversion] #define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */ ^ >> arch/m68k/include/asm/m525xsim.h:148:26: note: in expansion of macro >> 'MCFSIM_ICR4' #define MCFSIM_UART1ICR MCFSIM_ICR4 /* UART 1 ICR */ ^~~ >> arch/m68k/coldfire/device.c:517:46: note: in expansion of macro >> 'MCFSIM_UART1ICR' writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCFSIM_UART1ICR); ^~~ In file included from arch/m68k/include/asm/io_no.h:129:0, from arch/m68k/include/asm/io.h:3, from include/linux/io.h:25, from arch/m68k/coldfire/device.c:13: include/asm-generic/io.h:208:16: note: expected 'volatile void *' but argument is of type 'int' #define writeb writeb ^ include/asm-generic/io.h:209:20: note: in expansion of macro 'writeb' static inline void writeb(u8 value, volatile void __iomem *addr) ^~ In file included from arch/m68k/include/asm/mcfsim.h:29:0, from arch/m68k/include/asm/gpio.h:21, from include/linux/gpio.h:59, from arch/m68k/coldfire/device.c:15: arch/m68k/include/asm/m525xsim.h:103:24: warning: passing argument 2 of 'writeb' makes pointer from integer without a cast [-Wint-conversion] #define MCFUART_BASE0 (MCF_MBAR + 0x1c0) /* Base address UART0 */ ^ >> arch/m68k/coldfire/device.c:518:24: note: in expansion of macro >> 'MCFUART_BASE0' writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); ^ In file included from arch/m68k/include/asm/io_no.h:129:0, from arch/m68k/include/asm/io.h:3, from include/linux/io.h:25, from arch/m68k/coldfire/device.c:13: include/asm-generic/io.h:208:16: note: expected 'volatile void *' but argument is of type 'int' #define writeb writeb ^ include/asm-generic/io.h:209:20: note: in expansion of macro 'writeb' static inline void writeb(u8 value, volatile void __iomem *addr) ^~ In file included from arch/m68k/include/asm/mcfsim.h:29:0, from arch/m68k/include/asm/gpio.h:21, from include/linux/gpio.h:59, from arch/m68k/coldfire/device.c:15: arch/m68k/include/asm/m525xsim.h:47:22: warning: passing argument 2 of 'writeb' makes pointer from integer without a cast [-Wint-conversion] #define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */ ^ >> arch/m68k/include/asm/m525xsim.h:149:26: note: in expansion of macro >> 'MCFSIM_ICR5' #define MCFSIM_UART2ICR MCFSIM_ICR5 /* UART 2 ICR */ ^~~ >> arch/m68k/coldfire/device.c:522:46: note: in expansion of macro >> 'MCFSIM_UART2ICR' writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCFSIM_UART2ICR); ^~~ In file included from arch/m68k/include/asm/io_no.h:129:0, from arch/m68k/include/asm/io.h:3, from include/linux/io.h:25, from arch/m68k/coldfire/device.c:13: include/asm-generic/io.h:208:16: note: expected 'volatile void *' but argument is of type 'int' #define writeb writeb ^ include/asm-generic/io.h:209:20: note: in expansion of macro 'writeb' static inline void writeb(u8 value, volatile void __iomem *addr) ^~ In file included from arch/m68k/include/asm/mcfsim.h:29:0, from arch/m68k/include/asm/gpio.h:21, from include/linux/gpio.h:59, from