Commit 306b89d3 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Greg Kroah-Hartman

usb: host: xhci: rcar: Add firmware_name selection by soc_device_match()

This patch adds firmware_name selection by soc_device_match() to
use other firmware name in the future. (For now, using the firmware
is the same as before.)
Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent feea4680
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/usb/phy.h> #include <linux/usb/phy.h>
#include <linux/sys_soc.h>
#include "xhci.h" #include "xhci.h"
#include "xhci-plat.h" #include "xhci-plat.h"
...@@ -67,6 +68,22 @@ MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V3); ...@@ -67,6 +68,22 @@ MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V3);
#define RCAR_USB3_RX_POL_VAL BIT(21) #define RCAR_USB3_RX_POL_VAL BIT(21)
#define RCAR_USB3_TX_POL_VAL BIT(4) #define RCAR_USB3_TX_POL_VAL BIT(4)
/* For soc_device_attribute */
#define RCAR_XHCI_FIRMWARE_V2 BIT(0) /* FIRMWARE V2 */
#define RCAR_XHCI_FIRMWARE_V3 BIT(1) /* FIRMWARE V3 */
static const struct soc_device_attribute rcar_quirks_match[] = {
{
.soc_id = "r8a7795", .revision = "ES1.*",
.data = (void *)RCAR_XHCI_FIRMWARE_V2,
},
{
.soc_id = "r8a7796",
.data = (void *)RCAR_XHCI_FIRMWARE_V3,
},
{ /* sentinel */ },
};
static void xhci_rcar_start_gen2(struct usb_hcd *hcd) static void xhci_rcar_start_gen2(struct usb_hcd *hcd)
{ {
/* LCLK Select */ /* LCLK Select */
...@@ -122,9 +139,23 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd) ...@@ -122,9 +139,23 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
int retval, index, j, time; int retval, index, j, time;
int timeout = 10000; int timeout = 10000;
u32 data, val, temp; u32 data, val, temp;
u32 quirks = 0;
const struct soc_device_attribute *attr;
const char *firmware_name;
attr = soc_device_match(rcar_quirks_match);
if (attr)
quirks = (uintptr_t)attr->data;
if (quirks & RCAR_XHCI_FIRMWARE_V2)
firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2;
else if (quirks & RCAR_XHCI_FIRMWARE_V3)
firmware_name = XHCI_RCAR_FIRMWARE_NAME_V3;
else
firmware_name = priv->firmware_name;
/* request R-Car USB3.0 firmware */ /* request R-Car USB3.0 firmware */
retval = request_firmware(&fw, priv->firmware_name, dev); retval = request_firmware(&fw, firmware_name, dev);
if (retval) if (retval)
return retval; return retval;
......
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