xref: /openbmc/qemu/include/hw/usb/hcd-dwc3.h (revision 7a5951f6)
1 /*
2  * QEMU model of the USB DWC3 host controller emulation.
3  *
4  * Copyright (c) 2020 Xilinx Inc.
5  *
6  * Written by Vikram Garhwal<fnu.vikram@xilinx.com>
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  */
26 #ifndef HCD_DWC3_H
27 #define HCD_DWC3_H
28 
29 #include "hw/register.h"
30 #include "hw/usb/hcd-xhci.h"
31 #include "hw/usb/hcd-xhci-sysbus.h"
32 
33 #define TYPE_USB_DWC3 "usb_dwc3"
34 
35 #define USB_DWC3(obj) \
36      OBJECT_CHECK(USBDWC3, (obj), TYPE_USB_DWC3)
37 
38 #define USB_DWC3_R_MAX ((0x530 / 4) + 1)
39 #define DWC3_SIZE 0x10000
40 
41 typedef struct USBDWC3 {
42     SysBusDevice parent_obj;
43     MemoryRegion iomem;
44     XHCISysbusState sysbus_xhci;
45 
46     uint32_t regs[USB_DWC3_R_MAX];
47     RegisterInfo regs_info[USB_DWC3_R_MAX];
48 
49     struct {
50         uint8_t     mode;
51         uint32_t    dwc_usb3_user;
52     } cfg;
53 
54 } USBDWC3;
55 
56 #endif
57