Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1317481rda; Mon, 23 Oct 2023 08:58:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEloU8Hkyie4gBNWX/r2hKyaXnBTJJMEXOR2i/jpl6c0HAHEMGpYH8JxBj0Z7VQ6cEWPk3b X-Received: by 2002:a17:90a:4e4e:b0:278:f907:719d with SMTP id t14-20020a17090a4e4e00b00278f907719dmr6725287pjl.48.1698076729513; Mon, 23 Oct 2023 08:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698076729; cv=none; d=google.com; s=arc-20160816; b=FAqziqolgReiYhGZtaSP1NxHe4wF2FPExTloFFezG6D7yeufIW/1X1s0aCtjgxXNtY sLzmjX/l5XsEun+PcZhbnZrB4kmrw5LAJ9XYppmoAjWNgmKY98+k/1QXymhOHYnWnUJa pgV8mBB/NA/EaQn/Y56Hd4j7GCr7bFtOA942bvO6FeSHBNp1t/61CA6mgaS/ptMbk/L/ XPn0TwXvX4Nn6fEJbSXcOOnc0ZbYbT5+i7+HY+FPS3qe4Siogip2dGLdsocu64WpZii6 8YjgogW552ecENblFvAsmR+PyYYQlMyrdr81HBr63EI886gsRCGUeo0oYRyAvkB2122h jCWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=w04hko0ALSQIKl9oOb9CFpBESkrytBNxP9kxPA9iO2I=; fh=lA0/X79ZPEXoWZUgc4xUI5dZqBvGrbH1ML5dB6mzBZk=; b=uwOXTCGtzAuXLnLwblGPnvZEu6k5XXNuOlmK2TfN1d2llMEYTI3dHUa5fQD3qrAgcI oxIdbXzBzK6FxjqQNfgeyn1iYW1WjjPWCJzTo0WECnfIq6KSvy1PsibQr0R4vE1ykcLq Ec/wk6tvmdS0j7/MEDzlDTBq4mnoAJ8dYI13HkTwdhjvUQUQqxLNypKX6V9tI9LEAOq9 bJm61rgb7K1DURGrT4drfLpyXzdxdYJnOcEwrAqWWb/BZ1meAB0eT6xXgWnGsiSSjrOn AJQXbWVBqbCWfSSqj694dsFTTHtN+VHAp8ETyasTEyaavHx/Mdz7/Xa3mAQEBBt+G+Lj guYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uu2nv3x2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id c6-20020a17090ad90600b002568a675b65si9346470pjv.141.2023.10.23.08.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 08:58:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uu2nv3x2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5F3DD8060831; Mon, 23 Oct 2023 08:58:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbjJWP6f (ORCPT + 99 others); Mon, 23 Oct 2023 11:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjJWP6e (ORCPT ); Mon, 23 Oct 2023 11:58:34 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BA92E9; Mon, 23 Oct 2023 08:58:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16FEBC433C8; Mon, 23 Oct 2023 15:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698076712; bh=eHQE9AW+TMhNeP+Km14R1yq/+eqHlqagrK1M9EYQg3Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uu2nv3x2wZYIXNe6hKG4VpNBSs9klnoB6Bb9jinZaTd8TzjvSgHgniv6jtd9n5vFs 7kPHt1G0/UyPeCs5f2oc+JOzFHFSzHAaoPLgfK3egiOe/npAd/llQkGThbE92+Rw/j NoA8DMcD2UXJbL9U0JXG+m76kB2I5WrB2TB9JCMoub9aaVcgSvGwot81pmP9hd0Xz7 sD8fyyNRFmCL0zDAjtPkml5IuANJf+/MJWrqXPSdmGnkv3RA7EC5GVijuQnEECGKh1 3nZJrLxj6l3ouSEfkjosuXJNH/UUEVZ7X4H6++FTg0YturEfuuZr1dmJP+44g3MMKZ F+5hYBiCLvW5Q== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1quxKI-00022S-02; Mon, 23 Oct 2023 17:58:46 +0200 Date: Mon, 23 Oct 2023 17:58:46 +0200 From: Johan Hovold To: Krishna Kurapati Cc: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , Wesley Cheng , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com, quic_jackp@quicinc.com, ahalaney@redhat.com, quic_shazhuss@quicinc.com Subject: Re: [PATCH v13 07/10] usb: dwc3: qcom: Add multiport suspend/resume support for wrapper Message-ID: References: <20231007154806.605-1-quic_kriskura@quicinc.com> <20231007154806.605-8-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231007154806.605-8-quic_kriskura@quicinc.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 23 Oct 2023 08:58:47 -0700 (PDT) On Sat, Oct 07, 2023 at 09:18:03PM +0530, Krishna Kurapati wrote: > QCOM SoC SA8295P's tertiary quad port controller supports 2 HS+SS > ports and 2 HS only ports. Add support for configuring PWR_EVENT_IRQ's > for all the ports during suspend/resume. No need to mention SA8295P as this is needed for all multiport controllers. Say something about adding support for multiport controllers generally instead and mention what the power event irqs are used for. > Signed-off-by: Krishna Kurapati > --- > drivers/usb/dwc3/dwc3-qcom.c | 35 ++++++++++++++++++++++++++++------- > 1 file changed, 28 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 651b9775a0c2..dbd4239e61c9 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -37,7 +37,11 @@ > #define PIPE3_PHYSTATUS_SW BIT(3) > #define PIPE_UTMI_CLK_DIS BIT(8) > > -#define PWR_EVNT_IRQ_STAT_REG 0x58 > +#define PWR_EVNT_IRQ1_STAT_REG 0x58 > +#define PWR_EVNT_IRQ2_STAT_REG 0x1dc > +#define PWR_EVNT_IRQ3_STAT_REG 0x228 > +#define PWR_EVNT_IRQ4_STAT_REG 0x238 Not sure these defines makes sense on their own. You now only use them via the array below. I think I already asked you whether these offsets depend on SoC and you said no, right? > + > #define PWR_EVNT_LPM_IN_L2_MASK BIT(4) > #define PWR_EVNT_LPM_OUT_L2_MASK BIT(5) > > @@ -107,6 +111,19 @@ struct dwc3_qcom { > int num_ports; > }; > > +/* > + * Currently non-multiport controller have only one PWR_EVENT_IRQ register, > + * but multiport controllers like SA8295 contain upto 4 of them. > + */ Please try not talk about "currently" and as things are likely to change or, in fact, even *are* changing with your very patch series. Again, this is not SA8295 specific. > +#define NUM_PWR_EVENT_STAT_REGS 4 You already have MAX_PORTS, why are you defining a new define that will always have to be equal to MAX_PORTS? > + > +static u32 pwr_evnt_irq_stat_reg_offset[NUM_PWR_EVENT_STAT_REGS] = { missing const > + PWR_EVNT_IRQ1_STAT_REG, > + PWR_EVNT_IRQ2_STAT_REG, > + PWR_EVNT_IRQ3_STAT_REG, > + PWR_EVNT_IRQ4_STAT_REG, > +}; > + > static inline void dwc3_qcom_setbits(void __iomem *base, u32 offset, u32 val) > { > u32 reg; > @@ -446,9 +463,11 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup) > if (qcom->is_suspended) > return 0; > > - val = readl(qcom->qscratch_base + PWR_EVNT_IRQ_STAT_REG); > - if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) > - dev_err(qcom->dev, "HS-PHY not in L2\n"); > + for (i = 0; i < qcom->num_ports; i++) { > + val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg_offset[i]); > + if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) > + dev_err(qcom->dev, "HS-PHY not in L2\n"); Error message should contain the port number. > + } > > for (i = qcom->num_clocks - 1; i >= 0; i--) > clk_disable_unprepare(qcom->clks[i]); > @@ -494,9 +513,11 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup) > dev_warn(qcom->dev, "failed to enable interconnect: %d\n", ret); > > /* Clear existing events from PHY related to L2 in/out */ > - dwc3_qcom_setbits(qcom->qscratch_base, PWR_EVNT_IRQ_STAT_REG, > - PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK); > - > + for (i = 0; i < qcom->num_ports; i++) { > + dwc3_qcom_setbits(qcom->qscratch_base, > + pwr_evnt_irq_stat_reg_offset[i], > + PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK); Again, continuation lines should be indented at least two tabs further. > + } > qcom->is_suspended = false; > > return 0; Johan