From patchwork Thu May 9 09:15:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jules Maselbas X-Patchwork-Id: 10936917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0AB592A for ; Thu, 9 May 2019 09:16:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C077828A21 for ; Thu, 9 May 2019 09:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B440728A28; Thu, 9 May 2019 09:16:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 176E028A05 for ; Thu, 9 May 2019 09:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725992AbfEIJQM (ORCPT ); Thu, 9 May 2019 05:16:12 -0400 Received: from zimbra2.kalray.eu ([92.103.151.219]:35756 "EHLO zimbra2.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbfEIJQM (ORCPT ); Thu, 9 May 2019 05:16:12 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 6088427E9907; Thu, 9 May 2019 11:16:10 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id VZOBJmtAWNgE; Thu, 9 May 2019 11:16:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 0608B27E9902; Thu, 9 May 2019 11:16:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 0608B27E9902 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1557393365; bh=T/oQ8CcZlfmQ0HlLaFjP4S9/qk0tYWvG+MJfvM+WTXQ=; h=From:To:Date:Message-Id:MIME-Version; b=md1wceuHkMyDq0pE5+tjJygNERMEoBLTYZLzv+Ov23vprLmBZbL5dNtBmbQOFYTIE JQfGWNKp2QcspVRBGiadxH8VYIfOql24tnj6LGpx3Nej+V5IgHsU5o5b6HoOvWekCw MxtBc9Ibp9hxKASAz8wxPzvlRfC0XHxJXkQOknlo= X-Virus-Scanned: amavisd-new at zimbra2.kalray.eu Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bOkSSkui2tw7; Thu, 9 May 2019 11:16:04 +0200 (CEST) Received: from tellis.lin.mbt.kalray.eu (unknown [192.168.36.206]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id E1A8227E98F8; Thu, 9 May 2019 11:16:04 +0200 (CEST) From: Jules Maselbas To: Minas Harutyunyan Cc: Marek Szyprowski , Markus Reichl , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Jules Maselbas Subject: [PATCH v2] usb: dwc2: Use generic PHY width in params setup Date: Thu, 9 May 2019 11:15:28 +0200 Message-Id: <20190509091528.28397-1-jmaselbas@kalray.eu> X-Mailer: git-send-email 2.21.0.196.g041f5ea In-Reply-To: <20190507100852.11263-2-jmaselbas@kalray.eu> References: <20190507100852.11263-2-jmaselbas@kalray.eu> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless since it's value will be overwritten by dwc2_init_params(). This change make sure to take in account the generic PHY width information during paraminitialisation, done in dwc2_set_param_phy_utmi_width(). By doing so, the phy_utmi_width params can still be overrided by devicetree specific params and will also be checked against hardware capabilities. Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width") Tested-by: Marek Szyprowski Signed-off-by: Jules Maselbas Acked-by: Minas Harutyunyan --- v2: Fix typo in commit message. Add Fixes and Tested-by tags. --- drivers/usb/dwc2/params.c | 9 +++++++++ drivers/usb/dwc2/platform.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 6900eea57526..5949262ff669 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -253,6 +253,15 @@ static void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg) val = (hsotg->hw_params.utmi_phy_data_width == GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16; + if (hsotg->phy) { + /* + * If using the generic PHY framework, check if the PHY bus + * width is 8-bit and set the phyif appropriately. + */ + if (phy_get_bus_width(hsotg->phy) == 8) + val = 8; + } + hsotg->params.phy_utmi_width = val; } diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index d10a7f8daec3..e98d7812da2d 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -271,15 +271,6 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) hsotg->plat = dev_get_platdata(hsotg->dev); - if (hsotg->phy) { - /* - * If using the generic PHY framework, check if the PHY bus - * width is 8-bit and set the phyif appropriately. - */ - if (phy_get_bus_width(hsotg->phy) == 8) - hsotg->params.phy_utmi_width = 8; - } - /* Clock */ hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg"); if (IS_ERR(hsotg->clk)) {