diff options
author | Howard Chen <howard.chen@linaro.org> | 2015-03-20 12:19:12 +0800 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2015-04-16 11:53:25 +0200 |
commit | 4bd2e40e95d5e91d6328750b910d69c9ffa19fed (patch) | |
tree | 6662187fc37c84be21faac2e5aa33bece6a97aba | |
parent | 4e4a041dd647a7d4267cc115b09a91d6dd6e8508 (diff) |
tmp/drivers_usb_host_xhci-plat.c.p1
-rw-r--r-- | drivers/usb/host/xhci-plat.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 08d402b15482..d859f64a4da1 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -22,6 +22,7 @@ #include "xhci.h" #include "xhci-mvebu.h" #include "xhci-rcar.h" +#include "xhci-mtk.h" static struct hc_driver __read_mostly xhci_plat_hc_driver; @@ -39,6 +40,7 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) static int xhci_plat_setup(struct usb_hcd *hcd) { struct device_node *of_node = hcd->self.controller->of_node; + struct xhci_hcd *xhci; int ret; if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") || @@ -48,7 +50,22 @@ static int xhci_plat_setup(struct usb_hcd *hcd) return ret; } - return xhci_gen_setup(hcd, xhci_plat_quirks); + ret = xhci_gen_setup(hcd, xhci_plat_quirks); + if (ret) + return ret; + + xhci = hcd_to_xhci(hcd); + if (!usb_hcd_is_primary_hcd(hcd)) + return 0; + + if (of_device_is_compatible(of_node, "mediatek,mt8173-xhci")) { + ret = xhci_mtk_init_quirk(xhci); + if (!ret) + return ret; + } + + kfree(hcd_to_xhci(hcd)); + return ret; } static int xhci_plat_start(struct usb_hcd *hcd) @@ -83,6 +100,9 @@ static int xhci_plat_probe(struct platform_device *pdev) if (irq < 0) return -ENODEV; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; if (of_device_is_compatible(pdev->dev.of_node, "marvell,armada-375-xhci") || @@ -106,16 +126,15 @@ static int xhci_plat_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto put_hcd; } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - /* * Not all platforms have a clk so it is not an error if the * clock does not exists. @@ -191,6 +210,8 @@ static int xhci_plat_remove(struct platform_device *dev) if (!IS_ERR(clk)) clk_disable_unprepare(clk); usb_put_hcd(hcd); + if (xhci->quirks & XHCI_MTK_HOST) + xhci_mtk_exit_quirk(xhci); kfree(xhci); return 0; @@ -237,6 +258,7 @@ static const struct of_device_id usb_xhci_of_match[] = { { .compatible = "marvell,armada-380-xhci"}, { .compatible = "renesas,xhci-r8a7790"}, { .compatible = "renesas,xhci-r8a7791"}, + { .compatible = "mediatek,mt8173-xhci"}, { }, }; MODULE_DEVICE_TABLE(of, usb_xhci_of_match); |