Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ba17f5b in mainline for uspace/drv/ohci/hc.c


Ignore:
Timestamp:
2011-05-07T08:20:20Z (11 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master
Children:
bd2394b
Parents:
5f7b75a (diff), 6c6a95d2 (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:

Development branch changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.c

    r5f7b75a rba17f5b  
    4545#include "hcd_endpoint.h"
    4646
     47#define OHCI_USED_INTERRUPTS \
     48    (I_SO | I_WDH | I_UE | I_RHSC)
    4749static int interrupt_emulator(hc_t *instance);
    4850static void hc_gain_control(hc_t *instance);
     
    285287{
    286288        assert(instance);
    287         if ((status & ~IS_SF) == 0) /* ignore sof status */
     289        usb_log_debug("OHCI interrupt: %x.\n", status);
     290        if ((status & ~I_SF) == 0) /* ignore sof status */
    288291                return;
    289         if (status & IS_RHSC)
     292        if (status & I_RHSC)
    290293                rh_interrupt(&instance->rh);
    291294
    292         usb_log_debug("OHCI interrupt: %x.\n", status);
    293 
    294         if (status & IS_WDH) {
     295
     296        if (status & I_WDH) {
    295297                fibril_mutex_lock(&instance->guard);
    296298                usb_log_debug2("HCCA: %p-%#" PRIx32 " (%p).\n", instance->hcca,
     
    332334{
    333335        assert(instance);
     336        usb_log_debug("Requesting OHCI control.\n");
    334337        /* Turn off legacy emulation */
    335338        volatile uint32_t *ohci_emulation_reg =
     
    337340        usb_log_debug("OHCI legacy register %p: %x.\n",
    338341                ohci_emulation_reg, *ohci_emulation_reg);
    339         *ohci_emulation_reg = 0;
     342        *ohci_emulation_reg &= ~0x1;
    340343
    341344        /* Interrupt routing enabled => smm driver is active */
     
    421424            instance->registers->control);
    422425
    423         /* Disable interrupts */
    424         instance->registers->interrupt_disable = I_SF | I_OC;
    425         usb_log_debug2("Disabling interrupts: %x.\n",
    426             instance->registers->interrupt_disable);
    427         instance->registers->interrupt_disable = I_MI;
     426        /* Enable interrupts */
     427        instance->registers->interrupt_enable = OHCI_USED_INTERRUPTS;
    428428        usb_log_debug2("Enabled interrupts: %x.\n",
    429429            instance->registers->interrupt_enable);
     430        instance->registers->interrupt_enable = I_MI;
    430431
    431432        /* Set periodic start to 90% */
     
    492493            instance->lists[USB_TRANSFER_INTERRUPT].list_head_pa);
    493494
     495        /* Init interrupt code */
     496        instance->interrupt_code.cmds = instance->interrupt_commands;
     497        {
     498                /* Read status register */
     499                instance->interrupt_commands[0].cmd = CMD_MEM_READ_32;
     500                instance->interrupt_commands[0].dstarg = 1;
     501                instance->interrupt_commands[0].addr =
     502                    (void*)&instance->registers->interrupt_status;
     503
     504                /* Test whether we are the interrupt cause */
     505                instance->interrupt_commands[1].cmd = CMD_BTEST;
     506                instance->interrupt_commands[1].value =
     507                    OHCI_USED_INTERRUPTS;
     508                instance->interrupt_commands[1].srcarg = 1;
     509                instance->interrupt_commands[1].dstarg = 2;
     510
     511                /* Predicate cleaning and accepting */
     512                instance->interrupt_commands[2].cmd = CMD_PREDICATE;
     513                instance->interrupt_commands[2].value = 2;
     514                instance->interrupt_commands[2].srcarg = 2;
     515
     516                /* Write clean status register */
     517                instance->interrupt_commands[3].cmd = CMD_MEM_WRITE_A_32;
     518                instance->interrupt_commands[3].srcarg = 1;
     519                instance->interrupt_commands[3].addr =
     520                    (void*)&instance->registers->interrupt_status;
     521
     522                /* Accept interrupt */
     523                instance->interrupt_commands[4].cmd = CMD_ACCEPT;
     524
     525                instance->interrupt_code.cmdcount = OHCI_NEEDED_IRQ_COMMANDS;
     526        }
     527
    494528        return EOK;
    495529}
Note: See TracChangeset for help on using the changeset viewer.