Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
[delete extra comma in function parameters -Mathias]
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Felipe Balbi and committed by
Greg Kroah-Hartman
2dc240a3 78140156

+33 -1
+33 -1
drivers/usb/host/xhci-rcar.c
··· 11 11 #include <linux/firmware.h> 12 12 #include <linux/module.h> 13 13 #include <linux/platform_device.h> 14 + #include <linux/of.h> 14 15 #include <linux/usb/phy.h> 15 16 16 17 #include "xhci.h" ··· 77 76 writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL); 78 77 } 79 78 79 + static int xhci_rcar_is_gen2(struct device *dev) 80 + { 81 + struct device_node *node = dev->of_node; 82 + 83 + return of_device_is_compatible(node, "renesas,xhci-r8a7790") || 84 + of_device_is_compatible(node, "renesas,xhci-r8a7791") || 85 + of_device_is_compatible(node, "renesas,xhci-r8a7793") || 86 + of_device_is_compatible(node, "renensas,rcar-gen2-xhci"); 87 + } 88 + 89 + static int xhci_rcar_is_gen3(struct device *dev) 90 + { 91 + struct device_node *node = dev->of_node; 92 + 93 + return of_device_is_compatible(node, "renesas,xhci-r8a7795") || 94 + of_device_is_compatible(node, "renesas,rcar-gen3-xhci"); 95 + } 96 + 80 97 void xhci_rcar_start(struct usb_hcd *hcd) 81 98 { 82 99 u32 temp; ··· 104 85 temp = readl(hcd->regs + RCAR_USB3_INT_ENA); 105 86 temp |= RCAR_USB3_INT_ENA_VAL; 106 87 writel(temp, hcd->regs + RCAR_USB3_INT_ENA); 107 - if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2)) 88 + if (xhci_rcar_is_gen2(hcd->self.controller)) 108 89 xhci_rcar_start_gen2(hcd); 109 90 } 110 91 } ··· 175 156 /* This function needs to initialize a "phy" of usb before */ 176 157 int xhci_rcar_init_quirk(struct usb_hcd *hcd) 177 158 { 159 + struct xhci_hcd *xhci = hcd_to_xhci(hcd); 160 + 178 161 /* If hcd->regs is NULL, we don't just call the following function */ 179 162 if (!hcd->regs) 180 163 return 0; 164 + 165 + /* 166 + * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set 167 + * to 1. However, these SoCs don't support 64-bit address memory 168 + * pointers. So, this driver clears the AC64 bit of xhci->hcc_params 169 + * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in 170 + * xhci_gen_setup(). 171 + */ 172 + if (xhci_rcar_is_gen2(hcd->self.controller) || 173 + xhci_rcar_is_gen3(hcd->self.controller)) 174 + xhci->quirks |= XHCI_NO_64BIT_SUPPORT; 181 175 182 176 return xhci_rcar_download_firmware(hcd); 183 177 }