4 #include <linux/autoconf.h>
5 #include <asm/bootinfo.h>
8 extern unsigned long mips_machtype
;
11 #define ETHERNET_BASE ar_eth_base
12 #define ETHERNET_SIZE 0x00100000
13 #define ETHERNET_MACS 2
16 #define DMA_BASE ar_dma_base
17 #define DMA_SIZE 0x00100000
21 * probe link timer - 5 secs
23 #define LINK_TIMER (5*HZ)
26 * Interrupt register base address
28 #define INTERRUPT_BASE PHYS_TO_K1(ar_int_base)
33 #define AR531X_RESET (AR531X_RESETTMR + 0x0020)
34 #define RESET_SYSTEM 0x00000001 /* cold reset full system */
35 #define RESET_PROC 0x00000002 /* cold reset MIPS core */
36 #define RESET_WLAN0 0x00000004 /* cold reset WLAN MAC and BB */
37 #define RESET_EPHY0 0x00000008 /* cold reset ENET0 phy */
38 #define RESET_EPHY1 0x00000010 /* cold reset ENET1 phy */
39 #define RESET_ENET0 0x00000020 /* cold reset ENET0 mac */
40 #define RESET_ENET1 0x00000040 /* cold reset ENET1 mac */
42 #define IS_DMA_TX_INT(X) (((X) & (DMA_STATUS_TI)) != 0)
43 #define IS_DMA_RX_INT(X) (((X) & (DMA_STATUS_RI)) != 0)
44 #define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN)) == 0)
48 #define K1_TO_PHYS(x) (((unsigned int)(x)) & 0x1FFFFFFF) /* kseg1 to physical */
53 #define PHYS_TO_K1(x) (((unsigned int)(x)) | 0xA0000000) /* physical to kseg1 */
56 #define AR2313_TX_TIMEOUT (HZ/4)
61 #define DSC_RING_ENTRIES_SIZE (AR2313_DESCR_ENTRIES * sizeof(struct desc))
62 #define DSC_NEXT(idx) ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
64 static inline int tx_space (u32 csm
, u32 prd
)
66 return (csm
- prd
- 1) & (AR2313_DESCR_ENTRIES
- 1);
70 #define TX_RESERVED (MAX_SKB_FRAGS+1) /* +1 for message header */
71 #define tx_ring_full(csm, prd) (tx_space(csm, prd) <= TX_RESERVED)
73 #define tx_ring_full 0
76 #define AR2313_MBGET 2
77 #define AR2313_MBSET 3
78 #define AR2313_PCI_RECONFIG 4
79 #define AR2313_PCI_DUMP 5
80 #define AR2313_TEST_PANIC 6
81 #define AR2313_TEST_NULLPTR 7
82 #define AR2313_READ_DATA 8
83 #define AR2313_WRITE_DATA 9
84 #define AR2313_GET_VERSION 10
85 #define AR2313_TEST_HANG 11
86 #define AR2313_SYNC 12
91 u32 address
; /* virtual address of image */
92 u32 length
; /* size of image to download */
93 u32 mailbox
; /* mailbox to get/set */
94 u32 data
[2]; /* contents of mailbox to read/write */
99 * Struct private for the Sibyte.
101 * Elements are grouped so variables used by the tx handling goes
102 * together, and will go into the same cache lines etc. in order to
103 * avoid cache line contention between the rx and tx handling on SMP.
105 * Frequently accessed variables are put at the beginning of the
106 * struct to help the compiler generate better/shorter code.
108 struct ar2313_private
113 volatile ETHERNET_STRUCT
*eth_regs
;
114 volatile DMA
*dma_regs
;
115 volatile u32
*int_regs
;
117 spinlock_t lock
; /* Serialise access to device */
120 * RX and TX descriptors, must be adjacent
122 ar2313_descr_t
*rx_ring
;
123 ar2313_descr_t
*tx_ring
;
126 struct sk_buff
**rx_skb
;
127 struct sk_buff
**tx_skb
;
146 struct net_device_stats stats
;
154 struct timer_list link_timer
;
155 unsigned short phy
; /* merlot phy = 1, samsung phy = 0x1f */
157 unsigned short link
; /* 0 - link down, 1 - link up */
160 struct tasklet_struct rx_tasklet
;
168 static int ar2313_init(struct net_device
*dev
);
170 static void ar2313_tx_timeout(struct net_device
*dev
);
173 static void ar2313_multicast_list(struct net_device
*dev
);
175 static int ar2313_restart(struct net_device
*dev
);
177 static void ar2313_dump_regs(struct net_device
*dev
);
179 static void ar2313_load_rx_ring(struct net_device
*dev
, int bufs
);
180 static irqreturn_t
ar2313_interrupt(int irq
, void *dev_id
);
181 static int ar2313_open(struct net_device
*dev
);
182 static int ar2313_start_xmit(struct sk_buff
*skb
, struct net_device
*dev
);
183 static int ar2313_close(struct net_device
*dev
);
184 static int ar2313_ioctl(struct net_device
*dev
, struct ifreq
*ifr
, int cmd
);
185 static void ar2313_init_cleanup(struct net_device
*dev
);
186 static int ar2313_setup_timer(struct net_device
*dev
);
187 static void ar2313_link_timer_fn(unsigned long data
);
188 static void ar2313_check_link(struct net_device
*dev
);
189 static struct net_device_stats
*ar2313_get_stats(struct net_device
*dev
);
190 #endif /* _AR2313_H_ */