Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1321064rwd; Wed, 31 May 2023 12:12:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QhJEMAxbpMR3XgSNtxyxM6H1bg35cv+OqABufxuTmp5HkYvfAh7A4gofhnz0CrS5YOorx X-Received: by 2002:a05:6a00:174b:b0:64d:2e8a:4ccb with SMTP id j11-20020a056a00174b00b0064d2e8a4ccbmr6163324pfc.14.1685560367579; Wed, 31 May 2023 12:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685560367; cv=none; d=google.com; s=arc-20160816; b=eeER1QlsmSW7RVjc+5mmFrN8OXrPmTimlD7JdXWq+7qoSC20uB3b2O89lg36Zv7Eu8 aPFqOR3qHe+DRD3+Xi2IDh4MXPyOOQEBVeWuzuaDUsSz7J/VsqMeSRUbQ7UHaG9uuVcH sgierYI9T1JL+mTOs7Ni/UBX+9sUk/cbWZ88uu4AgMKSqQl6ZPK/VOF8xlff1nN5VRch 8ScwSe6xrThe4fuZ1S9BqXkWkoRtwWgSPJNdhkfSoCV5xxQnU0CV9YwQ9smkzx9hNjHH cS49cYFnEqsbo1VF5iC7FytEk5i+9PntF4Wxb92elBJP3Vo60215m67qMQieIVodaON0 pCXg== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=zyxR30g2bKMnEjOEuROEiWjiUjocH3rGbPWdVsGv92s=; b=OQ/vwf+0hzYi7giIyLuq5wDqPfWvAtzM6fcSRwv/zfTCPGNMN5kj6l5YpieM7lHUqA eFu7vquADM2h8o6ojQl8KvLm/AOi+coLEw9mybsVosXYlHfiVu8sbatOj+hmTjrSF26V MnQjJKibvo0dpROaW7Uo+Pq1YGTeW+0izrWHmP8LXs84fa2GpLQok3KJJwuDPnp+jDCj DRqb7nM06BJc7pxh2JmW07KyyTM0T1UaKPJ/bjL2mZQd9rhRyX4X0eb+5P1pexgkmqLe R+EYv3JCgRkp3pIa6XQjCmmm5H98viFDBITGpLob41ItkI1RkxNrJ+jIY18M6hpQpGgS T9Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Ye2IWrnh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020aa796e4000000b006443da2b461si2801828pfq.220.2023.05.31.12.12.33; Wed, 31 May 2023 12:12:47 -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=@gmail.com header.s=20221208 header.b=Ye2IWrnh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbjEaTJe (ORCPT + 99 others); Wed, 31 May 2023 15:09:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbjEaTJ0 (ORCPT ); Wed, 31 May 2023 15:09:26 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B20DB125; Wed, 31 May 2023 12:08:56 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5147e441c33so240614a12.0; Wed, 31 May 2023 12:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685560135; x=1688152135; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zyxR30g2bKMnEjOEuROEiWjiUjocH3rGbPWdVsGv92s=; b=Ye2IWrnhoxGCqV8CGZvUTZnGQFK30FN7eFPb3mkua59MXfEURFTToTqMIc9p4HZwMP wFzjlVy9+QNsDn11n5oBQPUWKVZnTri5EvZYXX1lbvupKK/+7zMxPcBPoMJN839ELKW9 a1pgRCPWS7GNpT+c1HzgV+ns6eEcXkOses3w16nXfaSiXwV1vQJr86mZsPBcDWh3byPy lPMencn3DjE+it5T1fGr1w6nHJ67qk4Bc8giOLvY+PenGdUi6wMJS29BtBXJdbiVu/+6 gZaLhB2bkTvf02Mdre9GTMnAcN8mLKnnjMiRp55fte9LFOqZf4BXk3L4hm5yihFbKZDz XFMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685560135; x=1688152135; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zyxR30g2bKMnEjOEuROEiWjiUjocH3rGbPWdVsGv92s=; b=IWpyQphcW6Z5uhCXJTtrPBNMDEutfQlECtR3IN/QE/b4R3cT9BPhuYOyEirPRM8sqr prMKBpA5fruEx8XnGNuqIkkrLU2o8Z61/EGfjYF9l45ShbuJYN6N7H4DxfnVqRP3DNZz eIuSacu7WvxvdPU5Ht//0wBRExNS/RNbFrb8yGE+1mQqJU4OAhHtyH34WE/c/9P/hV8+ DHVfP7nc+PcClFZ6xqS/dveeIT8qEa+L2U8KeUZgy8fFvAgB37vpP1fLazQpavNjOehV TY6UD6GzYPw+M761+S01IyIVDcETHD3J7+4C9plBWsuCEzJzcCY1kXHS0MRyYA4WfczR GklQ== X-Gm-Message-State: AC+VfDzCd127y1refm3+AEVDP9wKa3tFGDwK63Owm7rgfkazVeZGWiC3 iFJj+OIbKi5/RveJ/wd/G6c= X-Received: by 2002:a05:6402:5107:b0:514:9311:e83a with SMTP id m7-20020a056402510700b005149311e83amr7142584edd.8.1685560134877; Wed, 31 May 2023 12:08:54 -0700 (PDT) Received: from ?IPV6:2a01:c23:c18f:4600:8999:532:b66e:c213? (dynamic-2a01-0c23-c18f-4600-8999-0532-b66e-c213.c23.pool.telefonica.de. [2a01:c23:c18f:4600:8999:532:b66e:c213]) by smtp.googlemail.com with ESMTPSA id d25-20020a50fb19000000b0050cc4461fc5sm6101880edq.92.2023.05.31.12.08.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 May 2023 12:08:54 -0700 (PDT) Message-ID: <4a6c413c-8791-fd00-a73e-7a12413693e3@gmail.com> Date: Wed, 31 May 2023 21:08:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH 2/2] net: phy: realtek: Add optional external PHY clock To: Detlev Casanova , linux-kernel@vger.kernel.org Cc: Andrew Lunn , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , netdev@vger.kernel.org, devicetree@vger.kernel.org References: <20230531150340.522994-1-detlev.casanova@collabora.com> <20230531150340.522994-2-detlev.casanova@collabora.com> Content-Language: en-US From: Heiner Kallweit In-Reply-To: <20230531150340.522994-2-detlev.casanova@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org On 31.05.2023 17:03, Detlev Casanova wrote: > In some cases, the PHY can use an external clock source instead of a > crystal. > > Add an optional clock in the phy node to make sure that the clock source > is enabled, if specified, before probing. > > Signed-off-by: Detlev Casanova > --- > drivers/net/phy/realtek.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c > index 3d99fd6664d7..70c75dbbf799 100644 > --- a/drivers/net/phy/realtek.c > +++ b/drivers/net/phy/realtek.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > > #define RTL821x_PHYSR 0x11 > #define RTL821x_PHYSR_DUPLEX BIT(13) > @@ -80,6 +81,7 @@ struct rtl821x_priv { > u16 phycr1; > u16 phycr2; > bool has_phycr2; > + struct clk *clk; > }; > > static int rtl821x_read_page(struct phy_device *phydev) > @@ -103,6 +105,11 @@ static int rtl821x_probe(struct phy_device *phydev) > if (!priv) > return -ENOMEM; > > + priv->clk = devm_clk_get_optional_enabled(dev, "xtal"); Why add priv->clk if it isn't used outside probe()? How about suspend/resume? Would it make sense to stop the clock whilst PHY is suspended? > + if (IS_ERR(priv->clk)) > + return dev_err_probe(dev, PTR_ERR(priv->clk), > + "failed to get phy xtal clock\n"); > + > ret = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR1); > if (ret < 0) > return ret;