Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp714995pxr; Mon, 11 Apr 2022 05:28:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztfX4O3ScroonDT8BlUu7dbzkd2iKXAd8TAGhrwpiGETsVePst5X6ryb/R61W2HXUw15ls X-Received: by 2002:a50:fc89:0:b0:41d:83d1:9df3 with SMTP id f9-20020a50fc89000000b0041d83d19df3mr1994856edq.19.1649680121070; Mon, 11 Apr 2022 05:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649680121; cv=none; d=google.com; s=arc-20160816; b=aM1sWYzoiw+7/Abnldfqb6ZkWYUKwvBq0fDMHMq0Qem2K6dK0ipFn5+PP93l4K80jr 7DBZeenMpHY3FLiQSoK1tjOTnV5+F5LSxjDwGGlKTzXSR1pgw7EBWcNV+pHpnF5pR2Ck Z2akDN8wxDcHWZvQsp8UZAcf9ZyGTa4k11WAnw2aF2V6rDqz1Ycf5zJVtIsZHsz2z+iT b87aYQs+DkDsCKjc6c6fHJbS8Zj1MTo8p6DegAWFDeSmogSqo6Ukvk/UwIR3pwCVaBFz QzkeIH21L90OliCxJBXY93pJ13AqEKBOnANDNZudQJJqs4nreWF+3i0l5G0ZQ2PfvfYI 2JWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UeE3DlHg+k765pUKLVfunExjQe33DUSTZPFQMGgSjq0=; b=KehFiZRA+GOeyg06Ej5JlKaPOIC+BwbLdb1NM/7uotGaTRGuABFajwrP/+lud65c1c 5hvvR+3m6gcJXfHcq4MlaqNOX9uRMiSbIupxrtzwesmB5YRNQUiW+KVtP9GG0NKlONhM PlekRR4K5p7aYYg92rj1sUBpVefuHzXA0I5VCRHkLkHYlC4p1JvG9GICjSTpVJmqK6Pw PkDwJ4yEqMKQRRBJCmz0QAjso7cimT1kFC4r9dhY1ERqwjc0HMVojKgQoPjWhGLF/dpI OT2+qck866Zk1UyhjCdnvuHhdB/wakpUrCCfb6vljn02gCWrJ4uTXBXf0Ne1AZnuZqP6 YbMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a056402175600b0041d7158ec30si4097475edx.137.2022.04.11.05.28.15; Mon, 11 Apr 2022 05:28:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243576AbiDJQ02 (ORCPT + 99 others); Sun, 10 Apr 2022 12:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243575AbiDJQ0W (ORCPT ); Sun, 10 Apr 2022 12:26:22 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869FDB77; Sun, 10 Apr 2022 09:24:08 -0700 (PDT) Received: from p508fdda7.dip0.t-ipconnect.de ([80.143.221.167] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndaLz-0006WK-1f; Sun, 10 Apr 2022 18:23:55 +0200 From: Heiko Stuebner To: Felipe Balbi , Greg Kroah-Hartman , Robert Hancock , Sean Anderson , Peter Geis Cc: linux-rockchip@lists.infradead.org, Peter Geis , Frank Wunderlich , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: dwc3: fix backwards compat with rockchip devices Date: Sun, 10 Apr 2022 18:23:54 +0200 Message-ID: <12992587.uLZWGnKmhe@phil> In-Reply-To: <20220409152116.3834354-1-pgwipeout@gmail.com> References: <20220409152116.3834354-1-pgwipeout@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_NONE, T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Samstag, 9. April 2022, 17:21:15 CEST schrieb Peter Geis: > Commit 33fb697ec7e5 ("usb: dwc3: Get clocks individually") moved from > the clk_bulk api to individual clocks, following the snps,dwc3.yaml > dt-binding for clock names. > Unfortunately the rk3328 (and upcoming rk356x support) use the > rockchip,dwc3.yaml which has different clock names, which are common on > devices using the glue layer. > The rk3328 does not use a glue layer, but attaches directly to the dwc3 > core driver. > The offending patch series failed to account for this, thus dwc3 was > broken on rk3328. > > To retain backwards compatibility with rk3328 device trees we must also > check for the alternate clock names. > > Fixes: 33fb697ec7e5 ("usb: dwc3: Get clocks individually") > > Reported-by: Frank Wunderlich > Signed-off-by: Peter Geis Reviewed-by: Heiko Stuebner > --- > > This patch is standalone to fix the backwards compatibility, and is > necessary no matter if we decide to retain the clock names in > rockchip,dwc3.yaml as is or align with snps,dwc3.yaml. > > drivers/usb/dwc3/core.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 1170b800acdc..5bfd3e88af35 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -1690,21 +1690,44 @@ static int dwc3_probe(struct platform_device *pdev) > /* > * Clocks are optional, but new DT platforms should support all > * clocks as required by the DT-binding. > + * Some devices have different clock names in legacy device trees, > + * check for them to retain backwards compatibility. > */ > dwc->bus_clk = devm_clk_get_optional(dev, "bus_early"); > if (IS_ERR(dwc->bus_clk)) > return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), > "could not get bus clock\n"); > > + if (dwc->bus_clk == NULL) { > + dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk"); > + if (IS_ERR(dwc->bus_clk)) > + return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), > + "could not get bus clock\n"); > + } > + > dwc->ref_clk = devm_clk_get_optional(dev, "ref"); > if (IS_ERR(dwc->ref_clk)) > return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), > "could not get ref clock\n"); > > + if (dwc->ref_clk == NULL) { > + dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk"); > + if (IS_ERR(dwc->ref_clk)) > + return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), > + "could not get ref clock\n"); > + } > + > dwc->susp_clk = devm_clk_get_optional(dev, "suspend"); > if (IS_ERR(dwc->susp_clk)) > return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), > "could not get suspend clock\n"); > + > + if (dwc->susp_clk == NULL) { > + dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk"); > + if (IS_ERR(dwc->susp_clk)) > + return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), > + "could not get suspend clock\n"); > + } > } > > ret = reset_control_deassert(dwc->reset); >