Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
z85230.c File Reference
#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>
#include <linux/spinlock.h>
#include "z85230.h"

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define RT_LOCK
 
#define RT_UNLOCK
 

Functions

 EXPORT_SYMBOL (z8530_dead_port)
 
 EXPORT_SYMBOL (z8530_hdlc_kilostream)
 
 EXPORT_SYMBOL (z8530_hdlc_kilostream_85230)
 
 EXPORT_SYMBOL (z8530_sync)
 
 EXPORT_SYMBOL (z8530_nop)
 
irqreturn_t z8530_interrupt (int irq, void *dev_id)
 
 EXPORT_SYMBOL (z8530_interrupt)
 
int z8530_sync_open (struct net_device *dev, struct z8530_channel *c)
 
 EXPORT_SYMBOL (z8530_sync_open)
 
int z8530_sync_close (struct net_device *dev, struct z8530_channel *c)
 
 EXPORT_SYMBOL (z8530_sync_close)
 
int z8530_sync_dma_open (struct net_device *dev, struct z8530_channel *c)
 
 EXPORT_SYMBOL (z8530_sync_dma_open)
 
int z8530_sync_dma_close (struct net_device *dev, struct z8530_channel *c)
 
 EXPORT_SYMBOL (z8530_sync_dma_close)
 
int z8530_sync_txdma_open (struct net_device *dev, struct z8530_channel *c)
 
 EXPORT_SYMBOL (z8530_sync_txdma_open)
 
int z8530_sync_txdma_close (struct net_device *dev, struct z8530_channel *c)
 
 EXPORT_SYMBOL (z8530_sync_txdma_close)
 
void z8530_describe (struct z8530_dev *dev, char *mapping, unsigned long io)
 
 EXPORT_SYMBOL (z8530_describe)
 
int z8530_init (struct z8530_dev *dev)
 
 EXPORT_SYMBOL (z8530_init)
 
int z8530_shutdown (struct z8530_dev *dev)
 
 EXPORT_SYMBOL (z8530_shutdown)
 
int z8530_channel_load (struct z8530_channel *c, u8 *rtable)
 
 EXPORT_SYMBOL (z8530_channel_load)
 
void z8530_null_rx (struct z8530_channel *c, struct sk_buff *skb)
 
 EXPORT_SYMBOL (z8530_null_rx)
 
netdev_tx_t z8530_queue_xmit (struct z8530_channel *c, struct sk_buff *skb)
 
 EXPORT_SYMBOL (z8530_queue_xmit)
 
 module_init (z85230_init_driver)
 
 module_exit (z85230_cleanup_driver)
 
 MODULE_AUTHOR ("Red Hat Inc.")
 
 MODULE_DESCRIPTION ("Z85x30 synchronous driver core")
 
 MODULE_LICENSE ("GPL")
 

Variables

u8 z8530_dead_port []
 
u8 z8530_hdlc_kilostream []
 
u8 z8530_hdlc_kilostream_85230 []
 
struct z8530_irqhandler z8530_sync
 
struct z8530_irqhandler z8530_nop
 

Macro Definition Documentation

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 39 of file z85230.c.

#define RT_LOCK

Definition at line 55 of file z85230.c.

#define RT_UNLOCK

Definition at line 56 of file z85230.c.

Function Documentation

