From patchwork Thu Jun 29 14:45:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Thierry X-Patchwork-Id: 13297070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21164EB64D9 for ; Thu, 29 Jun 2023 14:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U2DF6FtEg6lR9xO4/WXF0Yd2sAhCQaSjMflLwrlnw7Y=; b=EmJM/fwnerSwEL 32sUX6LmGxRr8rlBG7a1H+71Wsw9RdRNSMIATkeKCApQjaT5MQxtMoAUSvO8Oazr/crNIKEgSBzhD IBUqBo6nmVID3MzQZs7BZB76KHehz9XfJxekCDrdGAFMVqEBujBW9i6YCsRf6VmG/GOPIhkLWt+Zy OV4NuenXAGCkJ8VaNog4n1HAp9bgGbPyJSlg3KuZBoJ6cLGC2TMAchhOmqBdfvik1zUqZBi5rjVFT ao+Z03J19U1teXnhv1gvQzCBxWF41+SEKmZ/egYfmoqfibPm1W9bJZ9zI32WwLiJebwZkA8O3BwHL iaU0xBLyJ6EMD9XFXu1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qEsuj-001KeV-2U; Thu, 29 Jun 2023 14:46:29 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qEsuf-001KdN-0c for linux-phy@lists.infradead.org; Thu, 29 Jun 2023 14:46:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688049983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zDXFOarJFkvxNU7P1GHKG3noUeFa/ZYuvulMUbxlN1A=; b=eXwI/4OYtZp5vKR5PCv3XtPt0bd4DjdcfXha2kLmeghDy0cy18iL/tZszxtGFO3ITWpYB6 dYy5jE75TNKL15bCqSk+mz0H9K48w61GYbKWNd71isU6isV5awB6ytDFIAdb7CnjDktTA8 y6CPCr3kDDakMekXQXKlQr52P5TssPM= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-ClYKkDvRMA60uMFpgrl7QQ-1; Thu, 29 Jun 2023 10:46:21 -0400 X-MC-Unique: ClYKkDvRMA60uMFpgrl7QQ-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-635dba99f82so8715946d6.3 for ; Thu, 29 Jun 2023 07:46:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688049981; x=1690641981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zDXFOarJFkvxNU7P1GHKG3noUeFa/ZYuvulMUbxlN1A=; b=URr7Rv+cAjjaS0RaW5F711w1ooAUGZoGMem3WZHQCxmZM5Y7fbeSFGNai9nlS6HzSx kijQXBb8UalZAGk+b0OIxH/TSLyPMOdcg+BWJiJzhJTNjiQUzwgHovZlybNS6MVBay/u pku162ipgYTaUVMdzr77JMzeIGPagfG4IIr7lrilIGzxPI6hF+4CGhXjnu+iBilHXGd9 +4xADF6ucST7kbD0kbzqCJHOiyFek7gsNaATdF0M7LCCxjW2R4NagmYM73BUIUJQaWaH WgsMLoMJMxGiXaINCanlznfURALL5UiTqWAVqNzrkkusKrzkSp70GtOOG8W9wLqEzpj/ YfEg== X-Gm-Message-State: AC+VfDzo8exY9B4SKUGd3rKOzrK3HbVIsMH0CVUum3cqwcA6pCsH6caZ x/z99CLtQo/Nf1SgcLnqrOCUxdHhwErwYArEP9UPbaTujLJ8yym2Tq8lwyzkJakvv+iUNlmfJb0 lpTnKBorRpZgu+jtkzOeS1PhFeg== X-Received: by 2002:a05:6214:2483:b0:635:dbb4:853e with SMTP id gi3-20020a056214248300b00635dbb4853emr15923412qvb.54.1688049981101; Thu, 29 Jun 2023 07:46:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CgQm3B3HQ8J0z+gAS6H/08cIkKpo/GCX/poZibomgLtQPS418bo46ORUPF/WAp8JuwB//QA== X-Received: by 2002:a05:6214:2483:b0:635:dbb4:853e with SMTP id gi3-20020a056214248300b00635dbb4853emr15923392qvb.54.1688049980886; Thu, 29 Jun 2023 07:46:20 -0700 (PDT) Received: from fedora.redhat.com ([107.171.218.122]) by smtp.gmail.com with ESMTPSA id a17-20020a0ccdd1000000b005dd8b9345b4sm7055590qvn.76.2023.06.29.07.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 07:46:20 -0700 (PDT) From: Adrien Thierry To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I Cc: Adrien Thierry , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v4 1/3] phy: qcom-snps-femto-v2: keep cfg_ahb_clk enabled during runtime suspend Date: Thu, 29 Jun 2023 10:45:38 -0400 Message-Id: <20230629144542.14906-2-athierry@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230629144542.14906-1-athierry@redhat.com> References: <20230629144542.14906-1-athierry@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230629_074625_322021_BD19B6B7 X-CRM114-Status: GOOD ( 14.71 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org In the dwc3 core, both system and runtime suspend end up calling dwc3_suspend_common(). From there, what happens for the PHYs depends on the USB mode and whether the controller is entering system or runtime suspend. HOST mode: (1) system suspend on a non-wakeup-capable controller The [1] if branch is taken. dwc3_core_exit() is called, which ends up calling phy_power_off() and phy_exit(). Those two functions decrease the PM runtime count at some point, so they will trigger the PHY runtime sleep (assuming the count is right). (2) runtime suspend / system suspend on a wakeup-capable controller The [1] branch is not taken. dwc3_suspend_common() calls phy_pm_runtime_put_sync(). Assuming the ref count is right, the PHY runtime suspend op is called. DEVICE mode: dwc3_core_exit() is called on both runtime and system sleep unless the controller is already runtime suspended. OTG mode: (1) system suspend : dwc3_core_exit() is called (2) runtime suspend : do nothing In host mode, the code seems to make a distinction between 1) runtime sleep / system sleep for wakeup-capable controller, and 2) system sleep for non-wakeup-capable controller, where phy_power_off() and phy_exit() are only called for the latter. This suggests the PHY is not supposed to be in a fully powered-off state for runtime sleep and system sleep for wakeup-capable controller. Moreover, downstream, cfg_ahb_clk only gets disabled for system suspend. The clocks are disabled by phy->set_suspend() [2] which is only called in the system sleep path through dwc3_core_exit() [3]. With that in mind, don't disable the clocks during the femto PHY runtime suspend callback. The clocks will only be disabled during system suspend for non-wakeup-capable controllers, through dwc3_core_exit(). [1] https://elixir.bootlin.com/linux/v6.4/source/drivers/usb/dwc3/core.c#L1988 [2] https://git.codelinaro.org/clo/la/kernel/msm-5.4/-/blob/LV.AU.1.2.1.r2-05300-gen3meta.0/drivers/usb/phy/phy-msm-snps-hs.c#L524 [3] https://git.codelinaro.org/clo/la/kernel/msm-5.4/-/blob/LV.AU.1.2.1.r2-05300-gen3meta.0/drivers/usb/dwc3/core.c#L1915 Signed-off-by: Adrien Thierry --- drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c index 6c237f3cc66d..3335480fc395 100644 --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c @@ -165,22 +165,13 @@ static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy) 0, USB2_AUTO_RESUME); } - clk_disable_unprepare(hsphy->cfg_ahb_clk); return 0; } static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy) { - int ret; - dev_dbg(&hsphy->phy->dev, "Resume QCOM SNPS PHY, mode\n"); - ret = clk_prepare_enable(hsphy->cfg_ahb_clk); - if (ret) { - dev_err(&hsphy->phy->dev, "failed to enable cfg ahb clock\n"); - return ret; - } - return 0; } From patchwork Thu Jun 29 14:45:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Thierry X-Patchwork-Id: 13297071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D89BEB64DD for ; Thu, 29 Jun 2023 14:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4r0Vyam/acRe28iFIEsq7E2xi2NHcUR3ckxe31GWVm8=; b=UjxAh2lpsonqfW tDzg49QAZC2PQDWEKCpwfwM1m9EDTyoWxb3B7QGXysMXJK+cKtyCclHAHyrsR45/MHHoIWkfVXz0e GurOSxy9ecIEC3fIR2TgzAb9HlpKR8kp5Tck/uNOlvbINSBz1sfFON2YiqLimyBgJcjiZDcIHJpCy qmjpcbkEkyHPOJOXJIi35YUAZwSnEOiCGkNiOclUlm8e0FnB81iLvMLb3J7uZCHc4eau+ODr8gF4n HpdvEZb5FcZZ59WBRB/pYy8nA41Lty0s1oht7LadeOC1BhQkkZv+Zrfv04nRQ2W45+5lzri15ImGf mQ6wmCaGIwjBfHEy3Qgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qEsuk-001Keg-07; Thu, 29 Jun 2023 14:46:30 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qEsuf-001KdS-2x for linux-phy@lists.infradead.org; Thu, 29 Jun 2023 14:46:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688049985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mJHAjr6KTZnVlwFWvOamTtWU7Nmn1qurp7u5WOjdc6M=; b=aq7PMk87Ys/hPSkrTCGZ6tJ1pj+yCoqt7m0uW8P5Xk/I/R10fpUDrhOx42ZCFj6doHi/XL pKemklTBroE02ryDleeG3PyTwDBOo7ErRHhBjfqApJwfGdOhEYrFZcPxGK2UVvBv1A3dFI xbUU3gHS88HLWzN5SHree+k5rXyeH4U= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-AeVR_hT0MqqIzPdt0vqb0Q-1; Thu, 29 Jun 2023 10:46:24 -0400 X-MC-Unique: AeVR_hT0MqqIzPdt0vqb0Q-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-76597a79a0aso98943485a.1 for ; Thu, 29 Jun 2023 07:46:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688049983; x=1690641983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mJHAjr6KTZnVlwFWvOamTtWU7Nmn1qurp7u5WOjdc6M=; b=P1JoOgVeHuPLb/t3Ti2F6EXLUVQ6hV6n9AJfnV0UJ+dYPOkaAad4+gqOUyy3QhGfGb IkDMCacWlV2Svu9Wr/eGbHbAX3VimzMIqaWqSupP9nYb0dCrixYenBQLkxn4P979EKas K2+jMCmvaICHiRCLMD19V/3ZuhP5cxos9r1pH1M5bTIEXxpS9SeVsNMfA5ZoAFMVbcQ9 idpEBEl5mz6dmIADmyjLPSVHM1Jj5QpgB74DTP3IvnQ/My7JvU/gBlJYKlyyuIeZWEbY 5OFcFGfEun6LKt+Y+hZPCbPoch2igcMSk2/3uFgT6BUTnk83kIhmpPlALiSIR0BeawQL gt8A== X-Gm-Message-State: AC+VfDzOq2eC5KNMB8/ZHJ+OKDAliUdh3nuRugT15JefL2prHAt5eWcK drEcv+5WhPSvVHtwc+NJb+iil4qE1aQhlElGha5F0ufUnOZwyctfDTBZCq97+5c3GZnMNVmoxze yRhFU7ci5OCHTDImSVzowCJTs9Q== X-Received: by 2002:a05:6214:493:b0:62f:ffcc:337a with SMTP id pt19-20020a056214049300b0062fffcc337amr53542791qvb.25.1688049983503; Thu, 29 Jun 2023 07:46:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ha+Mfs7Doj4shg6GNpLPTKkZCYV++sdbCYEyb8MOGt3lEwlYQ8NSoBGVyWNAjXMtZrjqRwQ== X-Received: by 2002:a05:6214:493:b0:62f:ffcc:337a with SMTP id pt19-20020a056214049300b0062fffcc337amr53542772qvb.25.1688049983271; Thu, 29 Jun 2023 07:46:23 -0700 (PDT) Received: from fedora.redhat.com ([107.171.218.122]) by smtp.gmail.com with ESMTPSA id a17-20020a0ccdd1000000b005dd8b9345b4sm7055590qvn.76.2023.06.29.07.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 07:46:22 -0700 (PDT) From: Adrien Thierry To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Wesley Cheng , Manu Gautam , Stephen Boyd , Philipp Zabel Cc: Adrien Thierry , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v4 2/3] phy: qcom-snps-femto-v2: properly enable ref clock Date: Thu, 29 Jun 2023 10:45:39 -0400 Message-Id: <20230629144542.14906-3-athierry@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230629144542.14906-1-athierry@redhat.com> References: <20230629144542.14906-1-athierry@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230629_074626_026164_5C19567F X-CRM114-Status: GOOD ( 20.35 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The driver is not enabling the ref clock, which thus gets disabled by the clk_disable_unused() initcall. This leads to the dwc3 controller failing to initialize if probed after clk_disable_unused() is called, for instance when the driver is built as a module. To fix this, switch to the clk_bulk API to handle both cfg_ahb and ref clocks at the proper places. Note that the cfg_ahb clock is currently not used by any device tree instantiation of the PHY. Work needs to be done separately to fix this. Link: https://lore.kernel.org/linux-arm-msm/ZEqvy+khHeTkC2hf@fedora/ Fixes: 51e8114f80d0 ("phy: qcom-snps: Add SNPS USB PHY driver for QCOM based SOCs") Signed-off-by: Adrien Thierry --- drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 63 ++++++++++++++----- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c index 3335480fc395..6170f8fd118e 100644 --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c @@ -110,11 +110,13 @@ struct phy_override_seq { /** * struct qcom_snps_hsphy - snps hs phy attributes * + * @dev: device structure + * * @phy: generic phy * @base: iomapped memory space for snps hs phy * - * @cfg_ahb_clk: AHB2PHY interface clock - * @ref_clk: phy reference clock + * @num_clks: number of clocks + * @clks: array of clocks * @phy_reset: phy reset control * @vregs: regulator supplies bulk data * @phy_initialized: if PHY has been initialized correctly @@ -122,11 +124,13 @@ struct phy_override_seq { * @update_seq_cfg: tuning parameters for phy init */ struct qcom_snps_hsphy { + struct device *dev; + struct phy *phy; void __iomem *base; - struct clk *cfg_ahb_clk; - struct clk *ref_clk; + int num_clks; + struct clk_bulk_data *clks; struct reset_control *phy_reset; struct regulator_bulk_data vregs[SNPS_HS_NUM_VREGS]; @@ -135,6 +139,34 @@ struct qcom_snps_hsphy { struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS]; }; +static int qcom_snps_hsphy_clk_init(struct qcom_snps_hsphy *hsphy) +{ + struct device *dev = hsphy->dev; + + hsphy->num_clks = 2; + hsphy->clks = devm_kcalloc(dev, hsphy->num_clks, sizeof(*hsphy->clks), GFP_KERNEL); + if (!hsphy->clks) + return -ENOMEM; + + /* + * TODO: Currently no device tree instantiation of the PHY is using the clock. + * This needs to be fixed in order for this code to be able to use devm_clk_bulk_get(). + */ + hsphy->clks[0].id = "cfg_ahb"; + hsphy->clks[0].clk = devm_clk_get_optional(dev, "cfg_ahb"); + if (IS_ERR(hsphy->clks[0].clk)) + return dev_err_probe(dev, PTR_ERR(hsphy->clks[0].clk), + "failed to get cfg_ahb clk\n"); + + hsphy->clks[1].id = "ref"; + hsphy->clks[1].clk = devm_clk_get(dev, "ref"); + if (IS_ERR(hsphy->clks[1].clk)) + return dev_err_probe(dev, PTR_ERR(hsphy->clks[1].clk), + "failed to get ref clk\n"); + + return 0; +} + static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset, u32 mask, u32 val) { @@ -365,16 +397,16 @@ static int qcom_snps_hsphy_init(struct phy *phy) if (ret) return ret; - ret = clk_prepare_enable(hsphy->cfg_ahb_clk); + ret = clk_bulk_prepare_enable(hsphy->num_clks, hsphy->clks); if (ret) { - dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret); + dev_err(&phy->dev, "failed to enable clocks, %d\n", ret); goto poweroff_phy; } ret = reset_control_assert(hsphy->phy_reset); if (ret) { dev_err(&phy->dev, "failed to assert phy_reset, %d\n", ret); - goto disable_ahb_clk; + goto disable_clks; } usleep_range(100, 150); @@ -382,7 +414,7 @@ static int qcom_snps_hsphy_init(struct phy *phy) ret = reset_control_deassert(hsphy->phy_reset); if (ret) { dev_err(&phy->dev, "failed to de-assert phy_reset, %d\n", ret); - goto disable_ahb_clk; + goto disable_clks; } qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_CFG0, @@ -439,8 +471,8 @@ static int qcom_snps_hsphy_init(struct phy *phy) return 0; -disable_ahb_clk: - clk_disable_unprepare(hsphy->cfg_ahb_clk); +disable_clks: + clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks); poweroff_phy: regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); @@ -452,7 +484,7 @@ static int qcom_snps_hsphy_exit(struct phy *phy) struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy); reset_control_assert(hsphy->phy_reset); - clk_disable_unprepare(hsphy->cfg_ahb_clk); + clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks); regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); hsphy->phy_initialized = false; @@ -545,14 +577,15 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev) if (!hsphy) return -ENOMEM; + hsphy->dev = dev; + hsphy->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(hsphy->base)) return PTR_ERR(hsphy->base); - hsphy->ref_clk = devm_clk_get(dev, "ref"); - if (IS_ERR(hsphy->ref_clk)) - return dev_err_probe(dev, PTR_ERR(hsphy->ref_clk), - "failed to get ref clk\n"); + ret = qcom_snps_hsphy_clk_init(hsphy); + if (ret) + return dev_err_probe(dev, ret, "failed to initialize clocks\n"); hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(hsphy->phy_reset)) { From patchwork Thu Jun 29 14:45:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Thierry X-Patchwork-Id: 13297072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0E46EB64D9 for ; Thu, 29 Jun 2023 14:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W5hM0XtpmJGLlwA6b/ji45Wmg+VqPg+HhEC35xOtXWE=; b=HjTA/H1yqkGyqq zoJpTdSPuW1hDMA9mEbp/6uQJlftItrBfAJ0et7HyZLyORI3c0RcsBBvbAB7c7qqbHrj21QsypaaT 1XIv9VpVICqH6QT/g+fOJgzeu297uEwz6dmRVqE5qs/eByyk8DCAOU8iE60Pql8z2+ZcFicEUkcrg tNJym+yhMybv6YuG/bmeENOdN6gEh079PEN66YsKAw4o6KIZMZTNr/3Uow8AW0HsNpVLSJ29GYlVF 4/JHEkbb+WbxWHAK3Y63IXPjNlfikSyBZ3w+zA7ngy4+qAUPahh+mqzWPCbgRDWuXam06InfkcVzY gDFYjWDkjXpLIzV9TSxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qEsum-001Kff-1F; Thu, 29 Jun 2023 14:46:32 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qEsuh-001Kdw-2R for linux-phy@lists.infradead.org; Thu, 29 Jun 2023 14:46:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688049986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=frkGVo4Jix0SxJdEp5WkIhYt82JsoR95HUu7QuiPKvU=; b=NuoyCQ2Hyg7qxjMm0mpgsz439duvP3u/3rd+YOOGqwUedAgW92x5geai6DY8H2CjplykBC tt3vK5taN+9V54in9wP0kZA0uBr0exLwW+QBXq2TfvMeVs//WUsray5YEapnXrZDp+UtY/ hWlb40NymGoElByCbrLafvrpa3ygxtE= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-270-ZCeGcj8GPfaw4nzTe9Me0g-1; Thu, 29 Jun 2023 10:46:25 -0400 X-MC-Unique: ZCeGcj8GPfaw4nzTe9Me0g-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-635e91e5537so8816466d6.2 for ; Thu, 29 Jun 2023 07:46:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688049985; x=1690641985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=frkGVo4Jix0SxJdEp5WkIhYt82JsoR95HUu7QuiPKvU=; b=dijGFhf/hdZWvjRfQyt4BTHp/M2Juy6TkDWePpL9mE7quaF1yDRaST8MfPGT0ottp/ xtiva6lPueFA52NfEykOYqa33MaQaO0ZyZ9hxA1/Qds/arYwA3fVvwybog26226AJPQj +LOUpbfNhl0BXIiZeXzQPQgmXrprX9ZsZnAE7JWyilmWIpJXNBXs4T0xrDDfzHNZmADU lFtax4Oyqqiy0wd63Wd6Jqs0xOFYF+KPFh6N6XFTperg1ON3EqjMpYq7uzy68n794MMd AYW5iceIiNtgEIjLM7ykP7Hoh9VguPTLmY4/nlxURxhbbrU7N3l77w8Ajpq1KY+7qDd7 9mVA== X-Gm-Message-State: AC+VfDzswlX2NFRjYmaExE+wBrvgSzBmhgi6MwYfwnnNYclMQhnX+HYS 8QTw+8RjAZoFcxGW3/k/epaLCMfxtxZ4xhrr/19AwzgS0K5lbgllhMsgI99UMH3YCnxYQczeBF3 CoeT7ei2LDCfTgsNYxcb+e42EVQ== X-Received: by 2002:a05:6214:e4b:b0:631:ed13:b286 with SMTP id o11-20020a0562140e4b00b00631ed13b286mr33755938qvc.26.1688049985346; Thu, 29 Jun 2023 07:46:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ74djRCokcr0OekNQKJ/UsWDEjH1oj9tvMOrgNFcOaxaU9DKrR6QyWHwiiSm2lavDbeQFZTFg== X-Received: by 2002:a05:6214:e4b:b0:631:ed13:b286 with SMTP id o11-20020a0562140e4b00b00631ed13b286mr33755923qvc.26.1688049985118; Thu, 29 Jun 2023 07:46:25 -0700 (PDT) Received: from fedora.redhat.com ([107.171.218.122]) by smtp.gmail.com with ESMTPSA id a17-20020a0ccdd1000000b005dd8b9345b4sm7055590qvn.76.2023.06.29.07.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 07:46:24 -0700 (PDT) From: Adrien Thierry To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I Cc: Adrien Thierry , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v4 3/3] phy: qcom-snps-femto-v2: use qcom_snps_hsphy_suspend/resume error code Date: Thu, 29 Jun 2023 10:45:40 -0400 Message-Id: <20230629144542.14906-4-athierry@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230629144542.14906-1-athierry@redhat.com> References: <20230629144542.14906-1-athierry@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230629_074627_864521_F3FD971E X-CRM114-Status: UNSURE ( 9.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The return value from qcom_snps_hsphy_suspend/resume is not used. Make sure qcom_snps_hsphy_runtime_suspend/resume return this value as well. Signed-off-by: Adrien Thierry --- drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c index 6170f8fd118e..d0319bee01c0 100644 --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c @@ -214,8 +214,7 @@ static int __maybe_unused qcom_snps_hsphy_runtime_suspend(struct device *dev) if (!hsphy->phy_initialized) return 0; - qcom_snps_hsphy_suspend(hsphy); - return 0; + return qcom_snps_hsphy_suspend(hsphy); } static int __maybe_unused qcom_snps_hsphy_runtime_resume(struct device *dev) @@ -225,8 +224,7 @@ static int __maybe_unused qcom_snps_hsphy_runtime_resume(struct device *dev) if (!hsphy->phy_initialized) return 0; - qcom_snps_hsphy_resume(hsphy); - return 0; + return qcom_snps_hsphy_resume(hsphy); } static int qcom_snps_hsphy_set_mode(struct phy *phy, enum phy_mode mode,