Commit b1c127ae authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

usb: host: xhci: plat: make use of new methods in xhci_plat_priv

Now that the code has been refactored enough,
switching over to using ->plat_start() and
->init_quirk() becomes a very simple patch.

After this patch, there are no further uses for
xhci_plat_type_is() which will be removed in a
follow-up patch.
Acked-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 72d4b284
...@@ -37,27 +37,32 @@ static const struct xhci_driver_overrides xhci_plat_overrides __initconst = { ...@@ -37,27 +37,32 @@ static const struct xhci_driver_overrides xhci_plat_overrides __initconst = {
.start = xhci_plat_start, .start = xhci_plat_start,
}; };
static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) static void xhci_priv_plat_start(struct usb_hcd *hcd)
{
struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
if (priv->plat_start)
priv->plat_start(hcd);
}
static int xhci_priv_init_quirk(struct usb_hcd *hcd)
{ {
struct usb_hcd *hcd = xhci_to_hcd(xhci); struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
if (!priv->init_quirk)
return 0;
return priv->init_quirk(hcd);
}
static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
{
/* /*
* As of now platform drivers don't provide MSI support so we ensure * As of now platform drivers don't provide MSI support so we ensure
* here that the generic code does not try to make a pci_dev from our * here that the generic code does not try to make a pci_dev from our
* dev struct in order to setup MSI * dev struct in order to setup MSI
*/ */
xhci->quirks |= XHCI_PLAT; xhci->quirks |= XHCI_PLAT;
/*
* On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set
* to 1. However, these SoCs don't support 64-bit address memory
* pointers. So, this driver clears the AC64 bit of xhci->hcc_params
* to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
* xhci_gen_setup().
*/
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
} }
/* called during probe() after chip reset completes */ /* called during probe() after chip reset completes */
...@@ -65,44 +70,38 @@ static int xhci_plat_setup(struct usb_hcd *hcd) ...@@ -65,44 +70,38 @@ static int xhci_plat_setup(struct usb_hcd *hcd)
{ {
int ret; int ret;
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) ||
xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) {
ret = xhci_rcar_init_quirk(hcd);
if (ret)
return ret;
}
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) { ret = xhci_priv_init_quirk(hcd);
ret = xhci_mvebu_mbus_init_quirk(hcd);
if (ret) if (ret)
return ret; return ret;
}
return xhci_gen_setup(hcd, xhci_plat_quirks); return xhci_gen_setup(hcd, xhci_plat_quirks);
} }
static int xhci_plat_start(struct usb_hcd *hcd) static int xhci_plat_start(struct usb_hcd *hcd)
{ {
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) || xhci_priv_plat_start(hcd);
xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3))
xhci_rcar_start(hcd);
return xhci_run(hcd); return xhci_run(hcd);
} }
#ifdef CONFIG_OF #ifdef CONFIG_OF
static const struct xhci_plat_priv xhci_plat_marvell_armada = { static const struct xhci_plat_priv xhci_plat_marvell_armada = {
.type = XHCI_PLAT_TYPE_MARVELL_ARMADA, .type = XHCI_PLAT_TYPE_MARVELL_ARMADA,
.init_quirk = xhci_mvebu_mbus_init_quirk,
}; };
static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = { static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2,
.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1, .firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1,
.init_quirk = xhci_rcar_init_quirk,
.plat_start = xhci_rcar_start,
}; };
static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
.type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3, .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3,
.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2, .firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
.init_quirk = xhci_rcar_init_quirk,
.plat_start = xhci_rcar_start,
}; };
static const struct of_device_id usb_xhci_of_match[] = { static const struct of_device_id usb_xhci_of_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment