/*
 * Called when the ehci_hcd module is removed.
 */
static void ehci_stop (struct usb_hcd *hcd)
{
	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);

	ehci_dbg (ehci, "stop\n");

	/* no more interrupts ... */
	del_timer_sync (&ehci->watchdog);
	del_timer_sync(&ehci->iaa_watchdog);

	spin_lock_irq(&ehci->lock);
	if (HC_IS_RUNNING (hcd->state))
		ehci_quiesce (ehci);

	ehci_silence_controller(ehci);
	ehci_reset (ehci);
	spin_unlock_irq(&ehci->lock);

	remove_companion_file(ehci);
	remove_debug_files (ehci);

	/* root hub is shut down separately (first, when possible) */
	spin_lock_irq (&ehci->lock);
	if (ehci->async)
		ehci_work (ehci);
	spin_unlock_irq (&ehci->lock);
	ehci_mem_cleanup (ehci);

#ifdef	EHCI_STATS
	ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
		ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
		ehci->stats.lost_iaa);
	ehci_dbg (ehci, "complete %ld unlink %ld\n",
		ehci->stats.complete, ehci->stats.unlink);
#endif

	dbg_status (ehci, "ehci_stop completed",
		    ehci_readl(ehci, &ehci->regs->status));
}
Ejemplo n.º 2
0
/* remember to add cleanup code (above) if you add anything here */
static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
{
	int i;

	/* QTDs for control/bulk/intr transfers */
	ehci->qtd_pool = dma_pool_create ("ehci_qtd",
			ehci_to_hcd(ehci)->self.controller,
			sizeof (struct ehci_qtd),
			32 /* byte alignment (for hw parts) */,
			4096 /* can't cross 4K */);
	if (!ehci->qtd_pool) {
		goto fail;
	}

	/* QHs for control/bulk/intr transfers */
	ehci->qh_pool = dma_pool_create ("ehci_qh",
			ehci_to_hcd(ehci)->self.controller,
			sizeof(struct ehci_qh_hw),
			32 /* byte alignment (for hw parts) */,
			4096 /* can't cross 4K */);
	if (!ehci->qh_pool) {
		goto fail;
	}
	ehci->async = ehci_qh_alloc (ehci, flags);
	if (!ehci->async) {
		goto fail;
	}

	/* ITD for high speed ISO transfers */
	ehci->itd_pool = dma_pool_create ("ehci_itd",
			ehci_to_hcd(ehci)->self.controller,
			sizeof (struct ehci_itd),
			32 /* byte alignment (for hw parts) */,
			4096 /* can't cross 4K */);
	if (!ehci->itd_pool) {
		goto fail;
	}

	/* SITD for full/low speed split ISO transfers */
	ehci->sitd_pool = dma_pool_create ("ehci_sitd",
			ehci_to_hcd(ehci)->self.controller,
			sizeof (struct ehci_sitd),
			32 /* byte alignment (for hw parts) */,
			4096 /* can't cross 4K */);
	if (!ehci->sitd_pool) {
		goto fail;
	}

	/* Hardware periodic table */
	ehci->periodic = (__le32 *)
		dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller,
			ehci->periodic_size * sizeof(__le32),
			&ehci->periodic_dma, 0);
	if (ehci->periodic == NULL) {
		goto fail;
	}
	for (i = 0; i < ehci->periodic_size; i++)
		ehci->periodic [i] = EHCI_LIST_END(ehci);

	/* software shadow of hardware table */
	ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
	if (ehci->pshadow != NULL)
		return 0;

