xref: /rk3399_rockchip-uboot/include/usb_ether.h (revision 291391bed566a569a80b50c924a7c43747abc1b5)
189d48367SSimon Glass /*
289d48367SSimon Glass  * Copyright (c) 2011 The Chromium OS Authors.
389d48367SSimon Glass  * See file CREDITS for list of people who contributed to this
489d48367SSimon Glass  * project.
589d48367SSimon Glass  *
689d48367SSimon Glass  * This program is free software; you can redistribute it and/or
789d48367SSimon Glass  * modify it under the terms of the GNU General Public License as
889d48367SSimon Glass  * published by the Free Software Foundation; either version 2 of
989d48367SSimon Glass  * the License, or (at your option) any later version.
1089d48367SSimon Glass  *
1189d48367SSimon Glass  * This program is distributed in the hope that it will be useful,
1289d48367SSimon Glass  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1389d48367SSimon Glass  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1489d48367SSimon Glass  * GNU General Public License for more details.
1589d48367SSimon Glass  *
1689d48367SSimon Glass  * You should have received a copy of the GNU General Public License
1789d48367SSimon Glass  * along with this program; if not, write to the Free Software
1889d48367SSimon Glass  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1989d48367SSimon Glass  * MA 02111-1307 USA
2089d48367SSimon Glass  */
2189d48367SSimon Glass 
2289d48367SSimon Glass #ifndef __USB_ETHER_H__
2389d48367SSimon Glass #define __USB_ETHER_H__
2489d48367SSimon Glass 
2589d48367SSimon Glass #include <net.h>
2689d48367SSimon Glass 
2789d48367SSimon Glass /*
2889d48367SSimon Glass  *	IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
2989d48367SSimon Glass  *	and FCS/CRC (frame check sequence).
3089d48367SSimon Glass  */
3189d48367SSimon Glass #define ETH_ALEN	6		/* Octets in one ethernet addr	 */
3289d48367SSimon Glass #define ETH_HLEN	14		/* Total octets in header.	 */
3389d48367SSimon Glass #define ETH_ZLEN	60		/* Min. octets in frame sans FCS */
3489d48367SSimon Glass #define ETH_DATA_LEN	1500		/* Max. octets in payload	 */
3589d48367SSimon Glass #define ETH_FRAME_LEN	PKTSIZE_ALIGN	/* Max. octets in frame sans FCS */
3689d48367SSimon Glass #define ETH_FCS_LEN	4		/* Octets in the FCS		 */
3789d48367SSimon Glass 
3889d48367SSimon Glass struct ueth_data {
3989d48367SSimon Glass 	/* eth info */
4089d48367SSimon Glass 	struct eth_device eth_dev;		/* used with eth_register */
4189d48367SSimon Glass 	int phy_id;						/* mii phy id */
4289d48367SSimon Glass 
4389d48367SSimon Glass 	/* usb info */
4489d48367SSimon Glass 	struct usb_device *pusb_dev;	/* this usb_device */
4589d48367SSimon Glass 	unsigned char	ifnum;			/* interface number */
4689d48367SSimon Glass 	unsigned char	ep_in;			/* in endpoint */
4789d48367SSimon Glass 	unsigned char	ep_out;			/* out ....... */
4889d48367SSimon Glass 	unsigned char	ep_int;			/* interrupt . */
4989d48367SSimon Glass 	unsigned char	subclass;		/* as in overview */
5089d48367SSimon Glass 	unsigned char	protocol;		/* .............. */
5189d48367SSimon Glass 	unsigned char	irqinterval;	/* Intervall for IRQ Pipe */
5289d48367SSimon Glass 
5389d48367SSimon Glass 	/* private fields for each driver can go here if needed */
54*291391beSSimon Glass #ifdef CONFIG_USB_ETHER_SMSC95XX
55*291391beSSimon Glass 	size_t rx_urb_size;  /* maximum USB URB size */
56*291391beSSimon Glass 	u32 mac_cr;  /* MAC control register value */
57*291391beSSimon Glass 	int have_hwaddr;  /* 1 if we have a hardware MAC address */
58*291391beSSimon Glass #endif
5989d48367SSimon Glass };
6089d48367SSimon Glass 
6189d48367SSimon Glass /*
6289d48367SSimon Glass  * Function definitions for each USB ethernet driver go here, bracketed by
6389d48367SSimon Glass  * #ifdef CONFIG_USB_ETHER_xxx...#endif
6489d48367SSimon Glass  */
659b70e007SSimon Glass #ifdef CONFIG_USB_ETHER_ASIX
669b70e007SSimon Glass void asix_eth_before_probe(void);
679b70e007SSimon Glass int asix_eth_probe(struct usb_device *dev, unsigned int ifnum,
689b70e007SSimon Glass 		      struct ueth_data *ss);
699b70e007SSimon Glass int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
709b70e007SSimon Glass 		      struct eth_device *eth);
719b70e007SSimon Glass #endif
7289d48367SSimon Glass 
73*291391beSSimon Glass #ifdef CONFIG_USB_ETHER_SMSC95XX
74*291391beSSimon Glass void smsc95xx_eth_before_probe(void);
75*291391beSSimon Glass int smsc95xx_eth_probe(struct usb_device *dev, unsigned int ifnum,
76*291391beSSimon Glass 			struct ueth_data *ss);
77*291391beSSimon Glass int smsc95xx_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
78*291391beSSimon Glass 			struct eth_device *eth);
79*291391beSSimon Glass #endif
80*291391beSSimon Glass 
8189d48367SSimon Glass #endif /* __USB_ETHER_H__ */
82