Changeset 89aca2da in mainline


Ignore:
Timestamp:
2011-05-30T18:21:50Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
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.
Message:

EHCI fixes

Location:
uspace/drv/ehci-hcd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ehci-hcd/main.c

    r55f324f r89aca2da  
    7575}
    7676
    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;
    7979        int irq = 0;
    8080
    81         int ret =
    82             pci_get_my_registers(device, &mem_reg_base, &mem_reg_size, &irq);
     81        int ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    8382        CHECK_RET_RETURN(ret,
    8483            "Failed to get memory addresses for %" PRIun ": %s.\n",
    8584            device->handle, str_error(ret));
    8685        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);
    8887
    89         ret = pci_disable_legacy(device);
     88        ret = pci_disable_legacy(device, reg_base, reg_size, irq);
    9089        CHECK_RET_RETURN(ret,
    9190            "Failed(%d) disable legacy USB: %s.\n", ret, str_error(ret));
  • uspace/drv/ehci-hcd/pci.c

    r55f324f r89aca2da  
    8787} while(0)
    8888
    89 static int pci_read32(ddf_dev_t *dev, int address, uint32_t *value)
     89static int pci_read32(const ddf_dev_t *dev, int address, uint32_t *value)
    9090{
    9191        PCI_READ(32);
    9292}
    93 static int pci_read16(ddf_dev_t *dev, int address, uint16_t *value)
     93static int pci_read16(const ddf_dev_t *dev, int address, uint16_t *value)
    9494{
    9595        PCI_READ(16);
    9696}
    97 static int pci_read8(ddf_dev_t *dev, int address, uint8_t *value)
     97static int pci_read8(const ddf_dev_t *dev, int address, uint8_t *value)
    9898{
    9999        PCI_READ(8);
     
    115115} while(0)
    116116
    117 static int pci_write32(ddf_dev_t *dev, int address, uint32_t value)
     117static int pci_write32(const ddf_dev_t *dev, int address, uint32_t value)
    118118{
    119119        PCI_WRITE(32);
    120120}
    121 static int pci_write16(ddf_dev_t *dev, int address, uint16_t value)
     121static int pci_write16(const ddf_dev_t *dev, int address, uint16_t value)
    122122{
    123123        PCI_WRITE(16);
    124124}
    125 static int pci_write8(ddf_dev_t *dev, int address, uint8_t value)
     125static int pci_write8(const ddf_dev_t *dev, int address, uint8_t value)
    126126{
    127127        PCI_WRITE(8);
     
    136136 * @return Error code.
    137137 */
    138 int pci_get_my_registers(ddf_dev_t *dev,
     138int pci_get_my_registers(const ddf_dev_t *dev,
    139139    uintptr_t *mem_reg_address, size_t *mem_reg_size, int *irq_no)
    140140{
     
    206206 * @return Error code.
    207207 */
    208 int pci_enable_interrupts(ddf_dev_t *device)
     208int pci_enable_interrupts(const ddf_dev_t *device)
    209209{
    210210        const int parent_phone =
     
    223223 * @return Error code.
    224224 */
    225 int pci_disable_legacy(ddf_dev_t *device)
     225int pci_disable_legacy(
     226    const ddf_dev_t *device, uintptr_t reg_base, size_t reg_size, int irq)
    226227{
    227228        assert(device);
     
    236237        } else (void)0
    237238
    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, &reg_base, &reg_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 */
    250240        void *regs = NULL;
    251         ret = pio_enable((void*)reg_base, reg_size, &regs);
     241        int ret = pio_enable((void*)reg_base, reg_size, &regs);
    252242        CHECK_RET_RETURN(ret, "Failed(%d) to map registers %p.\n",
    253243            ret, (void *) reg_base);
     
    316306                        CHECK_RET_RETURN(ret,
    317307                            "Failed(%d) zero USBLEGCTLSTS.\n", ret);
     308                        udelay(10);
    318309                        ret = pci_read32(
    319310                            device, eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
     
    350341        usb_log_debug("USBCMD value: %x.\n", *usbcmd);
    351342        if (*usbcmd & USBCMD_RUN) {
    352                 *usbcmd = 0;
    353                 /* Wait until hc is halted */
    354                 while ((*usbsts & USBSTS_HALTED) != 0);
    355343                *usbsts = 0x3f; /* ack all interrupts */
    356344                *usbint = 0; /* disable all interrutps */
    357345                *usbconf = 0; /* relase control of RH ports */
     346
     347                *usbcmd = 0;
     348                /* Wait until hc is halted */
     349                while ((*usbsts & USBSTS_HALTED) == 0);
    358350                usb_log_info("EHCI turned off.\n");
    359351        } else {
  • uspace/drv/ehci-hcd/pci.h

    r55f324f r89aca2da  
    3838#include <ddf/driver.h>
    3939
    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 *);
     40int pci_get_my_registers(const ddf_dev_t *, uintptr_t *, size_t *, int *);
     41int pci_enable_interrupts(const ddf_dev_t *);
     42int pci_disable_legacy(const ddf_dev_t *, uintptr_t, size_t, int);
    4343
    4444#endif
Note: See TracChangeset for help on using the changeset viewer.