From patchwork Tue Oct 27 01:18:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 7492941 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1B3D3BEEA4 for ; Tue, 27 Oct 2015 01:19:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A065208EB for ; Tue, 27 Oct 2015 01:19:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB3C4208E7 for ; Tue, 27 Oct 2015 01:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752708AbbJ0BTJ (ORCPT ); Mon, 26 Oct 2015 21:19:09 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:37137 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752648AbbJ0BTH (ORCPT ); Mon, 26 Oct 2015 21:19:07 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 27 Oct 2015 10:19:06 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 4DC363E76C; Tue, 27 Oct 2015 10:19:06 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 43C0E8002E; Tue, 27 Oct 2015 10:19:06 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 321D98002D; Tue, 27 Oct 2015 10:19:06 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id LAT01464; Tue, 27 Oct 2015 10:19:06 +0900 X-IronPort-AV: E=Sophos;i="5.20,202,1444662000"; d="scan'";a="198488532" Received: from mail-sg2apc01lp0246.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.246]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 27 Oct 2015 10:19:04 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by SIXPR06MB0924.apcprd06.prod.outlook.com (10.162.180.29) with Microsoft SMTP Server (TLS) id 15.1.306.13; Tue, 27 Oct 2015 01:19:03 +0000 From: Yoshihiro Shimoda To: , , , , , , CC: , , Yoshihiro Shimoda Subject: [PATCH v4 5/7] usb: host: xhci-rcar: Change code for new SoCs Date: Tue, 27 Oct 2015 10:18:28 +0900 Message-ID: <1445908710-5812-6-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1445908710-5812-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1445908710-5812-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0014.jpnprd01.prod.outlook.com (25.161.225.152) To SIXPR06MB0924.apcprd06.prod.outlook.com (25.162.180.29) X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB0924; 2:u0JhnCmGevPLCFdPsTkLDAbEZEXN3ss+nOpKclI930C6tWRWtJOgZlBCA7zQEl78BuN3FArAwc3ZNjulkZEizUt11LiIvNqYVqTEUe+gtksHGS1Jfmw9hBQUQBth9dIHw4jYh0Sjq5/Zi8nlRawYf/2y7bETaDqM7yi7L6cd2hc=; 3:YASShfVuKht+mYyTOyYbvvHNZ+4NnwXmL9RpLocbHffWUug9zuCzgL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4BTIGxnKnI/rG5FXnQvUyHO/IG8tTYE+fjAcT0zarmOX2SH9TPTlddEZstdnNOfPVO+hgxGIpZxuHQ3z9IaGO10EdaQTHlBBr2xgRFuJHCc7ieklblYZRwsvho2Y96JJGRbxc2HaU3Sx05ph+ZHA+QIp4l2Zc6NEtIDqAk7kbw/kRgof5jCbtywiN0oIwmbEL2lJZQzY72fEn2gAXjVIQu4uDzSanJj6RTFDs2rrnNo3RTGFoNsnISkTPyGdmE8OU6GtK72W/ylqnDlf9tghDQX7cbvX+IgqPBZor9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(102215026); SRVR:SIXPR06MB0924; BCL:0; PCL:0; RULEID:; SRVR:SIXPR06MB0924; X-Forefront-PRVS: 0742443479 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6029001)(6069001)(6009001)(199003)(189002)(2950100001)(229853001)(5003940100001)(66066001)(19580405001)(47776003)(97736004)(5001920100001)(48376002)(42382002)(5001770100001)(107886002)(189998001)(42186005)(5001960100002)(106356001)(76506005)(33646002)(105586002)(50226001)(50466002)(78352002)(92566002)(575784001)(101416001)(87976001)(19580395003)(81156007)(76176999)(50986999)(77096005)(40100003)(36756003)(122386002)(5004730100002)(5007970100001)(5008740100001)(4001430100002); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB0924; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SIXPR06MB0924; 23:pH7rc7LMeeolAv+PGoFpX/NA5Ni77n64SyvyetBE1?= =?us-ascii?Q?zvSOBTMSSv59ieamTSTp7MukjFB7D3KQpzcRrFFdWKhZ8bmNnJbew7mcKkZF?= =?us-ascii?Q?GClyTBShwj4HUo+MK1tupp3HlA7kuHOIHvZDVT2Z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okpWSLHcJCzFBxp+RGWrJ/XPQuERo+b9ZqTMRS6RhAWbpT+KerNf+C7?= =?us-ascii?Q?YCbJnrH63M3PHQXwHioOKPyd+s70GkLi+fC3ybbTr+joit9T9i7qleQsRf3m?= =?us-ascii?Q?2LhewfIRhxCUarS0RVD9c07ukoL5F0ORLfM5pImwm7/8pxfZe04zxnR/RELL?= =?us-ascii?Q?WekoC3GBuS+rhU=3D?= X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB0924; 5:OQG9i5a2vkjtSHIJzTzAtZ8bAxNFGkelD/SK6R4/RJQ1+1pZyc3BGc0syBN2AnUfEzFeATNAChRMCDXnRT15O+U2WYkp0toyAFW4Nl+fjMy42AsiMOwE43Krjlh2luWSjoFVT4Y5ZXOPaAcYOH3UBA==; 24:67gGPHweaj5RRi8+wDStJa0l0bx7GiODt7K2VOkJQWysr/ljcleKprY68S+AtV/CwEY3J/nSDzSAAFlJe6ACKRQE6qsnAvtV+yxk5aql6lY=; 20:OYO2UhZ0snLQz/zxDPUG13ndvqTxVmRGAwA96XUn4gjSHCIcssSqXX3FBGzWXVGJT58SFeTn4XJAbWLJXW3MGH5Xk2JM2cRVJRsAIIILcueAI/jdJmEgcJUUf5RjN078hJx6CfO31ExeBTmVg1GdToU1W2erCbMoa12Vy5fsy9Y= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2015 01:19:03.2656 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB0924 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-4.9 required=5.0 tests=AXB_X_OUTLOOKPROT_ENVSDR, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch changes code to ease the addition of next generation SoCs. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/host/xhci-plat.c | 1 + drivers/usb/host/xhci-rcar.c | 37 +++++++++++++++++++++++-------------- drivers/usb/host/xhci-rcar.h | 2 ++ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 083e77b..a471f12 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -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 = { .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, + .firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1, }; static const struct of_device_id usb_xhci_of_match[] = { diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index ff0d1b4..010a24f 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -14,10 +14,10 @@ #include #include "xhci.h" +#include "xhci-plat.h" #include "xhci-rcar.h" -#define FIRMWARE_NAME "r8a779x_usb3_v1.dlmem" -MODULE_FIRMWARE(FIRMWARE_NAME); +MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V1); /*** Register Offset ***/ #define RCAR_USB3_INT_ENA 0x224 /* Interrupt Enable */ @@ -56,6 +56,19 @@ MODULE_FIRMWARE(FIRMWARE_NAME); #define RCAR_USB3_RX_POL_VAL BIT(21) #define RCAR_USB3_TX_POL_VAL BIT(4) +static void xhci_rcar_start_gen2(struct usb_hcd *hcd) +{ + /* LCLK Select */ + writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK); + /* USB3.0 Configuration */ + writel(RCAR_USB3_CONF1_VAL, hcd->regs + RCAR_USB3_CONF1); + writel(RCAR_USB3_CONF2_VAL, hcd->regs + RCAR_USB3_CONF2); + writel(RCAR_USB3_CONF3_VAL, hcd->regs + RCAR_USB3_CONF3); + /* USB3.0 Polarity */ + writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL); + writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL); +} + void xhci_rcar_start(struct usb_hcd *hcd) { u32 temp; @@ -65,27 +78,23 @@ void xhci_rcar_start(struct usb_hcd *hcd) temp = readl(hcd->regs + RCAR_USB3_INT_ENA); temp |= RCAR_USB3_INT_ENA_VAL; writel(temp, hcd->regs + RCAR_USB3_INT_ENA); - /* LCLK Select */ - writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK); - /* USB3.0 Configuration */ - writel(RCAR_USB3_CONF1_VAL, hcd->regs + RCAR_USB3_CONF1); - writel(RCAR_USB3_CONF2_VAL, hcd->regs + RCAR_USB3_CONF2); - writel(RCAR_USB3_CONF3_VAL, hcd->regs + RCAR_USB3_CONF3); - /* USB3.0 Polarity */ - writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL); - writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL); + 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; int retval, index, j, time; int timeout = 10000; u32 data, val, temp; /* request R-Car USB3.0 firmware */ - retval = request_firmware(&fw, FIRMWARE_NAME, dev); + retval = request_firmware(&fw, priv->firmware_name, dev); if (retval) return retval; @@ -144,5 +153,5 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd) if (!hcd->regs) return 0; - return xhci_rcar_download_firmware(hcd->self.controller, hcd->regs); + return xhci_rcar_download_firmware(hcd); } diff --git a/drivers/usb/host/xhci-rcar.h b/drivers/usb/host/xhci-rcar.h index 5850125..ba3ad31 100644 --- a/drivers/usb/host/xhci-rcar.h +++ b/drivers/usb/host/xhci-rcar.h @@ -11,6 +11,8 @@ #ifndef _XHCI_RCAR_H #define _XHCI_RCAR_H +#define XHCI_RCAR_FIRMWARE_NAME_V1 "r8a779x_usb3_v1.dlmem" + #if IS_ENABLED(CONFIG_USB_XHCI_RCAR) void xhci_rcar_start(struct usb_hcd *hcd); int xhci_rcar_init_quirk(struct usb_hcd *hcd);