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()
Unified · Split
| @@ -0,0 +1,17 @@ | |||
| 1 | * Freescale i.MX PATA Controller | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: "fsl,imx27-pata" | ||
| 5 | - reg: Address range of the PATA Controller | ||
| 6 | - interrupts: The interrupt of the PATA Controller | ||
| 7 | - clocks: the clocks for the PATA Controller | ||
| 8 | |||
| 9 | Example: | ||
| 10 | |||
| 11 | pata: pata@83fe0000 { | ||
| 12 | compatible = "fsl,imx51-pata", "fsl,imx27-pata"; | ||
| 13 | reg = <0x83fe0000 0x4000>; | ||
| 14 | interrupts = <70>; | ||
| 15 | clocks = <&clks 161>; | ||
| 16 | status = "disabled"; | ||
| 17 | }; | ||
| @@ -17,7 +17,6 @@ · 16 unmodified lines | |||
| 17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
| 20 | #include <linux/pm_qos.h> | ||
| 21 | #include <scsi/scsi_device.h> | 20 | #include <scsi/scsi_device.h> |
| 22 | #include "libata.h" | 21 | #include "libata.h" |
| 23 | 22 | ||
| @@ -61,7 +60,8 @@ acpi_handle ata_ap_acpi_handle(struct ata_port *ap) · 37 unmodified lines | |||
| 61 | if (ap->flags & ATA_FLAG_ACPI_SATA) | 60 | if (ap->flags & ATA_FLAG_ACPI_SATA) |
| 62 | return NULL; | 61 | return NULL; |
| 63 | 62 | ||
| 64 | return acpi_get_child(DEVICE_ACPI_HANDLE(ap->host->dev), ap->port_no); | 63 | return ap->scsi_host ? |
| 64 | DEVICE_ACPI_HANDLE(&ap->scsi_host->shost_gendev) : NULL; | ||
| 65 | } | 65 | } |
| 66 | EXPORT_SYMBOL(ata_ap_acpi_handle); | 66 | EXPORT_SYMBOL(ata_ap_acpi_handle); |
| 67 | 67 | ||
| @@ -77,7 +77,7 @@ acpi_handle ata_dev_acpi_handle(struct ata_device *dev) · 9 unmodified lines | |||
| 77 | acpi_integer adr; | 77 | acpi_integer adr; |
| 78 | struct ata_port *ap = dev->link->ap; | 78 | struct ata_port *ap = dev->link->ap; |
| 79 | 79 | ||
| 80 | if (dev->flags & ATA_DFLAG_ACPI_DISABLED) | 80 | if (libata_noacpi || dev->flags & ATA_DFLAG_ACPI_DISABLED) |
| 81 | return NULL; | 81 | return NULL; |
| 82 | 82 | ||
| 83 | if (ap->flags & ATA_FLAG_ACPI_SATA) { | 83 | if (ap->flags & ATA_FLAG_ACPI_SATA) { |
| @@ -240,28 +240,15 @@ void ata_acpi_dissociate(struct ata_host *host) · 156 unmodified lines | |||
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | /** | 243 | static int __ata_acpi_gtm(struct ata_port *ap, acpi_handle handle, |
| 244 | * ata_acpi_gtm - execute _GTM | 244 | struct ata_acpi_gtm *gtm) |
| 245 | * @ap: target ATA port | ||
| 246 | * @gtm: out parameter for _GTM result | ||
| 247 | * | ||
| 248 | * Evaluate _GTM and store the result in @gtm. | ||
| 249 | * | ||
| 250 | * LOCKING: | ||
| 251 | * EH context. | ||
| 252 | * | ||
| 253 | * RETURNS: | ||
| 254 | * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure. | ||
| 255 | */ | ||
| 256 | int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm) | ||
| 257 | { | 245 | { |
| 258 | struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER }; | 246 | struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER }; |
| 259 | union acpi_object *out_obj; | 247 | union acpi_object *out_obj; |
| 260 | acpi_status status; | 248 | acpi_status status; |
| 261 | int rc = 0; | 249 | int rc = 0; |
| 262 | 250 | ||
| 263 | status = acpi_evaluate_object(ata_ap_acpi_handle(ap), "_GTM", NULL, | 251 | status = acpi_evaluate_object(handle, "_GTM", NULL, &output); |
| 264 | &output); | ||
| 265 | 252 | ||
| 266 | rc = -ENOENT; | 253 | rc = -ENOENT; |
| 267 | if (status == AE_NOT_FOUND) | 254 | if (status == AE_NOT_FOUND) |
| @@ -295,6 +282,27 @@ int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm) · 27 unmodified lines | |||
| 295 | return rc; | 282 | return rc; |
| 296 | } | 283 | } |
| 297 | 284 | ||
| 285 | /** | ||
| 286 | * ata_acpi_gtm - execute _GTM | ||
| 287 | * @ap: target ATA port | ||
| 288 | * @gtm: out parameter for _GTM result | ||
| 289 | * | ||
| 290 | * Evaluate _GTM and store the result in @gtm. | ||
| 291 | * | ||
| 292 | * LOCKING: | ||
| 293 | * EH context. | ||
| 294 | * | ||
| 295 | * RETURNS: | ||
| 296 | * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure. | ||
| 297 | */ | ||
| 298 | int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm) | ||
| 299 | { | ||
| 300 | if (ata_ap_acpi_handle(ap)) | ||
| 301 | return __ata_acpi_gtm(ap, ata_ap_acpi_handle(ap), gtm); | ||
| 302 | else | ||
| 303 | return -EINVAL; | ||
| 304 | } | ||
| 305 | |||
| 298 | EXPORT_SYMBOL_GPL(ata_acpi_gtm); | 306 | EXPORT_SYMBOL_GPL(ata_acpi_gtm); |
| 299 | 307 | ||
| 300 | /** | 308 | /** |
| @@ -1020,38 +1028,6 @@ void ata_acpi_on_disable(struct ata_device *dev) · 719 unmodified lines | |||
| 1020 | ata_acpi_clear_gtf(dev); | 1028 | ata_acpi_clear_gtf(dev); |
| 1021 | } | 1029 | } |
| 1022 | 1030 | ||
| 1023 | static void ata_acpi_register_power_resource(struct ata_device *dev) | ||
| 1024 | { | ||
| 1025 | struct scsi_device *sdev = dev->sdev; | ||
| 1026 | acpi_handle handle; | ||
| 1027 | |||
| 1028 | handle = ata_dev_acpi_handle(dev); | ||
| 1029 | if (handle) | ||
| 1030 | acpi_dev_pm_add_dependent(handle, &sdev->sdev_gendev); | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) | ||
| 1034 | { | ||
| 1035 | struct scsi_device *sdev = dev->sdev; | ||
| 1036 | acpi_handle handle; | ||
| 1037 | |||
| 1038 | handle = ata_dev_acpi_handle(dev); | ||
| 1039 | if (handle) | ||
| 1040 | acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev); | ||
| 1041 | } | ||
| 1042 | |||
| 1043 | void ata_acpi_bind(struct ata_device *dev) | ||
| 1044 | { | ||
| 1045 | ata_acpi_register_power_resource(dev); | ||
| 1046 | if (zpodd_dev_enabled(dev)) | ||
| 1047 | dev_pm_qos_expose_flags(&dev->sdev->sdev_gendev, 0); | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | void ata_acpi_unbind(struct ata_device *dev) | ||
| 1051 | { | ||
| 1052 | ata_acpi_unregister_power_resource(dev); | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | static int compat_pci_ata(struct ata_port *ap) | 1031 | static int compat_pci_ata(struct ata_port *ap) |
| 1056 | { | 1032 | { |
| 1057 | struct device *dev = ap->tdev.parent; | 1033 | struct device *dev = ap->tdev.parent; |
| @@ -1071,7 +1047,7 @@ static int compat_pci_ata(struct ata_port *ap) · 13 unmodified lines | |||
| 1071 | 1047 | ||
| 1072 | static int ata_acpi_bind_host(struct ata_port *ap, acpi_handle *handle) | 1048 | static int ata_acpi_bind_host(struct ata_port *ap, acpi_handle *handle) |
| 1073 | { | 1049 | { |
| 1074 | if (ap->flags & ATA_FLAG_ACPI_SATA) | 1050 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA) |
| 1075 | return -ENODEV; | 1051 | return -ENODEV; |
| 1076 | 1052 | ||
| 1077 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(ap->tdev.parent), | 1053 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(ap->tdev.parent), |
| @@ -1080,7 +1056,7 @@ static int ata_acpi_bind_host(struct ata_port *ap, acpi_handle *handle) · 2 unmodified lines | |||
| 1080 | if (!*handle) | 1056 | if (!*handle) |
| 1081 | return -ENODEV; | 1057 | return -ENODEV; |
| 1082 | 1058 | ||
| 1083 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) | 1059 | if (__ata_acpi_gtm(ap, *handle, &ap->__acpi_init_gtm) == 0) |
| 1084 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 1060 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
| 1085 | 1061 | ||
| 1086 | return 0; | 1062 | return 0; |
| @@ -49,6 +49,7 @@ · 48 unmodified lines | |||
| 49 | #include <linux/hdreg.h> | 49 | #include <linux/hdreg.h> |
| 50 | #include <linux/uaccess.h> | 50 | #include <linux/uaccess.h> |
| 51 | #include <linux/suspend.h> | 51 | #include <linux/suspend.h> |
| 52 | #include <linux/pm_qos.h> | ||
| 52 | #include <asm/unaligned.h> | 53 | #include <asm/unaligned.h> |
| 53 | 54 | ||
| 54 | #include "libata.h" | 55 | #include "libata.h" |
| @@ -2126,7 +2127,6 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf) · 2071 unmodified lines | |||
| 2126 | memcpy(&rbuf[8], "linux ", 8); | 2127 | memcpy(&rbuf[8], "linux ", 8); |
| 2127 | memcpy(&rbuf[16], "libata ", 16); | 2128 | memcpy(&rbuf[16], "libata ", 16); |
| 2128 | memcpy(&rbuf[32], DRV_VERSION, 4); | 2129 | memcpy(&rbuf[32], DRV_VERSION, 4); |
| 2129 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); | ||
| 2130 | 2130 | ||
| 2131 | /* we don't store the ATA device signature, so we fake it */ | 2131 | /* we don't store the ATA device signature, so we fake it */ |
| 2132 | 2132 | ||
| @@ -3668,7 +3668,9 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync) · 1535 unmodified lines | |||
| 3668 | if (!IS_ERR(sdev)) { | 3668 | if (!IS_ERR(sdev)) { |
| 3669 | dev->sdev = sdev; | 3669 | dev->sdev = sdev; |
| 3670 | scsi_device_put(sdev); | 3670 | scsi_device_put(sdev); |
| 3671 | ata_acpi_bind(dev); | 3671 | if (zpodd_dev_enabled(dev)) |
| 3672 | dev_pm_qos_expose_flags( | ||
| 3673 | &sdev->sdev_gendev, 0); | ||
| 3672 | } else { | 3674 | } else { |
| 3673 | dev->sdev = NULL; | 3675 | dev->sdev = NULL; |
| 3674 | } | 3676 | } |
| @@ -3767,7 +3769,6 @@ static void ata_scsi_remove_dev(struct ata_device *dev) · 92 unmodified lines | |||
| 3767 | 3769 | ||
| 3768 | if (zpodd_dev_enabled(dev)) | 3770 | if (zpodd_dev_enabled(dev)) |
| 3769 | zpodd_exit(dev); | 3771 | zpodd_exit(dev); |
| 3770 | ata_acpi_unbind(dev); | ||
| 3771 | 3772 | ||
| 3772 | /* clearing dev->sdev is protected by host lock */ | 3773 | /* clearing dev->sdev is protected by host lock */ |
| 3773 | sdev = dev->sdev; | 3774 | sdev = dev->sdev; |
| @@ -393,18 +393,7 @@ static struct platform_driver pata_at32_driver = { · 392 unmodified lines | |||
| 393 | }, | 393 | }, |
| 394 | }; | 394 | }; |
| 395 | 395 | ||
| 396 | static int __init pata_at32_init(void) | 396 | module_platform_driver_probe(pata_at32_driver, pata_at32_probe); |
| 397 | { | ||
| 398 | return platform_driver_probe(&pata_at32_driver, pata_at32_probe); | ||
| 399 | } | ||
| 400 | |||
| 401 | static void __exit pata_at32_exit(void) | ||
| 402 | { | ||
| 403 | platform_driver_unregister(&pata_at32_driver); | ||
| 404 | } | ||
| 405 | |||
| 406 | module_init(pata_at32_init); | ||
| 407 | module_exit(pata_at32_exit); | ||
| 408 | 397 | ||
| 409 | MODULE_LICENSE("GPL"); | 398 | MODULE_LICENSE("GPL"); |
| 410 | MODULE_DESCRIPTION("AVR32 SMC/CFC PATA Driver"); | 399 | MODULE_DESCRIPTION("AVR32 SMC/CFC PATA Driver"); |
| @@ -37,7 +37,7 @@ · 36 unmodified lines | |||
| 37 | struct pata_imx_priv { | 37 | struct pata_imx_priv { |
| 38 | struct clk *clk; | 38 | struct clk *clk; |
| 39 | /* timings/interrupt/control regs */ | 39 | /* timings/interrupt/control regs */ |
| 40 | u8 *host_regs; | 40 | void __iomem *host_regs; |
| 41 | u32 ata_ctl; | 41 | u32 ata_ctl; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| @@ -98,6 +98,7 @@ static int pata_imx_probe(struct platform_device *pdev) · 54 unmodified lines | |||
| 98 | struct pata_imx_priv *priv; | 98 | struct pata_imx_priv *priv; |
| 99 | int irq = 0; | 99 | int irq = 0; |
| 100 | struct resource *io_res; | 100 | struct resource *io_res; |
| 101 | int ret; | ||
| 101 | 102 | ||
| 102 | io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 103 | io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 103 | if (io_res == NULL) | 104 | if (io_res == NULL) |
| @@ -112,7 +113,7 @@ static int pata_imx_probe(struct platform_device *pdev) · 8 unmodified lines | |||
| 112 | if (!priv) | 113 | if (!priv) |
| 113 | return -ENOMEM; | 114 | return -ENOMEM; |
| 114 | 115 | ||
| 115 | priv->clk = clk_get(&pdev->dev, NULL); | 116 | priv->clk = devm_clk_get(&pdev->dev, NULL); |
| 116 | if (IS_ERR(priv->clk)) { | 117 | if (IS_ERR(priv->clk)) { |
| 117 | dev_err(&pdev->dev, "Failed to get clock\n"); | 118 | dev_err(&pdev->dev, "Failed to get clock\n"); |
| 118 | return PTR_ERR(priv->clk); | 119 | return PTR_ERR(priv->clk); |
| @@ -121,8 +122,10 @@ static int pata_imx_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 121 | clk_prepare_enable(priv->clk); | 122 | clk_prepare_enable(priv->clk); |
| 122 | 123 | ||
| 123 | host = ata_host_alloc(&pdev->dev, 1); | 124 | host = ata_host_alloc(&pdev->dev, 1); |
| 124 | if (!host) | 125 | if (!host) { |
| 125 | goto free_priv; | 126 | ret = -ENOMEM; |
| 127 | goto err; | ||
| 128 | } | ||
| 126 | 129 | ||
| 127 | host->private_data = priv; | 130 | host->private_data = priv; |
| 128 | ap = host->ports[0]; | 131 | ap = host->ports[0]; |
| @@ -135,7 +138,8 @@ static int pata_imx_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 135 | resource_size(io_res)); | 138 | resource_size(io_res)); |
| 136 | if (!priv->host_regs) { | 139 | if (!priv->host_regs) { |
| 137 | dev_err(&pdev->dev, "failed to map IO/CTL base\n"); | 140 | dev_err(&pdev->dev, "failed to map IO/CTL base\n"); |
| 138 | goto free_priv; | 141 | ret = -EBUSY; |
| 142 | goto err; | ||
| 139 | } | 143 | } |
| 140 | 144 | ||
| 141 | ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA; | 145 | ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA; |
| @@ -158,13 +162,17 @@ static int pata_imx_probe(struct platform_device *pdev) · 16 unmodified lines | |||
| 158 | priv->host_regs + PATA_IMX_ATA_INT_EN); | 162 | priv->host_regs + PATA_IMX_ATA_INT_EN); |
| 159 | 163 | ||
| 160 | /* activate */ | 164 | /* activate */ |
| 161 | return ata_host_activate(host, irq, ata_sff_interrupt, 0, | 165 | ret = ata_host_activate(host, irq, ata_sff_interrupt, 0, |
| 162 | &pata_imx_sht); | 166 | &pata_imx_sht); |
| 163 | 167 | ||
| 164 | free_priv: | 168 | if (ret) |
| 169 | goto err; | ||
| 170 | |||
| 171 | return 0; | ||
| 172 | err: | ||
| 165 | clk_disable_unprepare(priv->clk); | 173 | clk_disable_unprepare(priv->clk); |
| 166 | clk_put(priv->clk); | 174 | |
| 167 | return -ENOMEM; | 175 | return ret; |
| 168 | } | 176 | } |
| 169 | 177 | ||
| 170 | static int pata_imx_remove(struct platform_device *pdev) | 178 | static int pata_imx_remove(struct platform_device *pdev) |
| @@ -177,7 +185,6 @@ static int pata_imx_remove(struct platform_device *pdev) · 6 unmodified lines | |||
| 177 | __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); | 185 | __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); |
| 178 | 186 | ||
| 179 | clk_disable_unprepare(priv->clk); | 187 | clk_disable_unprepare(priv->clk); |
| 180 | clk_put(priv->clk); | ||
| 181 | 188 | ||
| 182 | return 0; | 189 | return 0; |
| 183 | } | 190 | } |
| @@ -223,11 +230,20 @@ static const struct dev_pm_ops pata_imx_pm_ops = { · 39 unmodified lines | |||
| 223 | }; | 230 | }; |
| 224 | #endif | 231 | #endif |
| 225 | 232 | ||
| 233 | static const struct of_device_id imx_pata_dt_ids[] = { | ||
| 234 | { | ||
| 235 | .compatible = "fsl,imx27-pata", | ||
| 236 | }, { | ||
| 237 | /* sentinel */ | ||
| 238 | } | ||
| 239 | }; | ||
| 240 | |||
| 226 | static struct platform_driver pata_imx_driver = { | 241 | static struct platform_driver pata_imx_driver = { |
| 227 | .probe = pata_imx_probe, | 242 | .probe = pata_imx_probe, |
| 228 | .remove = pata_imx_remove, | 243 | .remove = pata_imx_remove, |
| 229 | .driver = { | 244 | .driver = { |
| 230 | .name = DRV_NAME, | 245 | .name = DRV_NAME, |
| 246 | .of_match_table = imx_pata_dt_ids, | ||
| 231 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
| 232 | #ifdef CONFIG_PM | 248 | #ifdef CONFIG_PM |
| 233 | .pm = &pata_imx_pm_ops, | 249 | .pm = &pata_imx_pm_ops, |
| @@ -542,7 +542,7 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev) · 541 unmodified lines | |||
| 542 | u8 sysclk; | 542 | u8 sysclk; |
| 543 | 543 | ||
| 544 | /* Get the clock */ | 544 | /* Get the clock */ |
| 545 | sysclk = opti_syscfg(0xAC) & 0xC0; /* BIOS set */ | 545 | sysclk = (opti_syscfg(0xAC) & 0xC0) >> 6; /* BIOS set */ |
| 546 | 546 | ||
| 547 | /* Enter configuration mode */ | 547 | /* Enter configuration mode */ |
| 548 | ioread16(ap->ioaddr.error_addr); | 548 | ioread16(ap->ioaddr.error_addr); |
| @@ -926,7 +926,7 @@ static int octeon_cf_probe(struct platform_device *pdev) · 925 unmodified lines | |||
| 926 | goto free_cf_port; | 926 | goto free_cf_port; |
| 927 | } | 927 | } |
| 928 | cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start, | 928 | cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start, |
| 929 | res_cs1->end - res_cs1->start + 1); | 929 | resource_size(res_cs1)); |
| 930 | 930 | ||
| 931 | if (!cs1) | 931 | if (!cs1) |
| 932 | goto free_cf_port; | 932 | goto free_cf_port; |
| @@ -285,6 +285,7 @@ struct sata_fsl_host_priv { · 284 unmodified lines | |||
| 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 | ||
| 290 | static void fsl_sata_set_irq_coalescing(struct ata_host *host, | 291 | 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, · 52 unmodified lines | |||
| 343 | return strlen(buf); | 344 | return strlen(buf); |
| 344 | } | 345 | } |
| 345 | 346 | ||
| 347 | static 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 | |||
| 364 | static 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 | |||
| 346 | static inline unsigned int sata_fsl_tag(unsigned int tag, | 389 | static 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) · 1151 unmodified lines | |||
| 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 | ||
| 1505 | error_exit_with_cleanup: | 1559 | error_exit_with_cleanup: |
| @@ -1522,6 +1576,7 @@ static int sata_fsl_remove(struct platform_device *ofdev) · 16 unmodified lines | |||
| 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 | ||
| @@ -251,7 +251,7 @@ static const struct ata_port_info ahci_highbank_port_info = { · 250 unmodified lines | |||
| 251 | }; | 251 | }; |
| 252 | 252 | ||
| 253 | static struct scsi_host_template ahci_highbank_platform_sht = { | 253 | static struct scsi_host_template ahci_highbank_platform_sht = { |
| 254 | AHCI_SHT("highbank-ahci"), | 254 | AHCI_SHT("sata_highbank"), |
| 255 | }; | 255 | }; |
| 256 | 256 | ||
| 257 | static const struct of_device_id ahci_of_match[] = { | 257 | static const struct of_device_id ahci_of_match[] = { |
| @@ -418,7 +418,7 @@ static int ahci_highbank_resume(struct device *dev) · 160 unmodified lines | |||
| 418 | } | 418 | } |
| 419 | #endif | 419 | #endif |
| 420 | 420 | ||
| 421 | SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops, | 421 | static SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops, |
| 422 | ahci_highbank_suspend, ahci_highbank_resume); | 422 | ahci_highbank_suspend, ahci_highbank_resume); |
| 423 | 423 | ||
| 424 | static struct platform_driver ahci_highbank_driver = { | 424 | static struct platform_driver ahci_highbank_driver = { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <linux/libata.h> | 17 | #include <linux/libata.h> |
| 18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
| 20 | #include <linux/err.h> | ||
| 20 | 21 | ||
| 21 | #define DRV_NAME "sata_rcar" | 22 | #define DRV_NAME "sata_rcar" |
| 22 | 23 | ||
| @@ -799,9 +800,9 @@ static int sata_rcar_probe(struct platform_device *pdev) · 776 unmodified lines | |||
| 799 | 800 | ||
| 800 | host->private_data = priv; | 801 | host->private_data = priv; |
| 801 | 802 | ||
| 802 | priv->base = devm_request_and_ioremap(&pdev->dev, mem); | 803 | priv->base = devm_ioremap_resource(&pdev->dev, mem); |
| 803 | if (!priv->base) { | 804 | if (IS_ERR(priv->base)) { |
| 804 | ret = -EADDRNOTAVAIL; | 805 | ret = PTR_ERR(priv->base); |
| 805 | goto cleanup; | 806 | goto cleanup; |
| 806 | } | 807 | } |
| 807 | 808 | ||