From: Preetham Chandru Ramchandra <pchandru@nvidia.com>
To: tj@kernel.org, swarren@wwwdotorg.org, thierry.reding@gmail.com,
preetham260@gmail.com
Cc: ldewangan@nvidia.com, linux-ide@vger.kernel.org,
vbyravarasu@nvidia.com, pkunapuli@nvidia.com,
Preetham Chandru R <pchandru@nvidia.com>
Subject: [PATCH v2 2/3] ata: ahci_tegra: Add support to disable features
Date: Thu, 24 Nov 2016 13:13:37 +0530 [thread overview]
Message-ID: <1479973418-21351-3-git-send-email-pchandru@nvidia.com> (raw)
In-Reply-To: <1479973418-21351-1-git-send-email-pchandru@nvidia.com>
From: Preetham Chandru R <pchandru@nvidia.com>
Add support to disable DIPM, HIPM, DevSlp, partial, slumber and NCQ
features from DT. By default these features are enabled.
Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
---
v2:
* This change was created by seperating
"ata: ahci_tegra: add support for tegra210" from v1
drivers/ata/ahci_tegra.c | 107 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 82 insertions(+), 25 deletions(-)
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index d12e2a9..443c3e8 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -329,7 +329,7 @@ static int tegra_ahci_power_on(struct ahci_host_priv *hpriv)
return ret;
}
-static void tegra_ahci_power_off(struct ahci_host_priv *hpriv)
+static void tegra_ahci_controller_deinit(struct ahci_host_priv *hpriv)
{
struct tegra_ahci_priv *tegra = hpriv->plat_data;
@@ -345,6 +345,85 @@ static void tegra_ahci_power_off(struct ahci_host_priv *hpriv)
regulator_bulk_disable(tegra->soc_data->num_supplies, tegra->supplies);
}
+static void tegra_ahci_host_stop(struct ata_host *host)
+{
+ struct ahci_host_priv *hpriv = host->private_data;
+
+ tegra_ahci_controller_deinit(hpriv);
+}
+
+static struct ata_port_operations ahci_tegra_port_ops = {
+ .inherits = &ahci_ops,
+ .host_stop = tegra_ahci_host_stop,
+};
+
+static struct ata_port_info ahci_tegra_port_info = {
+ .flags = AHCI_FLAG_COMMON,
+ .pio_mask = ATA_PIO4,
+ .udma_mask = ATA_UDMA6,
+ .port_ops = &ahci_tegra_port_ops,
+};
+
+static void tegra_ahci_disable_devslp(struct tegra_ahci_priv *tegra)
+{
+ tegra_ahci_aux_update(tegra, 0, SDS_SUPPORT, SATA_AUX_MISC_CNTL_1_0);
+}
+
+static void tegra_ahci_disable_hipm(struct tegra_ahci_priv *tegra)
+{
+ tegra_ahci_scfg_update(tegra, 0, T_SATA0_AHCI_HBA_CAP_BKDR_SALP,
+ T_SATA0_AHCI_HBA_CAP_BKDR);
+}
+
+static void tegra_ahci_disable_partial(struct tegra_ahci_priv *tegra)
+{
+ tegra_ahci_scfg_update(tegra, 0,
+ T_SATA0_AHCI_HBA_CAP_BKDR_PARTIAL_ST_CAP,
+ T_SATA0_AHCI_HBA_CAP_BKDR);
+}
+
+static void tegra_ahci_disable_slumber(struct tegra_ahci_priv *tegra)
+{
+ tegra_ahci_scfg_update(tegra, 0,
+ T_SATA0_AHCI_HBA_CAP_BKDR_SLUMBER_ST_CAP,
+ T_SATA0_AHCI_HBA_CAP_BKDR);
+}
+
+static void tegra_ahci_disable_ncq(struct tegra_ahci_priv *tegra)
+{
+ tegra_ahci_scfg_update(tegra, 0, T_SATA0_AHCI_HBA_CAP_BKDR_SNCQ,
+ T_SATA0_AHCI_HBA_CAP_BKDR);
+}
+
+static void tegra_ahci_disable_features(struct ahci_host_priv *hpriv)
+{
+ struct tegra_ahci_priv *tegra = hpriv->plat_data;
+ struct platform_device *pdev = tegra->pdev;
+ struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+ struct property *prop;
+ const char *feature;
+
+ if (of_property_count_strings(np, "nvidia,disable-features") <= 0)
+ return;
+
+ of_property_for_each_string(np, "nvidia,disable-features", prop,
+ feature) {
+ if (!strcmp(feature, "devslp"))
+ tegra_ahci_disable_devslp(tegra);
+ else if (!strcmp(feature, "hipm"))
+ tegra_ahci_disable_hipm(tegra);
+ else if (!strcmp(feature, "ncq"))
+ tegra_ahci_disable_ncq(tegra);
+ else if (!strcmp(feature, "dipm"))
+ ahci_tegra_port_info.flags |= ATA_FLAG_NO_DIPM;
+ else if (!strcmp(feature, "partial"))
+ tegra_ahci_disable_partial(tegra);
+ else if (!strcmp(feature, "slumber"))
+ tegra_ahci_disable_slumber(tegra);
+ }
+}
+
static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
{
struct tegra_ahci_priv *tegra = hpriv->plat_data;
@@ -458,36 +537,14 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
tegra_ahci_sata_update(tegra, 0, SATA_CONFIGURATION_CLK_OVERRIDE,
SATA_CONFIGURATION_0);
+ tegra_ahci_disable_features(hpriv);
+
tegra_ahci_sata_update(tegra, IP_INT_MASK, IP_INT_MASK,
SATA_INTR_MASK_0);
return 0;
}
-static void tegra_ahci_controller_deinit(struct ahci_host_priv *hpriv)
-{
- tegra_ahci_power_off(hpriv);
-}
-
-static void tegra_ahci_host_stop(struct ata_host *host)
-{
- struct ahci_host_priv *hpriv = host->private_data;
-
- tegra_ahci_controller_deinit(hpriv);
-}
-
-static struct ata_port_operations ahci_tegra_port_ops = {
- .inherits = &ahci_ops,
- .host_stop = tegra_ahci_host_stop,
-};
-
-static const struct ata_port_info ahci_tegra_port_info = {
- .flags = AHCI_FLAG_COMMON,
- .pio_mask = ATA_PIO4,
- .udma_mask = ATA_UDMA6,
- .port_ops = &ahci_tegra_port_ops,
-};
-
static const struct of_device_id tegra_ahci_of_match[] = {
{
.compatible = "nvidia,tegra124-ahci",
--
2.1.4
next prev parent reply other threads:[~2016-11-24 7:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 7:43 [PATCH v2 0/3] ADD AHCI support for tegra210 Preetham Chandru Ramchandra
2016-11-24 7:43 ` [PATCH v2 1/3] ata: ahci_tegra: add " Preetham Chandru Ramchandra
[not found] ` <1479973418-21351-2-git-send-email-pchandru-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-28 12:32 ` [v2,1/3] " Mikko Perttunen
[not found] ` <7a8d3270-b8b7-06f9-b8d1-39f9575645ce-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-12-21 8:50 ` Preetham Chandru
[not found] ` <7c1c25bc28a040df9f1f47884ad25746-7W72rfoJkVnYuxH7O460wFaTQe2KTcn/@public.gmane.org>
2016-12-21 9:02 ` Mikko Perttunen
2016-11-24 7:43 ` Preetham Chandru Ramchandra [this message]
[not found] ` <1479973418-21351-3-git-send-email-pchandru-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-28 12:38 ` [v2,2/3] ata: ahci_tegra: Add support to disable features Mikko Perttunen
[not found] ` <bb810105-4196-0594-d378-3c6a7a94b475-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-12-21 9:12 ` Preetham Chandru
[not found] ` <209a3fbeaf094dd992220b850cc62692-7W72rfoJkVnYuxH7O460wFaTQe2KTcn/@public.gmane.org>
2016-12-21 9:31 ` Mikko Perttunen
[not found] ` <268c0db6-e172-0430-b5e0-a04e74c6ee9d-/1wQRMveznE@public.gmane.org>
2016-12-21 9:37 ` Preetham Chandru
2016-11-24 7:43 ` [PATCH v2 3/3] dt-bindings: ata: ahci_tegra: Add tegra210 AHCI Preetham Chandru Ramchandra
[not found] ` <1479973418-21351-4-git-send-email-pchandru-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-28 13:05 ` [v2,3/3] " Mikko Perttunen
[not found] ` <bdc5d888-0d9f-fed2-8a74-c42ae7e6b810-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-28 13:52 ` Jon Hunter
[not found] ` <bc12a764-ddc3-84cf-aa43-3900d1e78021-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-12-22 8:50 ` Preetham Chandru
2016-12-21 11:41 ` Preetham Chandru
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=1479973418-21351-3-git-send-email-pchandru@nvidia.com \
--to=pchandru@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-ide@vger.kernel.org \
--cc=pkunapuli@nvidia.com \
--cc=preetham260@gmail.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
--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