Simon Glass | 1e9961d | 2011-02-16 11:14:33 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The Chromium OS Authors. |
| 3 | * See file CREDITS for list of people who contributed to this |
| 4 | * project. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of |
| 9 | * the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 19 | * MA 02111-1307 USA |
| 20 | */ |
| 21 | |
| 22 | #ifndef __USB_ETHER_H__ |
| 23 | #define __USB_ETHER_H__ |
| 24 | |
| 25 | #include <net.h> |
| 26 | |
| 27 | /* |
| 28 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
| 29 | * and FCS/CRC (frame check sequence). |
| 30 | */ |
| 31 | #define ETH_ALEN 6 /* Octets in one ethernet addr */ |
| 32 | #define ETH_HLEN 14 /* Total octets in header. */ |
| 33 | #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ |
| 34 | #define ETH_DATA_LEN 1500 /* Max. octets in payload */ |
| 35 | #define ETH_FRAME_LEN PKTSIZE_ALIGN /* Max. octets in frame sans FCS */ |
| 36 | #define ETH_FCS_LEN 4 /* Octets in the FCS */ |
| 37 | |
| 38 | struct ueth_data { |
| 39 | /* eth info */ |
| 40 | struct eth_device eth_dev; /* used with eth_register */ |
| 41 | int phy_id; /* mii phy id */ |
| 42 | |
| 43 | /* usb info */ |
| 44 | struct usb_device *pusb_dev; /* this usb_device */ |
| 45 | unsigned char ifnum; /* interface number */ |
| 46 | unsigned char ep_in; /* in endpoint */ |
| 47 | unsigned char ep_out; /* out ....... */ |
| 48 | unsigned char ep_int; /* interrupt . */ |
| 49 | unsigned char subclass; /* as in overview */ |
| 50 | unsigned char protocol; /* .............. */ |
| 51 | unsigned char irqinterval; /* Intervall for IRQ Pipe */ |
| 52 | |
| 53 | /* private fields for each driver can go here if needed */ |
Simon Glass | 246c119 | 2011-06-13 16:13:09 -0700 | [diff] [blame] | 54 | #ifdef CONFIG_USB_ETHER_SMSC95XX |
| 55 | size_t rx_urb_size; /* maximum USB URB size */ |
| 56 | u32 mac_cr; /* MAC control register value */ |
| 57 | int have_hwaddr; /* 1 if we have a hardware MAC address */ |
| 58 | #endif |
Simon Glass | 1e9961d | 2011-02-16 11:14:33 -0800 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | /* |
| 62 | * Function definitions for each USB ethernet driver go here, bracketed by |
| 63 | * #ifdef CONFIG_USB_ETHER_xxx...#endif |
| 64 | */ |
Simon Glass | 246d693 | 2011-02-16 11:14:34 -0800 | [diff] [blame] | 65 | #ifdef CONFIG_USB_ETHER_ASIX |
| 66 | void asix_eth_before_probe(void); |
| 67 | int asix_eth_probe(struct usb_device *dev, unsigned int ifnum, |
| 68 | struct ueth_data *ss); |
| 69 | int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss, |
| 70 | struct eth_device *eth); |
| 71 | #endif |
Simon Glass | 1e9961d | 2011-02-16 11:14:33 -0800 | [diff] [blame] | 72 | |
Simon Glass | 246c119 | 2011-06-13 16:13:09 -0700 | [diff] [blame] | 73 | #ifdef CONFIG_USB_ETHER_SMSC95XX |
| 74 | void smsc95xx_eth_before_probe(void); |
| 75 | int smsc95xx_eth_probe(struct usb_device *dev, unsigned int ifnum, |
| 76 | struct ueth_data *ss); |
| 77 | int smsc95xx_eth_get_info(struct usb_device *dev, struct ueth_data *ss, |
| 78 | struct eth_device *eth); |
| 79 | #endif |
| 80 | |
Simon Glass | 1e9961d | 2011-02-16 11:14:33 -0800 | [diff] [blame] | 81 | #endif /* __USB_ETHER_H__ */ |