Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9115542rwd; Wed, 21 Jun 2023 03:17:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KzdVQPSobsMhEdT2i7NVGat4XyNJBKB2clCTkwZoCrGzWMJVTwyyMvpWNnE5beW4ZOCTL X-Received: by 2002:a05:6a00:1817:b0:668:8596:7520 with SMTP id y23-20020a056a00181700b0066885967520mr6066417pfa.4.1687342653309; Wed, 21 Jun 2023 03:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687342653; cv=none; d=google.com; s=arc-20160816; b=mrhiI93SxsHDzXIDNMeb+8jYQIWe0QwSRxvdV1Ef2+t1pLVfhdJ4oNp1ilfk4v3C1V TVzJpJo9wShiEMMcMFHKkA5uvM1NF59YdyNF7g6nL2gUnePlDVeEQnQ7zSKsmvaDTObA b098TaX+bZQ/l2jIEsRbOn9Cpn3XdnEij68/NErG4zz5o91meZeww8i4J5N2QmB2pHwR eC87mD3jgvpC49deDgeZsZgyFiiLjOowMag9TsJbdtz+qUoAZG2t+ollA/SeAOWAL997 yKOeGsxmP2jZ6FtQ49KWGJlEO9KblgiDlFVHMJeIOFEsbvU2sUQEszFXJxn+l7dfFtBW 8jbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=pksCYSKSrUw959LX6eQrI6QTHRyxobqR3+3tR4T6QsY=; b=C6AsPL4VWA9p0LXiaNHmCaxBDyb8WaTf9uUsnwyU+YeCUZF64QUuYjhiqJlrs2Dghv GHd2HTOBrd0Or63I/RH918aGxuchVQoYnOOH7PsJwOl01R5FPlAvg1seZX1TRJfuNGsZ o6P6jtXxrH5hIe+PSullVFnQzmvf5a6OC/FyggiFm8Fi6W3IVocJU8zrdMb0j/CB5iym En1lhFMLnemz+wPDu3EiccbYEURk6GiY5p51ltK5C3LrPFVylfjHdMe3pGoC8j6vwatI LvMcF16GmBXSMiZDXJ8K9l/c7j4MJyCj0BVbkpYe9o2MOmgHXRTWmYQmy7ItB2WLiz+2 y5JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HxtKccS8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c14-20020a056a00008e00b0064d62222c46si3713151pfj.121.2023.06.21.03.17.20; Wed, 21 Jun 2023 03:17:33 -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; dkim=pass header.i=@linaro.org header.s=google header.b=HxtKccS8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232402AbjFUKMO (ORCPT + 99 others); Wed, 21 Jun 2023 06:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbjFUKLr (ORCPT ); Wed, 21 Jun 2023 06:11:47 -0400 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327F51FDF for ; Wed, 21 Jun 2023 03:11:02 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-4f766777605so7574253e87.1 for ; Wed, 21 Jun 2023 03:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687341957; x=1689933957; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pksCYSKSrUw959LX6eQrI6QTHRyxobqR3+3tR4T6QsY=; b=HxtKccS8RJbfFltppK+lao89MD5mbUlOnGUB3wU94Lbk12nijhYFO8yzyRD0gFMXKc 47ZVNkQuTdJTwRBXXfX4EWbKf/p67W5lu0qaS4rUpPt4XepdOnBDx64bPb3Hc2UnNSSK jY0c9t66KDde3h7uicuu26TUo7Xret5V6rms1HY6u1OakmTevNL+A1ZDhwDT7TXpypg5 WDuTqHvIxN2YavpPb7K+VDs8hPpYpYeQKJgsjs1NOIpyMknTFG0rLLNZ3rTmKUe/H2nI n4d+vC54Cx+iqu9Wc7kqd+6BT3DgAkw1+b3RnUrR7+YhovyjIfa5EC/+obPHf/TJCRQc eMUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687341957; x=1689933957; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pksCYSKSrUw959LX6eQrI6QTHRyxobqR3+3tR4T6QsY=; b=dant+JWgr2KAVyEB3WZ1cADtiEMOnQyvjUZ0H2zcBwOeSnhYE8xTpIBolmRq1pn0C8 5bmhl9GRLD13TxO5OxxswpY2H9rBJg65GUwSEpWPosYS+JXs4LREpUQfCuOgVifY7A1N JU3f0X0zuP1KWaOpI69lej1Q27PGzMs0n+9twUhxGcGtFIhPwqlwGUnfb2JTWV+qoeQ/ GEJDVTipR7HUFmATaYWnYXNZAd/O5bx/KR5qJlxnUGPF8+s3wjF7VvXFDLTj14sGB8CT OP3+EbJgtkV4Pu6ceKi2cHr2tKHkMqiYuRnARJ2OutpbsVEvIQ0z8LMgUQtITqLpnPat 5ywA== X-Gm-Message-State: AC+VfDzje4WoXYrp+FaVT2Qri77Lxjs20Ia5cLXBKa1MMsVx25G/HTny bNHxPCijrEJo4zExvUWO1V2SjA== X-Received: by 2002:a19:6555:0:b0:4f8:5f32:b1da with SMTP id c21-20020a196555000000b004f85f32b1damr6833037lfj.24.1687341957210; Wed, 21 Jun 2023 03:05:57 -0700 (PDT) Received: from [192.168.1.101] (abxj193.neoplus.adsl.tpnet.pl. [83.9.3.193]) by smtp.gmail.com with ESMTPSA id l11-20020ac24a8b000000b004f87487db79sm718117lfp.222.2023.06.21.03.05.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jun 2023 03:05:56 -0700 (PDT) Message-ID: <03371bd0-12a5-3109-ebf7-33feeef31bac@linaro.org> Date: Wed, 21 Jun 2023 12:05:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v9 06/10] usb: dwc3: qcom: Add support to read IRQ's related to multiport Content-Language: en-US To: Krishna Kurapati , Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , Wesley Cheng , Johan Hovold Cc: 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, quic_harshq@quicinc.com, ahalaney@redhat.com, quic_shazhuss@quicinc.com References: <20230621043628.21485-1-quic_kriskura@quicinc.com> <20230621043628.21485-7-quic_kriskura@quicinc.com> From: Konrad Dybcio In-Reply-To: <20230621043628.21485-7-quic_kriskura@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable 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 On 21.06.2023 06:36, Krishna Kurapati wrote: > Add support to read Multiport IRQ's related to quad port controller > of SA8295 Device. > > Signed-off-by: Krishna Kurapati > --- > drivers/usb/dwc3/dwc3-qcom.c | 108 +++++++++++++++++++++++++++++------ > 1 file changed, 91 insertions(+), 17 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 3de43df6bbe8..3ab48a6925fe 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -74,9 +74,9 @@ struct dwc3_qcom { > struct reset_control *resets; > > int hs_phy_irq; > - int dp_hs_phy_irq; > - int dm_hs_phy_irq; > - int ss_phy_irq; > + int dp_hs_phy_irq[4]; > + int dm_hs_phy_irq[4]; > + int ss_phy_irq[2]; Not sure if that's been raised previously, but having raw numbers here is not very descriptive.. MAX_NUM_MP_HSPHY or something would be helpful for readability.. Konrad > enum usb_device_speed usb2_speed; > > struct extcon_dev *edev; > @@ -375,16 +375,16 @@ static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom) > dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq); > > if (qcom->usb2_speed == USB_SPEED_LOW) { > - dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq); > + dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq[0]); > } else if ((qcom->usb2_speed == USB_SPEED_HIGH) || > (qcom->usb2_speed == USB_SPEED_FULL)) { > - dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq); > + dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq[0]); > } else { > - dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq); > - dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq); > + dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq[0]); > + dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq[0]); > } > > - dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq); > + dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq[0]); > } > > static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom) > @@ -401,20 +401,20 @@ static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom) > */ > > if (qcom->usb2_speed == USB_SPEED_LOW) { > - dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq, > + dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq[0], > IRQ_TYPE_EDGE_FALLING); > } else if ((qcom->usb2_speed == USB_SPEED_HIGH) || > (qcom->usb2_speed == USB_SPEED_FULL)) { > - dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq, > + dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq[0], > IRQ_TYPE_EDGE_FALLING); > } else { > - dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq, > + dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq[0], > IRQ_TYPE_EDGE_RISING); > - dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq, > + dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq[0], > IRQ_TYPE_EDGE_RISING); > } > > - dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0); > + dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq[0], 0); > } > > static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup) > @@ -535,6 +535,80 @@ static int dwc3_qcom_get_irq(struct platform_device *pdev, > return ret; > } > > +static int dwc3_qcom_setup_mp_irq(struct platform_device *pdev) > +{ > + struct dwc3_qcom *qcom = platform_get_drvdata(pdev); > + char irq_name[15]; > + int irq; > + int ret; > + int i; > + > + for (i = 0; i < 4; i++) { > + if (qcom->dp_hs_phy_irq[i]) > + continue; > + > + sprintf(irq_name, "dp%d_hs_phy_irq", i+1); > + irq = dwc3_qcom_get_irq(pdev, irq_name, -1); > + if (irq > 0) { > + irq_set_status_flags(irq, IRQ_NOAUTOEN); > + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > + qcom_dwc3_resume_irq, > + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > + irq_name, qcom); > + if (ret) { > + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret); > + return ret; > + } > + } > + > + qcom->dp_hs_phy_irq[i] = irq; > + } > + > + for (i = 0; i < 4; i++) { > + if (qcom->dm_hs_phy_irq[i]) > + continue; > + > + sprintf(irq_name, "dm%d_hs_phy_irq", i+1); > + irq = dwc3_qcom_get_irq(pdev, irq_name, -1); > + if (irq > 0) { > + irq_set_status_flags(irq, IRQ_NOAUTOEN); > + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > + qcom_dwc3_resume_irq, > + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > + irq_name, qcom); > + if (ret) { > + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret); > + return ret; > + } > + } > + > + qcom->dm_hs_phy_irq[i] = irq; > + } > + > + for (i = 0; i < 2; i++) { > + if (qcom->ss_phy_irq[i]) > + continue; > + > + sprintf(irq_name, "ss%d_phy_irq", i+1); > + irq = dwc3_qcom_get_irq(pdev, irq_name, -1); > + if (irq > 0) { > + irq_set_status_flags(irq, IRQ_NOAUTOEN); > + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > + qcom_dwc3_resume_irq, > + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > + irq_name, qcom); > + if (ret) { > + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret); > + return ret; > + } > + } > + > + qcom->ss_phy_irq[i] = irq; > + } > + > + return 0; > +} > + > static int dwc3_qcom_setup_irq(struct platform_device *pdev) > { > struct dwc3_qcom *qcom = platform_get_drvdata(pdev); > @@ -570,7 +644,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret); > return ret; > } > - qcom->dp_hs_phy_irq = irq; > + qcom->dp_hs_phy_irq[0] = irq; > } > > irq = dwc3_qcom_get_irq(pdev, "dm_hs_phy_irq", > @@ -585,7 +659,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret); > return ret; > } > - qcom->dm_hs_phy_irq = irq; > + qcom->dm_hs_phy_irq[0] = irq; > } > > irq = dwc3_qcom_get_irq(pdev, "ss_phy_irq", > @@ -600,10 +674,10 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev) > dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret); > return ret; > } > - qcom->ss_phy_irq = irq; > + qcom->ss_phy_irq[0] = irq; > } > > - return 0; > + return dwc3_qcom_setup_mp_irq(pdev);; > } > > static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)