1f08c3bdfSopenharmony_ci/*
2f08c3bdfSopenharmony_ci *
3f08c3bdfSopenharmony_ci *   Copyright (c) International Business Machines  Corp., 2001
4f08c3bdfSopenharmony_ci *
5f08c3bdfSopenharmony_ci *   This program is free software;  you can redistribute it and/or modify
6f08c3bdfSopenharmony_ci *   it under the terms of the GNU General Public License as published by
7f08c3bdfSopenharmony_ci *   the Free Software Foundation; either version 2 of the License, or
8f08c3bdfSopenharmony_ci *   (at your option) any later version.
9f08c3bdfSopenharmony_ci *
10f08c3bdfSopenharmony_ci *   This program is distributed in the hope that it will be useful,
11f08c3bdfSopenharmony_ci *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12f08c3bdfSopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13f08c3bdfSopenharmony_ci *   the GNU General Public License for more details.
14f08c3bdfSopenharmony_ci *
15f08c3bdfSopenharmony_ci *   You should have received a copy of the GNU General Public License
16f08c3bdfSopenharmony_ci *   along with this program;  if not, write to the Free Software
17f08c3bdfSopenharmony_ci *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18f08c3bdfSopenharmony_ci *
19f08c3bdfSopenharmony_ci*/
20f08c3bdfSopenharmony_ci//extern struct usb_bus *usb_alloc_bus(struct usb_operations *);
21f08c3bdfSopenharmony_ciextern void usb_connect(struct usb_device *dev);
22f08c3bdfSopenharmony_ciextern int usb_new_device(struct usb_device *dev);
23f08c3bdfSopenharmony_ciextern void usb_free_bus(struct usb_bus *bus);
24f08c3bdfSopenharmony_ciextern void usb_register_bus(struct usb_bus *bus);
25f08c3bdfSopenharmony_ciextern void usb_deregister_bus(struct usb_bus *bus);
26f08c3bdfSopenharmony_ciextern int usb_hcd_pci_probe(struct pci_dev *, const struct pci_device_id *);
27f08c3bdfSopenharmony_ciextern void usb_hcd_pci_remove(struct pci_dev *);
28f08c3bdfSopenharmony_ciextern int usb_hcd_pci_suspend(struct pci_dev *, u32);
29f08c3bdfSopenharmony_ciextern int usb_hcd_pci_resume(struct pci_dev *);
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_ci#ifndef usb_operations
32f08c3bdfSopenharmony_ci	struct usb_operations {
33f08c3bdfSopenharmony_ci	        int (*allocate)(struct usb_device *);
34f08c3bdfSopenharmony_ci	        int (*deallocate)(struct usb_device *);
35f08c3bdfSopenharmony_ci	        int (*get_frame_number) (struct usb_device *dev);
36f08c3bdfSopenharmony_ci	        int (*submit_urb) (struct urb *urb);
37f08c3bdfSopenharmony_ci	        int (*unlink_urb) (struct urb *urb);
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ci		/* allocate dma-consistent buffer for URB_DMA_NOMAPPING */
40f08c3bdfSopenharmony_ci	        void *(*buffer_alloc)(struct usb_bus *bus, size_t size,
41f08c3bdfSopenharmony_ci        	                int mem_flags,
42f08c3bdfSopenharmony_ci        	                dma_addr_t *dma);
43f08c3bdfSopenharmony_ci        	void (*buffer_free)(struct usb_bus *bus, size_t size,
44f08c3bdfSopenharmony_ci                	        void *addr, dma_addr_t dma);
45f08c3bdfSopenharmony_ci	};
46f08c3bdfSopenharmony_ci#endif
47f08c3bdfSopenharmony_ci
48f08c3bdfSopenharmony_ci#ifndef usb_hcd
49f08c3bdfSopenharmony_ci	struct usb_hcd {
50f08c3bdfSopenharmony_ci		struct usb_bus          self;           /* hcd is-a bus */
51f08c3bdfSopenharmony_ci	        const char              *product_desc;  /* product/vendor string */
52f08c3bdfSopenharmony_ci	        const char              *description;   /* "ehci-hcd" etc */
53f08c3bdfSopenharmony_ci	        struct timer_list       rh_timer;       /* drives root hub */
54f08c3bdfSopenharmony_ci	        struct list_head        dev_list;       /* devices on this bus */
55f08c3bdfSopenharmony_ci	        struct work_struct      work;
56f08c3bdfSopenharmony_ci	        struct hc_driver        *driver;        /* hw-specific hooks */
57f08c3bdfSopenharmony_ci	        int                     irq;            /* irq allocated */
58f08c3bdfSopenharmony_ci	        void                    *regs;          /* device memory/io */
59f08c3bdfSopenharmony_ci	        struct device           *controller;    /* handle to hardware */
60f08c3bdfSopenharmony_ci	        struct pci_dev          *pdev;          /* pci is typical */
61f08c3bdfSopenharmony_ci	        int                     region;         /* pci region for regs */
62f08c3bdfSopenharmony_ci	        u32                     pci_state [16]; /* for PM state save */
63f08c3bdfSopenharmony_ci	        atomic_t                resume_count;   /* multiple resumes issue */
64f08c3bdfSopenharmony_ci	        struct pci_pool         *pool [4];
65f08c3bdfSopenharmony_ci	        int                     state;
66f08c3bdfSopenharmony_ci	};
67f08c3bdfSopenharmony_ci#endif
68f08c3bdfSopenharmony_ci
69f08c3bdfSopenharmony_ci
70f08c3bdfSopenharmony_ci#ifndef hc_driver
71f08c3bdfSopenharmony_ci	struct hc_driver {
72f08c3bdfSopenharmony_ci		const char      *description;   /* "ehci-hcd" etc */
73f08c3bdfSopenharmony_ci        	void    (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
74f08c3bdfSopenharmony_ci	        int     flags;
75f08c3bdfSopenharmony_ci        	int     (*start) (struct usb_hcd *hcd);
76f08c3bdfSopenharmony_ci        	int     (*suspend) (struct usb_hcd *hcd, __u32 state);
77f08c3bdfSopenharmony_ci        	int     (*resume) (struct usb_hcd *hcd);
78f08c3bdfSopenharmony_ci        	void    (*stop) (struct usb_hcd *hcd);
79f08c3bdfSopenharmony_ci        	int     (*get_frame_number) (struct usb_hcd *hcd);
80f08c3bdfSopenharmony_ci        	struct usb_hcd  *(*hcd_alloc) (void);
81f08c3bdfSopenharmony_ci        	void            (*hcd_free) (struct usb_hcd *hcd);
82f08c3bdfSopenharmony_ci	        int     (*urb_enqueue) (struct usb_hcd *hcd, struct urb *urb,
83f08c3bdfSopenharmony_ci				int mem_flags);
84f08c3bdfSopenharmony_ci        	int     (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb);
85f08c3bdfSopenharmony_ci        	void            (*free_config) (struct usb_hcd *hcd,
86f08c3bdfSopenharmony_ci                                struct usb_device *dev);
87f08c3bdfSopenharmony_ci
88f08c3bdfSopenharmony_ci		int     (*hub_status_data) (struct usb_hcd *hcd, char *buf);
89f08c3bdfSopenharmony_ci		int     (*hub_control) (struct usb_hcd *hcd,
90f08c3bdfSopenharmony_ci                                u16 typeReq, u16 wValue, u16 wIndex,
91f08c3bdfSopenharmony_ci                                char *buf, u16 wLength);
92f08c3bdfSopenharmony_ci	};
93f08c3bdfSopenharmony_ci#endif
94f08c3bdfSopenharmony_ci
95f08c3bdfSopenharmony_ci#ifndef USB_MAXBUS
96f08c3bdfSopenharmony_ci	#define USB_MAXBUS              64
97f08c3bdfSopenharmony_ci#endif
98f08c3bdfSopenharmony_ci
99f08c3bdfSopenharmony_cistruct tusb_user {
100f08c3bdfSopenharmony_ci	struct usb_bus		*bus;
101f08c3bdfSopenharmony_ci	struct usb_device	*dev;
102f08c3bdfSopenharmony_ci	struct pci_dev		*pdev;
103f08c3bdfSopenharmony_ci};
104f08c3bdfSopenharmony_citypedef struct tusb_user tusb_user_t;
105f08c3bdfSopenharmony_ci
106