EXPORT_SYMBOL ( z8530_dead_port  )
EXPORT_SYMBOL ( z8530_hdlc_kilostream  )
EXPORT_SYMBOL ( z8530_hdlc_kilostream_85230  )
EXPORT_SYMBOL ( z8530_sync  )
EXPORT_SYMBOL ( z8530_nop  )
EXPORT_SYMBOL ( z8530_interrupt  )
EXPORT_SYMBOL ( z8530_sync_open  )
EXPORT_SYMBOL ( z8530_sync_close  )
EXPORT_SYMBOL ( z8530_sync_dma_open  )
EXPORT_SYMBOL ( z8530_sync_dma_close  )
EXPORT_SYMBOL ( z8530_sync_txdma_open  )
EXPORT_SYMBOL ( z8530_sync_txdma_close  )
EXPORT_SYMBOL ( z8530_describe  )
EXPORT_SYMBOL ( z8530_init  )
EXPORT_SYMBOL ( z8530_shutdown  )
EXPORT_SYMBOL ( z8530_channel_load  )
EXPORT_SYMBOL ( z8530_null_rx  )
EXPORT_SYMBOL ( z8530_queue_xmit  )
MODULE_AUTHOR ( "Red Hat Inc."  )
MODULE_DESCRIPTION ( "Z85x30 synchronous driver core )
module_exit ( z85230_cleanup_driver  )
module_init ( z85230_init_driver  )
MODULE_LICENSE ( "GPL"  )
int z8530_channel_load ( struct z8530_channel c,
u8 rtable 
)

z8530_channel_load - Load channel data : Z8530 channel to configure : 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.

Definition at line 1383 of file z85230.c.

void z8530_describe ( struct z8530_dev dev,
char mapping,
unsigned long  io 
)

z8530_describe - Uniformly describe a Z8530 port : Z8530 device to describe : string holding mapping type (eg "I/O" or "Mem") : 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.

Definition at line 1229 of file z85230.c.

int z8530_init ( struct z8530_dev dev)

z8530_init - Initialise a Z8530 device : 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.

Definition at line 1324 of file z85230.c.

irqreturn_t z8530_interrupt ( int  irq,
void dev_id 
)

z8530_interrupt - Handle an interrupt from a Z8530 : Interrupt number : 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

Definition at line 707 of file z85230.c.

void z8530_null_rx ( struct z8530_channel c,
struct sk_buff skb 
)

z8530_null_rx - Discard a packet : The channel the packet arrived on : The buffer

We point the receive handler at this function when idle. Instead of processing the frames we get to throw them away.

Definition at line 1553 of file z85230.c.

netdev_tx_t z8530_queue_xmit ( struct z8530_channel c,
struct sk_buff skb 
)

z8530_queue_xmit - Queue a packet : The channel to use : 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.

Definition at line 1731 of file z85230.c.

int z8530_shutdown ( struct z8530_dev dev)

z8530_shutdown - Shutdown a Z8530 device : 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

Definition at line 1355 of file z85230.c.

int z8530_sync_close ( struct net_device dev,
struct z8530_channel c 
)

z8530_sync_close - Close a PIO Z8530 channel : Network device to close : Z8530 channel to disassociate and move to idle

Close down a Z8530 interface and switch its interrupt handlers to discard future events.

Definition at line 828 of file z85230.c.

int z8530_sync_dma_close ( struct net_device dev,
struct z8530_channel c 
)

z8530_sync_dma_close - Close down DMA I/O : Network device to detach : Z8530 channel to move into discard mode

Shut down a DMA mode synchronous interface. Halt the DMA, and free the buffers.

Definition at line 981 of file z85230.c.

int z8530_sync_dma_open ( struct net_device dev,
struct z8530_channel c 
)

z8530_sync_dma_open - Open a Z8530 for DMA I/O : The network device to attach : 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.

Definition at line 858 of file z85230.c.

int z8530_sync_open ( struct net_device dev,
struct z8530_channel c 
)

z8530_sync_open - Open a Z8530 channel for PIO : The network interface we are using : 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.

Definition at line 790 of file z85230.c.

int z8530_sync_txdma_close ( struct net_device dev,
struct z8530_channel c 
)

z8530_sync_txdma_close - Close down a TX driven DMA channel : Network device to detach : Z8530 channel to move into discard mode

Shut down a DMA/PIO split mode synchronous interface. Halt the DMA, and free the buffers.

Definition at line 1153 of file z85230.c.

int z8530_sync_txdma_open ( struct net_device dev,
struct z8530_channel c 
)

z8530_sync_txdma_open - Open a Z8530 for TX driven DMA : The network device to attach : The Z8530 channel to configure in sync DMA mode.

Set up a Z85x30 device for synchronous DMA tranmission. 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.

Definition at line 1052 of file z85230.c.

Variable Documentation

u8 z8530_dead_port[]
Initial value:
=
{
255
}

Definition at line 199 of file z85230.c.

u8 z8530_hdlc_kilostream[]
Initial value:

Definition at line 216 of file z85230.c.

u8 z8530_hdlc_kilostream_85230[]
Initial value:
=
{
2, 0,
1, 0,
9, 0,
6, 0xFF,
7, FLAG,
11, TCTRxCP,
14, DISDPLL,
23, 3,
255
}

Definition at line 241 of file z85230.c.

Initial value:
=
{
z8530_rx_clear,
z8530_tx_clear,
z8530_status_clear
}

Definition at line 681 of file z85230.c.

Initial value:
=
{
z8530_rx,
z8530_tx,
z8530_status
}

Definition at line 486 of file z85230.c.