4 #include <linux/autoconf.h>
5 #include <asm/bootinfo.h>
6 #include <ar531x_platform.h>
10 * probe link timer - 5 secs
12 #define LINK_TIMER (5*HZ)
14 #define IS_DMA_TX_INT(X) (((X) & (DMA_STATUS_TI)) != 0)
15 #define IS_DMA_RX_INT(X) (((X) & (DMA_STATUS_RI)) != 0)
16 #define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN)) == 0)
18 #define AR2313_TX_TIMEOUT (HZ/4)
23 #define DSC_RING_ENTRIES_SIZE (AR2313_DESCR_ENTRIES * sizeof(struct desc))
24 #define DSC_NEXT(idx) ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
26 static inline int tx_space (u32 csm
, u32 prd
)
28 return (csm
- prd
- 1) & (AR2313_DESCR_ENTRIES
- 1);
32 #define TX_RESERVED (MAX_SKB_FRAGS+1) /* +1 for message header */
33 #define tx_ring_full(csm, prd) (tx_space(csm, prd) <= TX_RESERVED)
35 #define tx_ring_full 0
38 #define AR2313_MBGET 2
39 #define AR2313_MBSET 3
40 #define AR2313_PCI_RECONFIG 4
41 #define AR2313_PCI_DUMP 5
42 #define AR2313_TEST_PANIC 6
43 #define AR2313_TEST_NULLPTR 7
44 #define AR2313_READ_DATA 8
45 #define AR2313_WRITE_DATA 9
46 #define AR2313_GET_VERSION 10
47 #define AR2313_TEST_HANG 11
48 #define AR2313_SYNC 12
53 u32 address
; /* virtual address of image */
54 u32 length
; /* size of image to download */
55 u32 mailbox
; /* mailbox to get/set */
56 u32 data
[2]; /* contents of mailbox to read/write */
61 * Struct private for the Sibyte.
63 * Elements are grouped so variables used by the tx handling goes
64 * together, and will go into the same cache lines etc. in order to
65 * avoid cache line contention between the rx and tx handling on SMP.
67 * Frequently accessed variables are put at the beginning of the
68 * struct to help the compiler generate better/shorter code.
72 struct net_device
*dev
;
76 volatile ETHERNET_STRUCT
*phy_regs
;
77 volatile ETHERNET_STRUCT
*eth_regs
;
78 volatile DMA
*dma_regs
;
79 volatile u32
*int_regs
;
80 struct ar531x_eth
*cfg
;
82 spinlock_t lock
; /* Serialise access to device */
85 * RX and TX descriptors, must be adjacent
87 ar2313_descr_t
*rx_ring
;
88 ar2313_descr_t
*tx_ring
;
91 struct sk_buff
**rx_skb
;
92 struct sk_buff
**tx_skb
;
111 struct net_device_stats stats
;
119 struct timer_list link_timer
;
120 unsigned short phy
; /* merlot phy = 1, samsung phy = 0x1f */
122 unsigned short link
; /* 0 - link down, 1 - link up */
125 struct tasklet_struct rx_tasklet
;
133 static int ar2313_init(struct net_device
*dev
);
135 static void ar2313_tx_timeout(struct net_device
*dev
);
138 static void ar2313_multicast_list(struct net_device
*dev
);
140 static int ar2313_restart(struct net_device
*dev
);
142 static void ar2313_dump_regs(struct net_device
*dev
);
144 static void ar2313_load_rx_ring(struct net_device
*dev
, int bufs
);
145 static irqreturn_t
ar2313_interrupt(int irq
, void *dev_id
);
146 static int ar2313_open(struct net_device
*dev
);
147 static int ar2313_start_xmit(struct sk_buff
*skb
, struct net_device
*dev
);
148 static int ar2313_close(struct net_device
*dev
);
149 static int ar2313_ioctl(struct net_device
*dev
, struct ifreq
*ifr
, int cmd
);
150 static void ar2313_init_cleanup(struct net_device
*dev
);
151 static int ar2313_setup_timer(struct net_device
*dev
);
152 static void ar2313_link_timer_fn(unsigned long data
);
153 static void ar2313_check_link(struct net_device
*dev
);
154 static struct net_device_stats
*ar2313_get_stats(struct net_device
*dev
);
155 #endif /* _AR2313_H_ */