Exemplo n.º 1
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;
}
Exemplo n.º 2
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;
}
Exemplo 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;
}
Exemplo n.º 4
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;
}