usb_ether.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #ifndef __USB_ETHER_H__
  22. #define __USB_ETHER_H__
  23. #include <net.h>
  24. /*
  25. * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
  26. * and FCS/CRC (frame check sequence).
  27. */
  28. #define ETH_ALEN 6 /* Octets in one ethernet addr */
  29. #define ETH_HLEN 14 /* Total octets in header. */
  30. #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
  31. #define ETH_DATA_LEN 1500 /* Max. octets in payload */
  32. #define ETH_FRAME_LEN PKTSIZE_ALIGN /* Max. octets in frame sans FCS */
  33. #define ETH_FCS_LEN 4 /* Octets in the FCS */
  34. struct ueth_data {
  35. /* eth info */
  36. struct eth_device eth_dev; /* used with eth_register */
  37. int phy_id; /* mii phy id */
  38. /* usb info */
  39. struct usb_device *pusb_dev; /* this usb_device */
  40. unsigned char ifnum; /* interface number */
  41. unsigned char ep_in; /* in endpoint */
  42. unsigned char ep_out; /* out ....... */
  43. unsigned char ep_int; /* interrupt . */
  44. unsigned char subclass; /* as in overview */
  45. unsigned char protocol; /* .............. */
  46. unsigned char irqinterval; /* Intervall for IRQ Pipe */
  47. /* private fields for each driver can go here if needed */
  48. #ifdef CONFIG_USB_ETHER_SMSC95XX
  49. size_t rx_urb_size; /* maximum USB URB size */
  50. u32 mac_cr; /* MAC control register value */
  51. int have_hwaddr; /* 1 if we have a hardware MAC address */
  52. #endif
  53. };
  54. /*
  55. * Function definitions for each USB ethernet driver go here, bracketed by
  56. * #ifdef CONFIG_USB_ETHER_xxx...#endif
  57. */
  58. #ifdef CONFIG_USB_ETHER_ASIX
  59. void asix_eth_before_probe(void);
  60. int asix_eth_probe(struct usb_device *dev, unsigned int ifnum,
  61. struct ueth_data *ss);
  62. int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
  63. struct eth_device *eth);
  64. #endif
  65. #ifdef CONFIG_USB_ETHER_SMSC95XX
  66. void smsc95xx_eth_before_probe(void);
  67. int smsc95xx_eth_probe(struct usb_device *dev, unsigned int ifnum,
  68. struct ueth_data *ss);
  69. int smsc95xx_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
  70. struct eth_device *eth);
  71. #endif
  72. #endif /* __USB_ETHER_H__ */