Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp571800rwr; Wed, 26 Apr 2023 03:31:35 -0700 (PDT) X-Google-Smtp-Source: AKy350YzKjHWsTv5doBPL87gLslZUil/f6st/2o2Ea9o0oD8Wq3ELo7wOCSIJysC5nQR57Nh8Peu X-Received: by 2002:a17:902:e94c:b0:19e:6e00:4676 with SMTP id b12-20020a170902e94c00b0019e6e004676mr25141470pll.61.1682505095059; Wed, 26 Apr 2023 03:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682505095; cv=none; d=google.com; s=arc-20160816; b=Pj16rHnl5ICeHovAdtHWI9B/WnzW1omnDxwWLnGD3vRHkVZRNzfIcMu3P9QEaFs8lU sVFYxEHpBtvPDwxXO0dhMOvWdzLYkBaBhh4KBqTc7ZTWa4CIOZYCluOuweIV2oSDHnSB 0z9OQAdRnAk/KqdXJDOVg4uOsgkBxBlzoKknbzA0irvZ3XRv8ErU1LtIGLSyl56xP2dD jT2SWYG8Fdp74pB0wQBtB9C3Lt3LNeF2wqcbX6aMFeMHlGV65g9GXtNo7p/CH6Zax3hX gA6Zx8eZeg48MGcJWdugpvuPaC8FJHaiGr5B2rQ6wsZU2UhrU8yQ/pXlhdh0CBzBdDMq wsZw== 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 :dkim-signature; bh=2iTDEsndR82cnln9Q9SqkIaok7IFFDU8o3YeSEDTGF4=; b=rY6HTTPxbr7NbGebfKxf8PL7Y6DJ3WSEvYMHwrXbOMKllVXAKmfHrivXP+kOyIaz7t h3QABMzG0Sprd2gl5qzm5TUkm1Ep6w2/y5Z9XIPxGxWaTySSF5VxkqBGG08bpYu+59DQ m8Xwe8Sg644piuDbyKvXSlljYgzIql67RpAOQidVCWt31o4WO3HjbXduwj8OxgTom/cq qqSEfaVGj4+tvhjmFjC5SOUNumDyxDJO3iBqPhuWp8c9hCFLPam8b3OWSiaaCm6lOXwH EcVH4BlWOjTHCKCmyh8dFepcqRSpzI6vakJTkjLwSJ2Hy5ykRNBfvRuDSHuQrZ2e3zMe 6tKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=UWTpX6du; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a170902ecca00b001a1eac2df75si6896572plh.490.2023.04.26.03.31.23; Wed, 26 Apr 2023 03:31:35 -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=@sberdevices.ru header.s=mail header.b=UWTpX6du; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240439AbjDZK3y (ORCPT + 99 others); Wed, 26 Apr 2023 06:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbjDZK3l (ORCPT ); Wed, 26 Apr 2023 06:29:41 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7504B49DD; Wed, 26 Apr 2023 03:29:39 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id C65D65FD7B; Wed, 26 Apr 2023 13:29:37 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1682504977; bh=2iTDEsndR82cnln9Q9SqkIaok7IFFDU8o3YeSEDTGF4=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=UWTpX6duaX2IAVpAWjNY+DnGpWEl9biaL1HpLEZLhnPWQd/jmgFvtA3iUtcTECWhL jnvnlvuNHprUDG+ktoCUwdHZb13SylUlo9lKBdudwwuXH1Pe4slJqyZLo703hNW55g wXN5GtR7mKp5t7x2P4JhAKLRSNfa5ru9NSCj2csc86NG67suAlfUEuEhI4lTCM7r5z wUykuePqRAg2KKNoE5B8YbhGgvAhzn9+jdU6LIOQ7KnebKcDf26DQTkv6QDWmL35V/ 3kIS1G1C/lSsnHrIUsmOUGEtw1lJLjfiwMtJiO8cuY/tzdTbRMVKEbm6KbvDQhTI/r nSjkT05vE1vRA== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Wed, 26 Apr 2023 13:29:37 +0300 (MSK) From: Dmitry Rokosov To: , , , , , , , , , , , CC: , , , , , , , , , , Dmitry Rokosov Subject: [PATCH v3 1/5] phy: amlogic: enable/disable clkin during Amlogic USB PHY init/exit Date: Wed, 26 Apr 2023 13:29:18 +0300 Message-ID: <20230426102922.19705-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230426102922.19705-1-ddrokosov@sberdevices.ru> References: <20230426102922.19705-1-ddrokosov@sberdevices.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/04/26 04:45:00 #21166225 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Previously, all Amlogic boards used the XTAL clock as the default board clock for the USB PHY input, so there was no need to enable it. However, with the introduction of new Amlogic SoCs like the A1 family, the USB PHY now uses a gated clock. Hence, it is necessary to enable this gated clock during the PHY initialization sequence, or disable it during the PHY exit, as appropriate. Signed-off-by: Dmitry Rokosov --- drivers/phy/amlogic/phy-meson-g12a-usb2.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb2.c b/drivers/phy/amlogic/phy-meson-g12a-usb2.c index 9d1efa0d9394..ec2555bb83d5 100644 --- a/drivers/phy/amlogic/phy-meson-g12a-usb2.c +++ b/drivers/phy/amlogic/phy-meson-g12a-usb2.c @@ -172,10 +172,16 @@ static int phy_meson_g12a_usb2_init(struct phy *phy) int ret; unsigned int value; - ret = reset_control_reset(priv->reset); + ret = clk_prepare_enable(priv->clk); if (ret) return ret; + ret = reset_control_reset(priv->reset); + if (ret) { + clk_disable_unprepare(priv->clk); + return ret; + } + udelay(RESET_COMPLETE_TIME); /* usb2_otg_aca_en == 0 */ @@ -277,8 +283,13 @@ static int phy_meson_g12a_usb2_init(struct phy *phy) static int phy_meson_g12a_usb2_exit(struct phy *phy) { struct phy_meson_g12a_usb2_priv *priv = phy_get_drvdata(phy); + int ret; + + ret = reset_control_reset(priv->reset); + if (!ret) + clk_disable_unprepare(priv->clk); - return reset_control_reset(priv->reset); + return ret; } /* set_mode is not needed, mode setting is handled via the UTMI bus */ -- 2.36.0