remove squashfs repartitioning hacks from spiflash driver - will be ported to redboot...
[openwrt.git] / target / linux / atheros-2.6 / files / drivers / net / ar2313 / ar2313.h
1 #ifndef _AR2313_H_
2 #define _AR2313_H_
3
4 #include <linux/autoconf.h>
5 #include <asm/bootinfo.h>
6 #include <ar531x_platform.h>
7 #include "platform.h"
8
9 /*
10 * probe link timer - 5 secs
11 */
12 #define LINK_TIMER (5*HZ)
13
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)
17
18 #define AR2313_TX_TIMEOUT (HZ/4)
19
20 /*
21 * Rings
22 */
23 #define DSC_RING_ENTRIES_SIZE (AR2313_DESCR_ENTRIES * sizeof(struct desc))
24 #define DSC_NEXT(idx) ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
25
26 static inline int tx_space (u32 csm, u32 prd)
27 {
28 return (csm - prd - 1) & (AR2313_DESCR_ENTRIES - 1);
29 }
30
31 #if MAX_SKB_FRAGS
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)
34 #else
35 #define tx_ring_full 0
36 #endif
37
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
49
50
51 struct ar2313_cmd {
52 u32 cmd;
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 */
57 };
58
59
60 /*
61 * Struct private for the Sibyte.
62 *
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.
66 *
67 * Frequently accessed variables are put at the beginning of the
68 * struct to help the compiler generate better/shorter code.
69 */
70 struct ar2313_private
71 {
72 struct net_device *dev;
73 int version;
74 u32 mb[2];
75
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;
81
82 spinlock_t lock; /* Serialise access to device */
83
84 /*
85 * RX and TX descriptors, must be adjacent
86 */
87 ar2313_descr_t *rx_ring;
88 ar2313_descr_t *tx_ring;
89
90
91 struct sk_buff **rx_skb;
92 struct sk_buff **tx_skb;
93
94 /*
95 * RX elements
96 */
97 u32 rx_skbprd;
98 u32 cur_rx;
99
100 /*
101 * TX elements
102 */
103 u32 tx_prd;
104 u32 tx_csm;
105
106 /*
107 * Misc elements
108 */
109 int board_idx;
110 char name[48];
111 struct net_device_stats stats;
112 struct {
113 u32 address;
114 u32 length;
115 char *mapping;
116 } desc;
117
118
119 struct timer_list link_timer;
120 unsigned short phy; /* merlot phy = 1, samsung phy = 0x1f */
121 unsigned short mac;
122 unsigned short link; /* 0 - link down, 1 - link up */
123 u16 phyData;
124
125 struct tasklet_struct rx_tasklet;
126 int unloading;
127 };
128
129
130 /*
131 * Prototypes
132 */
133 static int ar2313_init(struct net_device *dev);
134 #ifdef TX_TIMEOUT
135 static void ar2313_tx_timeout(struct net_device *dev);
136 #endif
137 #if 0
138 static void ar2313_multicast_list(struct net_device *dev);
139 #endif
140 static int ar2313_restart(struct net_device *dev);
141 #if DEBUG
142 static void ar2313_dump_regs(struct net_device *dev);
143 #endif
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_ */
This page took 0.049266 seconds and 5 git commands to generate.