aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-plat.c
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2015-11-24 13:09:49 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-01 10:45:51 -0800
commit4efb2f69411456d35051e9047c15157c9a5ba217 (patch)
tree9e35c337e3c18d7a788c91bbb678cf68619b3c05 /drivers/usb/host/xhci-plat.c
parentusb: host: xhci: add a platform-private field (diff)
downloadlinux-dev-4efb2f69411456d35051e9047c15157c9a5ba217.tar.xz
linux-dev-4efb2f69411456d35051e9047c15157c9a5ba217.zip
usb: host: xhci-plat: add struct xhci_plat_priv
This patch adds struct xhci_plat_priv to simplify the code to match platform specific variables. For now, this patch adds a member "type" in the structure. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-plat.c')
-rw-r--r--drivers/usb/host/xhci-plat.c73
1 files changed, 48 insertions, 25 deletions
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 4699c1e223d5..083e77bc80ae 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -22,6 +22,7 @@
#include <linux/acpi.h>
#include "xhci.h"
+#include "xhci-plat.h"
#include "xhci-mvebu.h"
#include "xhci-rcar.h"
@@ -31,6 +32,7 @@ static int xhci_plat_setup(struct usb_hcd *hcd);
static int xhci_plat_start(struct usb_hcd *hcd);
static const struct xhci_driver_overrides xhci_plat_overrides __initconst = {
+ .extra_priv_size = sizeof(struct xhci_plat_priv),
.reset = xhci_plat_setup,
.start = xhci_plat_start,
};
@@ -48,11 +50,9 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
/* called during probe() after chip reset completes */
static int xhci_plat_setup(struct usb_hcd *hcd)
{
- struct device_node *of_node = hcd->self.controller->of_node;
int ret;
- if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") ||
- of_device_is_compatible(of_node, "renesas,xhci-r8a7791")) {
+ if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2)) {
ret = xhci_rcar_init_quirk(hcd);
if (ret)
return ret;
@@ -63,19 +63,49 @@ static int xhci_plat_setup(struct usb_hcd *hcd)
static int xhci_plat_start(struct usb_hcd *hcd)
{
- struct device_node *of_node = hcd->self.controller->of_node;
-
- if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") ||
- of_device_is_compatible(of_node, "renesas,xhci-r8a7791"))
+ if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2))
xhci_rcar_start(hcd);
return xhci_run(hcd);
}
+#ifdef CONFIG_OF
+static const struct xhci_plat_priv xhci_plat_marvell_armada = {
+ .type = XHCI_PLAT_TYPE_MARVELL_ARMADA,
+};
+
+static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
+ .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
+};
+
+static const struct of_device_id usb_xhci_of_match[] = {
+ {
+ .compatible = "generic-xhci",
+ }, {
+ .compatible = "xhci-platform",
+ }, {
+ .compatible = "marvell,armada-375-xhci",
+ .data = &xhci_plat_marvell_armada,
+ }, {
+ .compatible = "marvell,armada-380-xhci",
+ .data = &xhci_plat_marvell_armada,
+ }, {
+ .compatible = "renesas,xhci-r8a7790",
+ .data = &xhci_plat_renesas_rcar_gen2,
+ }, {
+ .compatible = "renesas,xhci-r8a7791",
+ .data = &xhci_plat_renesas_rcar_gen2,
+ }, {
+ },
+};
+MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
+#endif
+
static int xhci_plat_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
+ const struct of_device_id *match;
const struct hc_driver *driver;
struct xhci_hcd *xhci;
struct resource *res;
@@ -133,10 +163,17 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_hcd;
}
- if (of_device_is_compatible(pdev->dev.of_node,
- "marvell,armada-375-xhci") ||
- of_device_is_compatible(pdev->dev.of_node,
- "marvell,armada-380-xhci")) {
+ xhci = hcd_to_xhci(hcd);
+ match = of_match_node(usb_xhci_of_match, node);
+ if (match) {
+ const struct xhci_plat_priv *priv_match = match->data;
+ struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
+ /* Just copy data for now */
+ *priv = *priv_match;
+ }
+
+ if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) {
ret = xhci_mvebu_mbus_init_quirk(pdev);
if (ret)
goto disable_clk;
@@ -144,7 +181,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
device_wakeup_enable(hcd->self.controller);
- xhci = hcd_to_xhci(hcd);
xhci->clk = clk;
xhci->main_hcd = hcd;
xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev,
@@ -255,19 +291,6 @@ static const struct dev_pm_ops xhci_plat_pm_ops = {
#define DEV_PM_OPS NULL
#endif /* CONFIG_PM */
-#ifdef CONFIG_OF
-static const struct of_device_id usb_xhci_of_match[] = {
- { .compatible = "generic-xhci" },
- { .compatible = "xhci-platform" },
- { .compatible = "marvell,armada-375-xhci"},
- { .compatible = "marvell,armada-380-xhci"},
- { .compatible = "renesas,xhci-r8a7790"},
- { .compatible = "renesas,xhci-r8a7791"},
- { },
-};
-MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
-#endif
-
static const struct acpi_device_id usb_xhci_acpi_match[] = {
/* XHCI-compliant USB Controller */
{ "PNP0D10", },