aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPreetham Ramchandra <pchandru@nvidia.com>2018-03-12 07:40:35 -0400
committerTejun Heo <tj@kernel.org>2018-03-14 11:24:20 -0400
commit502717ccf7720e785fdc1c9202d1b3930fd08038 (patch)
tree1300e0211bee5c330a86d84f574a26eb2d39d7a4
parent43ee827b562b092f594375945aec9178f9b5cca4 (diff)
ata: ahci_tegra: disable devslp for Tegra124
Tegra124 does not support devslp and it should be disabled. Signed-off-by: Preetham Chandru R <pchandru@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--drivers/ata/ahci_tegra.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index 547a6f93922c..620cdd16ef2f 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -166,12 +166,14 @@ struct tegra_ahci_ops {
166struct tegra_ahci_soc { 166struct tegra_ahci_soc {
167 const char *const *supply_names; 167 const char *const *supply_names;
168 u32 num_supplies; 168 u32 num_supplies;
169 bool supports_devslp;
169 const struct tegra_ahci_ops *ops; 170 const struct tegra_ahci_ops *ops;
170}; 171};
171 172
172struct tegra_ahci_priv { 173struct tegra_ahci_priv {
173 struct platform_device *pdev; 174 struct platform_device *pdev;
174 void __iomem *sata_regs; 175 void __iomem *sata_regs;
176 void __iomem *sata_aux_regs;
175 struct reset_control *sata_rst; 177 struct reset_control *sata_rst;
176 struct reset_control *sata_oob_rst; 178 struct reset_control *sata_oob_rst;
177 struct reset_control *sata_cold_rst; 179 struct reset_control *sata_cold_rst;
@@ -181,6 +183,18 @@ struct tegra_ahci_priv {
181 const struct tegra_ahci_soc *soc; 183 const struct tegra_ahci_soc *soc;
182}; 184};
183 185
186static void tegra_ahci_handle_quirks(struct ahci_host_priv *hpriv)
187{
188 struct tegra_ahci_priv *tegra = hpriv->plat_data;
189 u32 val;
190
191 if (tegra->sata_aux_regs && !tegra->soc->supports_devslp) {
192 val = readl(tegra->sata_aux_regs + SATA_AUX_MISC_CNTL_1_0);
193 val &= ~SATA_AUX_MISC_CNTL_1_0_SDS_SUPPORT;
194 writel(val, tegra->sata_aux_regs + SATA_AUX_MISC_CNTL_1_0);
195 }
196}
197
184static int tegra124_ahci_init(struct ahci_host_priv *hpriv) 198static int tegra124_ahci_init(struct ahci_host_priv *hpriv)
185{ 199{
186 struct tegra_ahci_priv *tegra = hpriv->plat_data; 200 struct tegra_ahci_priv *tegra = hpriv->plat_data;
@@ -401,6 +415,7 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
401 val &= ~SATA_CONFIGURATION_0_CLK_OVERRIDE; 415 val &= ~SATA_CONFIGURATION_0_CLK_OVERRIDE;
402 writel(val, tegra->sata_regs + SATA_CONFIGURATION_0); 416 writel(val, tegra->sata_regs + SATA_CONFIGURATION_0);
403 417
418 tegra_ahci_handle_quirks(hpriv);
404 419
405 /* Unmask SATA interrupts */ 420 /* Unmask SATA interrupts */
406 421
@@ -446,6 +461,7 @@ static const struct tegra_ahci_ops tegra124_ahci_ops = {
446static const struct tegra_ahci_soc tegra124_ahci_soc = { 461static const struct tegra_ahci_soc tegra124_ahci_soc = {
447 .supply_names = tegra124_supply_names, 462 .supply_names = tegra124_supply_names,
448 .num_supplies = ARRAY_SIZE(tegra124_supply_names), 463 .num_supplies = ARRAY_SIZE(tegra124_supply_names),
464 .supports_devslp = false,
449 .ops = &tegra124_ahci_ops, 465 .ops = &tegra124_ahci_ops,
450}; 466};
451 467
@@ -488,6 +504,16 @@ static int tegra_ahci_probe(struct platform_device *pdev)
488 if (IS_ERR(tegra->sata_regs)) 504 if (IS_ERR(tegra->sata_regs))
489 return PTR_ERR(tegra->sata_regs); 505 return PTR_ERR(tegra->sata_regs);
490 506
507 /*
508 * AUX registers is optional.
509 */
510 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
511 if (res) {
512 tegra->sata_aux_regs = devm_ioremap_resource(&pdev->dev, res);
513 if (IS_ERR(tegra->sata_aux_regs))
514 return PTR_ERR(tegra->sata_aux_regs);
515 }
516
491 tegra->sata_rst = devm_reset_control_get(&pdev->dev, "sata"); 517 tegra->sata_rst = devm_reset_control_get(&pdev->dev, "sata");
492 if (IS_ERR(tegra->sata_rst)) { 518 if (IS_ERR(tegra->sata_rst)) {
493 dev_err(&pdev->dev, "Failed to get sata reset\n"); 519 dev_err(&pdev->dev, "Failed to get sata reset\n");