aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorKefeng Wang <kefeng.wang@linaro.org>2014-05-14 02:13:41 -0400
committerTejun Heo <tj@kernel.org>2014-05-14 13:07:10 -0400
commitf9f36917903b57c571b1ddcfc6bc794ca4dd8232 (patch)
treecbabd67e07fd49de26f8ce42adba490eddaca77e /drivers/ata
parent888d91a08fa8e2be4cb0eef1e5736ef68b8f77f0 (diff)
libahci_platform: add host_flags parameter in ahci_platform_init_host()
Add a dynamic host_flags argument to make ahci_platform_init_host more flexible, then remove the AHCI_HFLAGS(...) argument from some driver's ata_port_info, and pass that in as the new argument. Cc: Hans de Geode <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
-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.c2
-rw-r--r--drivers/ata/ahci_st.c2
-rw-r--r--drivers/ata/ahci_sunxi.c9
-rw-r--r--drivers/ata/ahci_xgene.c7
-rw-r--r--drivers/ata/libahci_platform.c5
8 files changed, 23 insertions, 11 deletions
diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index 2c83613ce2db..2b77d53bccf8 100644
--- a/drivers/ata/ahci_da850.c
+++ b/drivers/ata/ahci_da850.c
@@ -85,7 +85,8 @@ 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, 0, 0); 88 rc = ahci_platform_init_host(pdev, hpriv, &ahci_da850_port_info,
89 0, 0, 0);
89 if (rc) 90 if (rc)
90 goto disable_resources; 91 goto disable_resources;
91 92
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 497c7abe1c7d..e7e44a73e4fe 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -267,7 +267,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
267 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; 267 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
268 writel(reg_val, hpriv->mmio + HOST_TIMER1MS); 268 writel(reg_val, hpriv->mmio + HOST_TIMER1MS);
269 269
270 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0); 270 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info,
271 0, 0, 0);
271 if (ret) 272 if (ret)
272 imx_sata_disable(hpriv); 273 imx_sata_disable(hpriv);
273 274
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index 1df8630c6b65..fd3dfd733b84 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -88,7 +88,8 @@ 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, 0, 0); 91 rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info,
92 0, 0, 0);
92 if (rc) 93 if (rc)
93 goto disable_resources; 94 goto disable_resources;
94 95
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index ef67e79944f9..a476a1fd3f8f 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -55,7 +55,7 @@ static int ahci_probe(struct platform_device *pdev)
55 goto disable_resources; 55 goto disable_resources;
56 } 56 }
57 57
58 rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0); 58 rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0, 0);
59 if (rc) 59 if (rc)
60 goto pdata_exit; 60 goto pdata_exit;
61 61
diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c
index 633222226c19..2595598df9ce 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); 169 err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, 0, 0, 0);
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 42d3f64e74b3..02002f125bd4 100644
--- a/drivers/ata/ahci_sunxi.c
+++ b/drivers/ata/ahci_sunxi.c
@@ -157,8 +157,6 @@ static void ahci_sunxi_start_engine(struct ata_port *ap)
157} 157}
158 158
159static const struct ata_port_info ahci_sunxi_port_info = { 159static const struct ata_port_info ahci_sunxi_port_info = {
160 AHCI_HFLAGS(AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
161 AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
162 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ, 160 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
163 .pio_mask = ATA_PIO4, 161 .pio_mask = ATA_PIO4,
164 .udma_mask = ATA_UDMA6, 162 .udma_mask = ATA_UDMA6,
@@ -169,6 +167,7 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
169{ 167{
170 struct device *dev = &pdev->dev; 168 struct device *dev = &pdev->dev;
171 struct ahci_host_priv *hpriv; 169 struct ahci_host_priv *hpriv;
170 unsigned long hflags;
172 int rc; 171 int rc;
173 172
174 hpriv = ahci_platform_get_resources(pdev); 173 hpriv = ahci_platform_get_resources(pdev);
@@ -185,7 +184,11 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
185 if (rc) 184 if (rc)
186 goto disable_resources; 185 goto disable_resources;
187 186
188 rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info, 0, 0); 187 hflags = AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
188 AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
189
190 rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info,
191 hflags, 0, 0);
189 if (rc) 192 if (rc)
190 goto disable_resources; 193 goto disable_resources;
191 194
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 77c89bf171f1..042a9bb45c86 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -303,7 +303,6 @@ static struct ata_port_operations xgene_ahci_ops = {
303}; 303};
304 304
305static const struct ata_port_info xgene_ahci_port_info = { 305static const struct ata_port_info xgene_ahci_port_info = {
306 AHCI_HFLAGS(AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
307 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ, 306 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
308 .pio_mask = ATA_PIO4, 307 .pio_mask = ATA_PIO4,
309 .udma_mask = ATA_UDMA6, 308 .udma_mask = ATA_UDMA6,
@@ -382,6 +381,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
382 struct ahci_host_priv *hpriv; 381 struct ahci_host_priv *hpriv;
383 struct xgene_ahci_context *ctx; 382 struct xgene_ahci_context *ctx;
384 struct resource *res; 383 struct resource *res;
384 unsigned long hflags;
385 int rc; 385 int rc;
386 386
387 hpriv = ahci_platform_get_resources(pdev); 387 hpriv = ahci_platform_get_resources(pdev);
@@ -450,7 +450,10 @@ static int xgene_ahci_probe(struct platform_device *pdev)
450 goto disable_resources; 450 goto disable_resources;
451 } 451 }
452 452
453 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info, 0, 0); 453 hflags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
454
455 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info,
456 hflags, 0, 0);
454 if (rc) 457 if (rc)
455 goto disable_resources; 458 goto disable_resources;
456 459
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 7cb3a85719c0..3a5b4ed25a4f 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -283,6 +283,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
283 * @pdev: platform device pointer for the host 283 * @pdev: platform device pointer for the host
284 * @hpriv: ahci-host private data for the host 284 * @hpriv: ahci-host private data for the host
285 * @pi_template: template for the ata_port_info to use 285 * @pi_template: template for the ata_port_info to use
286 * @host_flags: ahci host flags used in ahci_host_priv
286 * @force_port_map: param passed to ahci_save_initial_config 287 * @force_port_map: param passed to ahci_save_initial_config
287 * @mask_port_map: param passed to ahci_save_initial_config 288 * @mask_port_map: param passed to ahci_save_initial_config
288 * 289 *
@@ -296,6 +297,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
296int ahci_platform_init_host(struct platform_device *pdev, 297int ahci_platform_init_host(struct platform_device *pdev,
297 struct ahci_host_priv *hpriv, 298 struct ahci_host_priv *hpriv,
298 const struct ata_port_info *pi_template, 299 const struct ata_port_info *pi_template,
300 unsigned long host_flags,
299 unsigned int force_port_map, 301 unsigned int force_port_map,
300 unsigned int mask_port_map) 302 unsigned int mask_port_map)
301{ 303{
@@ -312,7 +314,8 @@ int ahci_platform_init_host(struct platform_device *pdev,
312 } 314 }
313 315
314 /* prepare host */ 316 /* prepare host */
315 hpriv->flags |= (unsigned long)pi.private_data; 317 pi.private_data = (void *)host_flags;
318 hpriv->flags |= host_flags;
316 319
317 ahci_save_initial_config(dev, hpriv, force_port_map, mask_port_map); 320 ahci_save_initial_config(dev, hpriv, force_port_map, mask_port_map);
318 321