Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
| 3 | * operating system. NET is implemented using the BSD Socket |
| 4 | * interface as the means of communication with the user level. |
| 5 | * |
| 6 | * Definitions used by the ARCnet driver. |
| 7 | * |
| 8 | * Authors: Avery Pennarun and David Woodhouse |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License |
| 12 | * as published by the Free Software Foundation; either version |
| 13 | * 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | */ |
| 16 | #ifndef _LINUX_ARCDEVICE_H |
| 17 | #define _LINUX_ARCDEVICE_H |
| 18 | |
| 19 | #include <asm/timex.h> |
| 20 | #include <linux/if_arcnet.h> |
| 21 | |
| 22 | #ifdef __KERNEL__ |
Alexey Dobriyan | a6b7a40 | 2011-06-06 10:43:46 +0000 | [diff] [blame] | 23 | #include <linux/irqreturn.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | /* |
| 26 | * RECON_THRESHOLD is the maximum number of RECON messages to receive |
| 27 | * within one minute before printing a "cabling problem" warning. The |
| 28 | * default value should be fine. |
| 29 | * |
| 30 | * After that, a "cabling restored" message will be printed on the next IRQ |
| 31 | * if no RECON messages have been received for 10 seconds. |
| 32 | * |
| 33 | * Do not define RECON_THRESHOLD at all if you want to disable this feature. |
| 34 | */ |
| 35 | #define RECON_THRESHOLD 30 |
| 36 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | /* |
| 38 | * Define this to the minimum "timeout" value. If a transmit takes longer |
| 39 | * than TX_TIMEOUT jiffies, Linux will abort the TX and retry. On a large |
| 40 | * network, or one with heavy network traffic, this timeout may need to be |
| 41 | * increased. The larger it is, though, the longer it will be between |
| 42 | * necessary transmits - don't set this too high. |
| 43 | */ |
| 44 | #define TX_TIMEOUT (HZ * 200 / 1000) |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | /* Display warnings about the driver being an ALPHA version. */ |
| 47 | #undef ALPHA_WARNING |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | /* |
| 50 | * Debugging bitflags: each option can be enabled individually. |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 51 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | * Note: only debug flags included in the ARCNET_DEBUG_MAX define will |
| 53 | * actually be available. GCC will (at least, GCC 2.7.0 will) notice |
| 54 | * lines using a BUGLVL not in ARCNET_DEBUG_MAX and automatically optimize |
| 55 | * them out. |
| 56 | */ |
| 57 | #define D_NORMAL 1 /* important operational info */ |
| 58 | #define D_EXTRA 2 /* useful, but non-vital information */ |
| 59 | #define D_INIT 4 /* show init/probe messages */ |
| 60 | #define D_INIT_REASONS 8 /* show reasons for discarding probes */ |
| 61 | #define D_RECON 32 /* print a message whenever token is lost */ |
| 62 | #define D_PROTO 64 /* debug auto-protocol support */ |
| 63 | /* debug levels below give LOTS of output during normal operation! */ |
| 64 | #define D_DURING 128 /* trace operations (including irq's) */ |
| 65 | #define D_TX 256 /* show tx packets */ |
| 66 | #define D_RX 512 /* show rx packets */ |
| 67 | #define D_SKB 1024 /* show skb's */ |
| 68 | #define D_SKB_SIZE 2048 /* show skb sizes */ |
| 69 | #define D_TIMING 4096 /* show time needed to copy buffers to card */ |
| 70 | #define D_DEBUG 8192 /* Very detailed debug line for line */ |
| 71 | |
| 72 | #ifndef ARCNET_DEBUG_MAX |
| 73 | #define ARCNET_DEBUG_MAX (127) /* change to ~0 if you want detailed debugging */ |
| 74 | #endif |
| 75 | |
| 76 | #ifndef ARCNET_DEBUG |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 77 | #define ARCNET_DEBUG (D_NORMAL | D_EXTRA) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #endif |
| 79 | extern int arcnet_debug; |
| 80 | |
Joe Perches | 72aeea4 | 2015-05-05 10:05:54 -0700 | [diff] [blame] | 81 | #define BUGLVL(x) ((x) & ARCNET_DEBUG_MAX & arcnet_debug) |
Joe Perches | d77510f | 2015-05-05 10:05:53 -0700 | [diff] [blame] | 82 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | /* macros to simplify debug checking */ |
Joe Perches | a34c093 | 2015-05-05 10:05:55 -0700 | [diff] [blame] | 84 | #define arc_printk(x, dev, fmt, ...) \ |
Joe Perches | d77510f | 2015-05-05 10:05:53 -0700 | [diff] [blame] | 85 | do { \ |
Joe Perches | a34c093 | 2015-05-05 10:05:55 -0700 | [diff] [blame] | 86 | if (BUGLVL(x)) { \ |
| 87 | if ((x) == D_NORMAL) \ |
| 88 | netdev_warn(dev, fmt, ##__VA_ARGS__); \ |
| 89 | else if ((x) < D_DURING) \ |
| 90 | netdev_info(dev, fmt, ##__VA_ARGS__); \ |
| 91 | else \ |
| 92 | netdev_dbg(dev, fmt, ##__VA_ARGS__); \ |
| 93 | } \ |
Joe Perches | d77510f | 2015-05-05 10:05:53 -0700 | [diff] [blame] | 94 | } while (0) |
| 95 | |
Joe Perches | a34c093 | 2015-05-05 10:05:55 -0700 | [diff] [blame] | 96 | #define arc_cont(x, fmt, ...) \ |
Joe Perches | d77510f | 2015-05-05 10:05:53 -0700 | [diff] [blame] | 97 | do { \ |
Joe Perches | a34c093 | 2015-05-05 10:05:55 -0700 | [diff] [blame] | 98 | if (BUGLVL(x)) \ |
| 99 | pr_cont(fmt, ##__VA_ARGS__); \ |
Joe Perches | d77510f | 2015-05-05 10:05:53 -0700 | [diff] [blame] | 100 | } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | /* see how long a function call takes to run, expressed in CPU cycles */ |
Joe Perches | a34c093 | 2015-05-05 10:05:55 -0700 | [diff] [blame] | 103 | #define TIME(dev, name, bytes, call) \ |
Joe Perches | 72aeea4 | 2015-05-05 10:05:54 -0700 | [diff] [blame] | 104 | do { \ |
| 105 | if (BUGLVL(D_TIMING)) { \ |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 106 | unsigned long _x, _y; \ |
| 107 | _x = get_cycles(); \ |
| 108 | call; \ |
| 109 | _y = get_cycles(); \ |
Joe Perches | a34c093 | 2015-05-05 10:05:55 -0700 | [diff] [blame] | 110 | arc_printk(D_TIMING, dev, \ |
| 111 | "%s: %d bytes in %lu cycles == %lu Kbytes/100Mcycle\n", \ |
| 112 | name, bytes, _y - _x, \ |
| 113 | 100000000 / 1024 * bytes / (_y - _x + 1)); \ |
Joe Perches | 72aeea4 | 2015-05-05 10:05:54 -0700 | [diff] [blame] | 114 | } else { \ |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 115 | call; \ |
Joe Perches | 72aeea4 | 2015-05-05 10:05:54 -0700 | [diff] [blame] | 116 | } \ |
| 117 | } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | /* |
| 120 | * Time needed to reset the card - in ms (milliseconds). This works on my |
| 121 | * SMC PC100. I can't find a reference that tells me just how long I |
| 122 | * should wait. |
| 123 | */ |
| 124 | #define RESETtime (300) |
| 125 | |
| 126 | /* |
| 127 | * These are the max/min lengths of packet payload, not including the |
| 128 | * arc_hardware header, but definitely including the soft header. |
| 129 | * |
| 130 | * Note: packet sizes 254, 255, 256 are impossible because of the way |
| 131 | * ARCnet registers work That's why RFC1201 defines "exception" packets. |
| 132 | * In non-RFC1201 protocols, we have to just tack some extra bytes on the |
| 133 | * end. |
| 134 | */ |
| 135 | #define MTU 253 /* normal packet max size */ |
| 136 | #define MinTU 257 /* extended packet min size */ |
| 137 | #define XMTU 508 /* extended packet max size */ |
| 138 | |
| 139 | /* status/interrupt mask bit fields */ |
| 140 | #define TXFREEflag 0x01 /* transmitter available */ |
| 141 | #define TXACKflag 0x02 /* transmitted msg. ackd */ |
| 142 | #define RECONflag 0x04 /* network reconfigured */ |
| 143 | #define TESTflag 0x08 /* test flag */ |
| 144 | #define EXCNAKflag 0x08 /* excesive nak flag */ |
| 145 | #define RESETflag 0x10 /* power-on-reset */ |
| 146 | #define RES1flag 0x20 /* reserved - usually set by jumper */ |
| 147 | #define RES2flag 0x40 /* reserved - usually set by jumper */ |
| 148 | #define NORXflag 0x80 /* receiver inhibited */ |
| 149 | |
| 150 | /* Flags used for IO-mapped memory operations */ |
| 151 | #define AUTOINCflag 0x40 /* Increase location with each access */ |
| 152 | #define IOMAPflag 0x02 /* (for 90xx) Use IO mapped memory, not mmap */ |
| 153 | #define ENABLE16flag 0x80 /* (for 90xx) Enable 16-bit mode */ |
| 154 | |
| 155 | /* in the command register, the following bits have these meanings: |
| 156 | * 0-2 command |
| 157 | * 3-4 page number (for enable rcv/xmt command) |
| 158 | * 7 receive broadcasts |
| 159 | */ |
| 160 | #define NOTXcmd 0x01 /* disable transmitter */ |
| 161 | #define NORXcmd 0x02 /* disable receiver */ |
| 162 | #define TXcmd 0x03 /* enable transmitter */ |
| 163 | #define RXcmd 0x04 /* enable receiver */ |
| 164 | #define CONFIGcmd 0x05 /* define configuration */ |
| 165 | #define CFLAGScmd 0x06 /* clear flags */ |
| 166 | #define TESTcmd 0x07 /* load test flags */ |
Michael Grzeschik | 84286f1 | 2015-04-15 11:43:57 +0200 | [diff] [blame] | 167 | #define STARTIOcmd 0x18 /* start internal operation */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
| 169 | /* flags for "clear flags" command */ |
| 170 | #define RESETclear 0x08 /* power-on-reset */ |
| 171 | #define CONFIGclear 0x10 /* system reconfigured */ |
| 172 | |
| 173 | #define EXCNAKclear 0x0E /* Clear and acknowledge the excive nak bit */ |
| 174 | |
| 175 | /* flags for "load test flags" command */ |
| 176 | #define TESTload 0x08 /* test flag (diagnostic) */ |
| 177 | |
| 178 | /* byte deposited into first address of buffers on reset */ |
| 179 | #define TESTvalue 0321 /* that's octal for 0xD1 :) */ |
| 180 | |
| 181 | /* for "enable receiver" command */ |
| 182 | #define RXbcasts 0x80 /* receive broadcasts */ |
| 183 | |
| 184 | /* flags for "define configuration" command */ |
| 185 | #define NORMALconf 0x00 /* 1-249 byte packets */ |
| 186 | #define EXTconf 0x08 /* 250-504 byte packets */ |
| 187 | |
| 188 | /* card feature flags, set during auto-detection. |
| 189 | * (currently only used by com20020pci) |
| 190 | */ |
| 191 | #define ARC_IS_5MBIT 1 /* card default speed is 5MBit */ |
| 192 | #define ARC_CAN_10MBIT 2 /* card uses COM20022, supporting 10MBit, |
| 193 | but default is 2.5MBit. */ |
| 194 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | /* information needed to define an encapsulation driver */ |
| 196 | struct ArcProto { |
| 197 | char suffix; /* a for RFC1201, e for ether-encap, etc. */ |
| 198 | int mtu; /* largest possible packet */ |
| 199 | int is_ip; /* This is a ip plugin - not a raw thing */ |
| 200 | |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 201 | void (*rx)(struct net_device *dev, int bufnum, |
| 202 | struct archdr *pkthdr, int length); |
| 203 | int (*build_header)(struct sk_buff *skb, struct net_device *dev, |
| 204 | unsigned short ethproto, uint8_t daddr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | /* these functions return '1' if the skb can now be freed */ |
Joe Perches | d6d7d3e | 2015-05-05 10:06:02 -0700 | [diff] [blame] | 207 | int (*prepare_tx)(struct net_device *dev, struct archdr *pkt, |
| 208 | int length, int bufnum); |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 209 | int (*continue_tx)(struct net_device *dev, int bufnum); |
| 210 | int (*ack_tx)(struct net_device *dev, int acked); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | }; |
| 212 | |
| 213 | extern struct ArcProto *arc_proto_map[256], *arc_proto_default, |
| 214 | *arc_bcast_proto, *arc_raw_proto; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | /* |
| 217 | * "Incoming" is information needed for each address that could be sending |
| 218 | * to us. Mostly for partially-received split packets. |
| 219 | */ |
| 220 | struct Incoming { |
| 221 | struct sk_buff *skb; /* packet data buffer */ |
Al Viro | 701181a | 2007-08-22 22:59:11 -0400 | [diff] [blame] | 222 | __be16 sequence; /* sequence number of assembly */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | uint8_t lastpacket, /* number of last packet (from 1) */ |
| 224 | numpackets; /* number of packets in split */ |
| 225 | }; |
| 226 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | /* only needed for RFC1201 */ |
| 228 | struct Outgoing { |
| 229 | struct ArcProto *proto; /* protocol driver that owns this: |
| 230 | * if NULL, no packet is pending. |
| 231 | */ |
| 232 | struct sk_buff *skb; /* buffer from upper levels */ |
| 233 | struct archdr *pkt; /* a pointer into the skb */ |
| 234 | uint16_t length, /* bytes total */ |
| 235 | dataleft, /* bytes left */ |
| 236 | segnum, /* segment being sent */ |
| 237 | numsegs; /* number of segments */ |
| 238 | }; |
| 239 | |
Michael Grzeschik | 8890624 | 2014-09-18 00:12:50 +0200 | [diff] [blame] | 240 | #define ARCNET_LED_NAME_SZ (IFNAMSIZ + 6) |
| 241 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | struct arcnet_local { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | uint8_t config, /* current value of CONFIG register */ |
| 244 | timeout, /* Extended timeout for COM20020 */ |
| 245 | backplane, /* Backplane flag for COM20020 */ |
| 246 | clockp, /* COM20020 clock divider */ |
| 247 | clockm, /* COM20020 clock multiplier flag */ |
| 248 | setup, /* Contents of setup1 register */ |
| 249 | setup2, /* Contents of setup2 register */ |
| 250 | intmask; /* current value of INTMASK register */ |
| 251 | uint8_t default_proto[256]; /* default encap to use for each host */ |
| 252 | int cur_tx, /* buffer used by current transmit, or -1 */ |
| 253 | next_tx, /* buffer where a packet is ready to send */ |
| 254 | cur_rx; /* current receive buffer */ |
| 255 | int lastload_dest, /* can last loaded packet be acked? */ |
| 256 | lasttrans_dest; /* can last TX'd packet be acked? */ |
| 257 | int timed_out; /* need to process TX timeout and drop packet */ |
| 258 | unsigned long last_timeout; /* time of last reported timeout */ |
| 259 | char *card_name; /* card ident string */ |
| 260 | int card_flags; /* special card features */ |
| 261 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | /* On preemtive and SMB a lock is needed */ |
| 263 | spinlock_t lock; |
| 264 | |
Michael Grzeschik | 8890624 | 2014-09-18 00:12:50 +0200 | [diff] [blame] | 265 | struct led_trigger *tx_led_trig; |
| 266 | char tx_led_trig_name[ARCNET_LED_NAME_SZ]; |
| 267 | struct led_trigger *recon_led_trig; |
| 268 | char recon_led_trig_name[ARCNET_LED_NAME_SZ]; |
| 269 | |
Michael Grzeschik | 59fbcbc | 2015-09-16 10:15:45 +0200 | [diff] [blame] | 270 | struct timer_list timer; |
| 271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | /* |
| 273 | * Buffer management: an ARCnet card has 4 x 512-byte buffers, each of |
| 274 | * which can be used for either sending or receiving. The new dynamic |
| 275 | * buffer management routines use a simple circular queue of available |
| 276 | * buffers, and take them as they're needed. This way, we simplify |
| 277 | * situations in which we (for example) want to pre-load a transmit |
| 278 | * buffer, or start receiving while we copy a received packet to |
| 279 | * memory. |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 280 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | * The rules: only the interrupt handler is allowed to _add_ buffers to |
| 282 | * the queue; thus, this doesn't require a lock. Both the interrupt |
| 283 | * handler and the transmit function will want to _remove_ buffers, so |
| 284 | * we need to handle the situation where they try to do it at the same |
| 285 | * time. |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 286 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | * If next_buf == first_free_buf, the queue is empty. Since there are |
| 288 | * only four possible buffers, the queue should never be full. |
| 289 | */ |
| 290 | atomic_t buf_lock; |
| 291 | int buf_queue[5]; |
| 292 | int next_buf, first_free_buf; |
| 293 | |
| 294 | /* network "reconfiguration" handling */ |
S.Caglar Onur | 9307b57 | 2008-03-28 14:41:24 -0700 | [diff] [blame] | 295 | unsigned long first_recon; /* time of "first" RECON message to count */ |
| 296 | unsigned long last_recon; /* time of most recent RECON */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | int num_recons; /* number of RECONs between first and last. */ |
Rasmus Villemoes | db55b62 | 2014-07-02 14:12:01 +0200 | [diff] [blame] | 298 | int network_down; /* do we think the network is down? */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
Rasmus Villemoes | db55b62 | 2014-07-02 14:12:01 +0200 | [diff] [blame] | 300 | int excnak_pending; /* We just got an excesive nak interrupt */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
| 302 | struct { |
| 303 | uint16_t sequence; /* sequence number (incs with each packet) */ |
Al Viro | 701181a | 2007-08-22 22:59:11 -0400 | [diff] [blame] | 304 | __be16 aborted_seq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | struct Incoming incoming[256]; /* one from each address */ |
| 307 | } rfc1201; |
| 308 | |
| 309 | /* really only used by rfc1201, but we'll pretend it's not */ |
| 310 | struct Outgoing outgoing; /* packet currently being sent */ |
| 311 | |
| 312 | /* hardware-specific functions */ |
| 313 | struct { |
| 314 | struct module *owner; |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 315 | void (*command)(struct net_device *dev, int cmd); |
| 316 | int (*status)(struct net_device *dev); |
| 317 | void (*intmask)(struct net_device *dev, int mask); |
| 318 | int (*reset)(struct net_device *dev, int really_reset); |
| 319 | void (*open)(struct net_device *dev); |
| 320 | void (*close)(struct net_device *dev); |
Michael Grzeschik | 8890624 | 2014-09-18 00:12:50 +0200 | [diff] [blame] | 321 | void (*datatrigger) (struct net_device * dev, int enable); |
| 322 | void (*recontrigger) (struct net_device * dev, int enable); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | |
Joe Perches | d6d7d3e | 2015-05-05 10:06:02 -0700 | [diff] [blame] | 324 | void (*copy_to_card)(struct net_device *dev, int bufnum, |
| 325 | int offset, void *buf, int count); |
| 326 | void (*copy_from_card)(struct net_device *dev, int bufnum, |
| 327 | int offset, void *buf, int count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | } hw; |
| 329 | |
| 330 | void __iomem *mem_start; /* pointer to ioremap'ed MMIO */ |
| 331 | }; |
| 332 | |
Michael Grzeschik | 8890624 | 2014-09-18 00:12:50 +0200 | [diff] [blame] | 333 | enum arcnet_led_event { |
| 334 | ARCNET_LED_EVENT_RECON, |
| 335 | ARCNET_LED_EVENT_OPEN, |
| 336 | ARCNET_LED_EVENT_STOP, |
| 337 | ARCNET_LED_EVENT_TX, |
| 338 | }; |
| 339 | |
| 340 | void arcnet_led_event(struct net_device *netdev, enum arcnet_led_event event); |
| 341 | void devm_arcnet_led_init(struct net_device *netdev, int index, int subid); |
| 342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | #if ARCNET_DEBUG_MAX & D_SKB |
| 344 | void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc); |
| 345 | #else |
Joe Perches | 83df99b | 2015-05-05 10:06:01 -0700 | [diff] [blame] | 346 | static inline |
| 347 | void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc) |
| 348 | { |
| 349 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | #endif |
| 351 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | void arcnet_unregister_proto(struct ArcProto *proto); |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 353 | irqreturn_t arcnet_interrupt(int irq, void *dev_id); |
Stephen Hemminger | bca5b89 | 2009-01-09 13:01:09 +0000 | [diff] [blame] | 354 | struct net_device *alloc_arcdev(const char *name); |
| 355 | |
| 356 | int arcnet_open(struct net_device *dev); |
| 357 | int arcnet_close(struct net_device *dev); |
Stephen Hemminger | 61357325 | 2009-08-31 19:50:58 +0000 | [diff] [blame] | 358 | netdev_tx_t arcnet_send_packet(struct sk_buff *skb, |
Joe Perches | cb33464 | 2015-05-05 10:05:47 -0700 | [diff] [blame] | 359 | struct net_device *dev); |
Stephen Hemminger | bca5b89 | 2009-01-09 13:01:09 +0000 | [diff] [blame] | 360 | void arcnet_timeout(struct net_device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | |
Joe Perches | e5fcfc1 | 2015-05-05 10:06:05 -0700 | [diff] [blame] | 362 | /* I/O equivalents */ |
| 363 | |
Joe Perches | 0fec651 | 2015-05-05 10:06:06 -0700 | [diff] [blame] | 364 | #ifdef CONFIG_SA1100_CT6001 |
| 365 | #define BUS_ALIGN 2 /* 8 bit device on a 16 bit bus - needs padding */ |
| 366 | #else |
| 367 | #define BUS_ALIGN 1 |
| 368 | #endif |
| 369 | |
Joe Perches | e5fcfc1 | 2015-05-05 10:06:05 -0700 | [diff] [blame] | 370 | /* addr and offset allow register like names to define the actual IO address. |
| 371 | * A configuration option multiplies the offset for alignment. |
| 372 | */ |
| 373 | #define arcnet_inb(addr, offset) \ |
Joe Perches | 0fec651 | 2015-05-05 10:06:06 -0700 | [diff] [blame] | 374 | inb((addr) + BUS_ALIGN * (offset)) |
Joe Perches | e5fcfc1 | 2015-05-05 10:06:05 -0700 | [diff] [blame] | 375 | #define arcnet_outb(value, addr, offset) \ |
Joe Perches | 0fec651 | 2015-05-05 10:06:06 -0700 | [diff] [blame] | 376 | outb(value, (addr) + BUS_ALIGN * (offset)) |
Joe Perches | e5fcfc1 | 2015-05-05 10:06:05 -0700 | [diff] [blame] | 377 | |
| 378 | #define arcnet_insb(addr, offset, buffer, count) \ |
Joe Perches | 0fec651 | 2015-05-05 10:06:06 -0700 | [diff] [blame] | 379 | insb((addr) + BUS_ALIGN * (offset), buffer, count) |
Joe Perches | e5fcfc1 | 2015-05-05 10:06:05 -0700 | [diff] [blame] | 380 | #define arcnet_outsb(addr, offset, buffer, count) \ |
Joe Perches | 0fec651 | 2015-05-05 10:06:06 -0700 | [diff] [blame] | 381 | outsb((addr) + BUS_ALIGN * (offset), buffer, count) |
Joe Perches | e5fcfc1 | 2015-05-05 10:06:05 -0700 | [diff] [blame] | 382 | |
Joe Perches | 9c76aa5 | 2015-05-05 10:06:09 -0700 | [diff] [blame] | 383 | #define arcnet_readb(addr, offset) \ |
| 384 | readb((addr) + (offset)) |
| 385 | #define arcnet_writeb(value, addr, offset) \ |
| 386 | writeb(value, (addr) + (offset)) |
| 387 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | #endif /* __KERNEL__ */ |
| 389 | #endif /* _LINUX_ARCDEVICE_H */ |