fail:
	ehci_dbg (ehci, "couldn't init memory\n");
	ehci_mem_cleanup (ehci);
	return -ENOMEM;
}
Ejemplo n.º 3
0
static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
{
	int i;

	
	ehci->qtd_pool = dma_pool_create ("ehci_qtd",
			ehci_to_hcd(ehci)->self.controller,
			sizeof (struct ehci_qtd),
			32 ,
			4096 );
	if (!ehci->qtd_pool) {
		goto fail;
	}

	
	ehci->qh_pool = dma_pool_create ("ehci_qh",
			ehci_to_hcd(ehci)->self.controller,
			sizeof(struct ehci_qh_hw),
			32 ,
			4096 );
	if (!ehci->qh_pool) {
		goto fail;
	}
	ehci->async = ehci_qh_alloc (ehci, flags);
	if (!ehci->async) {
		goto fail;
	}

	
	ehci->itd_pool = dma_pool_create ("ehci_itd",
			ehci_to_hcd(ehci)->self.controller,
			sizeof (struct ehci_itd),
			32 ,
			4096 );
	if (!ehci->itd_pool) {
		goto fail;
	}

	
	ehci->sitd_pool = dma_pool_create ("ehci_sitd",
			ehci_to_hcd(ehci)->self.controller,
			sizeof (struct ehci_sitd),
			32 ,
			4096 );
	if (!ehci->sitd_pool) {
		goto fail;
	}

	
	ehci->periodic = (__le32 *)
		dma_alloc_coherent (ehci_to_hcd(ehci)->self.controller,
			ehci->periodic_size * sizeof(__le32),
			&ehci->periodic_dma, 0);
	if (ehci->periodic == NULL) {
		goto fail;
	}

	if (ehci->use_dummy_qh) {
		struct ehci_qh_hw	*hw;
		ehci->dummy = ehci_qh_alloc(ehci, flags);
		if (!ehci->dummy)
			goto fail;

		hw = ehci->dummy->hw;
		hw->hw_next = EHCI_LIST_END(ehci);
		hw->hw_qtd_next = EHCI_LIST_END(ehci);
		hw->hw_alt_next = EHCI_LIST_END(ehci);
		hw->hw_token &= ~QTD_STS_ACTIVE;
		ehci->dummy->hw = hw;

		for (i = 0; i < ehci->periodic_size; i++)
			ehci->periodic[i] = ehci->dummy->qh_dma;
	} else {
		for (i = 0; i < ehci->periodic_size; i++)
			ehci->periodic[i] = EHCI_LIST_END(ehci);
	}

	
	ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
	if (ehci->pshadow != NULL)
		return 0;

fail:
	ehci_dbg (ehci, "couldn't init memory\n");
	ehci_mem_cleanup (ehci);
	return -ENOMEM;
}
Ejemplo n.º 4
0
/* remember to add cleanup code (above) if you add anything here */
static int ehci_mem_init (struct ehci_hcd *ehci, int flags)
{
    int i;

#if 0
    /* QTDs for control/bulk/intr transfers */
    ehci->qtd_pool = pci_pool_create ("ehci_qtd", ehci->hcd.pdev,
                                      sizeof (struct ehci_qtd),
                                      32 /* byte alignment (for hw parts) */,
                                      4096 /* can't cross 4K */,
                                      flags);
    if (!ehci->qtd_pool) {
        goto fail;
    }

    /* QHs for control/bulk/intr transfers */
    ehci->qh_pool = pci_pool_create ("ehci_qh", ehci->hcd.pdev,
                                     sizeof (struct ehci_qh),
                                     32 /* byte alignment (for hw parts) */,
                                     4096 /* can't cross 4K */,
                                     flags);
    if (!ehci->qh_pool) {
        goto fail;
    }
#endif
    ehci->async = ehci_qh_alloc (ehci, flags);
    if (!ehci->async) {
        goto fail;
    }

#if 0
    /* ITD for high speed ISO transfers */
    ehci->itd_pool = pci_pool_create ("ehci_itd", ehci->hcd.pdev,
                                      sizeof (struct ehci_itd),
                                      32 /* byte alignment (for hw parts) */,
                                      4096 /* can't cross 4K */,
                                      flags);
    if (!ehci->itd_pool) {
        goto fail;
    }

    /* SITD for full/low speed split ISO transfers */
    ehci->sitd_pool = pci_pool_create ("ehci_sitd", ehci->hcd.pdev,
                                       sizeof (struct ehci_sitd),
                                       32 /* byte alignment (for hw parts) */,
                                       4096 /* can't cross 4K */,
                                       flags);
    if (!ehci->sitd_pool) {
        goto fail;
    }
#endif

    /* Hardware periodic table */
#if 0
    ehci->periodic = (u32 *)
                     pci_alloc_consistent (ehci->hcd.pdev,
                                           ehci->periodic_size * sizeof (u32),
                                           &ehci->periodic_dma);
#endif
    ehci->periodic_real = kmalloc( PAGE_SIZE + ehci->periodic_size * sizeof (u32), MEMF_KERNEL );
    ehci->periodic = (u32*)PAGE_ALIGN( (uint32)ehci->periodic_real );
    if (ehci->periodic == 0) {
        goto fail;
    }
    for (i = 0; i < ehci->periodic_size; i++)
        ehci->periodic [i] = EHCI_LIST_END;

    /* software shadow of hardware table */
    ehci->pshadow = kmalloc (ehci->periodic_size * sizeof (void *), flags);
    if (ehci->pshadow == 0) {
        goto fail;
    }
    memset (ehci->pshadow, 0, ehci->periodic_size * sizeof (void *));

    return 0;

fail:
    ehci_dbg (ehci, "couldn't init memory\n");
    ehci_mem_cleanup (ehci);
    return -ENOMEM;
}
Ejemplo n.º 5
0
/* remember to add cleanup code (above) if you add anything here */
static int ehci_mem_init(struct ehci_hcd *ehci, gfp_t flags)
{
	int i;
	g_usb_pool_count = 0;
	g_debug_qtd_allocated = 0;
	g_debug_qH_allocated = 0;
	g_alloc_map = 0;

	if (cpu_is_mx37())
		use_iram_qtd = 0;
	else
		use_iram_qtd = 1;

	usb_pool_initialize(USB_IRAM_BASE_ADDR + IRAM_TD_SIZE * IRAM_NTD * 2,
			    USB_IRAM_SIZE - IRAM_TD_SIZE * IRAM_NTD * 2, 32);

	if (!ehci->iram_buffer[0]) {
		ehci->iram_buffer[0] = alloc_iram_buf();
		ehci->iram_buffer_v[0] = IO_ADDRESS(ehci->iram_buffer[0]);
		ehci->iram_buffer[1] = alloc_iram_buf();
		ehci->iram_buffer_v[1] = IO_ADDRESS(ehci->iram_buffer[1]);
	}

	/* QTDs for control/bulk/intr transfers */
	ehci->qtd_pool = dma_pool_create("ehci_qtd",
					ehci_to_hcd(ehci)->self.controller,
					sizeof(struct ehci_qtd),
					32/* byte alignment (for hw parts) */
					 , 4096 /* can't cross 4K */);
	if (!ehci->qtd_pool)
		goto fail;

	/* QHs for control/bulk/intr transfers */
	ehci->qh_pool = dma_pool_create("ehci_qh",
					ehci_to_hcd(ehci)->self.controller,
					sizeof(struct ehci_qh),
					32 /* byte alignment (for hw parts) */ ,
					4096 /* can't cross 4K */);
	if (!ehci->qh_pool)
		goto fail;

	ehci->async = ehci_qh_alloc(ehci, flags);
	if (!ehci->async)
		goto fail;

	/* ITD for high speed ISO transfers */
	ehci->itd_pool = dma_pool_create("ehci_itd",
					ehci_to_hcd(ehci)->self.controller,
					sizeof(struct ehci_itd),
					32/* byte alignment (for hw parts) */
					 , 4096 /* can't cross 4K */);
	if (!ehci->itd_pool)
		goto fail;

	/* SITD for full/low speed split ISO transfers */
	ehci->sitd_pool = dma_pool_create("ehci_sitd",
					ehci_to_hcd(ehci)->self.controller,
					sizeof(struct ehci_sitd),
					32/* byte alignment (for hw parts) */
					  , 4096 /* can't cross 4K */);
	if (!ehci->sitd_pool)
		goto fail;

	ehci->periodic = (__le32 *)
	    dma_alloc_coherent(ehci_to_hcd(ehci)->self.controller,
			       ehci->periodic_size * sizeof(__le32),
			       &ehci->periodic_dma, 0);

	if (ehci->periodic == NULL)
		goto fail;

	for (i = 0; i < ehci->periodic_size; i++)
		ehci->periodic[i] = EHCI_LIST_END(ehci);

	/* software shadow of hardware table */
	ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
	if (ehci->pshadow != NULL)
		return 0;

fail:
	ehci_dbg(ehci, "couldn't init memory\n");
	ehci_mem_cleanup(ehci);
	return -ENOMEM;
}