Changes in uspace/drv/bus/usb/uhci/main.c [366e9b6:53a309e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/main.c
r366e9b6 r53a309e 36 36 #include <assert.h> 37 37 #include <ddf/driver.h> 38 #include <devman.h>39 38 #include <errno.h> 40 39 #include <io/log.h> … … 50 49 #define NAME "uhci" 51 50 52 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *); 53 static int uhci_driver_start(hcd_t *, bool); 51 static int uhci_driver_init(hcd_t *, const hw_res_list_parsed_t *, bool); 54 52 static void uhci_driver_fini(hcd_t *); 55 static int disable_legacy( hcd_t *,ddf_dev_t *);53 static int disable_legacy(ddf_dev_t *); 56 54 57 55 static const ddf_hc_driver_t uhci_hc_driver = { 58 56 .claim = disable_legacy, 57 .hc_speed = USB_SPEED_FULL, 59 58 .irq_code_gen = uhci_hc_gen_irq_code, 60 59 .init = uhci_driver_init, 61 .start = uhci_driver_start,62 .setup_root_hub = hcd_setup_virtual_root_hub,63 60 .fini = uhci_driver_fini, 64 61 .name = "UHCI", … … 70 67 }; 71 68 72 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res )69 static int uhci_driver_init(hcd_t *hcd, const hw_res_list_parsed_t *res, bool irq) 73 70 { 74 int err;75 76 71 assert(hcd); 77 72 assert(hcd_get_driver_data(hcd) == NULL); … … 81 76 return ENOMEM; 82 77 83 if ((err = hc_init(instance, res)) != EOK) 84 goto err; 85 86 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops, &instance->bus.base); 87 88 return EOK; 89 90 err: 91 free(instance); 92 return err; 93 } 94 95 static int uhci_driver_start(hcd_t *hcd, bool interrupts) 96 { 97 assert(hcd); 98 hc_t *hc = hcd_get_driver_data(hcd); 99 100 hc->hw_interrupts = interrupts; 101 hc_start(hc); 102 return EOK; 78 const int ret = hc_init(instance, res, irq); 79 if (ret == EOK) { 80 hcd_set_implementation(hcd, instance, &uhci_hc_driver.ops); 81 } else { 82 free(instance); 83 } 84 return ret; 103 85 } 104 86 … … 110 92 hc_fini(hc); 111 93 112 hcd_set_implementation(hcd, NULL, NULL , NULL);94 hcd_set_implementation(hcd, NULL, NULL); 113 95 free(hc); 114 96 } … … 119 101 * @return Error code. 120 102 */ 121 static int disable_legacy( hcd_t *hcd,ddf_dev_t *device)103 static int disable_legacy(ddf_dev_t *device) 122 104 { 123 105 assert(device); 124 106 125 async_sess_t *parent_sess = devman_parent_device_connect( 126 ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 127 if (!parent_sess) 107 async_sess_t *parent_sess = ddf_dev_parent_sess_get(device); 108 if (parent_sess == NULL) 128 109 return ENOMEM; 129 110 130 111 /* See UHCI design guide page 45 for these values. 131 112 * Write all WC bits in USB legacy register */ 132 const int rc = pci_config_space_write_16(parent_sess, 0xc0, 0xaf00); 133 134 async_hangup(parent_sess); 135 return rc; 113 return pci_config_space_write_16(parent_sess, 0xc0, 0xaf00); 136 114 } 137 115
Note:
See TracChangeset
for help on using the changeset viewer.