Changeset e3a07bba in mainline
- Timestamp:
- 2013-12-31T22:31:21Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ba4a03a5
- Parents:
- 1bb9833
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/main.c
r1bb9833 re3a07bba 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup drvusbuhci hc28 /** @addtogroup drvusbuhci 29 29 * @{ 30 30 */ … … 35 35 #include <assert.h> 36 36 #include <ddf/driver.h> 37 #include <devman.h> 37 38 #include <errno.h> 38 39 #include <io/log.h> 40 #include <pci_dev_iface.h> 39 41 #include <stdio.h> 40 42 #include <str_error.h> … … 56 58 }; 57 59 60 /** Call the PCI driver with a request to clear legacy support register 61 * 62 * @param[in] device Device asking to disable interrupts 63 * @return Error code. 64 */ 65 static int disable_legacy(ddf_dev_t *device) 66 { 67 assert(device); 68 69 async_sess_t *parent_sess = devman_parent_device_connect( 70 EXCHANGE_SERIALIZE, ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 71 if (!parent_sess) 72 return ENOMEM; 73 74 /* See UHCI design guide page 45 for these values. 75 * Write all WC bits in USB legacy register */ 76 const int rc = pci_config_space_write_16(parent_sess, 0xc0, 0xaf00); 77 78 async_hangup(parent_sess); 79 return rc; 80 } 81 58 82 /** Initialize a new ddf driver instance for uhci hc and hub. 59 83 * … … 66 90 assert(device); 67 91 68 const int ret = device_setup_uhci(device); 92 int ret = disable_legacy(device); 93 if (ret != EOK) { 94 usb_log_error("Failed to disable legacy USB: %s.\n", 95 str_error(ret)); 96 return ret; 97 } 98 99 100 ret = device_setup_uhci(device); 69 101 if (ret != EOK) { 70 102 usb_log_error("Failed to initialize UHCI driver: %s.\n", -
uspace/drv/bus/usb/uhci/uhci.c
r1bb9833 re3a07bba 38 38 #include <ddf/interrupt.h> 39 39 #include <device/hw_res_parsed.h> 40 #include <pci_dev_iface.h>41 40 #include <devman.h> 42 41 #include <errno.h> … … 75 74 } 76 75 77 /** Call the PCI driver with a request to clear legacy support register78 *79 * @param[in] device Device asking to disable interrupts80 * @return Error code.81 */82 static int disable_legacy(ddf_dev_t *device)83 {84 assert(device);85 86 async_sess_t *parent_sess = devman_parent_device_connect(87 EXCHANGE_SERIALIZE, ddf_dev_get_handle(device), IPC_FLAG_BLOCKING);88 if (!parent_sess)89 return ENOMEM;90 91 /* See UHCI design guide page 45 for these values.92 * Write all WC bits in USB legacy register */93 const int rc = pci_config_space_write_16(parent_sess, 0xc0, 0xaf00);94 95 async_hangup(parent_sess);96 return rc;97 }98 99 76 /** Initialize hc and rh DDF structures and their respective drivers. 100 77 * … … 103 80 * This function does all the preparatory work for hc and rh drivers: 104 81 * - gets device's hw resources 105 * - disables UHCI legacy support (PCI config space)106 82 * - attempts to enable interrupts 107 83 * - registers interrupt handler … … 152 128 } 153 129 154 ret = disable_legacy(device);155 if (ret != EOK) {156 usb_log_error("Failed to disable legacy USB: %s.\n",157 str_error(ret));158 goto irq_unregister;159 }160 161 130 ret = hc_init(hc, ®s, interrupts); 162 131 if (ret != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.