From patchwork Wed Dec 13 06:46:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10109337 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4924E60327 for ; Wed, 13 Dec 2017 06:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4729B28E6A for ; Wed, 13 Dec 2017 06:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BF7228E6C; Wed, 13 Dec 2017 06:51:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5C6628E6A for ; Wed, 13 Dec 2017 06:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751081AbdLMGve (ORCPT ); Wed, 13 Dec 2017 01:51:34 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:38258 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750819AbdLMGvb (ORCPT ); Wed, 13 Dec 2017 01:51:31 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 13 Dec 2017 15:51:29 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id A82F584799; Wed, 13 Dec 2017 15:51:29 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.45,397,1508770800"; d="scan'208";a="264980814" Received: from mail-pu1apc01lp0023.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.23]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 13 Dec 2017 15:51:28 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/YUalZ8l8QAz6S0j4fxr8IFTAYER5xY63a58Pkeq6AA=; b=RKzOCExAJaY3htVBcmhRkrkklnOzhKTiiONHMZmCFtWdJDpm8w7ULMVkix/dYodd4fjvbwGOYngPGTRayQWZ6sLRk3Qu3MmzTeK9dqj+XWrjNgyW5HMGZNEbp1695ob+vx9vNpIwBmqdqBMUhycnIlbvwFlX0Ykbe555vzvfD4s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.138) by SIXPR06MB0988.apcprd06.prod.outlook.com (2a01:111:e400:51e9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 06:51:26 +0000 From: Yoshihiro Shimoda To: balbi@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH 1/4] usb: renesas_usbhs: Add a function to write the UGCTRL2 register Date: Wed, 13 Dec 2017 15:46:57 +0900 Message-Id: <1513147620-20925-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513147620-20925-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1513147620-20925-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OSXPR01CA0052.jpnprd01.prod.outlook.com (2603:1096:600:f::11) To SIXPR06MB0988.apcprd06.prod.outlook.com (2a01:111:e400:51e9::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 28b748ab-a4f1-4a57-ad6e-08d541f5ee9e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(48565401081)(5600026)(4604075)(2017052603307); SRVR:SIXPR06MB0988; X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB0988; 3:AtYxEu1UXO9of7fzpu22GRD+wFvscOnL7LyFM0N//7xfVLspksLHFTfADLMd1PhdkbOtECRuK5nwlDqj+ArbaDAIEm/4J7knMWB8SWepsaCxkrcAxmZwVJr7TQXIPo09nFEHd9+ki3QTxNa2CPvWkYqL1/ao9120pPejE4bqmrPG7sOMweXCWMJXvdX+COPWfQ6XXKh3WxFoAIXPLyx6j6vg9wKTMUNfBOzOn4jVOPXi3fT5dFM+0DGXp0o+A3Eb; 25:sKrWQ6rF5Edf3WUl7jDxMGHTHoZ0d0C7XqjIvDTftQVXhtjX0KDKi/gFxCRP/rKS1Ax0g3G2vlHu7zJ7ZBN2e/234pxSahwWyspXN4xNW1HZoiKxCSSAjZRbNtzq5HSwAFvDmaXwWXcxxxGfXMWm4H3hUX0g7pzdy0HQlEYhiyk4O1g/z0NCvURyuEMP06r1VFaXoMBdxhmtf/LisGYgak+Q1I5knfdb5XMxCYf6fBsQLw3EBv4zdcT8c9sAsGJhdjSRz+G6dQnhiMUCfz/k1n4gGbQaGnXV8NRldP89ZSvhbKgE5Hj2Ty5/722PuNpVB42H5ogqfb5UCmiiVkucDw==; 31:16cPhc6dEWT/XbnMKAcYUgwVsS8dhRHfDVFMklwH5ojr3fIEzJC+P4Gn5bPZaDC3OKV6ZU6d3bV8UBGmFFeSg1XApOsGfVjDszZbFzHroTy1YJqQB/mb24IHzqFlFw2lmX116Yh0zqpXY/usYc7wRKsyR1WS8J+6COdwxlpbQ29GPDIp+4xuvomvMK9x5jfytYuYxZRylf7HLuJ4YmV0erYVDp9oSbcLE+O7R3NVcM0= X-MS-TrafficTypeDiagnostic: SIXPR06MB0988: X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB0988; 20:V8pmE7ZTXj21c19SFQ5erDG4TPPZuk8Dt+WmKQZg8fh5pz6aq8Ipq4bi0D5TZuVxtMt8pTR97xW5VssV0sHIrwHw29Lo0w6ZPQVEJDBuy+MDL/zOsqi9UaLEjL2CHsEWJdsdT/DU5AfBaEnbNM74B0B4TPz45/mRZN7nH2UdLUlwZonMR2l8/9u8wzi/Xct/58k5URE7daOq07hV7GjjlBHRlKCuKYnu2lQcfeXpnVahZeHicMB07DYSF+8AabKGTcWvIv27DbRFct6OlTlLoo8De/UrRBx7AG5oJu46VB//Q0I0HEO2GuND/EslW1SIDLgPZ34zTno0dmqS2uhaEyT7zUjkVN3Trzg3hvtMC+Sp09MMrevwq6aFmKLJNjZmdG9vY3KKFnERoq0YCDNc4BEIn4YAymiGx98dCbZI/GceDbsh9tZVeqgmORl5szDCJ3vd650XjlhRZqmY62UjfGcUJ0MlURmZBKuXogdxIbBijN67g6WDLKWPPzjzqRpu; 4:7SbzlHUYZDmXQi8e3HwfUfJBOxbvP5BctzoJ8XHOTXajzhYEM40xJZyora1IFekUn9qxd/tDtL9M1pGE1PWyP19trn/Hek0HhyRgO48M1ssWBNzlmoegVc2cmi8OxHbbG5d5ug26TtTfWonnu8vQQLlOWMuG+lW8Ps2off32819Hzv9cLSxKbGpo2InIeixJxSxV6Uj3o6+w2wvCmRtr+EJl991XQ5ASq8He2lJkl9zf5LliIlfYIIFsIiNFaQG6H6lLrYEtyM+BTYf1xAxGWQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(93006095)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123562025)(20161123564025)(6072148)(201708071742011); SRVR:SIXPR06MB0988; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SIXPR06MB0988; X-Forefront-PRVS: 052017CAF1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(376002)(366004)(346002)(39860400002)(199004)(189003)(42882006)(6916009)(2351001)(2950100002)(6666003)(2361001)(106356001)(36756003)(6486002)(97736004)(6512007)(575784001)(16586007)(6506007)(386003)(68736007)(498600001)(316002)(3846002)(8936002)(16526018)(6116002)(25786009)(7736002)(78352004)(4326008)(66066001)(47776003)(105586002)(52116002)(76176011)(51416003)(53936002)(305945005)(8676002)(50466002)(81166006)(50226002)(5660300001)(48376002)(81156014)(107886003)(2906002)(3720700003); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB0988; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:en; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SIXPR06MB0988; 23:OIQmxyHQffaMFX2VjmjI0Delz4enyTroEXjRGeqsh?= =?us-ascii?Q?NOdDKNqrulJW/jk/vuePPWv9wQYChdZvTd+pDd0eDFiZ9eAujV3ALS9bp+05?= =?us-ascii?Q?IgaasH9fJAG/SyZmVjDafv/aIntOKv2l2Vq2ZGVxOVNL4U14hyy+5Dew1cON?= =?us-ascii?Q?J1FrJTiSGbNp+mph5sRxl0CwubDv8QBPQPMLc3w+PhJwd0wUEWhKiYaS2pCL?= =?us-ascii?Q?VC6XLCKzvtwJZBg1Kf/TmQizj1Bt0FJ1FHKPGhymEWQW0vDy9dIQPTN3tZhn?= =?us-ascii?Q?LjcLoR1rFpfIkkXM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RHQDBTlZA7qHLahjdcBWQi9T1wuQn2JWEPDfpJlF7p9pacNnP9pz76PhrIndpt74Kf18KLc38bjb8WydWkQNNJaXg1utpvFBxqIadclrQqMkfOM6n490ufyT8D7kCBoNPFubpBpZQNLV8rSZc9a2P8ZpilNM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 06:51:26.2868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28b748ab-a4f1-4a57-ad6e-08d541f5ee9e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB0988 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To cleanup the code, this patch adds a function to write the UGCTRL2 register. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/rcar3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/rcar3.c b/drivers/usb/renesas_usbhs/rcar3.c index c929d29..50e5fb5 100644 --- a/drivers/usb/renesas_usbhs/rcar3.c +++ b/drivers/usb/renesas_usbhs/rcar3.c @@ -44,13 +44,17 @@ static u32 usbhs_read32(struct usbhs_priv *priv, u32 reg) return ioread32(priv->base + reg); } +static void usbhs_rcar3_set_ugctrl2(struct usbhs_priv *priv, u32 val) +{ + usbhs_write32(priv, UGCTRL2, val | UGCTRL2_RESERVED_3); +} + static int usbhs_rcar3_power_ctrl(struct platform_device *pdev, void __iomem *base, int enable) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); - usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG | - UGCTRL2_VBUSSEL); + usbhs_rcar3_set_ugctrl2(priv, UGCTRL2_USB0SEL_OTG | UGCTRL2_VBUSSEL); if (enable) { usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM); @@ -73,8 +77,7 @@ static int usbhs_rcar3_power_and_pll_ctrl(struct platform_device *pdev, if (enable) { usbhs_write32(priv, UGCTRL, 0); /* release PLLRESET */ - usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | - UGCTRL2_USB0SEL_HSUSB); + usbhs_rcar3_set_ugctrl2(priv, UGCTRL2_USB0SEL_HSUSB); usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM); do {