net: wan: remove support for Z85230-based devices
authorJakub Kicinski <kuba@kernel.org>
Tue, 26 Apr 2022 17:54:35 +0000 (10:54 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 Apr 2022 11:22:56 +0000 (12:22 +0100)
Looks like all the changes to this driver had been automated
churn since git era begun. The driver is using virt_to_bus(),
it's just a maintenance burden unlikely to have any users.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/device_drivers/index.rst
Documentation/networking/device_drivers/wan/index.rst [deleted file]
Documentation/networking/device_drivers/wan/z8530book.rst [deleted file]
drivers/net/wan/Kconfig
drivers/net/wan/Makefile
drivers/net/wan/hostess_sv11.c [deleted file]
drivers/net/wan/sealevel.c [deleted file]
drivers/net/wan/z85230.c [deleted file]
drivers/net/wan/z85230.h [deleted file]

index 5f5cfdb..601eaca 100644 (file)
@@ -17,7 +17,6 @@ Contents:
    fddi/index
    hamradio/index
    qlogic/index
-   wan/index
    wifi/index
    wwan/index
 
diff --git a/Documentation/networking/device_drivers/wan/index.rst b/Documentation/networking/device_drivers/wan/index.rst
deleted file mode 100644 (file)
index 9d9ae94..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-
-Classic WAN Device Drivers
-==========================
-
-Contents:
-
-.. toctree::
-   :maxdepth: 2
-
-   z8530book
-
-.. only::  subproject and html
-
-   Indices
-   =======
-
-   * :ref:`genindex`
diff --git a/Documentation/networking/device_drivers/wan/z8530book.rst b/Documentation/networking/device_drivers/wan/z8530book.rst
deleted file mode 100644 (file)
index fea2c40..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-=======================
-Z8530 Programming Guide
-=======================
-
-:Author: Alan Cox
-
-Introduction
-============
-
-The Z85x30 family synchronous/asynchronous controller chips are used on
-a large number of cheap network interface cards. The kernel provides a
-core interface layer that is designed to make it easy to provide WAN
-services using this chip.
-
-The current driver only support synchronous operation. Merging the
-asynchronous driver support into this code to allow any Z85x30 device to
-be used as both a tty interface and as a synchronous controller is a
-project for Linux post the 2.4 release
-
-Driver Modes
-============
-
-The Z85230 driver layer can drive Z8530, Z85C30 and Z85230 devices in
-three different modes. Each mode can be applied to an individual channel
-on the chip (each chip has two channels).
-
-The PIO synchronous mode supports the most common Z8530 wiring. Here the
-chip is interface to the I/O and interrupt facilities of the host
-machine but not to the DMA subsystem. When running PIO the Z8530 has
-extremely tight timing requirements. Doing high speeds, even with a
-Z85230 will be tricky. Typically you should expect to achieve at best
-9600 baud with a Z8C530 and 64Kbits with a Z85230.
-
-The DMA mode supports the chip when it is configured to use dual DMA
-channels on an ISA bus. The better cards tend to support this mode of
-operation for a single channel. With DMA running the Z85230 tops out
-when it starts to hit ISA DMA constraints at about 512Kbits. It is worth
-noting here that many PC machines hang or crash when the chip is driven
-fast enough to hold the ISA bus solid.
-
-Transmit DMA mode uses a single DMA channel. The DMA channel is used for
-transmission as the transmit FIFO is smaller than the receive FIFO. it
-gives better performance than pure PIO mode but is nowhere near as ideal
-as pure DMA mode.
-
-Using the Z85230 driver
-=======================
-
-The Z85230 driver provides the back end interface to your board. To
-configure a Z8530 interface you need to detect the board and to identify
-its ports and interrupt resources. It is also your problem to verify the
-resources are available.
-
-Having identified the chip you need to fill in a struct z8530_dev,
-which describes each chip. This object must exist until you finally
-shutdown the board. Firstly zero the active field. This ensures nothing
-goes off without you intending it. The irq field should be set to the
-interrupt number of the chip. (Each chip has a single interrupt source
-rather than each channel). You are responsible for allocating the
-interrupt line. The interrupt handler should be set to
-:c:func:`z8530_interrupt()`. The device id should be set to the
-z8530_dev structure pointer. Whether the interrupt can be shared or not
-is board dependent, and up to you to initialise.
-
-The structure holds two channel structures. Initialise chanA.ctrlio and
-chanA.dataio with the address of the control and data ports. You can or
-this with Z8530_PORT_SLEEP to indicate your interface needs the 5uS
-delay for chip settling done in software. The PORT_SLEEP option is
-architecture specific. Other flags may become available on future
-platforms, eg for MMIO. Initialise the chanA.irqs to &z8530_nop to
-start the chip up as disabled and discarding interrupt events. This
-ensures that stray interrupts will be mopped up and not hang the bus.
-Set chanA.dev to point to the device structure itself. The private and
-name field you may use as you wish. The private field is unused by the
-Z85230 layer. The name is used for error reporting and it may thus make
-sense to make it match the network name.
-
-Repeat the same operation with the B channel if your chip has both
-channels wired to something useful. This isn't always the case. If it is
-not wired then the I/O values do not matter, but you must initialise
-chanB.dev.
-
-If your board has DMA facilities then initialise the txdma and rxdma
-fields for the relevant channels. You must also allocate the ISA DMA
-channels and do any necessary board level initialisation to configure
-them. The low level driver will do the Z8530 and DMA controller
-programming but not board specific magic.
-
-Having initialised the device you can then call
-:c:func:`z8530_init()`. This will probe the chip and reset it into
-a known state. An identification sequence is then run to identify the
-chip type. If the checks fail to pass the function returns a non zero
-error code. Typically this indicates that the port given is not valid.
-After this call the type field of the z8530_dev structure is
-initialised to either Z8530, Z85C30 or Z85230 according to the chip
-found.
-
-Once you have called z8530_init you can also make use of the utility
-function :c:func:`z8530_describe()`. This provides a consistent
-reporting format for the Z8530 devices, and allows all the drivers to
-provide consistent reporting.
-
-Attaching Network Interfaces
-============================
-
-If you wish to use the network interface facilities of the driver, then
-you need to attach a network device to each channel that is present and
-in use. In addition to use the generic HDLC you need to follow some
-additional plumbing rules. They may seem complex but a look at the
-example hostess_sv11 driver should reassure you.
-
-The network device used for each channel should be pointed to by the
-netdevice field of each channel. The hdlc-> priv field of the network
-device points to your private data - you will need to be able to find
-your private data from this.
-
-The way most drivers approach this particular problem is to create a
-structure holding the Z8530 device definition and put that into the
-private field of the network device. The network device fields of the
-channels then point back to the network devices.
-
-If you wish to use the generic HDLC then you need to register the HDLC
-device.
-
-Before you register your network device you will also need to provide
-suitable handlers for most of the network device callbacks. See the
-network device documentation for more details on this.
-
-Configuring And Activating The Port
-===================================
-
-The Z85230 driver provides helper functions and tables to load the port
-registers on the Z8530 chips. When programming the register settings for
-a channel be aware that the documentation recommends initialisation
-orders. Strange things happen when these are not followed.
-
-:c:func:`z8530_channel_load()` takes an array of pairs of
-initialisation values in an array of u8 type. The first value is the
-Z8530 register number. Add 16 to indicate the alternate register bank on
-the later chips. The array is terminated by a 255.
-
-The driver provides a pair of public tables. The z8530_hdlc_kilostream
-table is for the UK 'Kilostream' service and also happens to cover most
-other end host configurations. The z8530_hdlc_kilostream_85230 table
-is the same configuration using the enhancements of the 85230 chip. The
-configuration loaded is standard NRZ encoded synchronous data with HDLC
-bitstuffing. All of the timing is taken from the other end of the link.
-
-When writing your own tables be aware that the driver internally tracks
-register values. It may need to reload values. You should therefore be
-sure to set registers 1-7, 9-11, 14 and 15 in all configurations. Where
-the register settings depend on DMA selection the driver will update the
-bits itself when you open or close. Loading a new table with the
-interface open is not recommended.
-
-There are three standard configurations supported by the core code. In
-PIO mode the interface is programmed up to use interrupt driven PIO.
-This places high demands on the host processor to avoid latency. The
-driver is written to take account of latency issues but it cannot avoid
-latencies caused by other drivers, notably IDE in PIO mode. Because the
-drivers allocate buffers you must also prevent MTU changes while the
-port is open.
-
-Once the port is open it will call the rx_function of each channel
-whenever a completed packet arrived. This is invoked from interrupt
-context and passes you the channel and a network buffer (struct
-sk_buff) holding the data. The data includes the CRC bytes so most
-users will want to trim the last two bytes before processing the data.
-This function is very timing critical. When you wish to simply discard
-data the support code provides the function
-:c:func:`z8530_null_rx()` to discard the data.
-
-To active PIO mode sending and receiving the ``z8530_sync_open`` is called.
-This expects to be passed the network device and the channel. Typically
-this is called from your network device open callback. On a failure a
-non zero error status is returned.
-The :c:func:`z8530_sync_close()` function shuts down a PIO
-channel. This must be done before the channel is opened again and before
-the driver shuts down and unloads.
-
-The ideal mode of operation is dual channel DMA mode. Here the kernel
-driver will configure the board for DMA in both directions. The driver
-also handles ISA DMA issues such as controller programming and the
-memory range limit for you. This mode is activated by calling the
-:c:func:`z8530_sync_dma_open()` function. On failure a non zero
-error value is returned. Once this mode is activated it can be shut down
-by calling the :c:func:`z8530_sync_dma_close()`. You must call
-the close function matching the open mode you used.
-
-The final supported mode uses a single DMA channel to drive the transmit
-side. As the Z85C30 has a larger FIFO on the receive channel this tends
-to increase the maximum speed a little. This is activated by calling the
-``z8530_sync_txdma_open``. This returns a non zero error code on failure. The
-:c:func:`z8530_sync_txdma_close()` function closes down the Z8530
-interface from this mode.
-
-Network Layer Functions
-=======================
-
-The Z8530 layer provides functions to queue packets for transmission.
-The driver internally buffers the frame currently being transmitted and
-one further frame (in order to keep back to back transmission running).
-Any further buffering is up to the caller.
-
-The function :c:func:`z8530_queue_xmit()` takes a network buffer
-in sk_buff format and queues it for transmission. The caller must
-provide the entire packet with the exception of the bitstuffing and CRC.
-This is normally done by the caller via the generic HDLC interface
-layer. It returns 0 if the buffer has been queued and non zero values
-for queue full. If the function accepts the buffer it becomes property
-of the Z8530 layer and the caller should not free it.
-
-The function :c:func:`z8530_get_stats()` returns a pointer to an
-internally maintained per interface statistics block. This provides most
-of the interface code needed to implement the network layer get_stats
-callback.
-
-Porting The Z8530 Driver
-========================
-
-The Z8530 driver is written to be portable. In DMA mode it makes
-assumptions about the use of ISA DMA. These are probably warranted in
-most cases as the Z85230 in particular was designed to glue to PC type
-machines. The PIO mode makes no real assumptions.
-
-Should you need to retarget the Z8530 driver to another architecture the
-only code that should need changing are the port I/O functions. At the
-moment these assume PC I/O port accesses. This may not be appropriate
-for all platforms. Replacing :c:func:`z8530_read_port()` and
-``z8530_write_port`` is intended to be all that is required to port
-this driver layer.
-
-Known Bugs And Assumptions
-==========================
-
-Interrupt Locking
-    The locking in the driver is done via the global cli/sti lock. This
-    makes for relatively poor SMP performance. Switching this to use a
-    per device spin lock would probably materially improve performance.
-
-Occasional Failures
-    We have reports of occasional failures when run for very long
-    periods of time and the driver starts to receive junk frames. At the
-    moment the cause of this is not clear.
-
-Public Functions Provided
-=========================
-
-.. kernel-doc:: drivers/net/wan/z85230.c
-   :export:
-
-Internal Functions
-==================
-
-.. kernel-doc:: drivers/net/wan/z85230.c
-   :internal:
index 12c5b6c..dcb069d 100644 (file)
@@ -23,28 +23,6 @@ menuconfig WAN
 
 if WAN
 
-# There is no way to detect a comtrol sv11 - force it modular for now.
-config HOSTESS_SV11
-       tristate "Comtrol Hostess SV-11 support"
-       depends on ISA && m && ISA_DMA_API && INET && HDLC && VIRT_TO_BUS
-       help
-         Driver for Comtrol Hostess SV-11 network card which
-         operates on low speed synchronous serial links at up to
-         256Kbps, supporting PPP and Cisco HDLC.
-
-         The driver will be compiled as a module: the
-         module will be called hostess_sv11.
-
-# There is no way to detect a Sealevel board. Force it modular
-config SEALEVEL_4021
-       tristate "Sealevel Systems 4021 support"
-       depends on ISA && m && ISA_DMA_API && INET && HDLC && VIRT_TO_BUS
-       help
-         This is a driver for the Sealevel Systems ACB 56 serial I/O adapter.
-
-         The driver will be compiled as a module: the
-         module will be called sealevel.
-
 # Generic HDLC
 config HDLC
        tristate "Generic HDLC layer"
index 901a094..5bec8fa 100644 (file)
@@ -14,8 +14,6 @@ obj-$(CONFIG_HDLC_FR)         += hdlc_fr.o
 obj-$(CONFIG_HDLC_PPP)         += hdlc_ppp.o
 obj-$(CONFIG_HDLC_X25)         += hdlc_x25.o
 
-obj-$(CONFIG_HOSTESS_SV11)     += z85230.o     hostess_sv11.o
-obj-$(CONFIG_SEALEVEL_4021)    += z85230.o     sealevel.o
 obj-$(CONFIG_FARSYNC)          += farsync.o
 
 obj-$(CONFIG_LAPBETHER)                += lapbether.o
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
deleted file mode 100644 (file)
index e985e54..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*     Comtrol SV11 card driver
- *
- *     This is a slightly odd Z85230 synchronous driver. All you need to
- *     know basically is
- *
- *     Its a genuine Z85230
- *
- *     It supports DMA using two DMA channels in SYNC mode. The driver doesn't
- *     use these facilities
- *
- *     The control port is at io+1, the data at io+3 and turning off the DMA
- *     is done by writing 0 to io+4
- *
- *     The hardware does the bus handling to avoid the need for delays between
- *     touching control registers.
- *
- *     Port B isn't wired (why - beats me)
- *
- *     Generic HDLC port Copyright (C) 2008 Krzysztof Halasa <khc@pm.waw.pl>
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/net.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/delay.h>
-#include <linux/hdlc.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-#include <net/arp.h>
-
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/byteorder.h>
-#include "z85230.h"
-
-static int dma;
-
-/*     Network driver support routines
- */
-
-static inline struct z8530_dev *dev_to_sv(struct net_device *dev)
-{
-       return (struct z8530_dev *)dev_to_hdlc(dev)->priv;
-}
-
-/*     Frame receive. Simple for our card as we do HDLC and there
- *     is no funny garbage involved
- */
-
-static void hostess_input(struct z8530_channel *c, struct sk_buff *skb)
-{
-       /* Drop the CRC - it's not a good idea to try and negotiate it ;) */
-       skb_trim(skb, skb->len - 2);
-       skb->protocol = hdlc_type_trans(skb, c->netdevice);
-       skb_reset_mac_header(skb);
-       skb->dev = c->netdevice;
-       /*      Send it to the PPP layer. We don't have time to process
-        *      it right now.
-        */
-       netif_rx(skb);
-}
-
-/*     We've been placed in the UP state
- */
-
-static int hostess_open(struct net_device *d)
-{
-       struct z8530_dev *sv11 = dev_to_sv(d);
-       int err = -1;
-
-       /*      Link layer up
-        */
-       switch (dma) {
-       case 0:
-               err = z8530_sync_open(d, &sv11->chanA);
-               break;
-       case 1:
-               err = z8530_sync_dma_open(d, &sv11->chanA);
-               break;
-       case 2:
-               err = z8530_sync_txdma_open(d, &sv11->chanA);
-               break;
-       }
-
-       if (err)
-               return err;
-
-       err = hdlc_open(d);
-       if (err) {
-               switch (dma) {
-               case 0:
-                       z8530_sync_close(d, &sv11->chanA);
-                       break;
-               case 1:
-                       z8530_sync_dma_close(d, &sv11->chanA);
-                       break;
-               case 2:
-                       z8530_sync_txdma_close(d, &sv11->chanA);
-                       break;
-               }
-               return err;
-       }
-       sv11->chanA.rx_function = hostess_input;
-
-       /*
-        *      Go go go
-        */
-
-       netif_start_queue(d);
-       return 0;
-}
-
-static int hostess_close(struct net_device *d)
-{
-       struct z8530_dev *sv11 = dev_to_sv(d);
-       /*      Discard new frames
-        */
-       sv11->chanA.rx_function = z8530_null_rx;
-
-       hdlc_close(d);
-       netif_stop_queue(d);
-
-       switch (dma) {
-       case 0:
-               z8530_sync_close(d, &sv11->chanA);
-               break;
-       case 1:
-               z8530_sync_dma_close(d, &sv11->chanA);
-               break;
-       case 2:
-               z8530_sync_txdma_close(d, &sv11->chanA);
-               break;
-       }
-       return 0;
-}
-
-/*     Passed network frames, fire them downwind.
- */
-
-static netdev_tx_t hostess_queue_xmit(struct sk_buff *skb,
-                                     struct net_device *d)
-{
-       return z8530_queue_xmit(&dev_to_sv(d)->chanA, skb);
-}
-
-static int hostess_attach(struct net_device *dev, unsigned short encoding,
-                         unsigned short parity)
-{
-       if (encoding == ENCODING_NRZ && parity == PARITY_CRC16_PR1_CCITT)
-               return 0;
-       return -EINVAL;
-}
-
-/*     Description block for a Comtrol Hostess SV11 card
- */
-
-static const struct net_device_ops hostess_ops = {
-       .ndo_open       = hostess_open,
-       .ndo_stop       = hostess_close,
-       .ndo_start_xmit = hdlc_start_xmit,
-       .ndo_siocwandev = hdlc_ioctl,
-};
-
-static struct z8530_dev *sv11_init(int iobase, int irq)
-{
-       struct z8530_dev *sv;
-       struct net_device *netdev;
-       /*      Get the needed I/O space
-        */
-
-       if (!request_region(iobase, 8, "Comtrol SV11")) {
-               pr_warn("I/O 0x%X already in use\n", iobase);
-               return NULL;
-       }
-
-       sv = kzalloc(sizeof(struct z8530_dev), GFP_KERNEL);
-       if (!sv)
-               goto err_kzalloc;
-
-       /*      Stuff in the I/O addressing
-        */
-
-       sv->active = 0;
-
-       sv->chanA.ctrlio = iobase + 1;
-       sv->chanA.dataio = iobase + 3;
-       sv->chanB.ctrlio = -1;
-       sv->chanB.dataio = -1;
-       sv->chanA.irqs = &z8530_nop;
-       sv->chanB.irqs = &z8530_nop;
-
-       outb(0, iobase + 4);            /* DMA off */
-
-       /* We want a fast IRQ for this device. Actually we'd like an even faster
-        * IRQ ;) - This is one driver RtLinux is made for
-        */
-
-       if (request_irq(irq, z8530_interrupt, 0,
-                       "Hostess SV11", sv) < 0) {
-               pr_warn("IRQ %d already in use\n", irq);
-               goto err_irq;
-       }
-
-       sv->irq = irq;
-       sv->chanA.private = sv;
-       sv->chanA.dev = sv;
-       sv->chanB.dev = sv;
-
-       if (dma) {
-               /*      You can have DMA off or 1 and 3 thats the lot
-                *      on the Comtrol.
-                */
-               sv->chanA.txdma = 3;
-               sv->chanA.rxdma = 1;
-               outb(0x03 | 0x08, iobase + 4);          /* DMA on */
-               if (request_dma(sv->chanA.txdma, "Hostess SV/11 (TX)"))
-                       goto err_txdma;
-
-               if (dma == 1)
-                       if (request_dma(sv->chanA.rxdma, "Hostess SV/11 (RX)"))
-                               goto err_rxdma;
-       }
-
-       /* Kill our private IRQ line the hostess can end up chattering
-        * until the configuration is set
-        */
-       disable_irq(irq);
-
-       /*      Begin normal initialise
-        */
-
-       if (z8530_init(sv)) {
-               pr_err("Z8530 series device not found\n");
-               enable_irq(irq);
-               goto free_dma;
-       }
-       z8530_channel_load(&sv->chanB, z8530_dead_port);
-       if (sv->type == Z85C30)
-               z8530_channel_load(&sv->chanA, z8530_hdlc_kilostream);
-       else
-               z8530_channel_load(&sv->chanA, z8530_hdlc_kilostream_85230);
-
-       enable_irq(irq);
-
-       /*      Now we can take the IRQ
-        */
-
-       sv->chanA.netdevice = netdev = alloc_hdlcdev(sv);
-       if (!netdev)
-               goto free_dma;
-
-       dev_to_hdlc(netdev)->attach = hostess_attach;
-       dev_to_hdlc(netdev)->xmit = hostess_queue_xmit;
-       netdev->netdev_ops = &hostess_ops;
-       netdev->base_addr = iobase;
-       netdev->irq = irq;
-
-       if (register_hdlc_device(netdev)) {
-               pr_err("unable to register HDLC device\n");
-               free_netdev(netdev);
-               goto free_dma;
-       }
-
-       z8530_describe(sv, "I/O", iobase);
-       sv->active = 1;
-       return sv;
-
-free_dma:
-       if (dma == 1)
-               free_dma(sv->chanA.rxdma);
-err_rxdma:
-       if (dma)
-               free_dma(sv->chanA.txdma);
-err_txdma:
-       free_irq(irq, sv);
-err_irq:
-       kfree(sv);
-err_kzalloc:
-       release_region(iobase, 8);
-       return NULL;
-}
-
-static void sv11_shutdown(struct z8530_dev *dev)
-{
-       unregister_hdlc_device(dev->chanA.netdevice);
-       z8530_shutdown(dev);
-       free_irq(dev->irq, dev);
-       if (dma) {
-               if (dma == 1)
-                       free_dma(dev->chanA.rxdma);
-               free_dma(dev->chanA.txdma);
-       }
-       release_region(dev->chanA.ctrlio - 1, 8);
-       free_netdev(dev->chanA.netdevice);
-       kfree(dev);
-}
-
-static int io = 0x200;
-static int irq = 9;
-
-module_param_hw(io, int, ioport, 0);
-MODULE_PARM_DESC(io, "The I/O base of the Comtrol Hostess SV11 card");
-module_param_hw(dma, int, dma, 0);
-MODULE_PARM_DESC(dma, "Set this to 1 to use DMA1/DMA3 for TX/RX");
-module_param_hw(irq, int, irq, 0);
-MODULE_PARM_DESC(irq, "The interrupt line setting for the Comtrol Hostess SV11 card");
-
-MODULE_AUTHOR("Alan Cox");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Modular driver for the Comtrol Hostess SV11");
-
-static struct z8530_dev *sv11_unit;
-
-static int sv11_module_init(void)
-{
-       sv11_unit = sv11_init(io, irq);
-       if (!sv11_unit)
-               return -ENODEV;
-       return 0;
-}
-module_init(sv11_module_init);
-
-static void sv11_module_cleanup(void)
-{
-       if (sv11_unit)
-               sv11_shutdown(sv11_unit);
-}
-module_exit(sv11_module_cleanup);
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
deleted file mode 100644 (file)
index eddd20a..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*     Sealevel Systems 4021 driver.
- *
- *     (c) Copyright 1999, 2001 Alan Cox
- *     (c) Copyright 2001 Red Hat Inc.
- *     Generic HDLC port Copyright (C) 2008 Krzysztof Halasa <khc@pm.waw.pl>
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/net.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/delay.h>
-#include <linux/hdlc.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <net/arp.h>
-
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/byteorder.h>
-#include "z85230.h"
-
-struct slvl_device {
-       struct z8530_channel *chan;
-       int channel;
-};
-
-struct slvl_board {
-       struct slvl_device dev[2];
-       struct z8530_dev board;
-       int iobase;
-};
-
- /*    Network driver support routines */
-
-static inline struct slvl_device *dev_to_chan(struct net_device *dev)
-{
-       return (struct slvl_device *)dev_to_hdlc(dev)->priv;
-}
-
-/*     Frame receive. Simple for our card as we do HDLC and there
- *     is no funny garbage involved
- */
-
-static void sealevel_input(struct z8530_channel *c, struct sk_buff *skb)
-{
-       /* Drop the CRC - it's not a good idea to try and negotiate it ;) */
-       skb_trim(skb, skb->len - 2);
-       skb->protocol = hdlc_type_trans(skb, c->netdevice);
-       skb_reset_mac_header(skb);
-       skb->dev = c->netdevice;
-       netif_rx(skb);
-}
-
- /*    We've been placed in the UP state */
-
-static int sealevel_open(struct net_device *d)
-{
-       struct slvl_device *slvl = dev_to_chan(d);
-       int err = -1;
-       int unit = slvl->channel;
-
-        /*     Link layer up. */
-
-       switch (unit) {
-       case 0:
-               err = z8530_sync_dma_open(d, slvl->chan);
-               break;
-       case 1:
-               err = z8530_sync_open(d, slvl->chan);
-               break;
-       }
-
-       if (err)
-               return err;
-
-       err = hdlc_open(d);
-       if (err) {
-               switch (unit) {
-               case 0:
-                       z8530_sync_dma_close(d, slvl->chan);
-                       break;
-               case 1:
-                       z8530_sync_close(d, slvl->chan);
-                       break;
-               }
-               return err;
-       }
-
-       slvl->chan->rx_function = sealevel_input;
-
-       netif_start_queue(d);
-       return 0;
-}
-
-static int sealevel_close(struct net_device *d)
-{
-       struct slvl_device *slvl = dev_to_chan(d);
-       int unit = slvl->channel;
-
-       /*      Discard new frames */
-
-       slvl->chan->rx_function = z8530_null_rx;
-
-       hdlc_close(d);
-       netif_stop_queue(d);
-
-       switch (unit) {
-       case 0:
-               z8530_sync_dma_close(d, slvl->chan);
-               break;
-       case 1:
-               z8530_sync_close(d, slvl->chan);
-               break;
-       }
-       return 0;
-}
-
-/*     Passed network frames, fire them downwind. */
-
-static netdev_tx_t sealevel_queue_xmit(struct sk_buff *skb,
-                                      struct net_device *d)
-{
-       return z8530_queue_xmit(dev_to_chan(d)->chan, skb);
-}
-
-static int sealevel_attach(struct net_device *dev, unsigned short encoding,
-                          unsigned short parity)
-{
-       if (encoding == ENCODING_NRZ && parity == PARITY_CRC16_PR1_CCITT)
-               return 0;
-       return -EINVAL;
-}
-
-static const struct net_device_ops sealevel_ops = {
-       .ndo_open       = sealevel_open,
-       .ndo_stop       = sealevel_close,
-       .ndo_start_xmit = hdlc_start_xmit,
-       .ndo_siocwandev = hdlc_ioctl,
-};
-
-static int slvl_setup(struct slvl_device *sv, int iobase, int irq)
-{
-       struct net_device *dev = alloc_hdlcdev(sv);
-
-       if (!dev)
-               return -1;
-
-       dev_to_hdlc(dev)->attach = sealevel_attach;
-       dev_to_hdlc(dev)->xmit = sealevel_queue_xmit;
-       dev->netdev_ops = &sealevel_ops;
-       dev->base_addr = iobase;
-       dev->irq = irq;
-
-       if (register_hdlc_device(dev)) {
-               pr_err("unable to register HDLC device\n");
-               free_netdev(dev);
-               return -1;
-       }
-
-       sv->chan->netdevice = dev;
-       return 0;
-}
-
-/*     Allocate and setup Sealevel board. */
-
-static __init struct slvl_board *slvl_init(int iobase, int irq,
-                                          int txdma, int rxdma, int slow)
-{
-       struct z8530_dev *dev;
-       struct slvl_board *b;
-
-       /*      Get the needed I/O space */
-
-       if (!request_region(iobase, 8, "Sealevel 4021")) {
-               pr_warn("I/O 0x%X already in use\n", iobase);
-               return NULL;
-       }
-
-       b = kzalloc(sizeof(struct slvl_board), GFP_KERNEL);
-       if (!b)
-               goto err_kzalloc;
-
-       b->dev[0].chan = &b->board.chanA;
-       b->dev[0].channel = 0;
-
-       b->dev[1].chan = &b->board.chanB;
-       b->dev[1].channel = 1;
-
-       dev = &b->board;
-
-       /*      Stuff in the I/O addressing */
-
-       dev->active = 0;
-
-       b->iobase = iobase;
-
-       /*      Select 8530 delays for the old board */
-
-       if (slow)
-               iobase |= Z8530_PORT_SLEEP;
-
-       dev->chanA.ctrlio = iobase + 1;
-       dev->chanA.dataio = iobase;
-       dev->chanB.ctrlio = iobase + 3;
-       dev->chanB.dataio = iobase + 2;
-
-       dev->chanA.irqs = &z8530_nop;
-       dev->chanB.irqs = &z8530_nop;
-
-       /*      Assert DTR enable DMA */
-
-       outb(3 | (1 << 7), b->iobase + 4);
-
-       /* We want a fast IRQ for this device. Actually we'd like an even faster
-        * IRQ ;) - This is one driver RtLinux is made for
-        */
-
-       if (request_irq(irq, z8530_interrupt, 0,
-                       "SeaLevel", dev) < 0) {
-               pr_warn("IRQ %d already in use\n", irq);
-               goto err_request_irq;
-       }
-
-       dev->irq = irq;
-       dev->chanA.private = &b->dev[0];
-       dev->chanB.private = &b->dev[1];
-       dev->chanA.dev = dev;
-       dev->chanB.dev = dev;
-
-       dev->chanA.txdma = 3;
-       dev->chanA.rxdma = 1;
-       if (request_dma(dev->chanA.txdma, "SeaLevel (TX)"))
-               goto err_dma_tx;
-
-       if (request_dma(dev->chanA.rxdma, "SeaLevel (RX)"))
-               goto err_dma_rx;
-
-       disable_irq(irq);
-
-       /*      Begin normal initialise */
-
-       if (z8530_init(dev) != 0) {
-               pr_err("Z8530 series device not found\n");
-               enable_irq(irq);
-               goto free_hw;
-       }
-       if (dev->type == Z85C30) {
-               z8530_channel_load(&dev->chanA, z8530_hdlc_kilostream);
-               z8530_channel_load(&dev->chanB, z8530_hdlc_kilostream);
-       } else {
-               z8530_channel_load(&dev->chanA, z8530_hdlc_kilostream_85230);
-               z8530_channel_load(&dev->chanB, z8530_hdlc_kilostream_85230);
-       }
-
-       /*      Now we can take the IRQ */
-
-       enable_irq(irq);
-
-       if (slvl_setup(&b->dev[0], iobase, irq))
-               goto free_hw;
-       if (slvl_setup(&b->dev[1], iobase, irq))
-               goto free_netdev0;
-
-       z8530_describe(dev, "I/O", iobase);
-       dev->active = 1;
-       return b;
-
-free_netdev0:
-       unregister_hdlc_device(b->dev[0].chan->netdevice);
-       free_netdev(b->dev[0].chan->netdevice);
-free_hw:
-       free_dma(dev->chanA.rxdma);
-err_dma_rx:
-       free_dma(dev->chanA.txdma);
-err_dma_tx:
-       free_irq(irq, dev);
-err_request_irq:
-       kfree(b);
-err_kzalloc:
-       release_region(iobase, 8);
-       return NULL;
-}
-
-static void __exit slvl_shutdown(struct slvl_board *b)
-{
-       int u;
-
-       z8530_shutdown(&b->board);
-
-       for (u = 0; u < 2; u++) {
-               struct net_device *d = b->dev[u].chan->netdevice;
-
-               unregister_hdlc_device(d);
-               free_netdev(d);
-       }
-
-       free_irq(b->board.irq, &b->board);
-       free_dma(b->board.chanA.rxdma);
-       free_dma(b->board.chanA.txdma);
-       /* DMA off on the card, drop DTR */
-       outb(0, b->iobase);
-       release_region(b->iobase, 8);
-       kfree(b);
-}
-
-static int io = 0x238;
-static int txdma = 1;
-static int rxdma = 3;
-static int irq = 5;
-static bool slow;
-
-module_param_hw(io, int, ioport, 0);
-MODULE_PARM_DESC(io, "The I/O base of the Sealevel card");
-module_param_hw(txdma, int, dma, 0);
-MODULE_PARM_DESC(txdma, "Transmit DMA channel");
-module_param_hw(rxdma, int, dma, 0);
-MODULE_PARM_DESC(rxdma, "Receive DMA channel");
-module_param_hw(irq, int, irq, 0);
-MODULE_PARM_DESC(irq, "The interrupt line setting for the SeaLevel card");
-module_param(slow, bool, 0);
-MODULE_PARM_DESC(slow, "Set this for an older Sealevel card such as the 4012");
-
-MODULE_AUTHOR("Alan Cox");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Modular driver for the SeaLevel 4021");
-
-static struct slvl_board *slvl_unit;
-
-static int __init slvl_init_module(void)
-{
-       slvl_unit = slvl_init(io, irq, txdma, rxdma, slow);
-
-       return slvl_unit ? 0 : -ENODEV;
-}
-
-static void __exit slvl_cleanup_module(void)
-{
-       if (slvl_unit)
-               slvl_shutdown(slvl_unit);
-}
-
-module_init(slvl_init_module);
-module_exit(slvl_cleanup_module);
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
deleted file mode 100644 (file)
index 982a034..0000000
+++ /dev/null
@@ -1,1641 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*     (c) Copyright 1998 Alan Cox <alan@lxorguk.ukuu.org.uk>
- *     (c) Copyright 2000, 2001 Red Hat Inc
- *
- *     Development of this driver was funded by Equiinet Ltd
- *                     http://www.equiinet.com
- *
- *     ChangeLog:
- *
- *     Asynchronous mode dropped for 2.2. For 2.5 we will attempt the
- *     unification of all the Z85x30 asynchronous drivers for real.
- *
- *     DMA now uses get_free_page as kmalloc buffers may span a 64K
- *     boundary.
- *
- *     Modified for SMP safety and SMP locking by Alan Cox
- *                                     <alan@lxorguk.ukuu.org.uk>
- *
- *     Performance
- *
- *     Z85230:
- *     Non DMA you want a 486DX50 or better to do 64Kbits. 9600 baud
- *     X.25 is not unrealistic on all machines. DMA mode can in theory
- *     handle T1/E1 quite nicely. In practice the limit seems to be about
- *     512Kbit->1Mbit depending on motherboard.
- *
- *     Z85C30:
- *     64K will take DMA, 9600 baud X.25 should be ok.
- *
- *     Z8530:
- *     Synchronous mode without DMA is unlikely to pass about 2400 baud.
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/net.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/delay.h>
-#include <linux/hdlc.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/gfp.h>
-#include <asm/dma.h>
-#include <asm/io.h>
-#define RT_LOCK
-#define RT_UNLOCK
-#include <linux/spinlock.h>
-
-#include "z85230.h"
-
-/**
- *     z8530_read_port - Architecture specific interface function
- *     @p: port to read
- *
- *     Provided port access methods. The Comtrol SV11 requires no delays
- *     between accesses and uses PC I/O. Some drivers may need a 5uS delay
- *
- *     In the longer term this should become an architecture specific
- *     section so that this can become a generic driver interface for all
- *     platforms. For now we only handle PC I/O ports with or without the
- *     dread 5uS sanity delay.
- *
- *     The caller must hold sufficient locks to avoid violating the horrible
- *     5uS delay rule.
- */
-
-static inline int z8530_read_port(unsigned long p)
-{
-       u8 r = inb(Z8530_PORT_OF(p));
-
-       if (p & Z8530_PORT_SLEEP) /* gcc should figure this out efficiently ! */
-               udelay(5);
-       return r;
-}
-
-/**
- *     z8530_write_port - Architecture specific interface function
- *     @p: port to write
- *     @d: value to write
- *
- *     Write a value to a port with delays if need be. Note that the
- *     caller must hold locks to avoid read/writes from other contexts
- *     violating the 5uS rule
- *
- *     In the longer term this should become an architecture specific
- *     section so that this can become a generic driver interface for all
- *     platforms. For now we only handle PC I/O ports with or without the
- *     dread 5uS sanity delay.
- */
-
-static inline void z8530_write_port(unsigned long p, u8 d)
-{
-       outb(d, Z8530_PORT_OF(p));
-       if (p & Z8530_PORT_SLEEP)
-               udelay(5);
-}
-
-static void z8530_rx_done(struct z8530_channel *c);
-static void z8530_tx_done(struct z8530_channel *c);
-
-/**
- *     read_zsreg - Read a register from a Z85230
- *     @c: Z8530 channel to read from (2 per chip)
- *     @reg: Register to read
- *     FIXME: Use a spinlock.
- *
- *     Most of the Z8530 registers are indexed off the control registers.
- *     A read is done by writing to the control register and reading the
- *     register back.  The caller must hold the lock
- */
-
-static inline u8 read_zsreg(struct z8530_channel *c, u8 reg)
-{
-       if (reg)
-               z8530_write_port(c->ctrlio, reg);
-       return z8530_read_port(c->ctrlio);
-}
-
-/**
- *     read_zsdata - Read the data port of a Z8530 channel
- *     @c: The Z8530 channel to read the data port from
- *
- *     The data port provides fast access to some things. We still
- *     have all the 5uS delays to worry about.
- */
-
-static inline u8 read_zsdata(struct z8530_channel *c)
-{
-       u8 r;
-
-       r = z8530_read_port(c->dataio);
-       return r;
-}
-
-/**
- *     write_zsreg - Write to a Z8530 channel register
- *     @c: The Z8530 channel
- *     @reg: Register number
- *     @val: Value to write
- *
- *     Write a value to an indexed register. The caller must hold the lock
- *     to honour the irritating delay rules. We know about register 0
- *     being fast to access.
- *
- *      Assumes c->lock is held.
- */
-static inline void write_zsreg(struct z8530_channel *c, u8 reg, u8 val)
-{
-       if (reg)
-               z8530_write_port(c->ctrlio, reg);
-       z8530_write_port(c->ctrlio, val);
-}
-
-/**
- *     write_zsctrl - Write to a Z8530 control register
- *     @c: The Z8530 channel
- *     @val: Value to write
- *
- *     Write directly to the control register on the Z8530
- */
-
-static inline void write_zsctrl(struct z8530_channel *c, u8 val)
-{
-       z8530_write_port(c->ctrlio, val);
-}
-
-/**
- *     write_zsdata - Write to a Z8530 control register
- *     @c: The Z8530 channel
- *     @val: Value to write
- *
- *     Write directly to the data register on the Z8530
- */
-static inline void write_zsdata(struct z8530_channel *c, u8 val)
-{
-       z8530_write_port(c->dataio, val);
-}
-
-/*     Register loading parameters for a dead port
- */
-
-u8 z8530_dead_port[] = {
-       255
-};
-EXPORT_SYMBOL(z8530_dead_port);
-
-/*     Register loading parameters for currently supported circuit types
- */
-
-/*     Data clocked by telco end. This is the correct data for the UK
- *     "kilostream" service, and most other similar services.
- */
-
-u8 z8530_hdlc_kilostream[] = {
-       4,      SYNC_ENAB | SDLC | X1CLK,
-       2,      0,      /* No vector */
-       1,      0,
-       3,      ENT_HM | RxCRC_ENAB | Rx8,
-       5,      TxCRC_ENAB | RTS | TxENAB | Tx8 | DTR,
-       9,      0,              /* Disable interrupts */
-       6,      0xFF,
-       7,      FLAG,
-       10,     ABUNDER | NRZ | CRCPS,/*MARKIDLE ??*/
-       11,     TCTRxCP,
-       14,     DISDPLL,
-       15,     DCDIE | SYNCIE | CTSIE | TxUIE | BRKIE,
-       1,      EXT_INT_ENAB | TxINT_ENAB | INT_ALL_Rx,
-       9,      NV | MIE | NORESET,
-       255
-};
-EXPORT_SYMBOL(z8530_hdlc_kilostream);
-
-/*     As above but for enhanced chips.
- */
-
-u8 z8530_hdlc_kilostream_85230[] = {
-       4,      SYNC_ENAB | SDLC | X1CLK,
-       2,      0,      /* No vector */
-       1,      0,
-       3,      ENT_HM | RxCRC_ENAB | Rx8,
-       5,      TxCRC_ENAB | RTS | TxENAB | Tx8 | DTR,
-       9,      0,              /* Disable interrupts */
-       6,      0xFF,
-       7,      FLAG,
-       10,     ABUNDER | NRZ | CRCPS,  /* MARKIDLE?? */
-       11,     TCTRxCP,
-       14,     DISDPLL,
-       15,     DCDIE | SYNCIE | CTSIE | TxUIE | BRKIE,
-       1,      EXT_INT_ENAB | TxINT_ENAB | INT_ALL_Rx,
-       9,      NV | MIE | NORESET,
-       23,     3,              /* Extended mode AUTO TX and EOM*/
-
-       255
-};
-EXPORT_SYMBOL(z8530_hdlc_kilostream_85230);
-
-/**
- *     z8530_flush_fifo - Flush on chip RX FIFO
- *     @c: Channel to flush
- *
- *     Flush the receive FIFO. There is no specific option for this, we
- *     blindly read bytes and discard them. Reading when there is no data
- *     is harmless. The 8530 has a 4 byte FIFO, the 85230 has 8 bytes.
- *
- *     All locking is handled for the caller. On return data may still be
- *     present if it arrived during the flush.
- */
-
-static void z8530_flush_fifo(struct z8530_channel *c)
-{
-       read_zsreg(c, R1);
-       read_zsreg(c, R1);
-       read_zsreg(c, R1);
-       read_zsreg(c, R1);
-       if (c->dev->type == Z85230) {
-               read_zsreg(c, R1);
-               read_zsreg(c, R1);
-               read_zsreg(c, R1);
-               read_zsreg(c, R1);
-       }
-}
-
-/**
- *     z8530_rtsdtr - Control the outgoing DTS/RTS line
- *     @c: The Z8530 channel to control;
- *     @set: 1 to set, 0 to clear
- *
- *     Sets or clears DTR/RTS on the requested line. All locking is handled
- *     by the caller. For now we assume all boards use the actual RTS/DTR
- *     on the chip. Apparently one or two don't. We'll scream about them
- *     later.
- */
-
-static void z8530_rtsdtr(struct z8530_channel *c, int set)
-{
-       if (set)
-               c->regs[5] |= (RTS | DTR);
-       else
-               c->regs[5] &= ~(RTS | DTR);
-       write_zsreg(c, R5, c->regs[5]);
-}
-
-/**
- *     z8530_rx - Handle a PIO receive event
- *     @c: Z8530 channel to process
- *
- *     Receive handler for receiving in PIO mode. This is much like the
- *     async one but not quite the same or as complex
- *
- *     Note: Its intended that this handler can easily be separated from
- *     the main code to run realtime. That'll be needed for some machines
- *     (eg to ever clock 64kbits on a sparc ;)).
- *
- *     The RT_LOCK macros don't do anything now. Keep the code covered
- *     by them as short as possible in all circumstances - clocks cost
- *     baud. The interrupt handler is assumed to be atomic w.r.t. to
- *     other code - this is true in the RT case too.
- *
- *     We only cover the sync cases for this. If you want 2Mbit async
- *     do it yourself but consider medical assistance first. This non DMA
- *     synchronous mode is portable code. The DMA mode assumes PCI like
- *     ISA DMA
- *
- *     Called with the device lock held
- */
-
-static void z8530_rx(struct z8530_channel *c)
-{
-       u8 ch, stat;
-
-       while (1) {
-               /* FIFO empty ? */
-               if (!(read_zsreg(c, R0) & 1))
-                       break;
-               ch = read_zsdata(c);
-               stat = read_zsreg(c, R1);
-
-               /*      Overrun ?
-                */
-               if (c->count < c->max) {
-                       *c->dptr++ = ch;
-                       c->count++;
-               }
-
-               if (stat & END_FR) {
-                       /*      Error ?
-                        */
-                       if (stat & (Rx_OVR | CRC_ERR)) {
-                               /* Rewind the buffer and return */
-                               if (c->skb)
-                                       c->dptr = c->skb->data;
-                               c->count = 0;
-                               if (stat & Rx_OVR) {
-                                       pr_warn("%s: overrun\n", c->dev->name);
-                                       c->rx_overrun++;
-                               }
-                               if (stat & CRC_ERR) {
-                                       c->rx_crc_err++;
-                                       /* printk("crc error\n"); */
-                               }
-                               /* Shove the frame upstream */
-                       } else {
-                               /*      Drop the lock for RX processing, or
-                                *      there are deadlocks
-                                */
-                               z8530_rx_done(c);
-                               write_zsctrl(c, RES_Rx_CRC);
-                       }
-               }
-       }
-       /*      Clear irq
-        */
-       write_zsctrl(c, ERR_RES);
-       write_zsctrl(c, RES_H_IUS);
-}
-
-/**
- *     z8530_tx - Handle a PIO transmit event
- *     @c: Z8530 channel to process
- *
- *     Z8530 transmit interrupt handler for the PIO mode. The basic
- *     idea is to attempt to keep the FIFO fed. We fill as many bytes
- *     in as possible, its quite possible that we won't keep up with the
- *     data rate otherwise.
- */
-
-static void z8530_tx(struct z8530_channel *c)
-{
-       while (c->txcount) {
-               /* FIFO full ? */
-               if (!(read_zsreg(c, R0) & 4))
-                       return;
-               c->txcount--;
-               /*      Shovel out the byte
-                */
-               write_zsreg(c, R8, *c->tx_ptr++);
-               write_zsctrl(c, RES_H_IUS);
-               /* We are about to underflow */
-               if (c->txcount == 0) {
-                       write_zsctrl(c, RES_EOM_L);
-                       write_zsreg(c, R10, c->regs[10] & ~ABUNDER);
-               }
-       }
-
-       /*      End of frame TX - fire another one
-        */
-
-       write_zsctrl(c, RES_Tx_P);
-
-       z8530_tx_done(c);
-       write_zsctrl(c, RES_H_IUS);
-}
-
-/**
- *     z8530_status - Handle a PIO status exception
- *     @chan: Z8530 channel to process
- *
- *     A status event occurred in PIO synchronous mode. There are several
- *     reasons the chip will bother us here. A transmit underrun means we
- *     failed to feed the chip fast enough and just broke a packet. A DCD
- *     change is a line up or down.
- */
-
-static void z8530_status(struct z8530_channel *chan)
-{
-       u8 status, altered;
-
-       status = read_zsreg(chan, R0);
-       altered = chan->status ^ status;
-
-       chan->status = status;
-
-       if (status & TxEOM) {
-/*             printk("%s: Tx underrun.\n", chan->dev->name); */
-               chan->netdevice->stats.tx_fifo_errors++;
-               write_zsctrl(chan, ERR_RES);
-               z8530_tx_done(chan);
-       }
-
-       if (altered & chan->dcdcheck) {
-               if (status & chan->dcdcheck) {
-                       pr_info("%s: DCD raised\n", chan->dev->name);
-                       write_zsreg(chan, R3, chan->regs[3] | RxENABLE);
-                       if (chan->netdevice)
-                               netif_carrier_on(chan->netdevice);
-               } else {
-                       pr_info("%s: DCD lost\n", chan->dev->name);
-                       write_zsreg(chan, R3, chan->regs[3] & ~RxENABLE);
-                       z8530_flush_fifo(chan);
-                       if (chan->netdevice)
-                               netif_carrier_off(chan->netdevice);
-               }
-       }
-       write_zsctrl(chan, RES_EXT_INT);
-       write_zsctrl(chan, RES_H_IUS);
-}
-
-struct z8530_irqhandler z8530_sync = {
-       .rx = z8530_rx,
-       .tx = z8530_tx,
-       .status = z8530_status,
-};
-EXPORT_SYMBOL(z8530_sync);
-
-/**
- *     z8530_dma_rx - Handle a DMA RX event
- *     @chan: Channel to handle
- *
- *     Non bus mastering DMA interfaces for the Z8x30 devices. This
- *     is really pretty PC specific. The DMA mode means that most receive
- *     events are handled by the DMA hardware. We get a kick here only if
- *     a frame ended.
- */
-
-static void z8530_dma_rx(struct z8530_channel *chan)
-{
-       if (chan->rxdma_on) {
-               /* Special condition check only */
-               u8 status;
-
-               read_zsreg(chan, R7);
-               read_zsreg(chan, R6);
-
-               status = read_zsreg(chan, R1);
-
-               if (status & END_FR)
-                       z8530_rx_done(chan);    /* Fire up the next one */
-
-               write_zsctrl(chan, ERR_RES);
-               write_zsctrl(chan, RES_H_IUS);
-       } else {
-               /* DMA is off right now, drain the slow way */
-               z8530_rx(chan);
-       }
-}
-
-/**
- *     z8530_dma_tx - Handle a DMA TX event
- *     @chan:  The Z8530 channel to handle
- *
- *     We have received an interrupt while doing DMA transmissions. It
- *     shouldn't happen. Scream loudly if it does.
- */
-static void z8530_dma_tx(struct z8530_channel *chan)
-{
-       if (!chan->dma_tx) {
-               pr_warn("Hey who turned the DMA off?\n");
-               z8530_tx(chan);
-               return;
-       }
-       /* This shouldn't occur in DMA mode */
-       pr_err("DMA tx - bogus event!\n");
-       z8530_tx(chan);
-}
-
-/**
- *     z8530_dma_status - Handle a DMA status exception
- *     @chan: Z8530 channel to process
- *
- *     A status event occurred on the Z8530. We receive these for two reasons
- *     when in DMA mode. Firstly if we finished a packet transfer we get one
- *     and kick the next packet out. Secondly we may see a DCD change.
- *
- */
-static void z8530_dma_status(struct z8530_channel *chan)
-{
-       u8 status, altered;
-
-       status = read_zsreg(chan, R0);
-       altered = chan->status ^ status;
-
-       chan->status = status;
-
-       if (chan->dma_tx) {
-               if (status & TxEOM) {
-                       unsigned long flags;
-
-                       flags = claim_dma_lock();
-                       disable_dma(chan->txdma);
-                       clear_dma_ff(chan->txdma);
-                       chan->txdma_on = 0;
-                       release_dma_lock(flags);
-                       z8530_tx_done(chan);
-               }
-       }
-
-       if (altered & chan->dcdcheck) {
-               if (status & chan->dcdcheck) {
-                       pr_info("%s: DCD raised\n", chan->dev->name);
-                       write_zsreg(chan, R3, chan->regs[3] | RxENABLE);
-                       if (chan->netdevice)
-                               netif_carrier_on(chan->netdevice);
-               } else {
-                       pr_info("%s: DCD lost\n", chan->dev->name);
-                       write_zsreg(chan, R3, chan->regs[3] & ~RxENABLE);
-                       z8530_flush_fifo(chan);
-                       if (chan->netdevice)
-                               netif_carrier_off(chan->netdevice);
-               }
-       }
-
-       write_zsctrl(chan, RES_EXT_INT);
-       write_zsctrl(chan, RES_H_IUS);
-}
-
-static struct z8530_irqhandler z8530_dma_sync = {
-       .rx = z8530_dma_rx,
-       .tx = z8530_dma_tx,
-       .status = z8530_dma_status,
-};
-
-static struct z8530_irqhandler z8530_txdma_sync = {
-       .rx = z8530_rx,
-       .tx = z8530_dma_tx,
-       .status = z8530_dma_status,
-};
-
-/**
- *     z8530_rx_clear - Handle RX events from a stopped chip
- *     @c: Z8530 channel to shut up
- *
- *     Receive interrupt vectors for a Z8530 that is in 'parked' mode.
- *     For machines with PCI Z85x30 cards, or level triggered interrupts
- *     (eg the MacII) we must clear the interrupt cause or die.
- */
-
-static void z8530_rx_clear(struct z8530_channel *c)
-{
-       /*      Data and status bytes
-        */
-       u8 stat;
-
-       read_zsdata(c);
-       stat = read_zsreg(c, R1);
-
-       if (stat & END_FR)
-               write_zsctrl(c, RES_Rx_CRC);
-       /*      Clear irq
-        */
-       write_zsctrl(c, ERR_RES);
-       write_zsctrl(c, RES_H_IUS);
-}
-
-/**
- *     z8530_tx_clear - Handle TX events from a stopped chip
- *     @c: Z8530 channel to shut up
- *
- *     Transmit interrupt vectors for a Z8530 that is in 'parked' mode.
- *     For machines with PCI Z85x30 cards, or level triggered interrupts
- *     (eg the MacII) we must clear the interrupt cause or die.
- */
-
-static void z8530_tx_clear(struct z8530_channel *c)
-{
-       write_zsctrl(c, RES_Tx_P);
-       write_zsctrl(c, RES_H_IUS);
-}
-
-/**
- *     z8530_status_clear - Handle status events from a stopped chip
- *     @chan: Z8530 channel to shut up
- *
- *     Status interrupt vectors for a Z8530 that is in 'parked' mode.
- *     For machines with PCI Z85x30 cards, or level triggered interrupts
- *     (eg the MacII) we must clear the interrupt cause or die.
- */
-
-static void z8530_status_clear(struct z8530_channel *chan)
-{
-       u8 status = read_zsreg(chan, R0);
-
-       if (status & TxEOM)
-               write_zsctrl(chan, ERR_RES);
-       write_zsctrl(chan, RES_EXT_INT);
-       write_zsctrl(chan, RES_H_IUS);
-}
-
-struct z8530_irqhandler z8530_nop = {
-       .rx = z8530_rx_clear,
-       .tx = z8530_tx_clear,
-       .status = z8530_status_clear,
-};
-EXPORT_SYMBOL(z8530_nop);
-
-/**
- *     z8530_interrupt - Handle an interrupt from a Z8530
- *     @irq: Interrupt number
- *     @dev_id: The Z8530 device that is interrupting.
- *
- *     A Z85[2]30 device has stuck its hand in the air for attention.
- *     We scan both the channels on the chip for events and then call
- *     the channel specific call backs for each channel that has events.
- *     We have to use callback functions because the two channels can be
- *     in different modes.
- *
- *     Locking is done for the handlers. Note that locking is done
- *     at the chip level (the 5uS delay issue is per chip not per
- *     channel). c->lock for both channels points to dev->lock
- */
-
-irqreturn_t z8530_interrupt(int irq, void *dev_id)
-{
-       struct z8530_dev *dev = dev_id;
-       u8 intr;
-       static volatile int locker=0;
-       int work = 0;
-       struct z8530_irqhandler *irqs;
-
-       if (locker) {
-               pr_err("IRQ re-enter\n");
-               return IRQ_NONE;
-       }
-       locker = 1;
-
-       spin_lock(&dev->lock);
-
-       while (++work < 5000) {
-               intr = read_zsreg(&dev->chanA, R3);
-               if (!(intr &
-                  (CHARxIP | CHATxIP | CHAEXT | CHBRxIP | CHBTxIP | CHBEXT)))
-                       break;
-
-               /* This holds the IRQ status. On the 8530 you must read it
-                * from chan A even though it applies to the whole chip
-                */
-
-               /* Now walk the chip and see what it is wanting - it may be
-                * an IRQ for someone else remember
-                */
-
-               irqs = dev->chanA.irqs;
-
-               if (intr & (CHARxIP | CHATxIP | CHAEXT)) {
-                       if (intr & CHARxIP)
-                               irqs->rx(&dev->chanA);
-                       if (intr & CHATxIP)
-                               irqs->tx(&dev->chanA);
-                       if (intr & CHAEXT)
-                               irqs->status(&dev->chanA);
-               }
-
-               irqs = dev->chanB.irqs;
-
-               if (intr & (CHBRxIP | CHBTxIP | CHBEXT)) {
-                       if (intr & CHBRxIP)
-                               irqs->rx(&dev->chanB);
-                       if (intr & CHBTxIP)
-                               irqs->tx(&dev->chanB);
-                       if (intr & CHBEXT)
-                               irqs->status(&dev->chanB);
-               }
-       }
-       spin_unlock(&dev->lock);
-       if (work == 5000)
-               pr_err("%s: interrupt jammed - abort(0x%X)!\n",
-                      dev->name, intr);
-       /* Ok all done */
-       locker = 0;
-       return IRQ_HANDLED;
-}
-EXPORT_SYMBOL(z8530_interrupt);
-
-static const u8 reg_init[16] = {
-       0, 0, 0, 0,
-       0, 0, 0, 0,
-       0, 0, 0, 0,
-       0x55, 0, 0, 0
-};
-
-/**
- *     z8530_sync_open - Open a Z8530 channel for PIO
- *     @dev:   The network interface we are using
- *     @c:     The Z8530 channel to open in synchronous PIO mode
- *
- *     Switch a Z8530 into synchronous mode without DMA assist. We
- *     raise the RTS/DTR and commence network operation.
- */
-int z8530_sync_open(struct net_device *dev, struct z8530_channel *c)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(c->lock, flags);
-
-       c->sync = 1;
-       c->mtu = dev->mtu + 64;
-       c->count = 0;
-       c->skb = NULL;
-       c->skb2 = NULL;
-       c->irqs = &z8530_sync;
-
-       /* This loads the double buffer up */
-       z8530_rx_done(c);       /* Load the frame ring */
-       z8530_rx_done(c);       /* Load the backup frame */
-       z8530_rtsdtr(c, 1);
-       c->dma_tx = 0;
-       c->regs[R1] |= TxINT_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-       write_zsreg(c, R3, c->regs[R3] | RxENABLE);
-
-       spin_unlock_irqrestore(c->lock, flags);
-       return 0;
-}
-EXPORT_SYMBOL(z8530_sync_open);
-
-/**
- *     z8530_sync_close - Close a PIO Z8530 channel
- *     @dev: Network device to close
- *     @c: Z8530 channel to disassociate and move to idle
- *
- *     Close down a Z8530 interface and switch its interrupt handlers
- *     to discard future events.
- */
-int z8530_sync_close(struct net_device *dev, struct z8530_channel *c)
-{
-       u8 chk;
-       unsigned long flags;
-
-       spin_lock_irqsave(c->lock, flags);
-       c->irqs = &z8530_nop;
-       c->max = 0;
-       c->sync = 0;
-
-       chk = read_zsreg(c, R0);
-       write_zsreg(c, R3, c->regs[R3]);
-       z8530_rtsdtr(c, 0);
-
-       spin_unlock_irqrestore(c->lock, flags);
-       return 0;
-}
-EXPORT_SYMBOL(z8530_sync_close);
-
-/**
- *     z8530_sync_dma_open - Open a Z8530 for DMA I/O
- *     @dev: The network device to attach
- *     @c: The Z8530 channel to configure in sync DMA mode.
- *
- *     Set up a Z85x30 device for synchronous DMA in both directions. Two
- *     ISA DMA channels must be available for this to work. We assume ISA
- *     DMA driven I/O and PC limits on access.
- */
-int z8530_sync_dma_open(struct net_device *dev, struct z8530_channel *c)
-{
-       unsigned long cflags, dflags;
-
-       c->sync = 1;
-       c->mtu = dev->mtu + 64;
-       c->count = 0;
-       c->skb = NULL;
-       c->skb2 = NULL;
-
-       /*      Load the DMA interfaces up
-        */
-       c->rxdma_on = 0;
-       c->txdma_on = 0;
-
-       /*      Allocate the DMA flip buffers. Limit by page size.
-        *      Everyone runs 1500 mtu or less on wan links so this
-        *      should be fine.
-        */
-
-       if (c->mtu  > PAGE_SIZE / 2)
-               return -EMSGSIZE;
-
-       c->rx_buf[0] = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
-       if (!c->rx_buf[0])
-               return -ENOBUFS;
-       c->rx_buf[1] = c->rx_buf[0] + PAGE_SIZE / 2;
-
-       c->tx_dma_buf[0] = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
-       if (!c->tx_dma_buf[0]) {
-               free_page((unsigned long)c->rx_buf[0]);
-               c->rx_buf[0] = NULL;
-               return -ENOBUFS;
-       }
-       c->tx_dma_buf[1] = c->tx_dma_buf[0] + PAGE_SIZE / 2;
-
-       c->tx_dma_used = 0;
-       c->dma_tx = 1;
-       c->dma_num = 0;
-       c->dma_ready = 1;
-
-       /*      Enable DMA control mode
-        */
-
-       spin_lock_irqsave(c->lock, cflags);
-
-       /*      TX DMA via DIR/REQ
-        */
-
-       c->regs[R14] |= DTRREQ;
-       write_zsreg(c, R14, c->regs[R14]);
-
-       c->regs[R1] &= ~TxINT_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-
-       /*      RX DMA via W/Req
-        */
-
-       c->regs[R1] |= WT_FN_RDYFN;
-       c->regs[R1] |= WT_RDY_RT;
-       c->regs[R1] |= INT_ERR_Rx;
-       c->regs[R1] &= ~TxINT_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-       c->regs[R1] |= WT_RDY_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-
-       /*      DMA interrupts
-        */
-
-       /*      Set up the DMA configuration
-        */
-
-       dflags = claim_dma_lock();
-
-       disable_dma(c->rxdma);
-       clear_dma_ff(c->rxdma);
-       set_dma_mode(c->rxdma, DMA_MODE_READ | 0x10);
-       set_dma_addr(c->rxdma, virt_to_bus(c->rx_buf[0]));
-       set_dma_count(c->rxdma, c->mtu);
-       enable_dma(c->rxdma);
-
-       disable_dma(c->txdma);
-       clear_dma_ff(c->txdma);
-       set_dma_mode(c->txdma, DMA_MODE_WRITE);
-       disable_dma(c->txdma);
-
-       release_dma_lock(dflags);
-
-       /*      Select the DMA interrupt handlers
-        */
-
-       c->rxdma_on = 1;
-       c->txdma_on = 1;
-       c->tx_dma_used = 1;
-
-       c->irqs = &z8530_dma_sync;
-       z8530_rtsdtr(c, 1);
-       write_zsreg(c, R3, c->regs[R3] | RxENABLE);
-
-       spin_unlock_irqrestore(c->lock, cflags);
-
-       return 0;
-}
-EXPORT_SYMBOL(z8530_sync_dma_open);
-
-/**
- *     z8530_sync_dma_close - Close down DMA I/O
- *     @dev: Network device to detach
- *     @c: Z8530 channel to move into discard mode
- *
- *     Shut down a DMA mode synchronous interface. Halt the DMA, and
- *     free the buffers.
- */
-int z8530_sync_dma_close(struct net_device *dev, struct z8530_channel *c)
-{
-       u8 chk;
-       unsigned long flags;
-
-       c->irqs = &z8530_nop;
-       c->max = 0;
-       c->sync = 0;
-
-       /*      Disable the PC DMA channels
-        */
-
-       flags = claim_dma_lock();
-       disable_dma(c->rxdma);
-       clear_dma_ff(c->rxdma);
-
-       c->rxdma_on = 0;
-
-       disable_dma(c->txdma);
-       clear_dma_ff(c->txdma);
-       release_dma_lock(flags);
-
-       c->txdma_on = 0;
-       c->tx_dma_used = 0;
-
-       spin_lock_irqsave(c->lock, flags);
-
-       /*      Disable DMA control mode
-        */
-
-       c->regs[R1] &= ~WT_RDY_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-       c->regs[R1] &= ~(WT_RDY_RT | WT_FN_RDYFN | INT_ERR_Rx);
-       c->regs[R1] |= INT_ALL_Rx;
-       write_zsreg(c, R1, c->regs[R1]);
-       c->regs[R14] &= ~DTRREQ;
-       write_zsreg(c, R14, c->regs[R14]);
-
-       if (c->rx_buf[0]) {
-               free_page((unsigned long)c->rx_buf[0]);
-               c->rx_buf[0] = NULL;
-       }
-       if (c->tx_dma_buf[0]) {
-               free_page((unsigned  long)c->tx_dma_buf[0]);
-               c->tx_dma_buf[0] = NULL;
-       }
-       chk = read_zsreg(c, R0);
-       write_zsreg(c, R3, c->regs[R3]);
-       z8530_rtsdtr(c, 0);
-
-       spin_unlock_irqrestore(c->lock, flags);
-
-       return 0;
-}
-EXPORT_SYMBOL(z8530_sync_dma_close);
-
-/**
- *     z8530_sync_txdma_open - Open a Z8530 for TX driven DMA
- *     @dev: The network device to attach
- *     @c: The Z8530 channel to configure in sync DMA mode.
- *
- *     Set up a Z85x30 device for synchronous DMA transmission. One
- *     ISA DMA channel must be available for this to work. The receive
- *     side is run in PIO mode, but then it has the bigger FIFO.
- */
-
-int z8530_sync_txdma_open(struct net_device *dev, struct z8530_channel *c)
-{
-       unsigned long cflags, dflags;
-
-       printk("Opening sync interface for TX-DMA\n");
-       c->sync = 1;
-       c->mtu = dev->mtu + 64;
-       c->count = 0;
-       c->skb = NULL;
-       c->skb2 = NULL;
-
-       /*      Allocate the DMA flip buffers. Limit by page size.
-        *      Everyone runs 1500 mtu or less on wan links so this
-        *      should be fine.
-        */
-
-       if (c->mtu > PAGE_SIZE / 2)
-               return -EMSGSIZE;
-
-       c->tx_dma_buf[0] = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
-       if (!c->tx_dma_buf[0])
-               return -ENOBUFS;
-
-       c->tx_dma_buf[1] = c->tx_dma_buf[0] + PAGE_SIZE / 2;
-
-       spin_lock_irqsave(c->lock, cflags);
-
-       /*      Load the PIO receive ring
-        */
-
-       z8530_rx_done(c);
-       z8530_rx_done(c);
-
-       /*      Load the DMA interfaces up
-        */
-
-       c->rxdma_on = 0;
-       c->txdma_on = 0;
-
-       c->tx_dma_used = 0;
-       c->dma_num = 0;
-       c->dma_ready = 1;
-       c->dma_tx = 1;
-
-       /*      Enable DMA control mode
-        */
-
-       /*      TX DMA via DIR/REQ
-        */
-       c->regs[R14] |= DTRREQ;
-       write_zsreg(c, R14, c->regs[R14]);
-
-       c->regs[R1] &= ~TxINT_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-
-       /*      Set up the DMA configuration
-        */
-
-       dflags = claim_dma_lock();
-
-       disable_dma(c->txdma);
-       clear_dma_ff(c->txdma);
-       set_dma_mode(c->txdma, DMA_MODE_WRITE);
-       disable_dma(c->txdma);
-
-       release_dma_lock(dflags);
-
-       /*      Select the DMA interrupt handlers
-        */
-
-       c->rxdma_on = 0;
-       c->txdma_on = 1;
-       c->tx_dma_used = 1;
-
-       c->irqs = &z8530_txdma_sync;
-       z8530_rtsdtr(c, 1);
-       write_zsreg(c, R3, c->regs[R3] | RxENABLE);
-       spin_unlock_irqrestore(c->lock, cflags);
-
-       return 0;
-}
-EXPORT_SYMBOL(z8530_sync_txdma_open);
-
-/**
- *     z8530_sync_txdma_close - Close down a TX driven DMA channel
- *     @dev: Network device to detach
- *     @c: Z8530 channel to move into discard mode
- *
- *     Shut down a DMA/PIO split mode synchronous interface. Halt the DMA,
- *     and  free the buffers.
- */
-
-int z8530_sync_txdma_close(struct net_device *dev, struct z8530_channel *c)
-{
-       unsigned long dflags, cflags;
-       u8 chk;
-
-       spin_lock_irqsave(c->lock, cflags);
-
-       c->irqs = &z8530_nop;
-       c->max = 0;
-       c->sync = 0;
-
-       /*      Disable the PC DMA channels
-        */
-
-       dflags = claim_dma_lock();
-
-       disable_dma(c->txdma);
-       clear_dma_ff(c->txdma);
-       c->txdma_on = 0;
-       c->tx_dma_used = 0;
-
-       release_dma_lock(dflags);
-
-       /*      Disable DMA control mode
-        */
-
-       c->regs[R1] &= ~WT_RDY_ENAB;
-       write_zsreg(c, R1, c->regs[R1]);
-       c->regs[R1] &= ~(WT_RDY_RT | WT_FN_RDYFN | INT_ERR_Rx);
-       c->regs[R1] |= INT_ALL_Rx;
-       write_zsreg(c, R1, c->regs[R1]);
-       c->regs[R14] &= ~DTRREQ;
-       write_zsreg(c, R14, c->regs[R14]);
-
-       if (c->tx_dma_buf[0]) {
-               free_page((unsigned long)c->tx_dma_buf[0]);
-               c->tx_dma_buf[0] = NULL;
-       }
-       chk = read_zsreg(c, R0);
-       write_zsreg(c, R3, c->regs[R3]);
-       z8530_rtsdtr(c, 0);
-
-       spin_unlock_irqrestore(c->lock, cflags);
-       return 0;
-}
-EXPORT_SYMBOL(z8530_sync_txdma_close);
-
-/*     Name strings for Z8530 chips. SGI claim to have a 130, Zilog deny
- *     it exists...
- */
-static const char * const z8530_type_name[] = {
-       "Z8530",
-       "Z85C30",
-       "Z85230"
-};
-
-/**
- *     z8530_describe - Uniformly describe a Z8530 port
- *     @dev: Z8530 device to describe
- *     @mapping: string holding mapping type (eg "I/O" or "Mem")
- *     @io: the port value in question
- *
- *     Describe a Z8530 in a standard format. We must pass the I/O as
- *     the port offset isn't predictable. The main reason for this function
- *     is to try and get a common format of report.
- */
-
-void z8530_describe(struct z8530_dev *dev, char *mapping, unsigned long io)
-{
-       pr_info("%s: %s found at %s 0x%lX, IRQ %d\n",
-               dev->name,
-               z8530_type_name[dev->type],
-               mapping,
-               Z8530_PORT_OF(io),
-               dev->irq);
-}
-EXPORT_SYMBOL(z8530_describe);
-
-/*     Locked operation part of the z8530 init code
- */
-static inline int do_z8530_init(struct z8530_dev *dev)
-{
-       /* NOP the interrupt handlers first - we might get a
-        * floating IRQ transition when we reset the chip
-        */
-       dev->chanA.irqs = &z8530_nop;
-       dev->chanB.irqs = &z8530_nop;
-       dev->chanA.dcdcheck = DCD;
-       dev->chanB.dcdcheck = DCD;
-
-       /* Reset the chip */
-       write_zsreg(&dev->chanA, R9, 0xC0);
-       udelay(200);
-       /* Now check its valid */
-       write_zsreg(&dev->chanA, R12, 0xAA);
-       if (read_zsreg(&dev->chanA, R12) != 0xAA)
-               return -ENODEV;
-       write_zsreg(&dev->chanA, R12, 0x55);
-       if (read_zsreg(&dev->chanA, R12) != 0x55)
-               return -ENODEV;
-
-       dev->type = Z8530;
-
-       /*      See the application note.
-        */
-
-       write_zsreg(&dev->chanA, R15, 0x01);
-
-       /*      If we can set the low bit of R15 then
-        *      the chip is enhanced.
-        */
-
-       if (read_zsreg(&dev->chanA, R15) == 0x01) {
-               /* This C30 versus 230 detect is from Klaus Kudielka's dmascc */
-               /* Put a char in the fifo */
-               write_zsreg(&dev->chanA, R8, 0);
-               if (read_zsreg(&dev->chanA, R0) & Tx_BUF_EMP)
-                       dev->type = Z85230;     /* Has a FIFO */
-               else
-                       dev->type = Z85C30;     /* Z85C30, 1 byte FIFO */
-       }
-
-       /*      The code assumes R7' and friends are
-        *      off. Use write_zsext() for these and keep
-        *      this bit clear.
-        */
-
-       write_zsreg(&dev->chanA, R15, 0);
-
-       /*      At this point it looks like the chip is behaving
-        */
-
-       memcpy(dev->chanA.regs, reg_init, 16);
-       memcpy(dev->chanB.regs, reg_init, 16);
-
-       return 0;
-}
-
-/**
- *     z8530_init - Initialise a Z8530 device
- *     @dev: Z8530 device to initialise.
- *
- *     Configure up a Z8530/Z85C30 or Z85230 chip. We check the device
- *     is present, identify the type and then program it to hopefully
- *     keep quite and behave. This matters a lot, a Z8530 in the wrong
- *     state will sometimes get into stupid modes generating 10Khz
- *     interrupt streams and the like.
- *
- *     We set the interrupt handler up to discard any events, in case
- *     we get them during reset or setp.
- *
- *     Return 0 for success, or a negative value indicating the problem
- *     in errno form.
- */
-
-int z8530_init(struct z8530_dev *dev)
-{
-       unsigned long flags;
-       int ret;
-
-       /* Set up the chip level lock */
-       spin_lock_init(&dev->lock);
-       dev->chanA.lock = &dev->lock;
-       dev->chanB.lock = &dev->lock;
-
-       spin_lock_irqsave(&dev->lock, flags);
-       ret = do_z8530_init(dev);
-       spin_unlock_irqrestore(&dev->lock, flags);
-
-       return ret;
-}
-EXPORT_SYMBOL(z8530_init);
-
-/**
- *     z8530_shutdown - Shutdown a Z8530 device
- *     @dev: The Z8530 chip to shutdown
- *
- *     We set the interrupt handlers to silence any interrupts. We then
- *     reset the chip and wait 100uS to be sure the reset completed. Just
- *     in case the caller then tries to do stuff.
- *
- *     This is called without the lock held
- */
-int z8530_shutdown(struct z8530_dev *dev)
-{
-       unsigned long flags;
-       /* Reset the chip */
-
-       spin_lock_irqsave(&dev->lock, flags);
-       dev->chanA.irqs = &z8530_nop;
-       dev->chanB.irqs = &z8530_nop;
-       write_zsreg(&dev->chanA, R9, 0xC0);
-       /* We must lock the udelay, the chip is offlimits here */
-       udelay(100);
-       spin_unlock_irqrestore(&dev->lock, flags);
-       return 0;
-}
-EXPORT_SYMBOL(z8530_shutdown);
-
-/**
- *     z8530_channel_load - Load channel data
- *     @c: Z8530 channel to configure
- *     @rtable: table of register, value pairs
- *     FIXME: ioctl to allow user uploaded tables
- *
- *     Load a Z8530 channel up from the system data. We use +16 to
- *     indicate the "prime" registers. The value 255 terminates the
- *     table.
- */
-
-int z8530_channel_load(struct z8530_channel *c, u8 *rtable)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(c->lock, flags);
-
-       while (*rtable != 255) {
-               int reg = *rtable++;
-
-               if (reg > 0x0F)
-                       write_zsreg(c, R15, c->regs[15] | 1);
-               write_zsreg(c, reg & 0x0F, *rtable);
-               if (reg > 0x0F)
-                       write_zsreg(c, R15, c->regs[15] & ~1);
-               c->regs[reg] = *rtable++;
-       }
-       c->rx_function = z8530_null_rx;
-       c->skb = NULL;
-       c->tx_skb = NULL;
-       c->tx_next_skb = NULL;
-       c->mtu = 1500;
-       c->max = 0;
-       c->count = 0;
-       c->status = read_zsreg(c, R0);
-       c->sync = 1;
-       write_zsreg(c, R3, c->regs[R3] | RxENABLE);
-
-       spin_unlock_irqrestore(c->lock, flags);
-       return 0;
-}
-EXPORT_SYMBOL(z8530_channel_load);
-
-/**
- *     z8530_tx_begin - Begin packet transmission
- *     @c: The Z8530 channel to kick
- *
- *     This is the speed sensitive side of transmission. If we are called
- *     and no buffer is being transmitted we commence the next buffer. If
- *     nothing is queued we idle the sync.
- *
- *     Note: We are handling this code path in the interrupt path, keep it
- *     fast or bad things will happen.
- *
- *     Called with the lock held.
- */
-
-static void z8530_tx_begin(struct z8530_channel *c)
-{
-       unsigned long flags;
-
-       if (c->tx_skb)
-               return;
-
-       c->tx_skb = c->tx_next_skb;
-       c->tx_next_skb = NULL;
-       c->tx_ptr = c->tx_next_ptr;
-
-       if (!c->tx_skb) {
-               /* Idle on */
-               if (c->dma_tx) {
-                       flags = claim_dma_lock();
-                       disable_dma(c->txdma);
-                       /*      Check if we crapped out.
-                        */
-                       if (get_dma_residue(c->txdma)) {
-                               c->netdevice->stats.tx_dropped++;
-                               c->netdevice->stats.tx_fifo_errors++;
-                       }
-                       release_dma_lock(flags);
-               }
-               c->txcount = 0;
-       } else {
-               c->txcount = c->tx_skb->len;
-
-               if (c->dma_tx) {
-                       /*      FIXME. DMA is broken for the original 8530,
-                        *      on the older parts we need to set a flag and
-                        *      wait for a further TX interrupt to fire this
-                        *      stage off
-                        */
-
-                       flags = claim_dma_lock();
-                       disable_dma(c->txdma);
-
-                       /*      These two are needed by the 8530/85C30
-                        *      and must be issued when idling.
-                        */
-                       if (c->dev->type != Z85230) {
-                               write_zsctrl(c, RES_Tx_CRC);
-                               write_zsctrl(c, RES_EOM_L);
-                       }
-                       write_zsreg(c, R10, c->regs[10] & ~ABUNDER);
-                       clear_dma_ff(c->txdma);
-                       set_dma_addr(c->txdma, virt_to_bus(c->tx_ptr));
-                       set_dma_count(c->txdma, c->txcount);
-                       enable_dma(c->txdma);
-                       release_dma_lock(flags);
-                       write_zsctrl(c, RES_EOM_L);
-                       write_zsreg(c, R5, c->regs[R5] | TxENAB);
-               } else {
-                       /* ABUNDER off */
-                       write_zsreg(c, R10, c->regs[10]);
-                       write_zsctrl(c, RES_Tx_CRC);
-
-                       while (c->txcount && (read_zsreg(c, R0) & Tx_BUF_EMP)) {
-                               write_zsreg(c, R8, *c->tx_ptr++);
-                               c->txcount--;
-                       }
-               }
-       }
-       /*      Since we emptied tx_skb we can ask for more
-        */
-       netif_wake_queue(c->netdevice);
-}
-
-/**
- *     z8530_tx_done - TX complete callback
- *     @c: The channel that completed a transmit.
- *
- *     This is called when we complete a packet send. We wake the queue,
- *     start the next packet going and then free the buffer of the existing
- *     packet. This code is fairly timing sensitive.
- *
- *     Called with the register lock held.
- */
-
-static void z8530_tx_done(struct z8530_channel *c)
-{
-       struct sk_buff *skb;
-
-       /* Actually this can happen.*/
-       if (!c->tx_skb)
-               return;
-
-       skb = c->tx_skb;
-       c->tx_skb = NULL;
-       z8530_tx_begin(c);
-       c->netdevice->stats.tx_packets++;
-       c->netdevice->stats.tx_bytes += skb->len;
-       dev_consume_skb_irq(skb);
-}
-
-/**
- *     z8530_null_rx - Discard a packet
- *     @c: The channel the packet arrived on
- *     @skb: The buffer
- *
- *     We point the receive handler at this function when idle. Instead
- *     of processing the frames we get to throw them away.
- */
-void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb)
-{
-       dev_kfree_skb_any(skb);
-}
-EXPORT_SYMBOL(z8530_null_rx);
-
-/**
- *     z8530_rx_done - Receive completion callback
- *     @c: The channel that completed a receive
- *
- *     A new packet is complete. Our goal here is to get back into receive
- *     mode as fast as possible. On the Z85230 we could change to using
- *     ESCC mode, but on the older chips we have no choice. We flip to the
- *     new buffer immediately in DMA mode so that the DMA of the next
- *     frame can occur while we are copying the previous buffer to an sk_buff
- *
- *     Called with the lock held
- */
-static void z8530_rx_done(struct z8530_channel *c)
-{
-       struct sk_buff *skb;
-       int ct;
-
-       /*      Is our receive engine in DMA mode
-        */
-       if (c->rxdma_on) {
-               /*      Save the ready state and the buffer currently
-                *      being used as the DMA target
-                */
-               int ready = c->dma_ready;
-               unsigned char *rxb = c->rx_buf[c->dma_num];
-               unsigned long flags;
-
-               /*      Complete this DMA. Necessary to find the length
-                */
-               flags = claim_dma_lock();
-
-               disable_dma(c->rxdma);
-               clear_dma_ff(c->rxdma);
-               c->rxdma_on = 0;
-               ct = c->mtu - get_dma_residue(c->rxdma);
-               if (ct < 0)
-                       ct = 2; /* Shit happens.. */
-               c->dma_ready = 0;
-
-               /*      Normal case: the other slot is free, start the next DMA
-                *      into it immediately.
-                */
-
-               if (ready) {
-                       c->dma_num ^= 1;
-                       set_dma_mode(c->rxdma, DMA_MODE_READ | 0x10);
-                       set_dma_addr(c->rxdma, virt_to_bus(c->rx_buf[c->dma_num]));
-                       set_dma_count(c->rxdma, c->mtu);
-                       c->rxdma_on = 1;
-                       enable_dma(c->rxdma);
-                       /* Stop any frames that we missed the head of
-                        * from passing
-                        */
-                       write_zsreg(c, R0, RES_Rx_CRC);
-               } else {
-                       /* Can't occur as we dont reenable the DMA irq until
-                        * after the flip is done
-                        */
-                       netdev_warn(c->netdevice, "DMA flip overrun!\n");
-               }
-
-               release_dma_lock(flags);
-
-               /*      Shove the old buffer into an sk_buff. We can't DMA
-                *      directly into one on a PC - it might be above the 16Mb
-                *      boundary. Optimisation - we could check to see if we
-                *      can avoid the copy. Optimisation 2 - make the memcpy
-                *      a copychecksum.
-                */
-
-               skb = dev_alloc_skb(ct);
-               if (!skb) {
-                       c->netdevice->stats.rx_dropped++;
-                       netdev_warn(c->netdevice, "Memory squeeze\n");
-               } else {
-                       skb_put(skb, ct);
-                       skb_copy_to_linear_data(skb, rxb, ct);
-                       c->netdevice->stats.rx_packets++;
-                       c->netdevice->stats.rx_bytes += ct;
-               }
-               c->dma_ready = 1;
-       } else {
-               RT_LOCK;
-               skb = c->skb;
-
-               /*      The game we play for non DMA is similar. We want to
-                *      get the controller set up for the next packet as fast
-                *      as possible. We potentially only have one byte + the
-                *      fifo length for this. Thus we want to flip to the new
-                *      buffer and then mess around copying and allocating
-                *      things. For the current case it doesn't matter but
-                *      if you build a system where the sync irq isn't blocked
-                *      by the kernel IRQ disable then you need only block the
-                *      sync IRQ for the RT_LOCK area.
-                *
-                */
-               ct = c->count;
-
-               c->skb = c->skb2;
-               c->count = 0;
-               c->max = c->mtu;
-               if (c->skb) {
-                       c->dptr = c->skb->data;
-                       c->max = c->mtu;
-               } else {
-                       c->count = 0;
-                       c->max = 0;
-               }
-               RT_UNLOCK;
-
-               c->skb2 = dev_alloc_skb(c->mtu);
-               if (c->skb2)
-                       skb_put(c->skb2, c->mtu);
-
-               c->netdevice->stats.rx_packets++;
-               c->netdevice->stats.rx_bytes += ct;
-       }
-       /*      If we received a frame we must now process it.
-        */
-       if (skb) {
-               skb_trim(skb, ct);
-               c->rx_function(c, skb);
-       } else {
-               c->netdevice->stats.rx_dropped++;
-               netdev_err(c->netdevice, "Lost a frame\n");
-       }
-}
-
-/**
- *     spans_boundary - Check a packet can be ISA DMA'd
- *     @skb: The buffer to check
- *
- *     Returns true if the buffer cross a DMA boundary on a PC. The poor
- *     thing can only DMA within a 64K block not across the edges of it.
- */
-
-static inline int spans_boundary(struct sk_buff *skb)
-{
-       unsigned long a = (unsigned long)skb->data;
-
-       a ^= (a + skb->len);
-       if (a & 0x00010000)     /* If the 64K bit is different.. */
-               return 1;
-       return 0;
-}
-
-/**
- *     z8530_queue_xmit - Queue a packet
- *     @c: The channel to use
- *     @skb: The packet to kick down the channel
- *
- *     Queue a packet for transmission. Because we have rather
- *     hard to hit interrupt latencies for the Z85230 per packet
- *     even in DMA mode we do the flip to DMA buffer if needed here
- *     not in the IRQ.
- *
- *     Called from the network code. The lock is not held at this
- *     point.
- */
-netdev_tx_t z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb)
-{
-       unsigned long flags;
-
-       netif_stop_queue(c->netdevice);
-       if (c->tx_next_skb)
-               return NETDEV_TX_BUSY;
-
-       /* PC SPECIFIC - DMA limits */
-       /*      If we will DMA the transmit and its gone over the ISA bus
-        *      limit, then copy to the flip buffer
-        */
-
-       if (c->dma_tx &&
-           ((unsigned long)(virt_to_bus(skb->data + skb->len)) >=
-           16 * 1024 * 1024 || spans_boundary(skb))) {
-               /*      Send the flip buffer, and flip the flippy bit.
-                *      We don't care which is used when just so long as
-                *      we never use the same buffer twice in a row. Since
-                *      only one buffer can be going out at a time the other
-                *      has to be safe.
-                */
-               c->tx_next_ptr = c->tx_dma_buf[c->tx_dma_used];
-               c->tx_dma_used ^= 1;    /* Flip temp buffer */
-               skb_copy_from_linear_data(skb, c->tx_next_ptr, skb->len);
-       } else {
-               c->tx_next_ptr = skb->data;
-       }
-       RT_LOCK;
-       c->tx_next_skb = skb;
-       RT_UNLOCK;
-
-       spin_lock_irqsave(c->lock, flags);
-       z8530_tx_begin(c);
-       spin_unlock_irqrestore(c->lock, flags);
-
-       return NETDEV_TX_OK;
-}
-EXPORT_SYMBOL(z8530_queue_xmit);
-
-/*     Module support
- */
-static const char banner[] __initconst =
-       KERN_INFO "Generic Z85C30/Z85230 interface driver v0.02\n";
-
-static int __init z85230_init_driver(void)
-{
-       printk(banner);
-       return 0;
-}
-module_init(z85230_init_driver);
-
-static void __exit z85230_cleanup_driver(void)
-{
-}
-module_exit(z85230_cleanup_driver);
-
-MODULE_AUTHOR("Red Hat Inc.");
-MODULE_DESCRIPTION("Z85x30 synchronous driver core");
-MODULE_LICENSE("GPL");
diff --git a/drivers/net/wan/z85230.h b/drivers/net/wan/z85230.h
deleted file mode 100644 (file)
index 462cb62..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- *     Description of Z8530 Z85C30 and Z85230 communications chips
- *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 1998 Alan Cox <alan@lxorguk.ukuu.org.uk>
- */
-
-#ifndef _Z8530_H
-#define _Z8530_H
-
-#include <linux/tty.h>
-#include <linux/interrupt.h>
-
-/* Conversion routines to/from brg time constants from/to bits
- * per second.
- */
-#define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
-#define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
-
-/* The Zilog register set */
-
-#define        FLAG    0x7e
-
-/* Write Register 0 */
-#define        R0      0               /* Register selects */
-#define        R1      1
-#define        R2      2
-#define        R3      3
-#define        R4      4
-#define        R5      5
-#define        R6      6
-#define        R7      7
-#define        R8      8
-#define        R9      9
-#define        R10     10
-#define        R11     11
-#define        R12     12
-#define        R13     13
-#define        R14     14
-#define        R15     15
-
-#define RPRIME 16              /* Indicate a prime register access on 230 */
-
-#define        NULLCODE        0       /* Null Code */
-#define        POINT_HIGH      0x8     /* Select upper half of registers */
-#define        RES_EXT_INT     0x10    /* Reset Ext. Status Interrupts */
-#define        SEND_ABORT      0x18    /* HDLC Abort */
-#define        RES_RxINT_FC    0x20    /* Reset RxINT on First Character */
-#define        RES_Tx_P        0x28    /* Reset TxINT Pending */
-#define        ERR_RES         0x30    /* Error Reset */
-#define        RES_H_IUS       0x38    /* Reset highest IUS */
-
-#define        RES_Rx_CRC      0x40    /* Reset Rx CRC Checker */
-#define        RES_Tx_CRC      0x80    /* Reset Tx CRC Checker */
-#define        RES_EOM_L       0xC0    /* Reset EOM latch */
-
-/* Write Register 1 */
-
-#define        EXT_INT_ENAB    0x1     /* Ext Int Enable */
-#define        TxINT_ENAB      0x2     /* Tx Int Enable */
-#define        PAR_SPEC        0x4     /* Parity is special condition */
-
-#define        RxINT_DISAB     0       /* Rx Int Disable */
-#define        RxINT_FCERR     0x8     /* Rx Int on First Character Only or Error */
-#define        INT_ALL_Rx      0x10    /* Int on all Rx Characters or error */
-#define        INT_ERR_Rx      0x18    /* Int on error only */
-
-#define        WT_RDY_RT       0x20    /* Wait/Ready on R/T */
-#define        WT_FN_RDYFN     0x40    /* Wait/FN/Ready FN */
-#define        WT_RDY_ENAB     0x80    /* Wait/Ready Enable */
-
-/* Write Register #2 (Interrupt Vector) */
-
-/* Write Register 3 */
-
-#define        RxENABLE        0x1     /* Rx Enable */
-#define        SYNC_L_INH      0x2     /* Sync Character Load Inhibit */
-#define        ADD_SM          0x4     /* Address Search Mode (SDLC) */
-#define        RxCRC_ENAB      0x8     /* Rx CRC Enable */
-#define        ENT_HM          0x10    /* Enter Hunt Mode */
-#define        AUTO_ENAB       0x20    /* Auto Enables */
-#define        Rx5             0x0     /* Rx 5 Bits/Character */
-#define        Rx7             0x40    /* Rx 7 Bits/Character */
-#define        Rx6             0x80    /* Rx 6 Bits/Character */
-#define        Rx8             0xc0    /* Rx 8 Bits/Character */
-
-/* Write Register 4 */
-
-#define        PAR_ENA         0x1     /* Parity Enable */
-#define        PAR_EVEN        0x2     /* Parity Even/Odd* */
-
-#define        SYNC_ENAB       0       /* Sync Modes Enable */
-#define        SB1             0x4     /* 1 stop bit/char */
-#define        SB15            0x8     /* 1.5 stop bits/char */
-#define        SB2             0xc     /* 2 stop bits/char */
-
-#define        MONSYNC         0       /* 8 Bit Sync character */
-#define        BISYNC          0x10    /* 16 bit sync character */
-#define        SDLC            0x20    /* SDLC Mode (01111110 Sync Flag) */
-#define        EXTSYNC         0x30    /* External Sync Mode */
-
-#define        X1CLK           0x0     /* x1 clock mode */
-#define        X16CLK          0x40    /* x16 clock mode */
-#define        X32CLK          0x80    /* x32 clock mode */
-#define        X64CLK          0xC0    /* x64 clock mode */
-
-/* Write Register 5 */
-
-#define        TxCRC_ENAB      0x1     /* Tx CRC Enable */
-#define        RTS             0x2     /* RTS */
-#define        SDLC_CRC        0x4     /* SDLC/CRC-16 */
-#define        TxENAB          0x8     /* Tx Enable */
-#define        SND_BRK         0x10    /* Send Break */
-#define        Tx5             0x0     /* Tx 5 bits (or less)/character */
-#define        Tx7             0x20    /* Tx 7 bits/character */
-#define        Tx6             0x40    /* Tx 6 bits/character */
-#define        Tx8             0x60    /* Tx 8 bits/character */
-#define        DTR             0x80    /* DTR */
-
-/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */
-
-/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */
-
-/* Write Register 8 (transmit buffer) */
-
-/* Write Register 9 (Master interrupt control) */
-#define        VIS     1       /* Vector Includes Status */
-#define        NV      2       /* No Vector */
-#define        DLC     4       /* Disable Lower Chain */
-#define        MIE     8       /* Master Interrupt Enable */
-#define        STATHI  0x10    /* Status high */
-#define        NORESET 0       /* No reset on write to R9 */
-#define        CHRB    0x40    /* Reset channel B */
-#define        CHRA    0x80    /* Reset channel A */
-#define        FHWRES  0xc0    /* Force hardware reset */
-
-/* Write Register 10 (misc control bits) */
-#define        BIT6    1       /* 6 bit/8bit sync */
-#define        LOOPMODE 2      /* SDLC Loop mode */
-#define        ABUNDER 4       /* Abort/flag on SDLC xmit underrun */
-#define        MARKIDLE 8      /* Mark/flag on idle */
-#define        GAOP    0x10    /* Go active on poll */
-#define        NRZ     0       /* NRZ mode */
-#define        NRZI    0x20    /* NRZI mode */
-#define        FM1     0x40    /* FM1 (transition = 1) */
-#define        FM0     0x60    /* FM0 (transition = 0) */
-#define        CRCPS   0x80    /* CRC Preset I/O */
-
-/* Write Register 11 (Clock Mode control) */
-#define        TRxCXT  0       /* TRxC = Xtal output */
-#define        TRxCTC  1       /* TRxC = Transmit clock */
-#define        TRxCBR  2       /* TRxC = BR Generator Output */
-#define        TRxCDP  3       /* TRxC = DPLL output */
-#define        TRxCOI  4       /* TRxC O/I */
-#define        TCRTxCP 0       /* Transmit clock = RTxC pin */
-#define        TCTRxCP 8       /* Transmit clock = TRxC pin */
-#define        TCBR    0x10    /* Transmit clock = BR Generator output */
-#define        TCDPLL  0x18    /* Transmit clock = DPLL output */
-#define        RCRTxCP 0       /* Receive clock = RTxC pin */
-#define        RCTRxCP 0x20    /* Receive clock = TRxC pin */
-#define        RCBR    0x40    /* Receive clock = BR Generator output */
-#define        RCDPLL  0x60    /* Receive clock = DPLL output */
-#define        RTxCX   0x80    /* RTxC Xtal/No Xtal */
-
-/* Write Register 12 (lower byte of baud rate generator time constant) */
-
-/* Write Register 13 (upper byte of baud rate generator time constant) */
-
-/* Write Register 14 (Misc control bits) */
-#define        BRENABL 1       /* Baud rate generator enable */
-#define        BRSRC   2       /* Baud rate generator source */
-#define        DTRREQ  4       /* DTR/Request function */
-#define        AUTOECHO 8      /* Auto Echo */
-#define        LOOPBAK 0x10    /* Local loopback */
-#define        SEARCH  0x20    /* Enter search mode */
-#define        RMC     0x40    /* Reset missing clock */
-#define        DISDPLL 0x60    /* Disable DPLL */
-#define        SSBR    0x80    /* Set DPLL source = BR generator */
-#define        SSRTxC  0xa0    /* Set DPLL source = RTxC */
-#define        SFMM    0xc0    /* Set FM mode */
-#define        SNRZI   0xe0    /* Set NRZI mode */
-
-/* Write Register 15 (external/status interrupt control) */
-#define PRIME  1       /* R5' etc register access (Z85C30/230 only) */
-#define        ZCIE    2       /* Zero count IE */
-#define FIFOE  4       /* Z85230 only */
-#define        DCDIE   8       /* DCD IE */
-#define        SYNCIE  0x10    /* Sync/hunt IE */
-#define        CTSIE   0x20    /* CTS IE */
-#define        TxUIE   0x40    /* Tx Underrun/EOM IE */
-#define        BRKIE   0x80    /* Break/Abort IE */
-
-
-/* Read Register 0 */
-#define        Rx_CH_AV        0x1     /* Rx Character Available */
-#define        ZCOUNT          0x2     /* Zero count */
-#define        Tx_BUF_EMP      0x4     /* Tx Buffer empty */
-#define        DCD             0x8     /* DCD */
-#define        SYNC_HUNT       0x10    /* Sync/hunt */
-#define        CTS             0x20    /* CTS */
-#define        TxEOM           0x40    /* Tx underrun */
-#define        BRK_ABRT        0x80    /* Break/Abort */
-
-/* Read Register 1 */
-#define        ALL_SNT         0x1     /* All sent */
-/* Residue Data for 8 Rx bits/char programmed */
-#define        RES3            0x8     /* 0/3 */
-#define        RES4            0x4     /* 0/4 */
-#define        RES5            0xc     /* 0/5 */
-#define        RES6            0x2     /* 0/6 */
-#define        RES7            0xa     /* 0/7 */
-#define        RES8            0x6     /* 0/8 */
-#define        RES18           0xe     /* 1/8 */
-#define        RES28           0x0     /* 2/8 */
-/* Special Rx Condition Interrupts */
-#define        PAR_ERR         0x10    /* Parity error */
-#define        Rx_OVR          0x20    /* Rx Overrun Error */
-#define        CRC_ERR         0x40    /* CRC/Framing Error */
-#define        END_FR          0x80    /* End of Frame (SDLC) */
-
-/* Read Register 2 (channel b only) - Interrupt vector */
-
-/* Read Register 3 (interrupt pending register) ch a only */
-#define        CHBEXT  0x1             /* Channel B Ext/Stat IP */
-#define        CHBTxIP 0x2             /* Channel B Tx IP */
-#define        CHBRxIP 0x4             /* Channel B Rx IP */
-#define        CHAEXT  0x8             /* Channel A Ext/Stat IP */
-#define        CHATxIP 0x10            /* Channel A Tx IP */
-#define        CHARxIP 0x20            /* Channel A Rx IP */
-
-/* Read Register 8 (receive data register) */
-
-/* Read Register 10  (misc status bits) */
-#define        ONLOOP  2               /* On loop */
-#define        LOOPSEND 0x10           /* Loop sending */
-#define        CLK2MIS 0x40            /* Two clocks missing */
-#define        CLK1MIS 0x80            /* One clock missing */
-
-/* Read Register 12 (lower byte of baud rate generator constant) */
-
-/* Read Register 13 (upper byte of baud rate generator constant) */
-
-/* Read Register 15 (value of WR 15) */
-
-
-/*
- *     Interrupt handling functions for this SCC
- */
-
-struct z8530_channel;
-struct z8530_irqhandler
-{
-       void (*rx)(struct z8530_channel *);
-       void (*tx)(struct z8530_channel *);
-       void (*status)(struct z8530_channel *);
-};
-
-/*
- *     A channel of the Z8530
- */
-
-struct z8530_channel
-{
-       struct          z8530_irqhandler *irqs;         /* IRQ handlers */
-       /*
-        *      Synchronous
-        */
-       u16             count;          /* Buyes received */
-       u16             max;            /* Most we can receive this frame */
-       u16             mtu;            /* MTU of the device */
-       u8              *dptr;          /* Pointer into rx buffer */
-       struct sk_buff  *skb;           /* Buffer dptr points into */
-       struct sk_buff  *skb2;          /* Pending buffer */
-       u8              status;         /* Current DCD */
-       u8              dcdcheck;       /* which bit to check for line */
-       u8              sync;           /* Set if in sync mode */
-
-       u8              regs[32];       /* Register map for the chip */
-       u8              pendregs[32];   /* Pending register values */
-       
-       struct sk_buff  *tx_skb;        /* Buffer being transmitted */
-       struct sk_buff  *tx_next_skb;   /* Next transmit buffer */
-       u8              *tx_ptr;        /* Byte pointer into the buffer */
-       u8              *tx_next_ptr;   /* Next pointer to use */
-       u8              *tx_dma_buf[2]; /* TX flip buffers for DMA */
-       u8              tx_dma_used;    /* Flip buffer usage toggler */
-       u16             txcount;        /* Count of bytes to transmit */
-       
-       void            (*rx_function)(struct z8530_channel *, struct sk_buff *);
-       
-       /*
-        *      Sync DMA
-        */
-       
-       u8              rxdma;          /* DMA channels */
-       u8              txdma;          
-       u8              rxdma_on;       /* DMA active if flag set */
-       u8              txdma_on;
-       u8              dma_num;        /* Buffer we are DMAing into */
-       u8              dma_ready;      /* Is the other buffer free */
-       u8              dma_tx;         /* TX is to use DMA */
-       u8              *rx_buf[2];     /* The flip buffers */
-       
-       /*
-        *      System
-        */
-        
-       struct z8530_dev *dev;          /* Z85230 chip instance we are from */
-       unsigned long   ctrlio;         /* I/O ports */
-       unsigned long   dataio;
-
-       /*
-        *      For PC we encode this way.
-        */     
-#define Z8530_PORT_SLEEP       0x80000000
-#define Z8530_PORT_OF(x)       ((x)&0xFFFF)
-
-       u32             rx_overrun;             /* Overruns - not done yet */
-       u32             rx_crc_err;
-
-       /*
-        *      Bound device pointers
-        */
-
-       void            *private;       /* For our owner */
-       struct net_device       *netdevice;     /* Network layer device */
-
-       spinlock_t              *lock;    /* Device lock */
-};
-
-/*
- *     Each Z853x0 device.
- */
-
-struct z8530_dev
-{
-       char *name;     /* Device instance name */
-       struct z8530_channel chanA;     /* SCC channel A */
-       struct z8530_channel chanB;     /* SCC channel B */
-       int type;
-#define Z8530  0       /* NMOS dinosaur */     
-#define Z85C30 1       /* CMOS - better */
-#define Z85230 2       /* CMOS with real FIFO */
-       int irq;        /* Interrupt for the device */
-       int active;     /* Soft interrupt enable - the Mac doesn't 
-                          always have a hard disable on its 8530s... */
-       spinlock_t lock;
-};
-
-
-/*
- *     Functions
- */
-extern u8 z8530_dead_port[];
-extern u8 z8530_hdlc_kilostream_85230[];
-extern u8 z8530_hdlc_kilostream[];
-irqreturn_t z8530_interrupt(int, void *);
-void z8530_describe(struct z8530_dev *, char *mapping, unsigned long io);
-int z8530_init(struct z8530_dev *);
-int z8530_shutdown(struct z8530_dev *);
-int z8530_sync_open(struct net_device *, struct z8530_channel *);
-int z8530_sync_close(struct net_device *, struct z8530_channel *);
-int z8530_sync_dma_open(struct net_device *, struct z8530_channel *);
-int z8530_sync_dma_close(struct net_device *, struct z8530_channel *);
-int z8530_sync_txdma_open(struct net_device *, struct z8530_channel *);
-int z8530_sync_txdma_close(struct net_device *, struct z8530_channel *);
-int z8530_channel_load(struct z8530_channel *, u8 *);
-netdev_tx_t z8530_queue_xmit(struct z8530_channel *c, struct sk_buff *skb);
-void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb);
-
-
-/*
- *     Standard interrupt vector sets
- */
-extern struct z8530_irqhandler z8530_sync, z8530_async, z8530_nop;
-
-/*
- *     Asynchronous Interfacing
- */
-
-/*
- * The size of the serial xmit buffer is 1 page, or 4096 bytes
- */
-
-#define SERIAL_XMIT_SIZE 4096
-#define WAKEUP_CHARS   256
-
-/*
- * Events are used to schedule things to happen at timer-interrupt
- * time, instead of at rs interrupt time.
- */
-#define RS_EVENT_WRITE_WAKEUP  0
-
-/* Internal flags used only by kernel/chr_drv/serial.c */
-#define ZILOG_INITIALIZED      0x80000000 /* Serial port was initialized */
-#define ZILOG_CALLOUT_ACTIVE   0x40000000 /* Call out device is active */
-#define ZILOG_NORMAL_ACTIVE    0x20000000 /* Normal device is active */
-#define ZILOG_BOOT_AUTOCONF    0x10000000 /* Autoconfigure port on bootup */
-#define ZILOG_CLOSING          0x08000000 /* Serial port is closing */
-#define ZILOG_CTS_FLOW         0x04000000 /* Do CTS flow control */
-#define ZILOG_CHECK_CD         0x02000000 /* i.e., CLOCAL */
-
-#endif /* !(_Z8530_H) */