Ignore:
File:
1 edited

Legend:

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

    rc060090 r17d1542  
    8787} while(0)
    8888
    89 static int pci_read32(const ddf_dev_t *dev, int address, uint32_t *value)
     89static int pci_read32(ddf_dev_t *dev, int address, uint32_t *value)
    9090{
    9191        PCI_READ(32);
    9292}
    93 static int pci_read16(const ddf_dev_t *dev, int address, uint16_t *value)
     93static int pci_read16(ddf_dev_t *dev, int address, uint16_t *value)
    9494{
    9595        PCI_READ(16);
    9696}
    97 static int pci_read8(const ddf_dev_t *dev, int address, uint8_t *value)
     97static int pci_read8(ddf_dev_t *dev, int address, uint8_t *value)
    9898{
    9999        PCI_READ(8);
     
    115115} while(0)
    116116
    117 static int pci_write32(const ddf_dev_t *dev, int address, uint32_t value)
     117static int pci_write32(ddf_dev_t *dev, int address, uint32_t value)
    118118{
    119119        PCI_WRITE(32);
    120120}
    121 static int pci_write16(const ddf_dev_t *dev, int address, uint16_t value)
     121static int pci_write16(ddf_dev_t *dev, int address, uint16_t value)
    122122{
    123123        PCI_WRITE(16);
    124124}
    125 static int pci_write8(const ddf_dev_t *dev, int address, uint8_t value)
     125static int pci_write8(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(const ddf_dev_t *dev,
     138int pci_get_my_registers(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(const ddf_dev_t *device)
     208int pci_enable_interrupts(ddf_dev_t *device)
    209209{
    210210        const int parent_phone =
     
    223223 * @return Error code.
    224224 */
    225 int pci_disable_legacy(
    226     const ddf_dev_t *device, uintptr_t reg_base, size_t reg_size, int irq)
     225int pci_disable_legacy(ddf_dev_t *device)
    227226{
    228227        assert(device);
     
    237236        } else (void)0
    238237
    239         /* Map EHCI registers */
     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 */
    240250        void *regs = NULL;
    241         int ret = pio_enable((void*)reg_base, reg_size, &regs);
     251        ret = pio_enable((void*)reg_base, reg_size, &regs);
    242252        CHECK_RET_RETURN(ret, "Failed(%d) to map registers %p.\n",
    243253            ret, (void *) reg_base);
     
    306316                        CHECK_RET_RETURN(ret,
    307317                            "Failed(%d) zero USBLEGCTLSTS.\n", ret);
    308                         udelay(10);
    309318                        ret = pci_read32(
    310319                            device, eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
     
    341350        usb_log_debug("USBCMD value: %x.\n", *usbcmd);
    342351        if (*usbcmd & USBCMD_RUN) {
     352                *usbcmd = 0;
     353                /* Wait until hc is halted */
     354                while ((*usbsts & USBSTS_HALTED) != 0);
    343355                *usbsts = 0x3f; /* ack all interrupts */
    344356                *usbint = 0; /* disable all interrutps */
    345357                *usbconf = 0; /* relase control of RH ports */
    346 
    347                 *usbcmd = 0;
    348                 /* Wait until hc is halted */
    349                 while ((*usbsts & USBSTS_HALTED) == 0);
    350358                usb_log_info("EHCI turned off.\n");
    351359        } else {
Note: See TracChangeset for help on using the changeset viewer.