aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_fsl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 19:13:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 19:13:36 -0400
commit50528fabeb25f9883e2845f5147f5e00a1c57cf7 (patch)
treee64da7ca92df33ec2b3f8d0aab1f7e4c38d8626c /drivers/ata/sata_fsl.c
parent3ed1c478eff8db80e234d5446cb378b503135888 (diff)
parent2cc1144a31f76d4a9fb48bec5d6ba1359f980813 (diff)
Merge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
Pull libata update from Jeff Garzik: - More ACPI fixes, cleanups - Minor cleanups for sata_highbank, pata_at32, pata_octeon_cf, sata_rcar - pata_legacy: small bug found in opti chipset code (untested fix, due to ancient h/w) - sata_fsl: RX water mark config knob, some h/w needs it - pata_imx: cleanups, DeviceTree support - SCSI<->ATA translator: properly export translator version, not device firmware version * tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: sata_highbank: Rename proc_name to the module name ACPI/libata: Restore libata.noacpi support [libata] acpi: make ata_ap_acpi_handle not block [libata] SCSI: really use SATL version in VPD pata_imx: add devicetree support pata_imx: use void __iomem * for regs pata_imx: cleanup error path pata_imx: Use devm_clk_get sata_rcar: Convert to devm_ioremap_resource() fsl/sata: create a sysfs entry for rx water mark libata-acpi: remove redundent code for power resource handling sata_highbank: make ahci_highbank_pm_ops static pata_octeon_cf: Use resource_size function pata_legacy: bogus clock in opti82c46x_set_piomode() pata_at32: use module_platform_driver_probe()
Diffstat (limited to 'drivers/ata/sata_fsl.c')
-rw-r--r--drivers/ata/sata_fsl.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index dfc6fd0ac119..d40e403e82dd 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -285,6 +285,7 @@ struct sata_fsl_host_priv {
285 int irq; 285 int irq;
286 int data_snoop; 286 int data_snoop;
287 struct device_attribute intr_coalescing; 287 struct device_attribute intr_coalescing;
288 struct device_attribute rx_watermark;
288}; 289};
289 290
290static void fsl_sata_set_irq_coalescing(struct ata_host *host, 291static void fsl_sata_set_irq_coalescing(struct ata_host *host,
@@ -343,6 +344,48 @@ static ssize_t fsl_sata_intr_coalescing_store(struct device *dev,
343 return strlen(buf); 344 return strlen(buf);
344} 345}
345 346
347static ssize_t fsl_sata_rx_watermark_show(struct device *dev,
348 struct device_attribute *attr, char *buf)
349{
350 unsigned int rx_watermark;
351 unsigned long flags;
352 struct ata_host *host = dev_get_drvdata(dev);
353 struct sata_fsl_host_priv *host_priv = host->private_data;
354 void __iomem *csr_base = host_priv->csr_base;
355
356 spin_lock_irqsave(&host->lock, flags);
357 rx_watermark = ioread32(csr_base + TRANSCFG);
358 rx_watermark &= 0x1f;
359
360 spin_unlock_irqrestore(&host->lock, flags);
361 return sprintf(buf, "%d\n", rx_watermark);
362}
363
364static ssize_t fsl_sata_rx_watermark_store(struct device *dev,
365 struct device_attribute *attr,
366 const char *buf, size_t count)
367{
368 unsigned int rx_watermark;
369 unsigned long flags;
370 struct ata_host *host = dev_get_drvdata(dev);
371 struct sata_fsl_host_priv *host_priv = host->private_data;
372 void __iomem *csr_base = host_priv->csr_base;
373 u32 temp;
374
375 if (sscanf(buf, "%d", &rx_watermark) != 1) {
376 printk(KERN_ERR "fsl-sata: wrong parameter format.\n");
377 return -EINVAL;
378 }
379
380 spin_lock_irqsave(&host->lock, flags);
381 temp = ioread32(csr_base + TRANSCFG);
382 temp &= 0xffffffe0;
383 iowrite32(temp | rx_watermark, csr_base + TRANSCFG);
384
385 spin_unlock_irqrestore(&host->lock, flags);
386 return strlen(buf);
387}
388
346static inline unsigned int sata_fsl_tag(unsigned int tag, 389static inline unsigned int sata_fsl_tag(unsigned int tag,
347 void __iomem *hcr_base) 390 void __iomem *hcr_base)
348{ 391{
@@ -1500,6 +1543,17 @@ static int sata_fsl_probe(struct platform_device *ofdev)
1500 if (retval) 1543 if (retval)
1501 goto error_exit_with_cleanup; 1544 goto error_exit_with_cleanup;
1502 1545
1546 host_priv->rx_watermark.show = fsl_sata_rx_watermark_show;
1547 host_priv->rx_watermark.store = fsl_sata_rx_watermark_store;
1548 sysfs_attr_init(&host_priv->rx_watermark.attr);
1549 host_priv->rx_watermark.attr.name = "rx_watermark";
1550 host_priv->rx_watermark.attr.mode = S_IRUGO | S_IWUSR;
1551 retval = device_create_file(host->dev, &host_priv->rx_watermark);
1552 if (retval) {
1553 device_remove_file(&ofdev->dev, &host_priv->intr_coalescing);
1554 goto error_exit_with_cleanup;
1555 }
1556
1503 return 0; 1557 return 0;
1504 1558
1505error_exit_with_cleanup: 1559error_exit_with_cleanup:
@@ -1522,6 +1576,7 @@ static int sata_fsl_remove(struct platform_device *ofdev)
1522 struct sata_fsl_host_priv *host_priv = host->private_data; 1576 struct sata_fsl_host_priv *host_priv = host->private_data;
1523 1577
1524 device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); 1578 device_remove_file(&ofdev->dev, &host_priv->intr_coalescing);
1579 device_remove_file(&ofdev->dev, &host_priv->rx_watermark);
1525 1580
1526 ata_host_detach(host); 1581 ata_host_detach(host);
1527 1582