*/
#include <common.h>
+#include <log.h>
#include <usb.h>
#include <linux/errno.h>
#include <linux/compat.h>
#include <linux/usb/xhci-fsl.h>
#include <linux/usb/dwc3.h>
-#include "xhci.h"
+#include <usb/xhci.h>
#include <fsl_errata.h>
#include <fsl_usb.h>
#include <dm.h>
/* Declare global data pointer */
-#ifndef CONFIG_DM_USB
-static struct fsl_xhci fsl_xhci;
-unsigned long ctr_addr[] = FSL_USB_XHCI_ADDR;
-#else
struct xhci_fsl_priv {
struct xhci_ctrl xhci;
fdt_addr_t hcd_base;
struct fsl_xhci ctx;
};
-#endif
__weak int __board_usb_init(int index, enum usb_init_type init)
{
return 0;
}
-#ifdef CONFIG_DM_USB
static int xhci_fsl_probe(struct udevice *dev)
{
struct xhci_fsl_priv *priv = dev_get_priv(dev);
/*
* Get the base address for XHCI controller from the device node
*/
- priv->hcd_base = devfdt_get_addr(dev);
+ priv->hcd_base = dev_read_addr(dev);
if (priv->hcd_base == FDT_ADDR_T_NONE) {
debug("Can't get the XHCI register base address\n");
return -ENXIO;
static const struct udevice_id xhci_usb_ids[] = {
{ .compatible = "fsl,layerscape-dwc3", },
+ { .compatible = "fsl,ls1028a-dwc3", },
{ }
};
.probe = xhci_fsl_probe,
.remove = xhci_fsl_remove,
.ops = &xhci_usb_ops,
- .platdata_auto_alloc_size = sizeof(struct usb_platdata),
- .priv_auto_alloc_size = sizeof(struct xhci_fsl_priv),
+ .plat_auto = sizeof(struct usb_plat),
+ .priv_auto = sizeof(struct xhci_fsl_priv),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
-#else
-int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor)
-{
- struct fsl_xhci *ctx = &fsl_xhci;
- int ret = 0;
-
- ctx->hcd = (struct xhci_hccr *)ctr_addr[index];
- ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET);
-
- ret = board_usb_init(index, USB_INIT_HOST);
- if (ret != 0) {
- puts("Failed to initialize board for USB\n");
- return ret;
- }
-
- fsl_apply_xhci_errata();
-
- ret = fsl_xhci_core_init(ctx);
- if (ret < 0) {
- puts("Failed to initialize xhci\n");
- return ret;
- }
-
- *hccr = (struct xhci_hccr *)ctx->hcd;
- *hcor = (struct xhci_hcor *)((uintptr_t) *hccr
- + HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)));
-
- debug("fsl-xhci: init hccr %lx and hcor %lx hc_length %lx\n",
- (uintptr_t)*hccr, (uintptr_t)*hcor,
- (uintptr_t)HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)));
-
- return ret;
-}
-
-void xhci_hcd_stop(int index)
-{
- struct fsl_xhci *ctx = &fsl_xhci;
-
- fsl_xhci_core_exit(ctx);
-}
-#endif