public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
	Tejun Heo <tj@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Cc: linux-ide@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ata: ahci-platform: add reset control support
Date: Fri, 23 Mar 2018 09:19:14 +0100	[thread overview]
Message-ID: <87cd10b9-38f8-4e16-cfcf-425e92fc126c@redhat.com> (raw)
In-Reply-To: <1521768653-11824-1-git-send-email-hayashi.kunihiko@socionext.com>

Hi,

On 23-03-18 02:30, Kunihiko Hayashi wrote:
> Add support to get and control a list of resets for the device
> as optional and shared. These resets must be kept de-asserted until
> the device is enabled.
> 
> This is specified as shared because some SoCs like UniPhier series
> have common reset controls with all ahci controller instances.
> 
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>   .../devicetree/bindings/ata/ahci-platform.txt      |  1 +
>   drivers/ata/ahci.h                                 |  1 +
>   drivers/ata/libahci_platform.c                     | 24 +++++++++++++++++++---
>   3 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
> index c760ecb..f4006d3 100644
> --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
> +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
> @@ -30,6 +30,7 @@ compatible:
>   Optional properties:
>   - dma-coherent      : Present if dma operations are coherent
>   - clocks            : a list of phandle + clock specifier pairs
> +- resets            : a list of phandle + reset specifier pairs
>   - target-supply     : regulator for SATA target power
>   - phys              : reference to the SATA PHY node
>   - phy-names         : must be "sata-phy"
> diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
> index 749fd94..47ec77a2 100644
> --- a/drivers/ata/ahci.h
> +++ b/drivers/ata/ahci.h
> @@ -347,6 +347,7 @@ struct ahci_host_priv {
>   	u32			em_msg_type;	/* EM message type */
>   	bool			got_runtime_pm; /* Did we do pm_runtime_get? */
>   	struct clk		*clks[AHCI_MAX_CLKS]; /* Optional */
> +	struct reset_control	*rsts;		/* Optional */
>   	struct regulator	**target_pwrs;	/* Optional */
>   	/*
>   	 * If platform uses PHYs. There is a 1:1 relation between the port number and
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index 341d0ef..3130db9 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -25,6 +25,7 @@
>   #include <linux/phy/phy.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/of_platform.h>
> +#include <linux/reset.h>
>   #include "ahci.h"
>   
>   static void ahci_host_stop(struct ata_host *host);
> @@ -195,7 +196,8 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators);
>    * following order:
>    * 1) Regulator
>    * 2) Clocks (through ahci_platform_enable_clks)
> - * 3) Phys
> + * 3) Resets
> + * 4) Phys
>    *
>    * If resource enabling fails at any point the previous enabled resources
>    * are disabled in reverse order.
> @@ -215,12 +217,19 @@ int ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
>   	if (rc)
>   		goto disable_regulator;
>   
> -	rc = ahci_platform_enable_phys(hpriv);
> +	rc = reset_control_deassert(hpriv->rsts);
>   	if (rc)
>   		goto disable_clks;
>   
> +	rc = ahci_platform_enable_phys(hpriv);
> +	if (rc)
> +		goto disable_resets;
> +
>   	return 0;
>   
> +disable_resets:
> +	reset_control_assert(hpriv->rsts);
> +
>   disable_clks:
>   	ahci_platform_disable_clks(hpriv);
>   
> @@ -239,12 +248,15 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources);
>    * following order:
>    * 1) Phys
>    * 2) Clocks (through ahci_platform_disable_clks)
> - * 3) Regulator
> + * 3) Resets
> + * 4) Regulator
>    */
>   void ahci_platform_disable_resources(struct ahci_host_priv *hpriv)
>   {
>   	ahci_platform_disable_phys(hpriv);
>   
> +	reset_control_assert(hpriv->rsts);
> +
>   	ahci_platform_disable_clks(hpriv);
>   
>   	ahci_platform_disable_regulators(hpriv);
> @@ -393,6 +405,12 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
>   		hpriv->clks[i] = clk;
>   	}
>   
> +	hpriv->rsts = devm_reset_control_array_get_optional_shared(dev);
> +	if (IS_ERR(hpriv->rsts)) {
> +		rc = PTR_ERR(hpriv->rsts);
> +		goto err_out;
> +	}
> +
>   	hpriv->nports = child_nodes = of_get_child_count(dev->of_node);
>   
>   	/*
> 

  reply	other threads:[~2018-03-23  8:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23  1:30 [PATCH] ata: ahci-platform: add reset control support Kunihiko Hayashi
2018-03-23  8:19 ` Hans de Goede [this message]
2018-03-26 22:24 ` Rob Herring
2018-04-05  9:54 ` Thierry Reding
2018-04-05  9:59   ` Thierry Reding
2018-04-05 11:23   ` Kunihiko Hayashi
2018-04-05 11:30     ` Hans de Goede
2018-04-05 13:17   ` Patrice CHOTARD
2018-04-05 13:27     ` Hans de Goede
2018-04-05 13:54       ` Thierry Reding
2018-04-05 14:00         ` Hans de Goede
2018-04-05 14:08           ` Hans de Goede
2018-04-06  4:48             ` Kunihiko Hayashi
2018-04-06  8:29               ` Hans de Goede
2018-04-06  9:36                 ` Kunihiko Hayashi
2018-04-06 10:12                   ` Hans de Goede
2018-04-09 11:59                 ` Thierry Reding
     [not found]       ` <1f7d0738-1963-21c5-c293-e46fb0214ecf-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-04-05 14:00         ` Patrice CHOTARD

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=87cd10b9-38f8-4e16-cfcf-425e92fc126c@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tj@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