xref: /rk3399_rockchip-uboot/include/usb_ether.h (revision e1dbdf9109a2739862ccd3c39be0b8ee37721cb6)
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 
53*e1dbdf91SLucas Stach 	/* driver private */
54*e1dbdf91SLucas Stach 	void *dev_priv;
5589d48367SSimon Glass };
5689d48367SSimon Glass 
5789d48367SSimon Glass /*
5889d48367SSimon Glass  * Function definitions for each USB ethernet driver go here, bracketed by
5989d48367SSimon Glass  * #ifdef CONFIG_USB_ETHER_xxx...#endif
6089d48367SSimon Glass  */
619b70e007SSimon Glass #ifdef CONFIG_USB_ETHER_ASIX
629b70e007SSimon Glass void asix_eth_before_probe(void);
639b70e007SSimon Glass int asix_eth_probe(struct usb_device *dev, unsigned int ifnum,
649b70e007SSimon Glass 		      struct ueth_data *ss);
659b70e007SSimon Glass int asix_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
669b70e007SSimon Glass 		      struct eth_device *eth);
679b70e007SSimon Glass #endif
6889d48367SSimon Glass 
69291391beSSimon Glass #ifdef CONFIG_USB_ETHER_SMSC95XX
70291391beSSimon Glass void smsc95xx_eth_before_probe(void);
71291391beSSimon Glass int smsc95xx_eth_probe(struct usb_device *dev, unsigned int ifnum,
72291391beSSimon Glass 			struct ueth_data *ss);
73291391beSSimon Glass int smsc95xx_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
74291391beSSimon Glass 			struct eth_device *eth);
75291391beSSimon Glass #endif
76291391beSSimon Glass 
7789d48367SSimon Glass #endif /* __USB_ETHER_H__ */
78