aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAntoine Ténart <antoine.tenart@free-electrons.com>2014-07-30 14:13:56 -0400
committerTejun Heo <tj@kernel.org>2014-07-30 15:39:46 -0400
commit725c7b570fda4207e465ff8856c2c12c2645a685 (patch)
treeef05a418f09a519190a584581ca85c7ee049cec5 /drivers/ata
parente8f781836dc3335b5533f6e177a105bbe3ee7345 (diff)
ata: libahci_platform: move port_map parameters into the AHCI structure
This patch moves force_port_map and mask_port_map into the ahci_host_priv structure. This allows to modify them into the AHCI framework. This is needed by the new dt bindings representing ports as the port_map mask is computed automatically. Parameters modifying force_port_map, mask_port_map and flags have been removed from the ahci_platform_init_host() function, and inputs in the ahci_host_priv structure are now directly filed. Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/acard-ahci.c2
-rw-r--r--drivers/ata/ahci.c3
-rw-r--r--drivers/ata/ahci.h10
-rw-r--r--drivers/ata/ahci_da850.c3
-rw-r--r--drivers/ata/ahci_imx.c3
-rw-r--r--drivers/ata/ahci_mvebu.c3
-rw-r--r--drivers/ata/ahci_platform.c6
-rw-r--r--drivers/ata/ahci_st.c2
-rw-r--r--drivers/ata/ahci_sunxi.c8
-rw-r--r--drivers/ata/ahci_tegra.c3
-rw-r--r--drivers/ata/ahci_xgene.c6
-rw-r--r--drivers/ata/libahci.c19
-rw-r--r--drivers/ata/libahci_platform.c13
-rw-r--r--drivers/ata/sata_highbank.c2
14 files changed, 31 insertions, 52 deletions
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index 0cd7c7a39e5b..25d0ac32e721 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -441,7 +441,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
441 hpriv->mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; 441 hpriv->mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR];
442 442
443 /* save initial config */ 443 /* save initial config */
444 ahci_save_initial_config(&pdev->dev, hpriv, 0, 0); 444 ahci_save_initial_config(&pdev->dev, hpriv);
445 445
446 /* prepare host */ 446 /* prepare host */
447 if (hpriv->cap & HOST_CAP_NCQ) 447 if (hpriv->cap & HOST_CAP_NCQ)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 4cd52a4541a9..a29f8012fb08 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -526,8 +526,7 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev,
526 "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); 526 "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n");
527 } 527 }
528 528
529 ahci_save_initial_config(&pdev->dev, hpriv, force_port_map, 529 ahci_save_initial_config(&pdev->dev, hpriv);
530 mask_port_map);
531} 530}
532 531
533static int ahci_pci_reset_controller(struct ata_host *host) 532static int ahci_pci_reset_controller(struct ata_host *host)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 2ed84e1c70ea..15396f0330ae 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -316,8 +316,12 @@ struct ahci_port_priv {
316}; 316};
317 317
318struct ahci_host_priv { 318struct ahci_host_priv {
319 void __iomem * mmio; /* bus-independent mem map */ 319 /* Input fields */
320 unsigned int flags; /* AHCI_HFLAG_* */ 320 unsigned int flags; /* AHCI_HFLAG_* */
321 u32 force_port_map; /* force port map */
322 u32 mask_port_map; /* mask out particular bits */
323
324 void __iomem * mmio; /* bus-independent mem map */
321 u32 cap; /* cap to use */ 325 u32 cap; /* cap to use */
322 u32 cap2; /* cap2 to use */ 326 u32 cap2; /* cap2 to use */
323 u32 port_map; /* port map to use */ 327 u32 port_map; /* port map to use */
@@ -361,9 +365,7 @@ unsigned int ahci_dev_classify(struct ata_port *ap);
361void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag, 365void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
362 u32 opts); 366 u32 opts);
363void ahci_save_initial_config(struct device *dev, 367void ahci_save_initial_config(struct device *dev,
364 struct ahci_host_priv *hpriv, 368 struct ahci_host_priv *hpriv);
365 unsigned int force_port_map,
366 unsigned int mask_port_map);
367void ahci_init_controller(struct ata_host *host); 369void ahci_init_controller(struct ata_host *host);
368int ahci_reset_controller(struct ata_host *host); 370int ahci_reset_controller(struct ata_host *host);
369 371
diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index 2b77d53bccf8..ad1e71ec10cf 100644
--- a/drivers/ata/ahci_da850.c
+++ b/drivers/ata/ahci_da850.c
@@ -85,8 +85,7 @@ static int ahci_da850_probe(struct platform_device *pdev)
85 85
86 da850_sata_init(dev, pwrdn_reg, hpriv->mmio); 86 da850_sata_init(dev, pwrdn_reg, hpriv->mmio);
87 87
88 rc = ahci_platform_init_host(pdev, hpriv, &ahci_da850_port_info, 88 rc = ahci_platform_init_host(pdev, hpriv, &ahci_da850_port_info);
89 0, 0, 0);
90 if (rc) 89 if (rc)
91 goto disable_resources; 90 goto disable_resources;
92 91
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 1e5fa5f21aff..f3970b4ed889 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -620,8 +620,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
620 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; 620 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
621 writel(reg_val, hpriv->mmio + IMX_TIMER1MS); 621 writel(reg_val, hpriv->mmio + IMX_TIMER1MS);
622 622
623 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 623 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info);
624 0, 0, 0);
625 if (ret) 624 if (ret)
626 goto disable_sata; 625 goto disable_sata;
627 626
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index fd3dfd733b84..68672d2692ee 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -88,8 +88,7 @@ static int ahci_mvebu_probe(struct platform_device *pdev)
88 ahci_mvebu_mbus_config(hpriv, dram); 88 ahci_mvebu_mbus_config(hpriv, dram);
89 ahci_mvebu_regret_option(hpriv); 89 ahci_mvebu_regret_option(hpriv);
90 90
91 rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info, 91 rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info);
92 0, 0, 0);
93 if (rc) 92 if (rc)
94 goto disable_resources; 93 goto disable_resources;
95 94
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index b10d81ddb528..fb3eca5cd66c 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -34,7 +34,6 @@ static int ahci_probe(struct platform_device *pdev)
34 struct device *dev = &pdev->dev; 34 struct device *dev = &pdev->dev;
35 struct ahci_platform_data *pdata = dev_get_platdata(dev); 35 struct ahci_platform_data *pdata = dev_get_platdata(dev);
36 struct ahci_host_priv *hpriv; 36 struct ahci_host_priv *hpriv;
37 unsigned long hflags = 0;
38 int rc; 37 int rc;
39 38
40 hpriv = ahci_platform_get_resources(pdev); 39 hpriv = ahci_platform_get_resources(pdev);
@@ -58,10 +57,9 @@ static int ahci_probe(struct platform_device *pdev)
58 } 57 }
59 58
60 if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) 59 if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
61 hflags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; 60 hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
62 61
63 rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 62 rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info);
64 hflags, 0, 0);
65 if (rc) 63 if (rc)
66 goto pdata_exit; 64 goto pdata_exit;
67 65
diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c
index 29821b9fd13d..835d6eea84fd 100644
--- a/drivers/ata/ahci_st.c
+++ b/drivers/ata/ahci_st.c
@@ -166,7 +166,7 @@ static int st_ahci_probe(struct platform_device *pdev)
166 if (err) 166 if (err)
167 return err; 167 return err;
168 168
169 err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, 0, 0, 0); 169 err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info);
170 if (err) { 170 if (err) {
171 ahci_platform_disable_resources(hpriv); 171 ahci_platform_disable_resources(hpriv);
172 return err; 172 return err;
diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c
index 02002f125bd4..e44d675a30ec 100644
--- a/drivers/ata/ahci_sunxi.c
+++ b/drivers/ata/ahci_sunxi.c
@@ -167,7 +167,6 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
167{ 167{
168 struct device *dev = &pdev->dev; 168 struct device *dev = &pdev->dev;
169 struct ahci_host_priv *hpriv; 169 struct ahci_host_priv *hpriv;
170 unsigned long hflags;
171 int rc; 170 int rc;
172 171
173 hpriv = ahci_platform_get_resources(pdev); 172 hpriv = ahci_platform_get_resources(pdev);
@@ -184,11 +183,10 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
184 if (rc) 183 if (rc)
185 goto disable_resources; 184 goto disable_resources;
186 185
187 hflags = AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI | 186 hpriv->flags = AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
188 AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ; 187 AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
189 188
190 rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info, 189 rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info);
191 hflags, 0, 0);
192 if (rc) 190 if (rc)
193 goto disable_resources; 191 goto disable_resources;
194 192
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index d30bb21afd67..fc3df47fca35 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -348,8 +348,7 @@ static int tegra_ahci_probe(struct platform_device *pdev)
348 if (ret) 348 if (ret)
349 return ret; 349 return ret;
350 350
351 ret = ahci_platform_init_host(pdev, hpriv, &ahci_tegra_port_info, 351 ret = ahci_platform_init_host(pdev, hpriv, &ahci_tegra_port_info);
352 0, 0, 0);
353 if (ret) 352 if (ret)
354 goto deinit_controller; 353 goto deinit_controller;
355 354
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 1cfbdca638d2..bc281115490b 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -422,7 +422,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
422 struct ahci_host_priv *hpriv; 422 struct ahci_host_priv *hpriv;
423 struct xgene_ahci_context *ctx; 423 struct xgene_ahci_context *ctx;
424 struct resource *res; 424 struct resource *res;
425 unsigned long hflags;
426 int rc; 425 int rc;
427 426
428 hpriv = ahci_platform_get_resources(pdev); 427 hpriv = ahci_platform_get_resources(pdev);
@@ -481,10 +480,9 @@ static int xgene_ahci_probe(struct platform_device *pdev)
481 /* Configure the host controller */ 480 /* Configure the host controller */
482 xgene_ahci_hw_init(hpriv); 481 xgene_ahci_hw_init(hpriv);
483 482
484 hflags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ; 483 hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
485 484
486 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info, 485 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info);
487 hflags, 0, 0);
488 if (rc) 486 if (rc)
489 goto disable_resources; 487 goto disable_resources;
490 488
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index d72ce0470309..b784e9de426a 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -382,8 +382,6 @@ static ssize_t ahci_show_em_supported(struct device *dev,
382 * ahci_save_initial_config - Save and fixup initial config values 382 * ahci_save_initial_config - Save and fixup initial config values
383 * @dev: target AHCI device 383 * @dev: target AHCI device
384 * @hpriv: host private area to store config values 384 * @hpriv: host private area to store config values
385 * @force_port_map: force port map to a specified value
386 * @mask_port_map: mask out particular bits from port map
387 * 385 *
388 * Some registers containing configuration info might be setup by 386 * Some registers containing configuration info might be setup by
389 * BIOS and might be cleared on reset. This function saves the 387 * BIOS and might be cleared on reset. This function saves the
@@ -398,10 +396,7 @@ static ssize_t ahci_show_em_supported(struct device *dev,
398 * LOCKING: 396 * LOCKING:
399 * None. 397 * None.
400 */ 398 */
401void ahci_save_initial_config(struct device *dev, 399void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
402 struct ahci_host_priv *hpriv,
403 unsigned int force_port_map,
404 unsigned int mask_port_map)
405{ 400{
406 void __iomem *mmio = hpriv->mmio; 401 void __iomem *mmio = hpriv->mmio;
407 u32 cap, cap2, vers, port_map; 402 u32 cap, cap2, vers, port_map;
@@ -468,17 +463,17 @@ void ahci_save_initial_config(struct device *dev,
468 cap &= ~HOST_CAP_FBS; 463 cap &= ~HOST_CAP_FBS;
469 } 464 }
470 465
471 if (force_port_map && port_map != force_port_map) { 466 if (hpriv->force_port_map && port_map != hpriv->force_port_map) {
472 dev_info(dev, "forcing port_map 0x%x -> 0x%x\n", 467 dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
473 port_map, force_port_map); 468 port_map, hpriv->force_port_map);
474 port_map = force_port_map; 469 port_map = hpriv->force_port_map;
475 } 470 }
476 471
477 if (mask_port_map) { 472 if (hpriv->mask_port_map) {
478 dev_warn(dev, "masking port_map 0x%x -> 0x%x\n", 473 dev_warn(dev, "masking port_map 0x%x -> 0x%x\n",
479 port_map, 474 port_map,
480 port_map & mask_port_map); 475 port_map & hpriv->mask_port_map);
481 port_map &= mask_port_map; 476 port_map &= hpriv->mask_port_map;
482 } 477 }
483 478
484 /* cross check port_map and cap.n_ports */ 479 /* cross check port_map and cap.n_ports */
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 28840a2f470f..00582d3a46a4 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -288,9 +288,6 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
288 * @pdev: platform device pointer for the host 288 * @pdev: platform device pointer for the host
289 * @hpriv: ahci-host private data for the host 289 * @hpriv: ahci-host private data for the host
290 * @pi_template: template for the ata_port_info to use 290 * @pi_template: template for the ata_port_info to use
291 * @host_flags: ahci host flags used in ahci_host_priv
292 * @force_port_map: param passed to ahci_save_initial_config
293 * @mask_port_map: param passed to ahci_save_initial_config
294 * 291 *
295 * This function does all the usual steps needed to bring up an 292 * This function does all the usual steps needed to bring up an
296 * ahci-platform host, note any necessary resources (ie clks, phy, etc.) 293 * ahci-platform host, note any necessary resources (ie clks, phy, etc.)
@@ -301,10 +298,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
301 */ 298 */
302int ahci_platform_init_host(struct platform_device *pdev, 299int ahci_platform_init_host(struct platform_device *pdev,
303 struct ahci_host_priv *hpriv, 300 struct ahci_host_priv *hpriv,
304 const struct ata_port_info *pi_template, 301 const struct ata_port_info *pi_template)
305 unsigned long host_flags,
306 unsigned int force_port_map,
307 unsigned int mask_port_map)
308{ 302{
309 struct device *dev = &pdev->dev; 303 struct device *dev = &pdev->dev;
310 struct ata_port_info pi = *pi_template; 304 struct ata_port_info pi = *pi_template;
@@ -319,10 +313,9 @@ int ahci_platform_init_host(struct platform_device *pdev,
319 } 313 }
320 314
321 /* prepare host */ 315 /* prepare host */
322 pi.private_data = (void *)host_flags; 316 pi.private_data = (void *)hpriv->flags;
323 hpriv->flags |= host_flags;
324 317
325 ahci_save_initial_config(dev, hpriv, force_port_map, mask_port_map); 318 ahci_save_initial_config(dev, hpriv);
326 319
327 if (hpriv->cap & HOST_CAP_NCQ) 320 if (hpriv->cap & HOST_CAP_NCQ)
328 pi.flags |= ATA_FLAG_NCQ; 321 pi.flags |= ATA_FLAG_NCQ;
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 65965cf5af06..da3bc2709c63 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -512,7 +512,7 @@ static int ahci_highbank_probe(struct platform_device *pdev)
512 return rc; 512 return rc;
513 513
514 514
515 ahci_save_initial_config(dev, hpriv, 0, 0); 515 ahci_save_initial_config(dev, hpriv);
516 516
517 /* prepare host */ 517 /* prepare host */
518 if (hpriv->cap & HOST_CAP_NCQ) 518 if (hpriv->cap & HOST_CAP_NCQ)