From patchwork Wed Oct 7 11:38:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 7344571 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD1049F302 for ; Wed, 7 Oct 2015 11:39:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B0624205EF for ; Wed, 7 Oct 2015 11:39:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 934B6205DC for ; Wed, 7 Oct 2015 11:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753803AbbJGLjv (ORCPT ); Wed, 7 Oct 2015 07:39:51 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:10787 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753702AbbJGLjh (ORCPT ); Wed, 7 Oct 2015 07:39:37 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 07 Oct 2015 20:39:36 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 2F4924EFC5; Wed, 7 Oct 2015 20:39:36 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 1D7A9480A4; Wed, 7 Oct 2015 20:39:36 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 18310480A3; Wed, 7 Oct 2015 20:39:36 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id WAX14085; Wed, 7 Oct 2015 20:39:35 +0900 X-IronPort-AV: E=Sophos;i="5.17,648,1437404400"; d="scan'";a="197152513" Received: from mail-hk2apc01lp0215.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.215]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 07 Oct 2015 20:39:34 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by SG2PR06MB0918.apcprd06.prod.outlook.com (10.162.201.158) with Microsoft SMTP Server (TLS) id 15.1.293.16; Wed, 7 Oct 2015 11:39:33 +0000 From: Yoshihiro Shimoda To: , , , , , , CC: , , Yoshihiro Shimoda Subject: [PATCH v2 4/6] usb: host: xhci-rcar: Change code for new SoCs Date: Wed, 7 Oct 2015 20:38:56 +0900 Message-ID: <1444217938-4668-5-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1444217938-4668-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1444217938-4668-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0001.jpnprd01.prod.outlook.com (25.161.131.139) To SG2PR06MB0918.apcprd06.prod.outlook.com (25.162.201.158) X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0918; 2:pCsi4sN18T87PLd17W5+6Dm1RVY1EMAvOehyA7nJp7p9eryeKDbmJVDMIBiUjIqAfVHXh3+xr/W/MndJRuXDFJHBVYqSDbnUSljy9Prbs8ekU10G5B/dmhox1GoidYy3s6EfHvNJ/jZ4lni2mkexpK4/HPcSqzCHtOBoAlmGYyU=; 3:9luT+tDVG2Ls+TvKWmOrJ5n+TnGAJ7aVkfW4tGS0KMx8p0FjErCjiL80oY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PfEIanHlQFbF+vRUNaT5v7hat/8nJcHoNB+ptWGMFM7O/PrUAm+9eyZArrgCqxJ4CYOyRVBFqh/citFF8AgsqchyNPKTEXP9iBWmTSW0JwoAJAWpSkzqy8J4Drpvss+ttQ9D5AArPkW7mC8FunAvH5LeUJcdhnyV3YhVhMj70PgW8SgsCewDBcPJ6jTiOjG6waaCGKPvdS/wMvwvATrrNBwD7MBEfjNX9QMUl7+zcxHM3rC7c= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001); SRVR:SG2PR06MB0918; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB0918; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(6029001)(6069001)(199003)(189002)(47776003)(101416001)(50466002)(87976001)(50986999)(5001960100002)(107886002)(64706001)(33646002)(36756003)(66066001)(77096005)(2950100001)(42382002)(76176999)(40100003)(5004730100002)(78352002)(5007970100001)(5001920100001)(97736004)(81156007)(5001770100001)(5008740100001)(50226001)(229853001)(575784001)(189998001)(42186005)(122386002)(5003940100001)(48376002)(46102003)(76506005)(19580395003)(105586002)(19580405001)(106356001)(92566002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB0918; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB0918; 23:PnE5lt/Yds5BdJEM03SM3zRk1u5Jqd4CWfIR5uRum?= =?us-ascii?Q?K/d8s4ud0u4bUibs/LsoAK9DjfEJ5CGWSynECbO9GbH1moZFEyqEisIK7sDq?= =?us-ascii?Q?1BvTfDjmcvcJRMByivkw8TS1U2RA9VRW83wJqn6Yj5+fGT4ADWC5RbAIiUYm?= =?us-ascii?Q?zuQJ7yrYjX6daH48Ee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= =?us-ascii?Q?tEgXcqC9aZ67cbkLtRNh3G40XER7swFVU3lA6rUUSjYcmqoKSUC18DBg+K5o?= =?us-ascii?Q?L6CxKQa8TAfmUV2/JHJ9c+81H/3rJ9pJA/9tz8HvMugDYYM7+65RRlQyD3pq?= =?us-ascii?Q?ebvaZrJWMuOHIJ4c2l/cE+DtOAQevw6a9HnvEoJh7IWoC9vgJdZsoEFlQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0918; 5:Zxazz0V3djta5zR1gzoilH5LSCajXWJBSD/PeNjlb/zZt0dESO/027VINnae8MMzGch2K8BrTxug/Q0FJwCbI16TCiXFN0p5uNcmsDf6Xs2NqlI1s8tjoQr61bgtC6OXhWU48BH2lsUkfD7NlNUZzQ==; 24:qhvoeZecrdsjpF/gBX3hhp9562pI1UJNCzmb5n3Gfp8raKhw+4ugx6ntfNeoy8Uj8vCLStt3rIIRy6bB204S8weAmkxojIl9YnBcABTEI2w=; 20:BIOkmEBOMjBc6x7MXS9fDJelrDM6MPZQWb9Wvl5MKLU7dmKi8N2YFm1NBr5ZX7sVSq9R2+1nhjCSs+Lh80Fauv2Un+tGiGYq/ajtqPUM4ZT1y9GkdbTGkcRH5gbyZDP42Ug+nA+fRnG+KCqMkhenAvRR/tvy1ZRMUy3DTt1416I= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2015 11:39:33.5155 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0918 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.2 required=5.0 tests=AXB_X_OUTLOOKPROT_ENVSDR, BAYES_00, RCVD_IN_DNSWL_HI, T_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 4a974b7..4cdf60b 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -75,6 +75,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);