USB ehci: Add platform specific init calls
Some USB cores need a platform specific init hook, add it to the ehci driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
cefcb0c281
commit
80a4c202dd
|
@ -42,6 +42,10 @@ struct ehci_priv {
|
||||||
struct qTD *td;
|
struct qTD *td;
|
||||||
int portreset;
|
int portreset;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
int (*init)(void *drvdata);
|
||||||
|
int (*post_init)(void *drvdata);
|
||||||
|
void *drvdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define to_ehci(ptr) container_of(ptr, struct ehci_priv, host)
|
#define to_ehci(ptr) container_of(ptr, struct ehci_priv, host)
|
||||||
|
@ -748,6 +752,9 @@ static int ehci_init(struct usb_host *host)
|
||||||
if (ehci_reset(ehci) != 0)
|
if (ehci_reset(ehci) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (ehci->init)
|
||||||
|
ehci->init(ehci->drvdata);
|
||||||
|
|
||||||
ehci->qh_list->qh_link = cpu_to_hc32((uint32_t)ehci->qh_list | QH_LINK_TYPE_QH);
|
ehci->qh_list->qh_link = cpu_to_hc32((uint32_t)ehci->qh_list | QH_LINK_TYPE_QH);
|
||||||
ehci->qh_list->qh_endpt1 = cpu_to_hc32((1 << 15) | (USB_SPEED_HIGH << 12));
|
ehci->qh_list->qh_endpt1 = cpu_to_hc32((1 << 15) | (USB_SPEED_HIGH << 12));
|
||||||
ehci->qh_list->qh_curtd = cpu_to_hc32(QT_NEXT_TERMINATE);
|
ehci->qh_list->qh_curtd = cpu_to_hc32(QT_NEXT_TERMINATE);
|
||||||
|
@ -788,6 +795,9 @@ static int ehci_init(struct usb_host *host)
|
||||||
|
|
||||||
ehci->rootdev = 0;
|
ehci->rootdev = 0;
|
||||||
|
|
||||||
|
if (ehci->post_init)
|
||||||
|
ehci->post_init(ehci->drvdata);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -856,6 +866,10 @@ int ehci_register(struct device_d *dev, struct ehci_data *data)
|
||||||
ehci->hcor = (void __iomem *)ehci->hccr +
|
ehci->hcor = (void __iomem *)ehci->hccr +
|
||||||
HC_LENGTH(ehci_readl(&ehci->hccr->cr_capbase));
|
HC_LENGTH(ehci_readl(&ehci->hccr->cr_capbase));
|
||||||
|
|
||||||
|
ehci->drvdata = data->drvdata;
|
||||||
|
ehci->init = data->init;
|
||||||
|
ehci->post_init = data->post_init;
|
||||||
|
|
||||||
ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_TD);
|
ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_TD);
|
||||||
ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD);
|
ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,11 @@ struct ehci_data {
|
||||||
void __iomem *hccr;
|
void __iomem *hccr;
|
||||||
void __iomem *hcor;
|
void __iomem *hcor;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
/* platform specific init functions */
|
||||||
|
int (*init)(void *drvdata);
|
||||||
|
int (*post_init)(void *drvdata);
|
||||||
|
void *drvdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_USB_EHCI
|
#ifdef CONFIG_USB_EHCI
|
||||||
|
|
Loading…
Reference in New Issue