X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fusb.h;h=ba3d169ea8cbf977aaaeb8f95e9cf331537d1d58;hb=7d899c14cc1842004e5f94a376082e7b6cf5988d;hp=1cc3e4229daed2c528da4e16d73e601a616a15ea;hpb=6ca9da4d42aeb43df5ef29f7d0518009df583b2f;p=u-boot diff --git a/include/usb.h b/include/usb.h index 1cc3e4229d..ba3d169ea8 100644 --- a/include/usb.h +++ b/include/usb.h @@ -29,6 +29,16 @@ #include #include +/* + * The EHCI spec says that we must align to at least 32 bytes. However, + * some platforms require larger alignment. + */ +#if ARCH_DMA_MINALIGN > 32 +#define USB_DMA_MINALIGN ARCH_DMA_MINALIGN +#else +#define USB_DMA_MINALIGN 32 +#endif + /* Everything is aribtrary */ #define USB_ALTSETTINGALLOC 4 #define USB_MAXALTSETTING 128 /* Hard limit */ @@ -42,6 +52,12 @@ #define USB_CNTL_TIMEOUT 100 /* 100ms timeout */ +/* + * This is the timeout to allow for submitting an urb in ms. We allow more + * time for a BULK device to react - some are slow. + */ +#define USB_TIMEOUT_MS(pipe) (usb_pipebulk(pipe) ? 5000 : 1000) + /* device request (setup) */ struct devrequest { unsigned char requesttype; @@ -103,7 +119,9 @@ struct usb_device { int epmaxpacketout[16]; /* OUTput endpoint specific maximums */ int configno; /* selected config number */ - struct usb_device_descriptor descriptor; /* Device Descriptor */ + /* Device Descriptor */ + struct usb_device_descriptor descriptor + __attribute__((aligned(ARCH_DMA_MINALIGN))); struct usb_config config; /* config descriptor */ int have_langid; /* whether string_langid is valid yet */ @@ -132,7 +150,8 @@ struct usb_device { defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \ defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \ defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \ - defined(CONFIG_USB_OMAP3) + defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \ + defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) int usb_lowlevel_init(void); int usb_lowlevel_stop(void); @@ -142,7 +161,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, struct devrequest *setup); int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval); -void usb_event_poll(void); /* Defines */ #define USB_UHCI_VEND_ID 0x8086 @@ -161,6 +179,13 @@ int usb_stor_info(void); #endif +#ifdef CONFIG_USB_HOST_ETHER + +#define USB_MAX_ETH_DEV 5 +int usb_host_eth_scan(int mode); + +#endif + #ifdef CONFIG_USB_KEYBOARD int drv_usb_kbd_init(void); @@ -184,9 +209,8 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, void *data, int len, int *actual_length, int timeout); int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int transfer_len, int interval); -void usb_disable_asynch(int disable); +int usb_disable_asynch(int disable); int usb_maxpacket(struct usb_device *dev, unsigned long pipe); -inline void wait_ms(unsigned long ms); int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer, int cfgno); int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, @@ -258,7 +282,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate); */ /* Create various pipes... */ #define create_pipe(dev,endpoint) \ - (((dev)->devnum << 8) | (endpoint << 15) | \ + (((dev)->devnum << 8) | ((endpoint) << 15) | \ ((dev)->speed << 26) | (dev)->maxpacketsize) #define default_pipe(dev) ((dev)->speed << 26) @@ -353,4 +377,12 @@ struct usb_hub_device { struct usb_hub_descriptor desc; }; +int usb_hub_probe(struct usb_device *dev, int ifnum); +void usb_hub_reset(void); +int hub_port_reset(struct usb_device *dev, int port, + unsigned short *portstat); + +struct usb_device *usb_alloc_new_device(void); +int usb_new_device(struct usb_device *dev); + #endif /*_USB_H_ */