Changeset 89aca2da in mainline
- Timestamp:
- 2011-05-30T18:21:50Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8c74d15
- Parents:
- 55f324f (diff), c060090 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/drv/ehci-hcd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ehci-hcd/main.c
r55f324f r89aca2da 75 75 } 76 76 77 uintptr_t mem_reg_base = 0;78 size_t mem_reg_size = 0;77 uintptr_t reg_base = 0; 78 size_t reg_size = 0; 79 79 int irq = 0; 80 80 81 int ret = 82 pci_get_my_registers(device, &mem_reg_base, &mem_reg_size, &irq); 81 int ret = pci_get_my_registers(device, ®_base, ®_size, &irq); 83 82 CHECK_RET_RETURN(ret, 84 83 "Failed to get memory addresses for %" PRIun ": %s.\n", 85 84 device->handle, str_error(ret)); 86 85 usb_log_info("Memory mapped regs at 0x%" PRIxn " (size %zu), IRQ %d.\n", 87 mem_reg_base, mem_reg_size, irq);86 reg_base, reg_size, irq); 88 87 89 ret = pci_disable_legacy(device );88 ret = pci_disable_legacy(device, reg_base, reg_size, irq); 90 89 CHECK_RET_RETURN(ret, 91 90 "Failed(%d) disable legacy USB: %s.\n", ret, str_error(ret)); -
uspace/drv/ehci-hcd/pci.c
r55f324f r89aca2da 87 87 } while(0) 88 88 89 static int pci_read32( ddf_dev_t *dev, int address, uint32_t *value)89 static int pci_read32(const ddf_dev_t *dev, int address, uint32_t *value) 90 90 { 91 91 PCI_READ(32); 92 92 } 93 static int pci_read16( ddf_dev_t *dev, int address, uint16_t *value)93 static int pci_read16(const ddf_dev_t *dev, int address, uint16_t *value) 94 94 { 95 95 PCI_READ(16); 96 96 } 97 static int pci_read8( ddf_dev_t *dev, int address, uint8_t *value)97 static int pci_read8(const ddf_dev_t *dev, int address, uint8_t *value) 98 98 { 99 99 PCI_READ(8); … … 115 115 } while(0) 116 116 117 static int pci_write32( ddf_dev_t *dev, int address, uint32_t value)117 static int pci_write32(const ddf_dev_t *dev, int address, uint32_t value) 118 118 { 119 119 PCI_WRITE(32); 120 120 } 121 static int pci_write16( ddf_dev_t *dev, int address, uint16_t value)121 static int pci_write16(const ddf_dev_t *dev, int address, uint16_t value) 122 122 { 123 123 PCI_WRITE(16); 124 124 } 125 static int pci_write8( ddf_dev_t *dev, int address, uint8_t value)125 static int pci_write8(const ddf_dev_t *dev, int address, uint8_t value) 126 126 { 127 127 PCI_WRITE(8); … … 136 136 * @return Error code. 137 137 */ 138 int pci_get_my_registers( ddf_dev_t *dev,138 int pci_get_my_registers(const ddf_dev_t *dev, 139 139 uintptr_t *mem_reg_address, size_t *mem_reg_size, int *irq_no) 140 140 { … … 206 206 * @return Error code. 207 207 */ 208 int pci_enable_interrupts( ddf_dev_t *device)208 int pci_enable_interrupts(const ddf_dev_t *device) 209 209 { 210 210 const int parent_phone = … … 223 223 * @return Error code. 224 224 */ 225 int pci_disable_legacy(ddf_dev_t *device) 225 int pci_disable_legacy( 226 const ddf_dev_t *device, uintptr_t reg_base, size_t reg_size, int irq) 226 227 { 227 228 assert(device); … … 236 237 } else (void)0 237 238 238 uintptr_t reg_base = 0; 239 size_t reg_size = 0; 240 int irq = 0; 241 242 int ret = pci_get_my_registers(device, ®_base, ®_size, &irq); 243 CHECK_RET_RETURN(ret, "Failed(%d) to get EHCI registers.\n", ret); 244 245 usb_log_info("EHCI: Memory registers:%p size: %zu irq:%d.\n", 246 (void *) reg_base, reg_size, irq); 247 248 249 /* map EHCI registers */ 239 /* Map EHCI registers */ 250 240 void *regs = NULL; 251 ret = pio_enable((void*)reg_base, reg_size, ®s);241 int ret = pio_enable((void*)reg_base, reg_size, ®s); 252 242 CHECK_RET_RETURN(ret, "Failed(%d) to map registers %p.\n", 253 243 ret, (void *) reg_base); … … 316 306 CHECK_RET_RETURN(ret, 317 307 "Failed(%d) zero USBLEGCTLSTS.\n", ret); 308 udelay(10); 318 309 ret = pci_read32( 319 310 device, eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts); … … 350 341 usb_log_debug("USBCMD value: %x.\n", *usbcmd); 351 342 if (*usbcmd & USBCMD_RUN) { 352 *usbcmd = 0;353 /* Wait until hc is halted */354 while ((*usbsts & USBSTS_HALTED) != 0);355 343 *usbsts = 0x3f; /* ack all interrupts */ 356 344 *usbint = 0; /* disable all interrutps */ 357 345 *usbconf = 0; /* relase control of RH ports */ 346 347 *usbcmd = 0; 348 /* Wait until hc is halted */ 349 while ((*usbsts & USBSTS_HALTED) == 0); 358 350 usb_log_info("EHCI turned off.\n"); 359 351 } else { -
uspace/drv/ehci-hcd/pci.h
r55f324f r89aca2da 38 38 #include <ddf/driver.h> 39 39 40 int pci_get_my_registers( ddf_dev_t *, uintptr_t *, size_t *, int *);41 int pci_enable_interrupts( ddf_dev_t *);42 int pci_disable_legacy( ddf_dev_t *);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 *, uintptr_t, size_t, int); 43 43 44 44 #endif
Note:
See TracChangeset
for help on using the changeset viewer.