All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Alexandre Courbot
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] reset: Add Tegra BPMP reset driver
Date: Tue, 15 Nov 2016 18:38:48 +0100	[thread overview]
Message-ID: <20161115173848.GA12764@ulmo.ba.sec> (raw)
In-Reply-To: <1479229876.2456.41.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 6302 bytes --]

On Tue, Nov 15, 2016 at 06:11:16PM +0100, Philipp Zabel wrote:
> Hi Thierry,
> 
> Am Dienstag, den 15.11.2016, 17:17 +0100 schrieb Thierry Reding:
> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > 
> > This driver uses the services provided by the BPMP firmware driver to
> > implement a reset driver based on the MRQ_RESET request.
> > 
> > Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > ---
> > Hi Philipp,
> > 
> > I'm looking for an Acked-by on this because there are complicated
> > dependencies between this and other branches in the Tegra tree, so I
> > think it would be easiest to merge through that.
> > 
> > Thanks,
> > Thierry
> > 
> >  drivers/reset/Kconfig            |  1 +
> >  drivers/reset/Makefile           |  1 +
> >  drivers/reset/tegra/Kconfig      |  3 ++
> >  drivers/reset/tegra/Makefile     |  1 +
> >  drivers/reset/tegra/reset-bpmp.c | 71 ++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 77 insertions(+)
> >  create mode 100644 drivers/reset/tegra/Kconfig
> >  create mode 100644 drivers/reset/tegra/Makefile
> >  create mode 100644 drivers/reset/tegra/reset-bpmp.c
> > 
> > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
> > index 06d9fa2f3bc0..172dc966a01f 100644
> > --- a/drivers/reset/Kconfig
> > +++ b/drivers/reset/Kconfig
> > @@ -94,5 +94,6 @@ config RESET_ZYNQ
> >  
> >  source "drivers/reset/sti/Kconfig"
> >  source "drivers/reset/hisilicon/Kconfig"
> > +source "drivers/reset/tegra/Kconfig"
> >  
> >  endif
> > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> > index bbe7026617fc..13b346e03d84 100644
> > --- a/drivers/reset/Makefile
> > +++ b/drivers/reset/Makefile
> > @@ -1,6 +1,7 @@
> >  obj-y += core.o
> >  obj-y += hisilicon/
> >  obj-$(CONFIG_ARCH_STI) += sti/
> > +obj-$(CONFIG_ARCH_TEGRA) += tegra/
> 
> Could drivers therein be compiled without ARCH_TEGRA enabled? If so,
> please use obj-y here.
> 
> >  obj-$(CONFIG_RESET_ATH79) += reset-ath79.o
> >  obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o
> >  obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
> > diff --git a/drivers/reset/tegra/Kconfig b/drivers/reset/tegra/Kconfig
> > new file mode 100644
> > index 000000000000..0ec57a7016e6
> > --- /dev/null
> > +++ b/drivers/reset/tegra/Kconfig
> > @@ -0,0 +1,3 @@
> > +config RESET_TEGRA_BPMP
> > +	def_bool y
> > +	depends on TEGRA_BPMP
> 
> Or probably not, it looks like TEGRA_BPMP depends on ARCH_TEGRA and
> doesn't provide any stubs. I think this could be just
> 	def_bool TEGRA_BPMP
> though. But see below, RESET_TEGRA_BPMP doesn't seem to be used at all.

Yes, this is all really Tegra-specific, so I don't think it makes sense
to allow building this without.

> > diff --git a/drivers/reset/tegra/Makefile b/drivers/reset/tegra/Makefile
> > new file mode 100644
> > index 000000000000..fd943b1ae029
> > --- /dev/null
> > +++ b/drivers/reset/tegra/Makefile
> > @@ -0,0 +1 @@
> > +obj-$(CONFIG_ARCH_TEGRA_186_SOC)	+= reset-bpmp.o
> 
> This should probably be obj-$(CONFIG_RESET_TEGRA_BPMP).

Yes indeed. I had introduced RESET_TEGRA_BPMP is a way of resolving the
dependencies more nicely. The code structure is such that the BPMP
driver needs to call clock and reset drivers, and there are
CLOCK_TEGRA_BPMP and RESET_TEGRA_BPMP symbols to protect those bits of
the code and avoid a circular dependency.

> > diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c
> > new file mode 100644
> > index 000000000000..5daf2ee1a396
> > --- /dev/null
> > +++ b/drivers/reset/tegra/reset-bpmp.c
> > @@ -0,0 +1,71 @@
> > +/*
> > + * Copyright (C) 2016 NVIDIA Corporation
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include <linux/reset-controller.h>
> > +
> > +#include <soc/tegra/bpmp.h>
> > +#include <soc/tegra/bpmp-abi.h>
> > +
> > +static struct tegra_bpmp *to_tegra_bpmp(struct reset_controller_dev *rstc)
> > +{
> > +	return container_of(rstc, struct tegra_bpmp, rstc);
> > +}
> > +
> > +static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
> > +				   enum mrq_reset_commands command,
> > +				   unsigned int id)
> > +{
> > +	struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
> > +	struct mrq_reset_request request;
> > +	struct tegra_bpmp_message msg;
> > +
> > +	memset(&request, 0, sizeof(request));
> > +	request.cmd = command;
> > +	request.reset_id = id;
> > +
> > +	memset(&msg, 0, sizeof(msg));
> > +	msg.mrq = MRQ_RESET;
> > +	msg.tx.data = &request;
> > +	msg.tx.size = sizeof(request);
> > +
> > +	return tegra_bpmp_transfer(bpmp, &msg);
> > +}
> > +
> > +static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
> > +				   unsigned long id)
> > +{
> > +	return tegra_bpmp_reset_common(rstc, CMD_RESET_MODULE, id);
> > +}
> > +
> > +static int tegra_bpmp_reset_assert(struct reset_controller_dev *rstc,
> > +				   unsigned long id)
> > +{
> > +	return tegra_bpmp_reset_common(rstc, CMD_RESET_ASSERT, id);
> > +}
> > +
> > +static int tegra_bpmp_reset_deassert(struct reset_controller_dev *rstc,
> > +				     unsigned long id)
> > +{
> > +	return tegra_bpmp_reset_common(rstc, CMD_RESET_DEASSERT, id);
> > +}
> > +
> > +static const struct reset_control_ops tegra_bpmp_reset_ops = {
> > +	.reset = tegra_bpmp_reset_module,
> > +	.assert = tegra_bpmp_reset_assert,
> > +	.deassert = tegra_bpmp_reset_deassert,
> > +};
> > +
> > +int tegra_bpmp_init_resets(struct tegra_bpmp *bpmp)
> > +{
> > +	bpmp->rstc.ops = &tegra_bpmp_reset_ops;
> > +	bpmp->rstc.owner = THIS_MODULE;
> > +	bpmp->rstc.of_node = bpmp->dev->of_node;
> > +	bpmp->rstc.nr_resets = bpmp->soc->num_resets;
> > +
> > +	return devm_reset_controller_register(bpmp->dev, &bpmp->rstc);
> > +}
> 
> With the Kconfig symbol confusion resolved,
> 
> Acked-by: Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> 
> to merge this via the Tegra trees.

Great, I'll make that change and merge through the Tegra tree.

Thanks!
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Jon Hunter <jonathanh@nvidia.com>,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] reset: Add Tegra BPMP reset driver
Date: Tue, 15 Nov 2016 18:38:48 +0100	[thread overview]
Message-ID: <20161115173848.GA12764@ulmo.ba.sec> (raw)
In-Reply-To: <1479229876.2456.41.camel@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 6219 bytes --]

On Tue, Nov 15, 2016 at 06:11:16PM +0100, Philipp Zabel wrote:
> Hi Thierry,
> 
> Am Dienstag, den 15.11.2016, 17:17 +0100 schrieb Thierry Reding:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > This driver uses the services provided by the BPMP firmware driver to
> > implement a reset driver based on the MRQ_RESET request.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> > Hi Philipp,
> > 
> > I'm looking for an Acked-by on this because there are complicated
> > dependencies between this and other branches in the Tegra tree, so I
> > think it would be easiest to merge through that.
> > 
> > Thanks,
> > Thierry
> > 
> >  drivers/reset/Kconfig            |  1 +
> >  drivers/reset/Makefile           |  1 +
> >  drivers/reset/tegra/Kconfig      |  3 ++
> >  drivers/reset/tegra/Makefile     |  1 +
> >  drivers/reset/tegra/reset-bpmp.c | 71 ++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 77 insertions(+)
> >  create mode 100644 drivers/reset/tegra/Kconfig
> >  create mode 100644 drivers/reset/tegra/Makefile
> >  create mode 100644 drivers/reset/tegra/reset-bpmp.c
> > 
> > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
> > index 06d9fa2f3bc0..172dc966a01f 100644
> > --- a/drivers/reset/Kconfig
> > +++ b/drivers/reset/Kconfig
> > @@ -94,5 +94,6 @@ config RESET_ZYNQ
> >  
> >  source "drivers/reset/sti/Kconfig"
> >  source "drivers/reset/hisilicon/Kconfig"
> > +source "drivers/reset/tegra/Kconfig"
> >  
> >  endif
> > diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> > index bbe7026617fc..13b346e03d84 100644
> > --- a/drivers/reset/Makefile
> > +++ b/drivers/reset/Makefile
> > @@ -1,6 +1,7 @@
> >  obj-y += core.o
> >  obj-y += hisilicon/
> >  obj-$(CONFIG_ARCH_STI) += sti/
> > +obj-$(CONFIG_ARCH_TEGRA) += tegra/
> 
> Could drivers therein be compiled without ARCH_TEGRA enabled? If so,
> please use obj-y here.
> 
> >  obj-$(CONFIG_RESET_ATH79) += reset-ath79.o
> >  obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o
> >  obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
> > diff --git a/drivers/reset/tegra/Kconfig b/drivers/reset/tegra/Kconfig
> > new file mode 100644
> > index 000000000000..0ec57a7016e6
> > --- /dev/null
> > +++ b/drivers/reset/tegra/Kconfig
> > @@ -0,0 +1,3 @@
> > +config RESET_TEGRA_BPMP
> > +	def_bool y
> > +	depends on TEGRA_BPMP
> 
> Or probably not, it looks like TEGRA_BPMP depends on ARCH_TEGRA and
> doesn't provide any stubs. I think this could be just
> 	def_bool TEGRA_BPMP
> though. But see below, RESET_TEGRA_BPMP doesn't seem to be used at all.

Yes, this is all really Tegra-specific, so I don't think it makes sense
to allow building this without.

> > diff --git a/drivers/reset/tegra/Makefile b/drivers/reset/tegra/Makefile
> > new file mode 100644
> > index 000000000000..fd943b1ae029
> > --- /dev/null
> > +++ b/drivers/reset/tegra/Makefile
> > @@ -0,0 +1 @@
> > +obj-$(CONFIG_ARCH_TEGRA_186_SOC)	+= reset-bpmp.o
> 
> This should probably be obj-$(CONFIG_RESET_TEGRA_BPMP).

Yes indeed. I had introduced RESET_TEGRA_BPMP is a way of resolving the
dependencies more nicely. The code structure is such that the BPMP
driver needs to call clock and reset drivers, and there are
CLOCK_TEGRA_BPMP and RESET_TEGRA_BPMP symbols to protect those bits of
the code and avoid a circular dependency.

> > diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c
> > new file mode 100644
> > index 000000000000..5daf2ee1a396
> > --- /dev/null
> > +++ b/drivers/reset/tegra/reset-bpmp.c
> > @@ -0,0 +1,71 @@
> > +/*
> > + * Copyright (C) 2016 NVIDIA Corporation
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include <linux/reset-controller.h>
> > +
> > +#include <soc/tegra/bpmp.h>
> > +#include <soc/tegra/bpmp-abi.h>
> > +
> > +static struct tegra_bpmp *to_tegra_bpmp(struct reset_controller_dev *rstc)
> > +{
> > +	return container_of(rstc, struct tegra_bpmp, rstc);
> > +}
> > +
> > +static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
> > +				   enum mrq_reset_commands command,
> > +				   unsigned int id)
> > +{
> > +	struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
> > +	struct mrq_reset_request request;
> > +	struct tegra_bpmp_message msg;
> > +
> > +	memset(&request, 0, sizeof(request));
> > +	request.cmd = command;
> > +	request.reset_id = id;
> > +
> > +	memset(&msg, 0, sizeof(msg));
> > +	msg.mrq = MRQ_RESET;
> > +	msg.tx.data = &request;
> > +	msg.tx.size = sizeof(request);
> > +
> > +	return tegra_bpmp_transfer(bpmp, &msg);
> > +}
> > +
> > +static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
> > +				   unsigned long id)
> > +{
> > +	return tegra_bpmp_reset_common(rstc, CMD_RESET_MODULE, id);
> > +}
> > +
> > +static int tegra_bpmp_reset_assert(struct reset_controller_dev *rstc,
> > +				   unsigned long id)
> > +{
> > +	return tegra_bpmp_reset_common(rstc, CMD_RESET_ASSERT, id);
> > +}
> > +
> > +static int tegra_bpmp_reset_deassert(struct reset_controller_dev *rstc,
> > +				     unsigned long id)
> > +{
> > +	return tegra_bpmp_reset_common(rstc, CMD_RESET_DEASSERT, id);
> > +}
> > +
> > +static const struct reset_control_ops tegra_bpmp_reset_ops = {
> > +	.reset = tegra_bpmp_reset_module,
> > +	.assert = tegra_bpmp_reset_assert,
> > +	.deassert = tegra_bpmp_reset_deassert,
> > +};
> > +
> > +int tegra_bpmp_init_resets(struct tegra_bpmp *bpmp)
> > +{
> > +	bpmp->rstc.ops = &tegra_bpmp_reset_ops;
> > +	bpmp->rstc.owner = THIS_MODULE;
> > +	bpmp->rstc.of_node = bpmp->dev->of_node;
> > +	bpmp->rstc.nr_resets = bpmp->soc->num_resets;
> > +
> > +	return devm_reset_controller_register(bpmp->dev, &bpmp->rstc);
> > +}
> 
> With the Kconfig symbol confusion resolved,
> 
> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
> 
> to merge this via the Tegra trees.

Great, I'll make that change and merge through the Tegra tree.

Thanks!
Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  parent reply	other threads:[~2016-11-15 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-15 16:17 [PATCH] reset: Add Tegra BPMP reset driver Thierry Reding
     [not found] ` <20161115161749.31221-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-15 17:11   ` Philipp Zabel
2016-11-15 17:11     ` Philipp Zabel
     [not found]     ` <1479229876.2456.41.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-11-15 17:38       ` Thierry Reding [this message]
2016-11-15 17:38         ` Thierry Reding

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=20161115173848.GA12764@ulmo.ba.sec \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.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 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.