xref: /qemu/include/hw/usb/hcd-dwc3.h (revision 09951f5a27a7f8633118c1808cf17e66b30c3c62)
18bbe61f3SVikram Garhwal /*
28bbe61f3SVikram Garhwal  * QEMU model of the USB DWC3 host controller emulation.
38bbe61f3SVikram Garhwal  *
48bbe61f3SVikram Garhwal  * Copyright (c) 2020 Xilinx Inc.
58bbe61f3SVikram Garhwal  *
68bbe61f3SVikram Garhwal  * Written by Vikram Garhwal<fnu.vikram@xilinx.com>
78bbe61f3SVikram Garhwal  *
88bbe61f3SVikram Garhwal  * Permission is hereby granted, free of charge, to any person obtaining a copy
98bbe61f3SVikram Garhwal  * of this software and associated documentation files (the "Software"), to deal
108bbe61f3SVikram Garhwal  * in the Software without restriction, including without limitation the rights
118bbe61f3SVikram Garhwal  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
128bbe61f3SVikram Garhwal  * copies of the Software, and to permit persons to whom the Software is
138bbe61f3SVikram Garhwal  * furnished to do so, subject to the following conditions:
148bbe61f3SVikram Garhwal  *
158bbe61f3SVikram Garhwal  * The above copyright notice and this permission notice shall be included in
168bbe61f3SVikram Garhwal  * all copies or substantial portions of the Software.
178bbe61f3SVikram Garhwal  *
188bbe61f3SVikram Garhwal  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
198bbe61f3SVikram Garhwal  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
208bbe61f3SVikram Garhwal  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
218bbe61f3SVikram Garhwal  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
228bbe61f3SVikram Garhwal  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
238bbe61f3SVikram Garhwal  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
248bbe61f3SVikram Garhwal  * THE SOFTWARE.
258bbe61f3SVikram Garhwal  */
268bbe61f3SVikram Garhwal #ifndef HCD_DWC3_H
278bbe61f3SVikram Garhwal #define HCD_DWC3_H
288bbe61f3SVikram Garhwal 
297a5951f6SMarkus Armbruster #include "hw/register.h"
308bbe61f3SVikram Garhwal #include "hw/usb/hcd-xhci.h"
318bbe61f3SVikram Garhwal #include "hw/usb/hcd-xhci-sysbus.h"
328bbe61f3SVikram Garhwal 
338bbe61f3SVikram Garhwal #define TYPE_USB_DWC3 "usb_dwc3"
348bbe61f3SVikram Garhwal 
358bbe61f3SVikram Garhwal #define USB_DWC3(obj) \
368bbe61f3SVikram Garhwal      OBJECT_CHECK(USBDWC3, (obj), TYPE_USB_DWC3)
378bbe61f3SVikram Garhwal 
38*b513766eSBernhard Beschow #define USB_DWC3_R_MAX (0x600 / 4)
398bbe61f3SVikram Garhwal #define DWC3_SIZE 0x10000
408bbe61f3SVikram Garhwal 
418bbe61f3SVikram Garhwal typedef struct USBDWC3 {
428bbe61f3SVikram Garhwal     SysBusDevice parent_obj;
438bbe61f3SVikram Garhwal     MemoryRegion iomem;
448bbe61f3SVikram Garhwal     XHCISysbusState sysbus_xhci;
458bbe61f3SVikram Garhwal 
468bbe61f3SVikram Garhwal     uint32_t regs[USB_DWC3_R_MAX];
478bbe61f3SVikram Garhwal     RegisterInfo regs_info[USB_DWC3_R_MAX];
488bbe61f3SVikram Garhwal 
498bbe61f3SVikram Garhwal     struct {
508bbe61f3SVikram Garhwal         uint8_t     mode;
518bbe61f3SVikram Garhwal         uint32_t    dwc_usb3_user;
528bbe61f3SVikram Garhwal     } cfg;
538bbe61f3SVikram Garhwal 
548bbe61f3SVikram Garhwal } USBDWC3;
558bbe61f3SVikram Garhwal 
568bbe61f3SVikram Garhwal #endif
57