Message ID | 20230414152423.19842-2-ddrokosov@sberdevices.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp466832vqo; Fri, 14 Apr 2023 08:29:10 -0700 (PDT) X-Google-Smtp-Source: AKy350Zv80CRFm579RnxoVaqKsfy/TbYo7CFQQOMcEy4KV/zNClC/09Mph1Anhpbrm8SOEwSQYtx X-Received: by 2002:a05:6a20:4982:b0:e8:fe82:5843 with SMTP id fs2-20020a056a20498200b000e8fe825843mr5897057pzb.45.1681486150591; Fri, 14 Apr 2023 08:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681486150; cv=none; d=google.com; s=arc-20160816; b=RTNkdFr/JrGLVSebyClSaPV/7S2QBJsSKxpfKGXwTRa2l7byttWtHCmWu0pMbPButh Rc6r52tGauEd47KeYF8qkpibPLJ8w0bZ7j3LWOiO4ESesSA4JnTPx5KpZvve1ye4c/wD aJutXBlywQ+xaRbx9O1xoKEPvsV06rA3/TR6IQwKHZZDu+g45E77CrFIYLXWC2A2zRJY LwMsprTxn0UQeGELSFqqT84JBYDjtQXyP4lP2VVzO6c1bGEY1qVbgJopsCmEbFZlBlVr XbnFav2wte9QAi22hNCO9jUNeiTQ8q3b52tmvx48A7G6lcwmwQCxc+lZyVUqzf0knSEp F9IQ== 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=tOUyWscI9lZ1BfORK8wKAfGeDsR5jeAkMWXUSzV4nOo=; b=Xz5G3kTjFCvwUUCe/flZAg4KSbiyomvrZfkqDOjp8eq9TD1NT1oMygnA0N1HUzwhNb J3HgZdQp1akOm/AHakcdvjtxNTNSmwAh5l2lHvkzMHXfixOoAZ1DJQ6Oa4fNZCMjC6i7 0YE706UT7IoBGUI6hdy/XAdB5VlZbGC1LEehoLMRt30r8fJUQ8Q57EC7f9elXUemPyiO biSYVbM4GN4AD++sLB1PchHITGWwabEHIeBsakJFwS0kI2ubb5PHa4OvOykNIc65Knry /XtwQNwEY+n0uVzGR7M18EYwsiYJRG34JI720OdzYd4lzeXiG+RlrD+B0u1PsMxddwcN OVyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=CFdpljeg; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2-20020a630d42000000b004fb7e7ef77dsi4889346pgn.693.2023.04.14.08.28.57; Fri, 14 Apr 2023 08:29:10 -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=CFdpljeg; 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 S230368AbjDNPYi (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Fri, 14 Apr 2023 11:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjDNPYh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Apr 2023 11:24:37 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D90AD29; Fri, 14 Apr 2023 08:24:35 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 1D0375FD24; Fri, 14 Apr 2023 18:24:33 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1681485873; bh=tOUyWscI9lZ1BfORK8wKAfGeDsR5jeAkMWXUSzV4nOo=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=CFdpljegFDGexcztw33NhE658VcGlcFo5wn3igYeJFqCtORsOzU1iJZtNx5OimR/Y yrWTJo1YWhhrl+k6uGaY0UtI+OpMNNpWiDZoxhjzFUJ/Q5PK+Ra57awx4f5TUZNIzv 1ouylhk4YsGKFNyAtBKR2dLW1xkSnUEP9FnyRkFofutwcV4uyDLEZIAAY1l3cWXehw hd6oIkmEoGKt4L2uEmlsUdSK5/mVTzLdzekjD/fDlr7Dit+h1uDMHIYZEoZfb6LqtS ZLcSfn2SSLUPzZ5jCA/DCJi9HoDnbTYfRaukxs5vN3AGDjRiYc7J0mF1jkLj8R2oFx p2KNLorzVL5zQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Fri, 14 Apr 2023 18:24:33 +0300 (MSK) From: Dmitry Rokosov <ddrokosov@sberdevices.ru> To: <gregkh@linuxfoundation.org>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <neil.armstrong@linaro.org>, <khilman@baylibre.com>, <jbrunet@baylibre.com>, <martin.blumenstingl@googlemail.com>, <mturquette@baylibre.com>, <vkoul@kernel.org>, <kishon@kernel.org>, <hminas@synopsys.com>, <Thinh.Nguyen@synopsys.com> CC: <yue.wang@amlogic.com>, <hanjie.lin@amlogic.com>, <kernel@sberdevices.ru>, <rockosov@gmail.com>, <linux-usb@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-amlogic@lists.infradead.org>, <linux-phy@lists.infradead.org>, Dmitry Rokosov <ddrokosov@sberdevices.ru> Subject: [PATCH v1 1/5] phy: amlogic: during USB PHY clkin obtaining, enable it Date: Fri, 14 Apr 2023 18:24:19 +0300 Message-ID: <20230414152423.19842-2-ddrokosov@sberdevices.ru> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230414152423.19842-1-ddrokosov@sberdevices.ru> References: <20230414152423.19842-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-EXCH01.sberdevices.ru (172.16.1.4) 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/14 08:08:00 #21104846 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_PASS, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763166021589383406?= X-GMAIL-MSGID: =?utf-8?q?1763166021589383406?= |
Series |
arm64: meson: support Amlogic A1 USB OTG controller
|
|
Commit Message
Dmitry Rokosov
April 14, 2023, 3:24 p.m. UTC
Previously, all Amlogic boards used the XTAL clock as the USB PHY input
clock, and it did not need to be enabled as it was the default board
clock. However, in new Amlogic SoCs such as the A1 family, USB PHY uses
a gated clock, so it is necessary to enable this gated clock during
probing.
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
drivers/phy/amlogic/phy-meson-g12a-usb2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Dmitry, On Fri, Apr 14, 2023 at 5:24 PM Dmitry Rokosov <ddrokosov@sberdevices.ru> wrote: [...] > - priv->clk = devm_clk_get(dev, "xtal"); > + priv->clk = devm_clk_get_enabled(dev, "xtal"); Generally this works fine but I wouldn't recommend this approach if: - there's some required wait time after the clock has been enabled (see phy_meson_g12a_usb2_init - there's already some required wait time after triggering the reset) - clock gating (for power saving) is needed when the dwc3 driver is unloaded by the PHY driver is not In this case: just manually manage the clock in phy_meson_g12a_usb2_{init,exit} Best regards, Martin
On Sun, Apr 16, 2023 at 10:54:17PM +0200, Martin Blumenstingl wrote: > Hi Dmitry, > > On Fri, Apr 14, 2023 at 5:24 PM Dmitry Rokosov <ddrokosov@sberdevices.ru> wrote: > [...] > > - priv->clk = devm_clk_get(dev, "xtal"); > > + priv->clk = devm_clk_get_enabled(dev, "xtal"); > Generally this works fine but I wouldn't recommend this approach if: > - there's some required wait time after the clock has been enabled > (see phy_meson_g12a_usb2_init - there's already some required wait > time after triggering the reset) > - clock gating (for power saving) is needed when the dwc3 driver is > unloaded by the PHY driver is not > > In this case: just manually manage the clock in phy_meson_g12a_usb2_{init,exit} I'm sorry, but I'm not fully understanding your point. Currently, no sleeps are required for this clock and we don't have any logic for power saving (g12a phy_ops doesn't have power_on()/power_off() implementation). However, I believe all of your arguments make sense for the future development of the phy_meson_g12a_usb2 driver. Is that correct?
diff --git a/drivers/phy/amlogic/phy-meson-g12a-usb2.c b/drivers/phy/amlogic/phy-meson-g12a-usb2.c index 9d1efa0d9394..26b99fbe1026 100644 --- a/drivers/phy/amlogic/phy-meson-g12a-usb2.c +++ b/drivers/phy/amlogic/phy-meson-g12a-usb2.c @@ -315,7 +315,7 @@ static int phy_meson_g12a_usb2_probe(struct platform_device *pdev) if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); - priv->clk = devm_clk_get(dev, "xtal"); + priv->clk = devm_clk_get_enabled(dev, "xtal"); if (IS_ERR(priv->clk)) return PTR_ERR(priv->clk);