Changeset a948c23 in mainline


Ignore:
Timestamp:
2011-05-08T14:38:27Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8855939
Parents:
d394e57a
Message:

Fine tune EHCI handling

File:
1 edited

Legend:

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

    rd394e57a ra948c23  
    5454
    5555#define CMD_OFFSET 0x0
    56 #define CONFIGFLAG_OFFSET 0x40
     56#define STS_OFFSET 0x4
     57#define CFG_OFFSET 0x40
    5758
    5859#define USBCMD_RUN 1
     
    264265         * It would prevent pre-OS code from interfering. */
    265266        ret = async_req_3_0(parent_phone, DEV_IFACE_ID(PCI_DEV_IFACE),
    266            IPC_M_CONFIG_SPACE_WRITE_32, eecp + USBLEGCTLSTS_OFFSET, 0);
     267           IPC_M_CONFIG_SPACE_WRITE_32, eecp + USBLEGCTLSTS_OFFSET,
     268           0xe0000000);
    267269        CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) zero USBLEGCTLSTS.\n", ret);
    268         usb_log_debug("Zeroed USBLEGCTLSTS register.\n");
    269270
    270271        /* Read again Legacy Support and Control register */
     
    291292        volatile uint32_t *usbcmd =
    292293            (uint32_t*)((uint8_t*)registers + operation_offset + CMD_OFFSET);
     294        volatile uint32_t *usbsts =
     295            (uint32_t*)((uint8_t*)registers + operation_offset + STS_OFFSET);
    293296        volatile uint32_t *usbconfigured =
    294             (uint32_t*)((uint8_t*)registers + operation_offset
    295             + CONFIGFLAG_OFFSET);
     297            (uint32_t*)((uint8_t*)registers + operation_offset + CFG_OFFSET);
    296298        usb_log_debug("USBCMD value: %x.\n", *usbcmd);
    297299        if (*usbcmd & USBCMD_RUN) {
    298300                *usbcmd = 0;
    299                 *usbconfigured = 0;
     301                while (!(*usbsts & (1 << 12))); /*wait until hc is halted */
     302                *usbcmd = 0x2; /* reset */
     303                while (*usbcmd & 0x2); /* wait for reset to complete */
    300304                usb_log_info("EHCI turned off.\n");
    301305        } else {
    302306                usb_log_info("EHCI was not running.\n");
    303307        }
     308        usb_log_debug("Registers: %x(0x00080000):%x(0x00001000):%x(0x0).\n",
     309            *usbcmd, *usbsts, *usbconfigured);
    304310
    305311        async_hangup(parent_phone);
Note: See TracChangeset for help on using the changeset viewer.