Skip to content

Commit 2dc240a

Browse files
Felipe Balbigregkh
authored andcommitted
usb: host: xhci: rcar: retire use of xhci_plat_type_is()
We're preparing to remove xhci_plat_type_is() in favor of a better approach where we define function pointers ahead of time. This will let us make assumptions about which platforms we're running on and which platform-specific functions we should call. Acked-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> [delete extra comma in function parameters -Mathias] Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7814015 commit 2dc240a

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

drivers/usb/host/xhci-rcar.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/firmware.h>
1212
#include <linux/module.h>
1313
#include <linux/platform_device.h>
14+
#include <linux/of.h>
1415
#include <linux/usb/phy.h>
1516

1617
#include "xhci.h"
@@ -76,6 +77,24 @@ static void xhci_rcar_start_gen2(struct usb_hcd *hcd)
7677
writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL);
7778
}
7879

80+
static int xhci_rcar_is_gen2(struct device *dev)
81+
{
82+
struct device_node *node = dev->of_node;
83+
84+
return of_device_is_compatible(node, "renesas,xhci-r8a7790") ||
85+
of_device_is_compatible(node, "renesas,xhci-r8a7791") ||
86+
of_device_is_compatible(node, "renesas,xhci-r8a7793") ||
87+
of_device_is_compatible(node, "renensas,rcar-gen2-xhci");
88+
}
89+
90+
static int xhci_rcar_is_gen3(struct device *dev)
91+
{
92+
struct device_node *node = dev->of_node;
93+
94+
return of_device_is_compatible(node, "renesas,xhci-r8a7795") ||
95+
of_device_is_compatible(node, "renesas,rcar-gen3-xhci");
96+
}
97+
7998
void xhci_rcar_start(struct usb_hcd *hcd)
8099
{
81100
u32 temp;
@@ -85,7 +104,7 @@ void xhci_rcar_start(struct usb_hcd *hcd)
85104
temp = readl(hcd->regs + RCAR_USB3_INT_ENA);
86105
temp |= RCAR_USB3_INT_ENA_VAL;
87106
writel(temp, hcd->regs + RCAR_USB3_INT_ENA);
88-
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2))
107+
if (xhci_rcar_is_gen2(hcd->self.controller))
89108
xhci_rcar_start_gen2(hcd);
90109
}
91110
}
@@ -156,9 +175,22 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
156175
/* This function needs to initialize a "phy" of usb before */
157176
int xhci_rcar_init_quirk(struct usb_hcd *hcd)
158177
{
178+
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
179+
159180
/* If hcd->regs is NULL, we don't just call the following function */
160181
if (!hcd->regs)
161182
return 0;
162183

184+
/*
185+
* On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set
186+
* to 1. However, these SoCs don't support 64-bit address memory
187+
* pointers. So, this driver clears the AC64 bit of xhci->hcc_params
188+
* to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
189+
* xhci_gen_setup().
190+
*/
191+
if (xhci_rcar_is_gen2(hcd->self.controller) ||
192+
xhci_rcar_is_gen3(hcd->self.controller))
193+
xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
194+
163195
return xhci_rcar_download_firmware(hcd);
164196
}

0 commit comments

Comments
 (0)