xref: /openbmc/qemu/hw/usb/vt82c686-uhci-pci.c (revision 0b29090a)
1 #include "qemu/osdep.h"
2 #include "hw/isa/vt82c686.h"
3 #include "hcd-uhci.h"
4 
5 static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)
6 {
7     UHCIState *s = UHCI(dev);
8     uint8_t *pci_conf = s->dev.config;
9 
10     /* USB misc control 1/2 */
11     pci_set_long(pci_conf + 0x40, 0x00001000);
12     /* PM capability */
13     pci_set_long(pci_conf + 0x80, 0x00020001);
14     /* USB legacy support  */
15     pci_set_long(pci_conf + 0xc0, 0x00002000);
16 
17     usb_uhci_common_realize(dev, errp);
18 }
19 
20 static UHCIInfo uhci_info[] = {
21     {
22         .name      = TYPE_VT82C686B_USB_UHCI,
23         .vendor_id = PCI_VENDOR_ID_VIA,
24         .device_id = PCI_DEVICE_ID_VIA_UHCI,
25         .revision  = 0x01,
26         .irq_pin   = 3,
27         .realize   = usb_uhci_vt82c686b_realize,
28         .unplug    = true,
29         /* Reason: only works as USB function of VT82xx superio chips */
30         .notuser   = true,
31     }
32 };
33 
34 static const TypeInfo vt82c686b_usb_uhci_type_info = {
35     .parent         = TYPE_UHCI,
36     .name           = TYPE_VT82C686B_USB_UHCI,
37     .class_init     = uhci_data_class_init,
38     .class_data     = uhci_info,
39 };
40 
41 static void vt82c686b_usb_uhci_register_types(void)
42 {
43     type_register_static(&vt82c686b_usb_uhci_type_info);
44 }
45 
46 type_init(vt82c686b_usb_uhci_register_types)
47