aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-26 17:39:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-26 17:39:40 -0400
commit75a442efb1ca613f8d1cc71a32c2c9b0aefae4a5 (patch)
tree6161c21803db3f03bcbd26715761e2d310246bb8 /drivers/ata
parentb55b048718c8c833186c87ceeea86b78346cda2e (diff)
parent737bee9308c457090711684b976e0fe02785a094 (diff)
Merge branch 'for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata updates from Tejun Heo: "libata saw quite a bit of activities in this cycle: - SMR drive support still being worked on - bug fixes and improvements to misc SCSI command emulation - some low level driver updates" * 'for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (39 commits) libata-scsi: better style in ata_msense_*() AHCI: Clear GHC.IS to prevent unexpectly asserting INTx ata: sata_dwc_460ex: remove redundant dev_err call ata: define ATA_PROT_* in terms of ATA_PROT_FLAG_* libata: remove ATA_PROT_FLAG_DATA libata: remove ata_is_nodata ata: make lba_{28,48}_ok() use ATA_MAX_SECTORS{,_LBA48} libata-scsi: minor cleanup for ata_scsi_zbc_out_xlat libata-scsi: Fix ZBC management out command translation libata-scsi: Fix translation of REPORT ZONES command ata: Handle ATA NCQ NO-DATA commands correctly libata-eh: decode all taskfile protocols ata: fixup ATA_PROT_NODATA libsas: use ata_is_ncq() and ata_has_dma() accessors libata: use ata_is_ncq() accessors libata: return boolean values from ata_is_* libata-scsi: avoid repeated calculation of number of TRIM ranges libata-scsi: reject WRITE SAME (16) with n_block that exceeds limit libata-scsi: rename ata_msense_ctl_mode() to ata_msense_control() libata-scsi: fix D_SENSE bit relection in control mode page ...
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/Kconfig8
-rw-r--r--drivers/ata/Makefile2
-rw-r--r--drivers/ata/ahci.c2
-rw-r--r--drivers/ata/ahci_brcm.c (renamed from drivers/ata/ahci_brcmstb.c)46
-rw-r--r--drivers/ata/libahci.c10
-rw-r--r--drivers/ata/libata-core.c14
-rw-r--r--drivers/ata/libata-eh.c8
-rw-r--r--drivers/ata/libata-scsi.c82
-rw-r--r--drivers/ata/libata-transport.c9
-rw-r--r--drivers/ata/pata_arasan_cf.c2
-rw-r--r--drivers/ata/pata_atiixp.c4
-rw-r--r--drivers/ata/pata_hpt366.c2
-rw-r--r--drivers/ata/pata_marvell.c2
-rw-r--r--drivers/ata/sata_dwc_460ex.c14
14 files changed, 129 insertions, 76 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index e2dc4c045146..2c8be74f401d 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -98,12 +98,12 @@ config SATA_AHCI_PLATFORM
98 98
99 If unsure, say N. 99 If unsure, say N.
100 100
101config AHCI_BRCMSTB 101config AHCI_BRCM
102 tristate "Broadcom STB AHCI SATA support" 102 tristate "Broadcom AHCI SATA support"
103 depends on ARCH_BRCMSTB || BMIPS_GENERIC 103 depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP
104 help 104 help
105 This option enables support for the AHCI SATA3 controller found on 105 This option enables support for the AHCI SATA3 controller found on
106 STB SoC's. 106 Broadcom SoC's.
107 107
108 If unsure, say N. 108 If unsure, say N.
109 109
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 0b2afb7e5f35..a46e6b784bda 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
11obj-$(CONFIG_SATA_SIL24) += sata_sil24.o 11obj-$(CONFIG_SATA_SIL24) += sata_sil24.o
12obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o 12obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o
13obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o 13obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o
14obj-$(CONFIG_AHCI_BRCMSTB) += ahci_brcmstb.o libahci.o libahci_platform.o 14obj-$(CONFIG_AHCI_BRCM) += ahci_brcm.o libahci.o libahci_platform.o
15obj-$(CONFIG_AHCI_CEVA) += ahci_ceva.o libahci.o libahci_platform.o 15obj-$(CONFIG_AHCI_CEVA) += ahci_ceva.o libahci.o libahci_platform.o
16obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o 16obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o
17obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o 17obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index a83bbcc58b4c..90eabaf81215 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -580,7 +580,7 @@ static struct pci_driver ahci_pci_driver = {
580 }, 580 },
581}; 581};
582 582
583#if defined(CONFIG_PATA_MARVELL) || defined(CONFIG_PATA_MARVELL_MODULE) 583#if IS_ENABLED(CONFIG_PATA_MARVELL)
584static int marvell_enable; 584static int marvell_enable;
585#else 585#else
586static int marvell_enable = 1; 586static int marvell_enable = 1;
diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcm.c
index e87bcec0fd7c..6f8a7341fa08 100644
--- a/drivers/ata/ahci_brcmstb.c
+++ b/drivers/ata/ahci_brcm.c
@@ -71,6 +71,12 @@
71 (DATA_ENDIAN << DMADESC_ENDIAN_SHIFT) | \ 71 (DATA_ENDIAN << DMADESC_ENDIAN_SHIFT) | \
72 (MMIO_ENDIAN << MMIO_ENDIAN_SHIFT)) 72 (MMIO_ENDIAN << MMIO_ENDIAN_SHIFT))
73 73
74enum brcm_ahci_version {
75 BRCM_SATA_BCM7425 = 1,
76 BRCM_SATA_BCM7445,
77 BRCM_SATA_NSP,
78};
79
74enum brcm_ahci_quirks { 80enum brcm_ahci_quirks {
75 BRCM_AHCI_QUIRK_NO_NCQ = BIT(0), 81 BRCM_AHCI_QUIRK_NO_NCQ = BIT(0),
76 BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(1), 82 BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(1),
@@ -81,6 +87,7 @@ struct brcm_ahci_priv {
81 void __iomem *top_ctrl; 87 void __iomem *top_ctrl;
82 u32 port_mask; 88 u32 port_mask;
83 u32 quirks; 89 u32 quirks;
90 enum brcm_ahci_version version;
84}; 91};
85 92
86static const struct ata_port_info ahci_brcm_port_info = { 93static const struct ata_port_info ahci_brcm_port_info = {
@@ -247,9 +254,19 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev,
247 254
248static void brcm_sata_init(struct brcm_ahci_priv *priv) 255static void brcm_sata_init(struct brcm_ahci_priv *priv)
249{ 256{
257 void __iomem *ctrl = priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL;
258
250 /* Configure endianness */ 259 /* Configure endianness */
251 brcm_sata_writereg(BUS_CTRL_ENDIAN_CONF, 260 if (priv->version == BRCM_SATA_NSP) {
252 priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL); 261 u32 data = brcm_sata_readreg(ctrl);
262
263 data &= ~((0x03 << DMADATA_ENDIAN_SHIFT) |
264 (0x03 << DMADESC_ENDIAN_SHIFT));
265 data |= (0x02 << DMADATA_ENDIAN_SHIFT) |
266 (0x02 << DMADESC_ENDIAN_SHIFT);
267 brcm_sata_writereg(data, ctrl);
268 } else
269 brcm_sata_writereg(BUS_CTRL_ENDIAN_CONF, ctrl);
253} 270}
254 271
255#ifdef CONFIG_PM_SLEEP 272#ifdef CONFIG_PM_SLEEP
@@ -282,8 +299,17 @@ static struct scsi_host_template ahci_platform_sht = {
282 AHCI_SHT(DRV_NAME), 299 AHCI_SHT(DRV_NAME),
283}; 300};
284 301
302static const struct of_device_id ahci_of_match[] = {
303 {.compatible = "brcm,bcm7425-ahci", .data = (void *)BRCM_SATA_BCM7425},
304 {.compatible = "brcm,bcm7445-ahci", .data = (void *)BRCM_SATA_BCM7445},
305 {.compatible = "brcm,bcm-nsp-ahci", .data = (void *)BRCM_SATA_NSP},
306 {},
307};
308MODULE_DEVICE_TABLE(of, ahci_of_match);
309
285static int brcm_ahci_probe(struct platform_device *pdev) 310static int brcm_ahci_probe(struct platform_device *pdev)
286{ 311{
312 const struct of_device_id *of_id;
287 struct device *dev = &pdev->dev; 313 struct device *dev = &pdev->dev;
288 struct brcm_ahci_priv *priv; 314 struct brcm_ahci_priv *priv;
289 struct ahci_host_priv *hpriv; 315 struct ahci_host_priv *hpriv;
@@ -293,6 +319,12 @@ static int brcm_ahci_probe(struct platform_device *pdev)
293 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 319 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
294 if (!priv) 320 if (!priv)
295 return -ENOMEM; 321 return -ENOMEM;
322
323 of_id = of_match_node(ahci_of_match, pdev->dev.of_node);
324 if (!of_id)
325 return -ENODEV;
326
327 priv->version = (enum brcm_ahci_version)of_id->data;
296 priv->dev = dev; 328 priv->dev = dev;
297 329
298 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "top-ctrl"); 330 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "top-ctrl");
@@ -300,7 +332,8 @@ static int brcm_ahci_probe(struct platform_device *pdev)
300 if (IS_ERR(priv->top_ctrl)) 332 if (IS_ERR(priv->top_ctrl))
301 return PTR_ERR(priv->top_ctrl); 333 return PTR_ERR(priv->top_ctrl);
302 334
303 if (of_device_is_compatible(dev->of_node, "brcm,bcm7425-ahci")) { 335 if ((priv->version == BRCM_SATA_BCM7425) ||
336 (priv->version == BRCM_SATA_NSP)) {
304 priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ; 337 priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ;
305 priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; 338 priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
306 } 339 }
@@ -354,13 +387,6 @@ static int brcm_ahci_remove(struct platform_device *pdev)
354 return 0; 387 return 0;
355} 388}
356 389
357static const struct of_device_id ahci_of_match[] = {
358 {.compatible = "brcm,bcm7425-ahci"},
359 {.compatible = "brcm,bcm7445-ahci"},
360 {},
361};
362MODULE_DEVICE_TABLE(of, ahci_of_match);
363
364static SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume); 390static SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume);
365 391
366static struct platform_driver brcm_ahci_driver = { 392static struct platform_driver brcm_ahci_driver = {
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 71b07198e207..7461a587b39b 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1975,7 +1975,7 @@ unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
1975 */ 1975 */
1976 pp->active_link = qc->dev->link; 1976 pp->active_link = qc->dev->link;
1977 1977
1978 if (qc->tf.protocol == ATA_PROT_NCQ) 1978 if (ata_is_ncq(qc->tf.protocol))
1979 writel(1 << qc->tag, port_mmio + PORT_SCR_ACT); 1979 writel(1 << qc->tag, port_mmio + PORT_SCR_ACT);
1980 1980
1981 if (pp->fbs_enabled && pp->fbs_last_dev != qc->dev->link->pmp) { 1981 if (pp->fbs_enabled && pp->fbs_last_dev != qc->dev->link->pmp) {
@@ -2392,12 +2392,20 @@ static int ahci_port_start(struct ata_port *ap)
2392static void ahci_port_stop(struct ata_port *ap) 2392static void ahci_port_stop(struct ata_port *ap)
2393{ 2393{
2394 c