From patchwork Mon Oct 26 08:12:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 7486051 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 784AFBEEA4 for ; Mon, 26 Oct 2015 08:13:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 746AA206B6 for ; Mon, 26 Oct 2015 08:13:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C2E920651 for ; Mon, 26 Oct 2015 08:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753287AbbJZINZ (ORCPT ); Mon, 26 Oct 2015 04:13:25 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:27916 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752964AbbJZINW (ORCPT ); Mon, 26 Oct 2015 04:13:22 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 26 Oct 2015 17:13:20 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id BC5224B8ED; Mon, 26 Oct 2015 17:13:20 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id A7502480A3; Mon, 26 Oct 2015 17:13:20 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id A5AA4480A5; Mon, 26 Oct 2015 17:13:20 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id TAC08779; Mon, 26 Oct 2015 17:13:20 +0900 X-IronPort-AV: E=Sophos;i="5.20,200,1444662000"; d="scan'208";a="198436165" Received: from mail-pu1apc01lp0021.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.21]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 26 Oct 2015 17:13:19 +0900 Received: from TY1PR06MB0928.apcprd06.prod.outlook.com (10.164.99.154) by TY1PR06MB0989.apcprd06.prod.outlook.com (10.164.99.23) with Microsoft SMTP Server (TLS) id 15.1.306.13; Mon, 26 Oct 2015 08:13:17 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by TY1PR06MB0928.apcprd06.prod.outlook.com (10.164.99.154) with Microsoft SMTP Server (TLS) id 15.1.306.13; Mon, 26 Oct 2015 08:13:15 +0000 From: Yoshihiro Shimoda To: , , , , , , CC: , , Yoshihiro Shimoda Subject: [PATCH v3 5/7] usb: host: xhci-rcar: Change code for new SoCs Date: Mon, 26 Oct 2015 17:12:33 +0900 Message-ID: <1445847155-5468-6-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1445847155-5468-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1445847155-5468-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0016.apcprd06.prod.outlook.com (25.164.91.26) To TY1PR06MB0928.apcprd06.prod.outlook.com (25.164.99.154) X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0928; 2:6kGF338B4pZ8o1Ei7Iguu9rbaNdpb5aDPLbxaTo5yzjUlS5hsP26Em9ARWwjLSCkH0QOjHa+UZ5IjVcbe9NyZ9Fve1hL7ciQl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sX9kvhC7Lagwctt; 4:sGKT2KvdPShpzX1NU1HmA81QiLfOp1vvmdO5DhihPYnswzuwqWodpnEJrfXCw22F5yG1ucbVntjfqs2iskh/SQpapZ/MjjYj8rU7K/Mf9Zalt4p7fQTOl+TS5hEJEJz8hHKZWp88Vj8FjFuszgR+Iu+QunchI8wlEfBirx0Ho7fAK0m0b860mY2kegXOJ7WOJ+rgAKsglaZXR0D7RSzMxQYDT9SopwmjorOYoNhWRln0jfCp5e7bSMQyFsID22fK8J9tBpljGzSLvNbNntBUKKX1QOIfMXLhw1OQ7JwAtD/lSZSTWJTEsF1V49+IDs27BPPHlobQQ9e7bePQjwiDwrTC3yBKIgzVmrlJDSNr5RHd9RiOYMnW5rG7mYjGwdTF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(102215026); SRVR:TY1PR06MB0928; BCL:0; PCL:0; RULEID:; SRVR:TY1PR06MB0928; X-Forefront-PRVS: 0741C77572 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6029001)(6069001)(6009001)(199003)(189002)(4001430100002)(50226001)(19580395003)(229853001)(106356001)(2950100001)(5003940100001)(105586002)(19580405001)(40100003)(77096005)(33646002)(92566002)(5001770100001)(81156007)(107886002)(97736004)(78352002)(189998001)(101416001)(122386002)(5001960100002)(42382002)(5008740100001)(575784001)(5004730100002)(5007970100001)(87976001)(76176999)(50986999)(50466002)(42186005)(36756003)(76506005)(48376002)(66066001)(47776003); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR06MB0928; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TY1PR06MB0928; 23:17ZapjZm3Gg9FYxriCII0I6VdebmVLIwUgAfoSCEy?= =?us-ascii?Q?4AddDHfRNcaAFHq+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JGgoqvZDmS?= =?us-ascii?Q?PqcfvKkRcubQjcev00msi/xGIBMaUGueYsDKGzEMqsNnt0UHHE+kAvaexGOg?= =?us-ascii?Q?n1IJvqItgkDoRubd0V/gR5rpl5bYK+B0YxjaFDHwWS9oQGGfZQYsMzQBltpj?= =?us-ascii?Q?MQnKwxBBSuV1Q81D1s0nlZBhHLi4ee+1BgVOBWdfOaEFwEmJg6v+USnMkr9z?= =?us-ascii?Q?LGhLDKX251iYT9/vUdkCbHzblYcGy6A?= X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0928; 5:VzNlk7Sn5meJYoACt4/EpADQRrLaYZUClKywdLwOtQtQPAghcZRQJPi7I2aoVVIi6ff8pK7lJINUfzSFSu1IT+Q4Ht6SJC6LQq+Su2Smaav/OQrL3/XD/2BS/pHNPFPvlF47yVKHJKGdR3sHq9FKCQ==; 24:sv4l9moCCjR3sn1CNGqIIasMr942eYqRA/Ylk+E8J27cxzgT57/pJnS8tkdr5lj+aMO7xSQSHvglyK4jmwRxhygo+sOlgfUH8vd+sBBeyZE=; 20:1JA5DQDuk73w3W0DaF15iE3DGJeSaLH+IBOG/YyYys3IwwvCfjAg5cow95gTtAqQc9NdlTiq1zcPfFwmABttiVyYUXyGW1kSyv7DzAGC88q8QRhTwEglrqmkcxO94oCnjRvoLRHFOHiyCg7zmIefh646FLPL7yN6vHp9T5zy6uY= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2015 08:13:15.7988 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR06MB0928 X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0989; 2:I2ljSBrGVhGzuXlZyaIjFqKtuDY8oMHPQxmO6a1fE0speI5qXJLDyZZD1CvWCLwoAfqqwTVrrfhsWmidx3o3PXwg2rX0Fcj/Ai7vUafSEe2Cy6VSah6V0FE5e1E66VZa+gut0yzYykBqgJQTK1v9CKQgWChgLBLw7a+tEmj95as=; 23:/QXMNFc0APdxl5Q1VkEUP5888ErbPzYYGti6RCSI6RIzloSc04T+koX8/RibGzThS+jBvl1VbgJunVvxlxqVQbYvjvrK3OFN/jw5HHefbvYIFduA4LM5PfOok6kRdYwbel8DTpQErhFC7OfrRIqzjZtFFs8HyDpu39K3PEmBi18P0gJgik+IinBR2rixYt3K X-OriginatorOrg: renesas.com 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);