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