mbox series

[0/9] Genpd related code changes to drop am335x pdata

Message ID 20201026111049.54835-1-tony@atomide.com
Headers show
Series Genpd related code changes to drop am335x pdata | expand

Message

Tony Lindgren Oct. 26, 2020, 11:10 a.m. UTC
Hi all,

Here are the code related changes for v5.11 merge window to drop the
remaining am335x platform data. I'll be posting the related device tree
changes separately.

Regards,

Tony


Tero Kristo (1):
  soc: ti: omap-prm: am3: add genpd support for remaining PRM instances

Tony Lindgren (8):
  ARM: OMAP2+: Check for inited flag
  ARM: OMAP2+: Probe PRCM first to probe l4_wkup with simple-pm-bus
  clk: ti: am33xx: Keep am3 l3 main clock always on for genpd
  bus: ti-sysc: Support modules without control registers
  bus: ti-sysc: Implement GPMC debug quirk to drop platform data
  soc: ti: omap-prm: Add pm_clk for genpd
  soc: ti: pm33xx: Enable basic PM runtime support for genpd
  remoteproc/wkup_m3: Use reset control driver if available

 arch/arm/mach-omap2/omap_hwmod.c      |  6 +++
 arch/arm/mach-omap2/pdata-quirks.c    | 11 ++++
 drivers/bus/ti-sysc.c                 | 17 +++++++
 drivers/clk/ti/clk-33xx.c             |  2 +
 drivers/remoteproc/wkup_m3_rproc.c    | 28 +++++++---
 drivers/soc/ti/omap_prm.c             | 73 +++++++++++++++++++++++++--
 drivers/soc/ti/pm33xx.c               | 17 ++++++-
 include/linux/platform_data/ti-sysc.h |  1 +
 8 files changed, 143 insertions(+), 12 deletions(-)

Comments

Philipp Zabel Oct. 26, 2020, 11:35 a.m. UTC | #1
Hi Tony,

On Mon, 2020-10-26 at 13:10 +0200, Tony Lindgren wrote:
> In order to move wkup_m3 to probe without platform data, let's add
> support for using optional reset control driver if configured in the
> dts. With this change and the related dts change, we can start
> dropping the platform data for am335x.
> 
> And once wkup_m3 no longer needs platform data, we can simply drop the
> related legacy reset platform data callbacks from wkup_m3 driver later
> on after also am437x no longer depends on it.
> 
> Cc: linux-remoteproc@vger.kernel.org
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Dave Gerlach <d-gerlach@ti.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Suman Anna <s-anna@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> 
> Please review and ack if no issues. If you guys instead want to set up an
> immutable remoteproc branch with just this patch in it against v5.10-rc1
> that works too :)
> 
> ---
>  drivers/remoteproc/wkup_m3_rproc.c | 28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/remoteproc/wkup_m3_rproc.c b/drivers/remoteproc/wkup_m3_rproc.c
> --- a/drivers/remoteproc/wkup_m3_rproc.c
> +++ b/drivers/remoteproc/wkup_m3_rproc.c
> @@ -17,6 +17,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/remoteproc.h>
> +#include <linux/reset.h>
>  
>  #include <linux/platform_data/wkup_m3.h>
>  
> @@ -43,11 +44,13 @@ struct wkup_m3_mem {
>   * @rproc: rproc handle
>   * @pdev: pointer to platform device
>   * @mem: WkupM3 memory information
> + * @rsts: reset control
>   */
>  struct wkup_m3_rproc {
>  	struct rproc *rproc;
>  	struct platform_device *pdev;
>  	struct wkup_m3_mem mem[WKUPM3_MEM_MAX];
> +	struct reset_control *rsts;
>  };
>  
>  static int wkup_m3_rproc_start(struct rproc *rproc)
> @@ -57,6 +60,9 @@ static int wkup_m3_rproc_start(struct rproc *rproc)
>  	struct device *dev = &pdev->dev;
>  	struct wkup_m3_platform_data *pdata = dev_get_platdata(dev);
>  
> +	if (wkupm3->rsts)

No need for this check, reset_control_deassert() just returns 0 if the
rstc parameter is NULL.

> +		return reset_control_deassert(wkupm3->rsts);
> +
>  	if (pdata->deassert_reset(pdev, pdata->reset_name)) {
>  		dev_err(dev, "Unable to reset wkup_m3!\n");
>  		return -ENODEV;
> @@ -72,6 +78,9 @@ static int wkup_m3_rproc_stop(struct rproc *rproc)
>  	struct device *dev = &pdev->dev;
>  	struct wkup_m3_platform_data *pdata = dev_get_platdata(dev);
>  
> +	if (wkupm3->rsts)

Same as above.

> +		return reset_control_assert(wkupm3->rsts);
> +
>  	if (pdata->assert_reset(pdev, pdata->reset_name)) {
>  		dev_err(dev, "Unable to assert reset of wkup_m3!\n");
>  		return -ENODEV;
> @@ -132,12 +141,6 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev)
>  	int ret;
>  	int i;
>  
> -	if (!(pdata && pdata->deassert_reset && pdata->assert_reset &&
> -	      pdata->reset_name)) {
> -		dev_err(dev, "Platform data missing!\n");
> -		return -ENODEV;
> -	}
> -
>  	ret = of_property_read_string(dev->of_node, "ti,pm-firmware",
>  				      &fw_name);
>  	if (ret) {
> @@ -165,6 +168,17 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev)
>  	wkupm3->rproc = rproc;
>  	wkupm3->pdev = pdev;
>  
> +	wkupm3->rsts = devm_reset_control_get_optional_shared(dev, "rstctrl");
> +	if (PTR_ERR_OR_ZERO(wkupm3->rsts)) {

Please properly return errors. rsts will be NULL if the optional rstctrl
reset is not specified:

	if (IS_ERR(wkump3->rsts))
		return PTR_ERR(wkump3->rsts);

	if (!wkump3->rsts) {
> +		if (!(pdata && pdata->deassert_reset && pdata->assert_reset &&
> +		      pdata->reset_name)) {
> +			dev_err(dev, "Platform data missing!\n");
> +			ret = -ENODEV;
> +			goto err_put_rproc;
> +		}
> +		wkupm3->rsts = NULL;

I assume this will later be dropped with the platform data support?

> +	}
> +
>  	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
>  		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>  						   mem_names[i]);
> @@ -173,7 +187,7 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "devm_ioremap_resource failed for resource %d\n",
>  				i);
>  			ret = PTR_ERR(wkupm3->mem[i].cpu_addr);
> -			goto err;
> +			goto err_put_rproc;
>  		}
>  		wkupm3->mem[i].bus_addr = res->start;
>  		wkupm3->mem[i].size = resource_size(res);

