From: Kishon Vijay Abraham I <kishon@ti.com>
To: Swapnil Kashinath Jakhade <sjakhade@cadence.com>,
Vinod Koul <vkoul@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Lokesh Vutla <lokeshvutla@ti.com>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>
Subject: Re: [PATCH 3/4] phy: cadence-torrent: Do not configure SERDES if it's already configured
Date: Tue, 30 Mar 2021 15:27:22 +0530 [thread overview]
Message-ID: <88abbe18-8bc9-8f64-ceb5-df178a0f21d9@ti.com> (raw)
In-Reply-To: <MN2PR07MB61607501847D2DD1C62A84F0C5699@MN2PR07MB6160.namprd07.prod.outlook.com>
Hi Swapnil,
On 18/03/21 3:25 pm, Swapnil Kashinath Jakhade wrote:
>
>
>> -----Original Message-----
>> From: Kishon Vijay Abraham I <kishon@ti.com>
>> Sent: Wednesday, March 10, 2021 9:25 PM
>> To: Kishon Vijay Abraham I <kishon@ti.com>; Vinod Koul
>> <vkoul@kernel.org>; Rob Herring <robh+dt@kernel.org>; Philipp Zabel
>> <p.zabel@pengutronix.de>; Swapnil Kashinath Jakhade
>> <sjakhade@cadence.com>
>> Cc: linux-kernel@vger.kernel.org; devicetree@vger.kernel.org; Lokesh Vutla
>> <lokeshvutla@ti.com>; linux-phy@lists.infradead.org
>> Subject: [PATCH 3/4] phy: cadence-torrent: Do not configure SERDES if it's
>> already configured
>>
>> EXTERNAL MAIL
>>
>>
>> Do not configure torrent SERDES if it's already configured.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>> drivers/phy/cadence/phy-cadence-torrent.c | 32 ++++++++++++++++-------
>> 1 file changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/phy/cadence/phy-cadence-torrent.c
>> b/drivers/phy/cadence/phy-cadence-torrent.c
>> index ab51c4bf7b30..5ee1657f5a1c 100644
>> --- a/drivers/phy/cadence/phy-cadence-torrent.c
>> +++ b/drivers/phy/cadence/phy-cadence-torrent.c
>> @@ -371,6 +371,10 @@ static const struct phy_ops cdns_torrent_phy_ops =
>> {
>> .owner = THIS_MODULE,
>> };
>>
>> +static const struct phy_ops noop_ops = {
>> + .owner = THIS_MODULE,
>> +};
>> +
>> struct cdns_reg_pairs {
>> u32 val;
>> u32 off;
>> @@ -2306,6 +2310,7 @@ static int cdns_torrent_phy_probe(struct
>> platform_device *pdev)
>> struct device_node *child;
>> int ret, subnodes, node = 0, i;
>> u32 total_num_lanes = 0;
>> + int already_configured;
>> u8 init_dp_regmap = 0;
>> u32 phy_type;
>>
>> @@ -2344,16 +2349,20 @@ static int cdns_torrent_phy_probe(struct
>> platform_device *pdev)
>> if (ret)
>> return ret;
>>
>> - ret = cdns_torrent_reset(cdns_phy);
>> - if (ret)
>> - goto clk_cleanup;
>> + regmap_field_read(cdns_phy->phy_pma_cmn_ctrl_1,
>> &already_configured);
>>
>> - ret = cdns_torrent_clk(cdns_phy);
>> - if (ret)
>> - goto clk_cleanup;
>> + if (!already_configured) {
>> + ret = cdns_torrent_reset(cdns_phy);
>> + if (ret)
>> + goto clk_cleanup;
>> +
>> + ret = cdns_torrent_clk(cdns_phy);
>> + if (ret)
>> + goto clk_cleanup;
>>
> Should if (!already_configured) be checked while calling clk_disable_unprepare()?
Both clk_unprepare() and clk_disable() checks for passed clk for ERR or
NULL. So don't think it's necessary to have !already_configured check.
> Otherwise,
> Reviewed-by: Swapnil Jakhade <sjakhade@cadence.com>
Thanks
Kishon
>
> Thanks & regards,
> Swapnil
>
>> - /* Enable APB */
>> - reset_control_deassert(cdns_phy->apb_rst);
>> + /* Enable APB */
>> + reset_control_deassert(cdns_phy->apb_rst);
>> + }
>>
>> for_each_available_child_of_node(dev->of_node, child) {
>> struct phy *gphy;
>> @@ -2423,7 +2432,10 @@ static int cdns_torrent_phy_probe(struct
>> platform_device *pdev)
>> of_property_read_u32(child, "cdns,ssc-mode",
>> &cdns_phy->phys[node].ssc_mode);
>>
>> - gphy = devm_phy_create(dev, child,
>> &cdns_torrent_phy_ops);
>> + if (!already_configured)
>> + gphy = devm_phy_create(dev, child,
>> &cdns_torrent_phy_ops);
>> + else
>> + gphy = devm_phy_create(dev, child, &noop_ops);
>> if (IS_ERR(gphy)) {
>> ret = PTR_ERR(gphy);
>> goto put_child;
>> @@ -2507,7 +2519,7 @@ static int cdns_torrent_phy_probe(struct
>> platform_device *pdev)
>> goto put_lnk_rst;
>> }
>>
>> - if (cdns_phy->nsubnodes > 1) {
>> + if (cdns_phy->nsubnodes > 1 && !already_configured) {
>> ret = cdns_torrent_phy_configure_multilink(cdns_phy);
>> if (ret)
>> goto put_lnk_rst;
>> --
>> 2.17.1
>
next prev parent reply other threads:[~2021-03-30 9:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 15:54 [PATCH 0/4] j721e-wiz/cadence-torrent: Support to skip SERDES configuration Kishon Vijay Abraham I
2021-03-10 15:54 ` [PATCH 1/4] phy: ti: j721e-wiz: Do not configure wiz if its already configured Kishon Vijay Abraham I
2021-03-10 15:54 ` [PATCH 2/4] phy: cadence-torrent: Group reset APIs and clock APIs Kishon Vijay Abraham I
2021-03-18 9:56 ` Swapnil Kashinath Jakhade
2021-03-10 15:54 ` [PATCH 3/4] phy: cadence-torrent: Do not configure SERDES if it's already configured Kishon Vijay Abraham I
2021-03-18 9:55 ` Swapnil Kashinath Jakhade
2021-03-30 9:57 ` Kishon Vijay Abraham I [this message]
2021-03-10 15:54 ` [PATCH 4/4] phy: cadence-torrent: Explicitly request exclusive reset control Kishon Vijay Abraham I
2021-03-18 9:58 ` Swapnil Kashinath Jakhade
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88abbe18-8bc9-8f64-ceb5-df178a0f21d9@ti.com \
--to=kishon@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=lokeshvutla@ti.com \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=sjakhade@cadence.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).