From: Ravi Gunasekaran <r-gunasekaran@ti.com> To: Andrew Lunn <andrew@lunn.ch> Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <linux-omap@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <kishon@ti.com>, <vigneshr@ti.com> Subject: Re: [PATCH v2 net-next] net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 Date: Thu, 11 Aug 2022 12:30:00 +0530 [thread overview] Message-ID: <9d17ab9f-1679-4af1-f85c-a538cb330d7b@ti.com> (raw) In-Reply-To: <YvRNpAdG7/edUEc+@lunn.ch> On 11/08/22 6:00 am, Andrew Lunn wrote: >> +static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg) >> +{ >> + int ret; >> + struct mdiobb_ctrl *ctrl = bus->priv; >> + struct davinci_mdio_data *data; >> + >> + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); >> + >> + if (phy & ~PHY_REG_MASK || reg & ~PHY_ID_MASK) >> + return -EINVAL; > > You don't need this. Leave it up to the bit banging code to do the > validation. This also breaks C45, which the bit banging code can do, > and it looks like the hardware cannot. I will remove these validation. >> + >> + ret = pm_runtime_resume_and_get(data->dev); >> + if (ret < 0) >> + return ret; >> + >> + ret = mdiobb_read(bus, phy, reg); >> + >> + pm_runtime_mark_last_busy(data->dev); >> + pm_runtime_put_autosuspend(data->dev); > > Once you take the validation out, this function then all becomes about > runtime power management. Should the bit banging core actually be > doing this? It seems like it is something which could be useful for > other devices. > > struct mii_bus has a parent member. If set, you could apply these run > time PM functions to that. Please add a patch to modify the core bit > banging code, and then you should be able to remove these helpers. Devices may or may not be configured for runtime autosuspend, and perhaps may not even use runtime PM. pm_runtime_enabled() and the autosuspend configuration could be addressed by checking against dev->power.use_autosuspend flag. But if the runtime PM functions are added to the bit banging core, would it not restrict the usage of pm_runtime_put_*() variants for others? There is atleast one device sh_eth, which is not configured for autosuspend but uses the bit bang core in sh_mdiobb_read() and invokes regular runtime PM functions. >> static int davinci_mdio_probe(struct platform_device *pdev) >> { >> struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev); >> @@ -340,12 +535,30 @@ static int davinci_mdio_probe(struct platform_device *pdev) >> struct phy_device *phy; >> int ret, addr; >> int autosuspend_delay_ms = -1; >> + const struct soc_device_attribute *soc_match_data; > > netdev uses reverse christmas tree. Variables should be sorted longest > first, shortest last. Noted. I will fix this as well. -- Regards, Ravi
WARNING: multiple messages have this Message-ID (diff)
From: Ravi Gunasekaran <r-gunasekaran@ti.com> To: Andrew Lunn <andrew@lunn.ch> Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <linux-omap@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <kishon@ti.com>, <vigneshr@ti.com> Subject: Re: [PATCH v2 net-next] net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 Date: Thu, 11 Aug 2022 12:30:00 +0530 [thread overview] Message-ID: <9d17ab9f-1679-4af1-f85c-a538cb330d7b@ti.com> (raw) In-Reply-To: <YvRNpAdG7/edUEc+@lunn.ch> On 11/08/22 6:00 am, Andrew Lunn wrote: >> +static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg) >> +{ >> + int ret; >> + struct mdiobb_ctrl *ctrl = bus->priv; >> + struct davinci_mdio_data *data; >> + >> + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); >> + >> + if (phy & ~PHY_REG_MASK || reg & ~PHY_ID_MASK) >> + return -EINVAL; > > You don't need this. Leave it up to the bit banging code to do the > validation. This also breaks C45, which the bit banging code can do, > and it looks like the hardware cannot. I will remove these validation. >> + >> + ret = pm_runtime_resume_and_get(data->dev); >> + if (ret < 0) >> + return ret; >> + >> + ret = mdiobb_read(bus, phy, reg); >> + >> + pm_runtime_mark_last_busy(data->dev); >> + pm_runtime_put_autosuspend(data->dev); > > Once you take the validation out, this function then all becomes about > runtime power management. Should the bit banging core actually be > doing this? It seems like it is something which could be useful for > other devices. > > struct mii_bus has a parent member. If set, you could apply these run > time PM functions to that. Please add a patch to modify the core bit > banging code, and then you should be able to remove these helpers. Devices may or may not be configured for runtime autosuspend, and perhaps may not even use runtime PM. pm_runtime_enabled() and the autosuspend configuration could be addressed by checking against dev->power.use_autosuspend flag. But if the runtime PM functions are added to the bit banging core, would it not restrict the usage of pm_runtime_put_*() variants for others? There is atleast one device sh_eth, which is not configured for autosuspend but uses the bit bang core in sh_mdiobb_read() and invokes regular runtime PM functions. >> static int davinci_mdio_probe(struct platform_device *pdev) >> { >> struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev); >> @@ -340,12 +535,30 @@ static int davinci_mdio_probe(struct platform_device *pdev) >> struct phy_device *phy; >> int ret, addr; >> int autosuspend_delay_ms = -1; >> + const struct soc_device_attribute *soc_match_data; > > netdev uses reverse christmas tree. Variables should be sorted longest > first, shortest last. Noted. I will fix this as well. -- Regards, Ravi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-08-11 7:00 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-10 11:13 [PATCH v2 net-next] net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 Ravi Gunasekaran 2022-08-10 11:13 ` Ravi Gunasekaran 2022-08-11 0:30 ` Andrew Lunn 2022-08-11 0:30 ` Andrew Lunn 2022-08-11 7:00 ` Ravi Gunasekaran [this message] 2022-08-11 7:00 ` Ravi Gunasekaran 2022-08-11 12:57 ` Andrew Lunn 2022-08-11 12:57 ` Andrew Lunn 2022-08-12 4:36 ` Ravi Gunasekaran 2022-08-12 4:36 ` Ravi Gunasekaran 2022-08-12 15:54 ` Andrew Lunn 2022-08-12 15:54 ` Andrew Lunn 2022-08-16 4:26 ` Ravi Gunasekaran 2022-08-16 4:26 ` Ravi Gunasekaran 2022-08-13 0:57 ` kernel test robot 2022-08-13 0:57 ` kernel test robot
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=9d17ab9f-1679-4af1-f85c-a538cb330d7b@ti.com \ --to=r-gunasekaran@ti.com \ --cc=andrew@lunn.ch \ --cc=davem@davemloft.net \ --cc=edumazet@google.com \ --cc=kishon@ti.com \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=pabeni@redhat.com \ --cc=vigneshr@ti.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.