diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 16:13:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 16:13:36 -0700 |
commit | 50528fabeb25f9883e2845f5147f5e00a1c57cf7 (patch) | |
tree | e64da7ca92df33ec2b3f8d0aab1f7e4c38d8626c /drivers/ata/sata_fsl.c | |
parent | 3ed1c478eff8db80e234d5446cb378b503135888 (diff) | |
parent | 2cc1144a31f76d4a9fb48bec5d6ba1359f980813 (diff) | |
download | op-kernel-dev-50528fabeb25f9883e2845f5147f5e00a1c57cf7.zip op-kernel-dev-50528fabeb25f9883e2845f5147f5e00a1c57cf7.tar.gz |
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.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index dfc6fd0..d40e403 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -285,6 +285,7 @@ struct sata_fsl_host_priv { int irq; int data_snoop; struct device_attribute intr_coalescing; + struct device_attribute rx_watermark; }; static 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, return strlen(buf); } +static ssize_t fsl_sata_rx_watermark_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned int rx_watermark; + unsigned long flags; + struct ata_host *host = dev_get_drvdata(dev); + struct sata_fsl_host_priv *host_priv = host->private_data; + void __iomem *csr_base = host_priv->csr_base; + + spin_lock_irqsave(&host->lock, flags); + rx_watermark = ioread32(csr_base + TRANSCFG); + rx_watermark &= 0x1f; + + spin_unlock_irqrestore(&host->lock, flags); + return sprintf(buf, "%d\n", rx_watermark); +} + +static ssize_t fsl_sata_rx_watermark_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned int rx_watermark; + unsigned long flags; + struct ata_host *host = dev_get_drvdata(dev); + struct sata_fsl_host_priv *host_priv = host->private_data; + void __iomem *csr_base = host_priv->csr_base; + u32 temp; + + if (sscanf(buf, "%d", &rx_watermark) != 1) { + printk(KERN_ERR "fsl-sata: wrong parameter format.\n"); + return -EINVAL; + } + + spin_lock_irqsave(&host->lock, flags); + temp = ioread32(csr_base + TRANSCFG); + temp &= 0xffffffe0; + iowrite32(temp | rx_watermark, csr_base + TRANSCFG); + + spin_unlock_irqrestore(&host->lock, flags); + return strlen(buf); +} + static inline unsigned int sata_fsl_tag(unsigned int tag, void __iomem *hcr_base) { @@ -1500,6 +1543,17 @@ static int sata_fsl_probe(struct platform_device *ofdev) if (retval) goto error_exit_with_cleanup; + host_priv->rx_watermark.show = fsl_sata_rx_watermark_show; + host_priv->rx_watermark.store = fsl_sata_rx_watermark_store; + sysfs_attr_init(&host_priv->rx_watermark.attr); + host_priv->rx_watermark.attr.name = "rx_watermark"; + host_priv->rx_watermark.attr.mode = S_IRUGO | S_IWUSR; + retval = device_create_file(host->dev, &host_priv->rx_watermark); + if (retval) { + device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); + goto error_exit_with_cleanup; + } + return 0; error_exit_with_cleanup: @@ -1522,6 +1576,7 @@ static int sata_fsl_remove(struct platform_device *ofdev) struct sata_fsl_host_priv *host_priv = host->private_data; device_remove_file(&ofdev->dev, &host_priv->intr_coalescing); + device_remove_file(&ofdev->dev, &host_priv->rx_watermark); ata_host_detach(host); |