All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0
@ 2017-07-24 12:30 Yoshihiro Shimoda
  2017-07-24 12:30 ` [PATCH 1/3] usb: host: xhci: rcar: Add firmware_name selection by soc_device_match() Yoshihiro Shimoda
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-24 12:30 UTC (permalink / raw)
  To: mathias.nyman, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

This patch set is based on the latest Greg's usb.git / usb-next branch
(the commit id = 141769851cb73e8f986e9ed83129cde3b645288d)

Yoshihiro Shimoda (3):
  usb: host: xhci: rcar: Add firmware_name selection by
    soc_device_match()
  usb: host: xhci: plat: re-fact xhci_plat_priv for R-Car Gen3
  usb: host: xhci: rcar: Add support for R-Car H3 ES2.0

 drivers/usb/host/xhci-plat.c | 10 +---------
 drivers/usb/host/xhci-rcar.c | 40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 11 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] usb: host: xhci: rcar: Add firmware_name selection by soc_device_match()
  2017-07-24 12:30 [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0 Yoshihiro Shimoda
@ 2017-07-24 12:30 ` Yoshihiro Shimoda
  2017-07-24 12:30 ` [PATCH 2/3] usb: host: xhci: plat: re-fact xhci_plat_priv for R-Car Gen3 Yoshihiro Shimoda
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-24 12:30 UTC (permalink / raw)
  To: mathias.nyman, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

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: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/xhci-rcar.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 0727822..8f78d04 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -13,6 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/usb/phy.h>
+#include <linux/sys_soc.h>
 
 #include "xhci.h"
 #include "xhci-plat.h"
@@ -67,6 +68,22 @@
 #define RCAR_USB3_RX_POL_VAL	BIT(21)
 #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)
 {
 	/* LCLK Select */
@@ -122,9 +139,23 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
 	int retval, index, j, time;
 	int timeout = 10000;
 	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 */
-	retval = request_firmware(&fw, priv->firmware_name, dev);
+	retval = request_firmware(&fw, firmware_name, dev);
 	if (retval)
 		return retval;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] usb: host: xhci: plat: re-fact xhci_plat_priv for R-Car Gen3
  2017-07-24 12:30 [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0 Yoshihiro Shimoda
  2017-07-24 12:30 ` [PATCH 1/3] usb: host: xhci: rcar: Add firmware_name selection by soc_device_match() Yoshihiro Shimoda
@ 2017-07-24 12:30 ` Yoshihiro Shimoda
  2017-07-24 12:30 ` [PATCH 3/3] usb: host: xhci: rcar: Add support for R-Car H3 ES2.0 Yoshihiro Shimoda
  2017-08-10 11:07 ` [PATCH 0/3] usb: host: xhci: {plat,rcar}: add " Mathias Nyman
  3 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-24 12:30 UTC (permalink / raw)
  To: mathias.nyman, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

Since the firmware_name is decided by xhci-rcar.c on R-Car Gen3 now,
this patch removes 2 things:
 - Remove struct xhci_plat_priv xhci_plat_renesas_rcar_r8a7796.
 - Remoce .firmware_name from xhci_plat_renesas_rcar_gen3.

The bahavior is the same as before.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/xhci-plat.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c04144b..163bafd 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -107,14 +107,6 @@ static int xhci_plat_start(struct usb_hcd *hcd)
 };
 
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
-	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
-	.init_quirk = xhci_rcar_init_quirk,
-	.plat_start = xhci_rcar_start,
-	.resume_quirk = xhci_rcar_resume_quirk,
-};
-
-static const struct xhci_plat_priv xhci_plat_renesas_rcar_r8a7796 = {
-	.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V3,
 	.init_quirk = xhci_rcar_init_quirk,
 	.plat_start = xhci_rcar_start,
 	.resume_quirk = xhci_rcar_resume_quirk,
@@ -145,7 +137,7 @@ static int xhci_plat_start(struct usb_hcd *hcd)
 		.data = &xhci_plat_renesas_rcar_gen3,
 	}, {
 		.compatible = "renesas,xhci-r8a7796",
-		.data = &xhci_plat_renesas_rcar_r8a7796,
+		.data = &xhci_plat_renesas_rcar_gen3,
 	}, {
 		.compatible = "renesas,rcar-gen2-xhci",
 		.data = &xhci_plat_renesas_rcar_gen2,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] usb: host: xhci: rcar: Add support for R-Car H3 ES2.0
  2017-07-24 12:30 [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0 Yoshihiro Shimoda
  2017-07-24 12:30 ` [PATCH 1/3] usb: host: xhci: rcar: Add firmware_name selection by soc_device_match() Yoshihiro Shimoda
  2017-07-24 12:30 ` [PATCH 2/3] usb: host: xhci: plat: re-fact xhci_plat_priv for R-Car Gen3 Yoshihiro Shimoda
@ 2017-07-24 12:30 ` Yoshihiro Shimoda
  2017-08-10 11:07 ` [PATCH 0/3] usb: host: xhci: {plat,rcar}: add " Mathias Nyman
  3 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-24 12:30 UTC (permalink / raw)
  To: mathias.nyman, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

This patch adds support for R-Car H3 ES2.0. Since this SoC revision
(or later) should use the V3 firmware, the driver needs to check
the revision via soc_device_match().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/xhci-rcar.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 8f78d04..198bc18 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -20,7 +20,8 @@
 #include "xhci-rcar.h"
 
 /*
-* - The V3 firmware is for r8a7796 (with good performance).
+* - The V3 firmware is for r8a7796 (with good performance) and r8a7795 es2.0
+*   or later.
 * - The V2 firmware can be used on both r8a7795 (es1.x) and r8a7796.
 * - The V2 firmware is possible to use on R-Car Gen2. However, the V2 causes
 *   performance degradation. So, this driver continues to use the V1 if R-Car
@@ -78,6 +79,10 @@
 		.data = (void *)RCAR_XHCI_FIRMWARE_V2,
 	},
 	{
+		.soc_id = "r8a7795",
+		.data = (void *)RCAR_XHCI_FIRMWARE_V3,
+	},
+	{
 		.soc_id = "r8a7796",
 		.data = (void *)RCAR_XHCI_FIRMWARE_V3,
 	},
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0
  2017-07-24 12:30 [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0 Yoshihiro Shimoda
                   ` (2 preceding siblings ...)
  2017-07-24 12:30 ` [PATCH 3/3] usb: host: xhci: rcar: Add support for R-Car H3 ES2.0 Yoshihiro Shimoda
@ 2017-08-10 11:07 ` Mathias Nyman
  3 siblings, 0 replies; 5+ messages in thread
From: Mathias Nyman @ 2017-08-10 11:07 UTC (permalink / raw)
  To: Yoshihiro Shimoda, mathias.nyman, gregkh; +Cc: linux-usb, linux-renesas-soc

On 24.07.2017 15:30, Yoshihiro Shimoda wrote:
> This patch set is based on the latest Greg's usb.git / usb-next branch
> (the commit id = 141769851cb73e8f986e9ed83129cde3b645288d)
>
> Yoshihiro Shimoda (3):
>    usb: host: xhci: rcar: Add firmware_name selection by
>      soc_device_match()
>    usb: host: xhci: plat: re-fact xhci_plat_priv for R-Car Gen3
>    usb: host: xhci: rcar: Add support for R-Car H3 ES2.0
>
>   drivers/usb/host/xhci-plat.c | 10 +---------
>   drivers/usb/host/xhci-rcar.c | 40 ++++++++++++++++++++++++++++++++++++++--
>   2 files changed, 39 insertions(+), 11 deletions(-)
>

Thanks, adding

-Mathias

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-10 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 12:30 [PATCH 0/3] usb: host: xhci: {plat,rcar}: add support for R-Car H3 ES2.0 Yoshihiro Shimoda
2017-07-24 12:30 ` [PATCH 1/3] usb: host: xhci: rcar: Add firmware_name selection by soc_device_match() Yoshihiro Shimoda
2017-07-24 12:30 ` [PATCH 2/3] usb: host: xhci: plat: re-fact xhci_plat_priv for R-Car Gen3 Yoshihiro Shimoda
2017-07-24 12:30 ` [PATCH 3/3] usb: host: xhci: rcar: Add support for R-Car H3 ES2.0 Yoshihiro Shimoda
2017-08-10 11:07 ` [PATCH 0/3] usb: host: xhci: {plat,rcar}: add " Mathias Nyman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.