Changeset 0b20937 in mainline
- Timestamp:
- 2012-03-15T14:30:10Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd36d39
- Parents:
- 5f6d34b
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/Makefile
r5f6d34b r0b20937 44 44 hc.c \ 45 45 main.c \ 46 pci.c \46 res.c \ 47 47 root_hub.c \ 48 48 transfer_list.c \ -
uspace/drv/bus/usb/uhci/res.c
r5f6d34b r0b20937 39 39 #include <devman.h> 40 40 #include <device/hw_res_parsed.h> 41 #include <device/pci.h> 41 42 42 #include <usb/debug.h> 43 #include <pci_dev_iface.h> 44 45 #include "pci.h" 43 #include "res.h" 46 44 47 45 /** Get I/O address of registers and IRQ for given device. … … 53 51 * @return Error code. 54 52 */ 55 int pci_get_my_registers(const ddf_dev_t *dev,53 int get_my_registers(const ddf_dev_t *dev, 56 54 uintptr_t *io_reg_address, size_t *io_reg_size, int *irq_no) 57 55 { 58 56 assert(dev); 59 assert(io_reg_address);60 assert(io_reg_size);61 assert(irq_no);62 57 63 58 async_sess_t *parent_sess = … … 97 92 * @return Error code. 98 93 */ 99 int pci_enable_interrupts(const ddf_dev_t *device)94 int enable_interrupts(const ddf_dev_t *device) 100 95 { 101 96 async_sess_t *parent_sess = … … 116 111 * @return Error code. 117 112 */ 118 int pci_disable_legacy(const ddf_dev_t *device)113 int disable_legacy(const ddf_dev_t *device) 119 114 { 120 115 assert(device); 121 116 122 async_sess_t *parent_sess = 123 devman_parent_device_connect(EXCHANGE_SERIALIZE, device->handle, 124 IPC_FLAG_BLOCKING); 117 async_sess_t *parent_sess = devman_parent_device_connect( 118 EXCHANGE_SERIALIZE, device->handle, IPC_FLAG_BLOCKING); 125 119 if (!parent_sess) 126 120 return ENOMEM; 127 121 128 /* See UHCI design guide for these values p.45, 129 * write all WC bits in USB legacy register */ 130 const sysarg_t address = 0xc0; 131 const sysarg_t value = 0xaf00; 122 /* See UHCI design guide page 45 for these values. 123 * Write all WC bits in USB legacy register */ 124 const int rc = pci_config_space_write_16(parent_sess, 0xc0, 0xaf00); 132 125 133 async_exch_t *exch = async_exchange_begin(parent_sess);134 135 const int rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),136 IPC_M_CONFIG_SPACE_WRITE_16, address, value);137 138 async_exchange_end(exch);139 126 async_hangup(parent_sess); 140 141 127 return rc; 142 128 } -
uspace/drv/bus/usb/uhci/res.h
r5f6d34b r0b20937 38 38 #include <ddf/driver.h> 39 39 40 int pci_get_my_registers(const ddf_dev_t *, uintptr_t *, size_t *, int *);41 int pci_enable_interrupts(const ddf_dev_t *);42 int pci_disable_legacy(const ddf_dev_t *);40 int get_my_registers(const ddf_dev_t *, uintptr_t *, size_t *, int *); 41 int enable_interrupts(const ddf_dev_t *); 42 int disable_legacy(const ddf_dev_t *); 43 43 44 44 #endif -
uspace/drv/bus/usb/uhci/uhci.c
r5f6d34b r0b20937 41 41 42 42 #include "uhci.h" 43 #include "pci.h" 44 43 44 #include "res.h" 45 45 #include "hc.h" 46 46 #include "root_hub.h" … … 49 49 * and USB root hub */ 50 50 typedef struct uhci { 51 /** Pointer to DDF represen ation of UHCI host controller */51 /** Pointer to DDF representation of UHCI host controller */ 52 52 ddf_fun_t *hc_fun; 53 /** Pointer to DDF represen ation of UHCI root hub */53 /** Pointer to DDF representation of UHCI root hub */ 54 54 ddf_fun_t *rh_fun; 55 55 56 /** Internal driver's represen ation of UHCI host controller */56 /** Internal driver's representation of UHCI host controller */ 57 57 hc_t hc; 58 /** Internal driver's represen ation of UHCI root hub */58 /** Internal driver's representation of UHCI root hub */ 59 59 rh_t rh; 60 60 } uhci_t; … … 187 187 int irq = 0; 188 188 189 ret = pci_get_my_registers(device, ®_base, ®_size, &irq);189 ret = get_my_registers(device, ®_base, ®_size, &irq); 190 190 CHECK_RET_DEST_FREE_RETURN(ret, 191 191 "Failed to get I/O addresses for %" PRIun ": %s.\n", … … 194 194 (void *) reg_base, reg_size, irq); 195 195 196 ret = pci_disable_legacy(device);196 ret = disable_legacy(device); 197 197 CHECK_RET_DEST_FREE_RETURN(ret, 198 198 "Failed to disable legacy USB: %s.\n", str_error(ret)); … … 220 220 221 221 bool interrupts = false; 222 ret = pci_enable_interrupts(device);222 ret = enable_interrupts(device); 223 223 if (ret != EOK) { 224 224 usb_log_warning("Failed to enable interrupts: %s."
Note:
See TracChangeset
for help on using the changeset viewer.