Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bf9d9d6 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Greg Kroah-Hartman
Browse files

usb: host: xhci-rcar: Change code for new SoCs



This patch changes code to ease the addition of next generation SoCs.

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 e93272fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -76,6 +76,7 @@ static const struct xhci_plat_priv xhci_plat_marvell_armada = {


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,
};
};


static const struct of_device_id usb_xhci_of_match[] = {
static const struct of_device_id usb_xhci_of_match[] = {
+23 −14
Original line number Original line Diff line number Diff line
@@ -14,10 +14,10 @@
#include <linux/usb/phy.h>
#include <linux/usb/phy.h>


#include "xhci.h"
#include "xhci.h"
#include "xhci-plat.h"
#include "xhci-rcar.h"
#include "xhci-rcar.h"


#define FIRMWARE_NAME		"r8a779x_usb3_v1.dlmem"
MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V1);
MODULE_FIRMWARE(FIRMWARE_NAME);


/*** Register Offset ***/
/*** Register Offset ***/
#define RCAR_USB3_INT_ENA	0x224	/* Interrupt Enable */
#define RCAR_USB3_INT_ENA	0x224	/* Interrupt Enable */
@@ -56,15 +56,8 @@ MODULE_FIRMWARE(FIRMWARE_NAME);
#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)


void xhci_rcar_start(struct usb_hcd *hcd)
static void xhci_rcar_start_gen2(struct usb_hcd *hcd)
{
{
	u32 temp;

	if (hcd->regs != NULL) {
		/* Interrupt Enable */
		temp = readl(hcd->regs + RCAR_USB3_INT_ENA);
		temp |= RCAR_USB3_INT_ENA_VAL;
		writel(temp, hcd->regs + RCAR_USB3_INT_ENA);
	/* LCLK Select */
	/* LCLK Select */
	writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK);
	writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK);
	/* USB3.0 Configuration */
	/* USB3.0 Configuration */
@@ -75,17 +68,33 @@ void xhci_rcar_start(struct usb_hcd *hcd)
	writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL);
	writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL);
	writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL);
	writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL);
}
}

void xhci_rcar_start(struct usb_hcd *hcd)
{
	u32 temp;

	if (hcd->regs != NULL) {
		/* Interrupt Enable */
		temp = readl(hcd->regs + RCAR_USB3_INT_ENA);
		temp |= RCAR_USB3_INT_ENA_VAL;
		writel(temp, hcd->regs + RCAR_USB3_INT_ENA);
		if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2))
			xhci_rcar_start_gen2(hcd);
	}
}
}


static int xhci_rcar_download_firmware(struct device *dev, void __iomem *regs)
static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
{
{
	struct device *dev = hcd->self.controller;
	void __iomem *regs = hcd->regs;
	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
	const struct firmware *fw;
	const struct firmware *fw;
	int retval, index, j, time;
	int retval, index, j, time;
	int timeout = 10000;
	int timeout = 10000;
	u32 data, val, temp;
	u32 data, val, temp;


	/* request R-Car USB3.0 firmware */
	/* request R-Car USB3.0 firmware */
	retval = request_firmware(&fw, FIRMWARE_NAME, dev);
	retval = request_firmware(&fw, priv->firmware_name, dev);
	if (retval)
	if (retval)
		return retval;
		return retval;


@@ -144,5 +153,5 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd)
	if (!hcd->regs)
	if (!hcd->regs)
		return 0;
		return 0;


	return xhci_rcar_download_firmware(hcd->self.controller, hcd->regs);
	return xhci_rcar_download_firmware(hcd);
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,8 @@
#ifndef _XHCI_RCAR_H
#ifndef _XHCI_RCAR_H
#define _XHCI_RCAR_H
#define _XHCI_RCAR_H


#define XHCI_RCAR_FIRMWARE_NAME_V1	"r8a779x_usb3_v1.dlmem"

#if IS_ENABLED(CONFIG_USB_XHCI_RCAR)
#if IS_ENABLED(CONFIG_USB_XHCI_RCAR)
void xhci_rcar_start(struct usb_hcd *hcd);
void xhci_rcar_start(struct usb_hcd *hcd);
int xhci_rcar_init_quirk(struct usb_hcd *hcd);
int xhci_rcar_init_quirk(struct usb_hcd *hcd);