/****************************************************************** * Copyright 2005 Mentor Graphics Corporation * Copyright (C) 2005-2006 by Texas Instruments * * This file is part of the Inventra Controller Driver for Linux. * * The Inventra Controller Driver for Linux is free software; you * can redistribute it and/or modify it under the terms of the GNU * General Public License version 2 as published by the Free Software * Foundation. * * The Inventra Controller Driver for Linux is distributed in * the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public * License for more details. * * You should have received a copy of the GNU General Public License * along with The Inventra Controller Driver for Linux ; if not, * write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA * * ANY DOWNLOAD, USE, REPRODUCTION, MODIFICATION OR DISTRIBUTION * OF THIS DRIVER INDICATES YOUR COMPLETE AND UNCONDITIONAL ACCEPTANCE * OF THOSE TERMS.THIS DRIVER IS PROVIDED "AS IS" AND MENTOR GRAPHICS * MAKES NO WARRANTIES, EXPRESS OR IMPLIED, RELATED TO THIS DRIVER. * MENTOR GRAPHICS SPECIFICALLY DISCLAIMS ALL IMPLIED WARRANTIES * OF MERCHANTABILITY; FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. MENTOR GRAPHICS DOES NOT PROVIDE SUPPORT * SERVICES OR UPDATES FOR THIS DRIVER, EVEN IF YOU ARE A MENTOR * GRAPHICS SUPPORT CUSTOMER. ******************************************************************/ #ifndef _MUSB_HOST_H #define _MUSB_HOST_H static inline struct usb_hcd *musb_to_hcd(struct musb *musb) { return (struct usb_hcd *) (((void *)musb) - offsetof(struct usb_hcd, hcd_priv)); } static inline struct musb *hcd_to_musb(struct usb_hcd *hcd) { return (void *) hcd->hcd_priv; } /* stored in "usb_host_endpoint.hcpriv" for scheduled endpoints */ struct musb_qh { struct usb_host_endpoint *hep; /* usbcore info */ struct usb_device *dev; struct musb_hw_ep *hw_ep; /* current binding */ struct list_head ring; /* of musb_qh */ //struct musb_qh *next; /* for periodic tree */ unsigned offset; /* in urb->transfer_buffer */ unsigned segsize; /* current xfer fragment */ u8 type_reg; /* {rx,tx} type register */ u8 intv_reg; /* {rx,tx} interval register */ u8 addr_reg; /* device address register */ u8 h_addr_reg; /* hub address register */ u8 h_port_reg; /* hub port register */ u8 is_ready; /* safe to modify hw_ep */ u8 type; /* XFERTYPE_* */ u8 epnum; u16 maxpacket; u16 frame; /* for periodic schedule */ unsigned iso_idx; /* in urb->iso_frame_desc[] */ }; /* map from control or bulk queue head to the first qh on that ring */ static inline struct musb_qh *first_qh(struct list_head *q) { if (list_empty(q)) return NULL; return container_of(q->next, struct musb_qh, ring); } extern void musb_root_disconnect(struct musb *musb); struct usb_hcd; extern int musb_hub_status_data(struct usb_hcd *hcd, char *buf); extern int musb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, char *buf, u16 wLength); extern int musb_bus_suspend(struct usb_hcd *); extern int musb_bus_resume(struct usb_hcd *); extern const struct hc_driver musb_hc_driver; static inline struct urb *next_urb(struct musb_qh *qh) { #ifdef CONFIG_USB_MUSB_HDRC_HCD struct list_head *queue; if (!qh) return NULL; queue = &qh->hep->urb_list; if (list_empty(queue)) return NULL; return container_of(queue->next, struct urb, urb_list); #else return NULL; #endif } #endif /* _MUSB_HOST_H */