linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org,
	linux-mtd@lists.infradead.org, linux-watchdog@vger.kernel.org,
	devicetree@vger.kernel.org, martin.blumenstingl@googlemail.com,
	john@phrozen.org, linux-spi@vger.kernel.org,
	hauke.mehrtens@intel.com, robh@kernel.org,
	andy.shevchenko@gmail.com
Subject: Re: [PATCH v3 10/16] reset: Add a reset controller driver for the Lantiq XWAY based SoCs
Date: Mon, 29 May 2017 12:20:14 +0200	[thread overview]
Message-ID: <1496053214.17695.49.camel@pengutronix.de> (raw)
In-Reply-To: <20170528184006.31668-11-hauke@hauke-m.de>

Hi Hauke,

On Sun, 2017-05-28 at 20:40 +0200, Hauke Mehrtens wrote:
[...]
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reset/lantiq,reset.txt
> @@ -0,0 +1,30 @@
> +Lantiq XWAY SoC RCU reset controller binding
> +============================================
> +
> +This binding describes a reset-controller found on the RCU module on Lantiq
> +XWAY SoCs.
> +
> +
> +-------------------------------------------------------------------------------
> +Required properties:
> +- compatible		: Should be one of
> +				"lantiq,reset-danube"
> +				"lantiq,reset-xrx200"
> +- regmap		: A phandle to the RCU syscon
> +- offset-set		: Offset of the reset set register
> +- offset-status		: Offset of the reset status register
> +- #reset-cells		: Specifies the number of cells needed to encode the
> +			  reset line, should be 2.
> +			  The first cell takes the reset set bit and the
> +			  second cell takes the status bit.
> +
> +-------------------------------------------------------------------------------
> +Example for the reset-controllers on the xRX200 SoCs:
> +	reset0: reset-controller@0 {
> +		compatible = "lantiq,reset-xrx200";
> +
> +		regmap = <&rcu0>;

Why not place these nodes as children of &rcu0 ? This property would be
superfluous then.

> +		offset-set = <0x10>;
> +		offset-status = <0x14>;
> +		#reset-cells = <2>;
> +	};
[...]
> --- /dev/null
> +++ b/drivers/reset/reset-lantiq.c
> @@ -0,0 +1,205 @@
[...]
> +static int lantiq_rcu_reset_update(struct reset_controller_dev *rcdev,
> +				   unsigned long id, bool assert)
> +{
> +	struct lantiq_rcu_reset_priv *priv = to_lantiq_rcu_reset_priv(rcdev);
> +	int ret, retry = LANTIQ_RCU_RESET_TIMEOUT;
> +	unsigned int set = id & 0x1f;
> +	u32 val;
> +
> +	if (assert)
> +		val = BIT(set);
> +	else
> +		val = 0;
> +
> +	ret = regmap_update_bits(priv->regmap, priv->reset_offset, BIT(set),
> +				 val);
> +	if (ret) {
> +		dev_err(priv->dev, "Failed to set reset bit %u\n", set);
> +		return ret;
> +	}
> +
> +	do {
> +		ret = lantiq_rcu_reset_status(rcdev, id);
> +		if (ret < 0)
> +			return ret;
> +		if (ret == assert)
> +			break;
> +		usleep_range(20, 40);
> +	} while (--retry);

How about wrapping this in a lantiq_rcu_poll_status(_timeout) function?
I still think this is a case where regmap_read_poll_timeout could be
used.

[...]
> +static int lantiq_rcu_reset_of_probe(struct platform_device *pdev,
> +			       struct lantiq_rcu_reset_priv *priv)
> +{
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	priv->regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap");

Why not use syscon_node_to_regmap(dev->of_node->parent) ?

regards
Philipp

  reply	other threads:[~2017-05-29 10:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-28 18:39 [PATCH v3 00/16] MIPS: lantiq: handle RCU register by separate drivers Hauke Mehrtens
     [not found] ` <20170528184006.31668-1-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2017-05-28 18:39   ` [PATCH v3 01/16] MIPS: lantiq: Use of_platform_default_populate instead of __dt_register_buses Hauke Mehrtens
2017-05-28 18:39   ` [PATCH v3 02/16] mtd: lantiq-flash: drop check of boot select Hauke Mehrtens
2017-05-28 18:39   ` [PATCH v3 03/16] mtd: spi-falcon: " Hauke Mehrtens
2017-05-28 18:39   ` [PATCH v3 04/16] watchdog: lantiq: access boot cause register through regmap Hauke Mehrtens
2017-05-28 18:39   ` [PATCH v3 05/16] watchdog: lantiq: add device tree binding documentation Hauke Mehrtens
     [not found]     ` <20170528184006.31668-6-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2017-05-31 20:00       ` Rob Herring
2017-05-31 20:11         ` Hauke Mehrtens
2017-05-28 18:39   ` [PATCH v3 06/16] MIPS: lantiq: Enable MFD_SYSCON to be able to use it for the RCU MFD Hauke Mehrtens
2017-05-28 18:39   ` [PATCH v3 07/16] Documentation: DT: MIPS: lantiq: Add docs for the RCU bindings Hauke Mehrtens
     [not found]     ` <20170528184006.31668-8-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2017-05-31 20:05       ` Rob Herring
2017-05-31 20:13         ` Hauke Mehrtens
     [not found]           ` <6b8bb1cd-c090-435d-d150-d53edf04d2df-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2017-05-31 21:04             ` Rob Herring
2017-05-28 18:39   ` [PATCH v3 08/16] MIPS: lantiq: Convert the fpi bus driver to a platform_driver Hauke Mehrtens
     [not found]     ` <20170528184006.31668-9-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2017-05-30 18:23       ` Andy Shevchenko
     [not found]         ` <CAHp75VcU3cF07GQG5vPV9uhmpOzO2aGD8Fj9-Do4yN3BXNN1Rg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-30 22:02           ` Hauke Mehrtens
2017-05-31 20:54       ` Rob Herring
2017-05-28 18:39   ` [PATCH v3 09/16] MIPS: lantiq: remove ltq_reset_cause() and ltq_boot_select() Hauke Mehrtens
2017-05-28 18:40   ` [PATCH v3 10/16] reset: Add a reset controller driver for the Lantiq XWAY based SoCs Hauke Mehrtens
2017-05-29 10:20     ` Philipp Zabel [this message]
     [not found]       ` <1496053214.17695.49.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-05-31 20:58         ` Rob Herring
2017-05-28 18:40   ` [PATCH v3 11/16] MIPS: lantiq: remove old reset controller implementation Hauke Mehrtens
2017-05-28 18:40   ` [PATCH v3 12/16] MIPS: lantiq: Add a GPHY driver which uses the RCU syscon-mfd Hauke Mehrtens
2017-05-28 18:40   ` [PATCH v3 13/16] MIPS: lantiq: remove old GPHY loader code Hauke Mehrtens
2017-05-28 18:40   ` [PATCH v3 14/16] phy: Add an USB PHY driver for the Lantiq SoCs using the RCU module Hauke Mehrtens
     [not found]     ` <20170528184006.31668-15-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2017-05-30 18:31       ` Andy Shevchenko
     [not found]         ` <CAHp75Ve9bV99=WCzmXU-Rth-gar5gqvy4taZ7NMQQHGKcVbHHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-30 20:21           ` Hauke Mehrtens
2017-05-28 18:40   ` [PATCH v3 15/16] MIPS: lantiq: remove old USB PHY initialisation Hauke Mehrtens
2017-05-28 18:40   ` [PATCH v3 16/16] MIPS: lantiq: Remove the arch/mips/lantiq/xway/reset.c implementation Hauke Mehrtens

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=1496053214.17695.49.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hauke.mehrtens@intel.com \
    --cc=hauke@hauke-m.de \
    --cc=john@phrozen.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=ralf@linux-mips.org \
    --cc=robh@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).