devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Preetham Chandru Ramchandra <pchandru@nvidia.com>
Cc: tj@kernel.org, cyndis@kapsi.fi, robh+dt@kernel.org,
	mark.rutland@arm.com, devicetree@vger.kernel.org,
	preetham260@gmail.com, linux-tegra@vger.kernel.org,
	linux-ide@vger.kernel.org, vbyravarasu@nvidia.com,
	pkunapuli@nvidia.com
Subject: Re: [PATCH V7 5/7] ata: ahci_tegra: disable devslp for t124
Date: Mon, 19 Feb 2018 15:47:12 +0100	[thread overview]
Message-ID: <20180219144712.GH11455@ulmo> (raw)
In-Reply-To: <1518456406-21564-6-git-send-email-pchandru@nvidia.com>

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

On Mon, Feb 12, 2018 at 10:56:44PM +0530, Preetham Chandru Ramchandra wrote:
> From: Preetham Ramchandra <pchandru@nvidia.com>
> 
> t124 does not support devslp and it should be
> disabled.

Please spell out t124 as Tegra124 in the subject and the commit message.

> 
> Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
> ---
>  drivers/ata/ahci_tegra.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
> index 6aaf8a4571c8..62f2afb54789 100644
> --- a/drivers/ata/ahci_tegra.c
> +++ b/drivers/ata/ahci_tegra.c
> @@ -145,6 +145,10 @@
>  #define FUSE_SATA_CALIB					0x124
>  #define FUSE_SATA_CALIB_MASK				0x3
>  
> +enum {
> +	NO_DEVSLP	= (1 << 0),
> +};
> +
>  struct sata_pad_calibration {
>  	u8 gen1_tx_amp;
>  	u8 gen1_tx_peak;
> @@ -166,12 +170,14 @@ struct tegra_ahci_ops {
>  struct tegra_ahci_soc {
>  	const char *const	*supply_names;
>  	u32			num_supplies;
> +	u32			quirks;
>  	struct tegra_ahci_ops	ops;
>  };

I'd prefer these to be simple booleans, which make the code easier to
read, in my opinion. This could be:

	bool supports_devslp;

>  
>  struct tegra_ahci_priv {
>  	struct platform_device	   *pdev;
>  	void __iomem		   *sata_regs;
> +	void __iomem		   *sata_aux_regs;
>  	struct reset_control	   *sata_rst;
>  	struct reset_control	   *sata_oob_rst;
>  	struct reset_control	   *sata_cold_rst;
> @@ -181,6 +187,18 @@ struct tegra_ahci_priv {
>  	struct tegra_ahci_soc	   *soc_data;
>  };
>  
> +static void tegra_ahci_handle_quirks(struct ahci_host_priv *hpriv)
> +{
> +	struct tegra_ahci_priv *tegra = hpriv->plat_data;
> +	u32 val;
> +
> +	if (tegra->sata_aux_regs && (tegra->soc_data->quirks & NO_DEVSLP)) {

And then this becomes:

	if (tegra->sata_aux_regs && !tegra->soc->supports_devslp)

> +		val = readl(tegra->sata_aux_regs + SATA_AUX_MISC_CNTL_1_0);
> +		val &= ~SATA_AUX_MISC_CNTL_1_0_SDS_SUPPORT;
> +		writel(val, tegra->sata_aux_regs + SATA_AUX_MISC_CNTL_1_0);
> +	}
> +}
> +
>  static int tegra124_ahci_init(struct ahci_host_priv *hpriv)
>  {
>  	struct tegra_ahci_priv *tegra = hpriv->plat_data;
> @@ -400,6 +418,7 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
>  	val &= ~SATA_CONFIGURATION_0_CLK_OVERRIDE;
>  	writel(val, tegra->sata_regs + SATA_CONFIGURATION_0);
>  
> +	tegra_ahci_handle_quirks(hpriv);
>  
>  	/* Unmask SATA interrupts */
>  
> @@ -441,6 +460,7 @@ static const char *const tegra124_supply_names[] = {
>  static const struct tegra_ahci_soc tegra124_ahci_soc_data = {
>  	.supply_names = tegra124_supply_names,
>  	.num_supplies = ARRAY_SIZE(tegra124_supply_names),
> +	.quirks = NO_DEVSLP,
>  	.ops = {
>  		.init = tegra124_ahci_init,
>  	},
> @@ -485,6 +505,15 @@ static int tegra_ahci_probe(struct platform_device *pdev)
>  	tegra->sata_regs = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(tegra->sata_regs))
>  		return PTR_ERR(tegra->sata_regs);
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> +	/*
> +	 * Aux register is optional.
> +	 */

"Aux register" -> "AUX registers". Also, I think it's more idiomatic to
place the comment above platform_get_resource() so that the assignment
and the check below are not separated.

Thierry

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

  reply	other threads:[~2018-02-19 14:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 17:26 [PATCH V7 0/7] Refactor and add AHCI support for tegra210 Preetham Chandru Ramchandra
     [not found] ` <1518456406-21564-1-git-send-email-pchandru-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2018-02-12 17:26   ` [PATCH V7 1/7] dt-bindings: ahci-tegra: add binding documentation Preetham Chandru Ramchandra
2018-02-19  2:46     ` Rob Herring
2018-02-19 14:14       ` Thierry Reding
2018-02-19 14:24       ` Thierry Reding
2018-02-27 12:03         ` Preetham Chandru
2018-02-27 12:02       ` Preetham Chandru
2018-02-19 14:27     ` Thierry Reding
2018-02-27 12:05       ` Preetham Chandru
2018-02-19 14:28     ` Thierry Reding
2018-02-27 12:05       ` Preetham Chandru
2018-02-12 17:26   ` [PATCH V7 2/7] arm64: tegra: Enable AHCI on Jetson TX1 Preetham Chandru Ramchandra
2018-02-19 14:31     ` Thierry Reding
2018-02-12 17:26   ` [PATCH V7 3/7] ata: ahci_tegra: Update initialization sequence Preetham Chandru Ramchandra
2018-02-19 14:41     ` Thierry Reding
2018-02-19 14:54     ` Thierry Reding
2018-02-12 17:26   ` [PATCH V7 6/7] ata: ahci_tegra: disable DIPM Preetham Chandru Ramchandra
2018-02-19 14:47     ` Thierry Reding
2018-02-12 17:26   ` [PATCH V7 7/7] ata: ahci_tegra: Add AHCI support for Tegra210 Preetham Chandru Ramchandra
2018-02-19 14:49     ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 4/7] ata: ahci_tegra: initialize regulators from soc_data Preetham Chandru Ramchandra
2018-02-19 14:42   ` Thierry Reding
2018-02-12 17:26 ` [PATCH V7 5/7] ata: ahci_tegra: disable devslp for t124 Preetham Chandru Ramchandra
2018-02-19 14:47   ` Thierry Reding [this message]
2018-02-14 13:11 ` [PATCH V7 0/7] Refactor and add AHCI support for tegra210 Mikko Perttunen

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=20180219144712.GH11455@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=cyndis@kapsi.fi \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pchandru@nvidia.com \
    --cc=pkunapuli@nvidia.com \
    --cc=preetham260@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=tj@kernel.org \
    --cc=vbyravarasu@nvidia.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: 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).