regards
Philipp
Tony Lindgren Oct. 26, 2020, 1:02 p.m. UTC | #2
Hi,

* Philipp Zabel <p.zabel@pengutronix.de> [201026 11:35]:
> On Mon, 2020-10-26 at 13:10 +0200, Tony Lindgren wrote:
> > @@ -57,6 +60,9 @@ static int wkup_m3_rproc_start(struct rproc *rproc)
> >  	struct device *dev = &pdev->dev;
> >  	struct wkup_m3_platform_data *pdata = dev_get_platdata(dev);
> >  
> > +	if (wkupm3->rsts)
> 
> No need for this check, reset_control_deassert() just returns 0 if the
> rstc parameter is NULL.
> 
> > +		return reset_control_deassert(wkupm3->rsts);
> > +
> >  	if (pdata->deassert_reset(pdev, pdata->reset_name)) {
> >  		dev_err(dev, "Unable to reset wkup_m3!\n");
> >  		return -ENODEV;
> > @@ -72,6 +78,9 @@ static int wkup_m3_rproc_stop(struct rproc *rproc)
> >  	struct device *dev = &pdev->dev;
> >  	struct wkup_m3_platform_data *pdata = dev_get_platdata(dev);
> >  
> > +	if (wkupm3->rsts)
> 
> Same as above.

OK great.

> > +		return reset_control_assert(wkupm3->rsts);
> > +
> >  	if (pdata->assert_reset(pdev, pdata->reset_name)) {
> >  		dev_err(dev, "Unable to assert reset of wkup_m3!\n");
> >  		return -ENODEV;
> > @@ -132,12 +141,6 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev)
> >  	int ret;
> >  	int i;
> >  
> > -	if (!(pdata && pdata->deassert_reset && pdata->assert_reset &&
> > -	      pdata->reset_name)) {
> > -		dev_err(dev, "Platform data missing!\n");
> > -		return -ENODEV;
> > -	}
> > -
> >  	ret = of_property_read_string(dev->of_node, "ti,pm-firmware",
> >  				      &fw_name);
> >  	if (ret) {
> > @@ -165,6 +168,17 @@ static int wkup_m3_rproc_probe(struct platform_device *pdev)
> >  	wkupm3->rproc = rproc;
> >  	wkupm3->pdev = pdev;
> >  
> > +	wkupm3->rsts = devm_reset_control_get_optional_shared(dev, "rstctrl");
> > +	if (PTR_ERR_OR_ZERO(wkupm3->rsts)) {
> 
> Please properly return errors. rsts will be NULL if the optional rstctrl
> reset is not specified:
> 
> 	if (IS_ERR(wkump3->rsts))
> 		return PTR_ERR(wkump3->rsts);

OK thanks will do.

> 	if (!wkump3->rsts) {
> > +		if (!(pdata && pdata->deassert_reset && pdata->assert_reset &&
> > +		      pdata->reset_name)) {
> > +			dev_err(dev, "Platform data missing!\n");
> > +			ret = -ENODEV;
> > +			goto err_put_rproc;
> > +		}
> > +		wkupm3->rsts = NULL;
> 
> I assume this will later be dropped with the platform data support?

Yes once also am437x has been updated to probe with dts data only we
can drop the custom callbacks.

Regards,

Tony
Tony Lindgren Oct. 26, 2020, 1:13 p.m. UTC | #3
* Tony Lindgren <tony@atomide.com> [201026 11:11]:
> Hi all,
> 
> Here are the code related changes for v5.11 merge window to drop the
> remaining am335x platform data. I'll be posting the related device tree
> changes separately.

Sorry I forgot to mention that this series depends also on a series of
fixes posted earlier at [1].

Also, the related dts changes are now posted at [2], and I've also
pushed out an initial branch for easier testing at [3].

Regards,

Tony

[1] https://lore.kernel.org/linux-omap/20201026105812.38418-1-tony@atomide.com/T/#t
[2] https://lore.kernel.org/linux-omap/20201026131007.GB5639@atomide.com/T/#t
[3] https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git/log/?h=omap-for-v5.11/genpd