Commit c13e69b2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

Pull libata updates from Jeff Garzik:

 - More ACPI fixes

 - ata_piix: cosmetic code movement, re-enable MS Virtual PC support

 - generic platform driver improvements; use common code

 - pata_cs5536: add quirk for broken udma

 - printk prettiness (dev_printk becomes dev_info, etc.)

 - sata_promise: fix hardreset lockdep error

 - minor cleanups from Sergei Shtylyov

 - minor, automated cleanups from Wei Yongjun

 - fix null ptr deref bug, in sysfs API

* tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (37 commits)
  sata_dwc_460ex: remove file exec bit (chmod 0755 -> 0644)
  [libata] fix Null pointer dereference on disk error
  ahci: convert ata_link_printk() to ata_link_warn()
  pata_imx: convert ata_dev_printk() to ata_dev_info()
  ARM: ep93xx: convert ata_<foo>_printk() to ata_<foo>_<level>()
  ahci_platform: make structs static
  Revert "pata_octeon_cf: perform host detach, removal on exit"
  Revert "libata: check SATA_SETTINGS log with HW Feature Ctrl"
  pata_of_platform: fix compile error
  libata: use pci_get_drvdata() helper
  pata_octeon_cf: perform host detach, removal on exit
  sata_highbank: utilize common ata_platform_remove_one()
  pata_palmld: utilize common ata_platform_remove_one()
  pata_platform: remove unused remove function
  pata_platform: utilize common ata_platform_remove_one()
  pata_of_platform: utilize common ata_platform_remove_one()
  pata_mpc52xx: utilize common ata_platform_remove_one()
  pata_ixp4xx_cf: utilize common ata_platform_remove_one()
  ahci_platform: utilize common ata_platform_remove_one()
  libata: implement ata_platform_remove_one()
  ...
parents c5258190 72d5f2da
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <linux/ahci_platform.h> #include <linux/ahci_platform.h>
#include "ahci.h" #include "ahci.h"
static void ahci_host_stop(struct ata_host *host);
enum ahci_type { enum ahci_type {
AHCI, /* standard platform ahci */ AHCI, /* standard platform ahci */
IMX53_AHCI, /* ahci on i.mx53 */ IMX53_AHCI, /* ahci on i.mx53 */
...@@ -47,6 +49,15 @@ static struct platform_device_id ahci_devtype[] = { ...@@ -47,6 +49,15 @@ static struct platform_device_id ahci_devtype[] = {
}; };
MODULE_DEVICE_TABLE(platform, ahci_devtype); MODULE_DEVICE_TABLE(platform, ahci_devtype);
static struct ata_port_operations ahci_platform_ops = {
.inherits = &ahci_ops,
.host_stop = ahci_host_stop,
};
static struct ata_port_operations ahci_platform_retry_srst_ops = {
.inherits = &ahci_pmp_retry_srst_ops,
.host_stop = ahci_host_stop,
};
static const struct ata_port_info ahci_port_info[] = { static const struct ata_port_info ahci_port_info[] = {
/* by features */ /* by features */
...@@ -54,20 +65,20 @@ static const struct ata_port_info ahci_port_info[] = { ...@@ -54,20 +65,20 @@ static const struct ata_port_info ahci_port_info[] = {
.flags = AHCI_FLAG_COMMON, .flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6, .udma_mask = ATA_UDMA6,
.port_ops = &ahci_ops, .port_ops = &ahci_platform_ops,
}, },
[IMX53_AHCI] = { [IMX53_AHCI] = {
.flags = AHCI_FLAG_COMMON, .flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6, .udma_mask = ATA_UDMA6,
.port_ops = &ahci_pmp_retry_srst_ops, .port_ops = &ahci_platform_retry_srst_ops,
}, },
[STRICT_AHCI] = { [STRICT_AHCI] = {
AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE), AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE),
.flags = AHCI_FLAG_COMMON, .flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4, .pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6, .udma_mask = ATA_UDMA6,
.port_ops = &ahci_ops, .port_ops = &ahci_platform_ops,
}, },
}; };
...@@ -75,7 +86,7 @@ static struct scsi_host_template ahci_platform_sht = { ...@@ -75,7 +86,7 @@ static struct scsi_host_template ahci_platform_sht = {
AHCI_SHT("ahci_platform"), AHCI_SHT("ahci_platform"),
}; };
static int __init ahci_probe(struct platform_device *pdev) static int __devinit ahci_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ahci_platform_data *pdata = dev_get_platdata(dev); struct ahci_platform_data *pdata = dev_get_platdata(dev);
...@@ -218,15 +229,12 @@ static int __init ahci_probe(struct platform_device *pdev) ...@@ -218,15 +229,12 @@ static int __init ahci_probe(struct platform_device *pdev)
return rc; return rc;
} }
static int __devexit ahci_remove(struct platform_device *pdev) static void ahci_host_stop(struct ata_host *host)
{ {
struct device *dev = &pdev->dev; struct device *dev = host->dev;
struct ahci_platform_data *pdata = dev_get_platdata(dev); struct ahci_platform_data *pdata = dev_get_platdata(dev);
struct ata_host *host = dev_get_drvdata(dev);
struct ahci_host_priv *hpriv = host->private_data; struct ahci_host_priv *hpriv = host->private_data;
ata_host_detach(host);
if (pdata && pdata->exit) if (pdata && pdata->exit)
pdata->exit(dev); pdata->exit(dev);
...@@ -234,8 +242,6 @@ static int __devexit ahci_remove(struct platform_device *pdev) ...@@ -234,8 +242,6 @@ static int __devexit ahci_remove(struct platform_device *pdev)
clk_disable_unprepare(hpriv->clk); clk_disable_unprepare(hpriv->clk);
clk_put(hpriv->clk); clk_put(hpriv->clk);
} }
return 0;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -317,7 +323,7 @@ static int ahci_resume(struct device *dev) ...@@ -317,7 +323,7 @@ static int ahci_resume(struct device *dev)
} }
#endif #endif
SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume);
static const struct of_device_id ahci_of_match[] = { static const struct of_device_id ahci_of_match[] = {
{ .compatible = "snps,spear-ahci", }, { .compatible = "snps,spear-ahci", },
...@@ -326,7 +332,8 @@ static const struct of_device_id ahci_of_match[] = { ...@@ -326,7 +332,8 @@ static const struct of_device_id ahci_of_match[] = {
MODULE_DEVICE_TABLE(of, ahci_of_match); MODULE_DEVICE_TABLE(of, ahci_of_match);
static struct platform_driver ahci_driver = { static struct platform_driver ahci_driver = {
.remove = __devexit_p(ahci_remove), .probe = ahci_probe,
.remove = ata_platform_remove_one,
.driver = { .driver = {
.name = "ahci", .name = "ahci",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -335,18 +342,7 @@ static struct platform_driver ahci_driver = { ...@@ -335,18 +342,7 @@ static struct platform_driver ahci_driver = {
}, },
.id_table = ahci_devtype, .id_table = ahci_devtype,
}; };
module_platform_driver(ahci_driver);
static int __init ahci_init(void)
{
return platform_driver_probe(&ahci_driver, ahci_probe);
}
module_init(ahci_init);
static void __exit ahci_exit(void)
{
platform_driver_unregister(&ahci_driver);
}
module_exit(ahci_exit);
MODULE_DESCRIPTION("AHCI SATA platform driver"); MODULE_DESCRIPTION("AHCI SATA platform driver");
MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>"); MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
......
This diff is collapsed.
...@@ -1384,7 +1384,7 @@ int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class, ...@@ -1384,7 +1384,7 @@ int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
if (rc == -EIO) { if (rc == -EIO) {
irq_sts = readl(port_mmio + PORT_IRQ_STAT); irq_sts = readl(port_mmio + PORT_IRQ_STAT);
if (irq_sts & PORT_IRQ_BAD_PMP) { if (irq_sts & PORT_IRQ_BAD_PMP) {
ata_link_printk(link, KERN_WARNING, ata_link_warn(link,
"applying PMP SRST workaround " "applying PMP SRST workaround "
"and retrying\n"); "and retrying\n");
rc = ahci_do_softreset(link, class, 0, deadline, rc = ahci_do_softreset(link, class, 0, deadline,
......
...@@ -76,6 +76,9 @@ acpi_handle ata_dev_acpi_handle(struct ata_device *dev) ...@@ -76,6 +76,9 @@ acpi_handle ata_dev_acpi_handle(struct ata_device *dev)
acpi_integer adr; acpi_integer adr;
struct ata_port *ap = dev->link->ap; struct ata_port *ap = dev->link->ap;
if (dev->flags & ATA_DFLAG_ACPI_DISABLED)
return NULL;
if (ap->flags & ATA_FLAG_ACPI_SATA) { if (ap->flags & ATA_FLAG_ACPI_SATA) {
if (!sata_pmp_attached(ap)) if (!sata_pmp_attached(ap))
adr = SATA_ADR(ap->port_no, NO_PORT_MULT); adr = SATA_ADR(ap->port_no, NO_PORT_MULT);
...@@ -945,6 +948,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev) ...@@ -945,6 +948,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
return rc; return rc;
} }
dev->flags |= ATA_DFLAG_ACPI_DISABLED;
ata_dev_warn(dev, "ACPI: failed the second time, disabled\n"); ata_dev_warn(dev, "ACPI: failed the second time, disabled\n");
/* We can safely continue if no _GTF command has been executed /* We can safely continue if no _GTF command has been executed
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/platform_device.h>
#include "libata.h" #include "libata.h"
#include "libata-transport.h" #include "libata-transport.h"
...@@ -2560,6 +2561,7 @@ int ata_bus_probe(struct ata_port *ap) ...@@ -2560,6 +2561,7 @@ int ata_bus_probe(struct ata_port *ap)
* bus as we may be talking too fast. * bus as we may be talking too fast.
*/ */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->dma_mode = 0xff;
/* If the controller has a pio mode setup function /* If the controller has a pio mode setup function
* then use it to set the chipset to rights. Don't * then use it to set the chipset to rights. Don't
...@@ -6286,8 +6288,7 @@ void ata_host_detach(struct ata_host *host) ...@@ -6286,8 +6288,7 @@ void ata_host_detach(struct ata_host *host)
*/ */
void ata_pci_remove_one(struct pci_dev *pdev) void ata_pci_remove_one(struct pci_dev *pdev)
{ {
struct device *dev = &pdev->dev; struct ata_host *host = pci_get_drvdata(pdev);
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host); ata_host_detach(host);
} }
...@@ -6356,7 +6357,7 @@ int ata_pci_device_do_resume(struct pci_dev *pdev) ...@@ -6356,7 +6357,7 @@ int ata_pci_device_do_resume(struct pci_dev *pdev)
int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
{ {
struct ata_host *host = dev_get_drvdata(&pdev->dev); struct ata_host *host = pci_get_drvdata(pdev);
int rc = 0; int rc = 0;
rc = ata_host_suspend(host, mesg); rc = ata_host_suspend(host, mesg);
...@@ -6370,7 +6371,7 @@ int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) ...@@ -6370,7 +6371,7 @@ int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
int ata_pci_device_resume(struct pci_dev *pdev) int ata_pci_device_resume(struct pci_dev *pdev)
{ {
struct ata_host *host = dev_get_drvdata(&pdev->dev); struct ata_host *host = pci_get_drvdata(pdev);
int rc; int rc;
rc = ata_pci_device_do_resume(pdev); rc = ata_pci_device_do_resume(pdev);
...@@ -6382,6 +6383,26 @@ int ata_pci_device_resume(struct pci_dev *pdev) ...@@ -6382,6 +6383,26 @@ int ata_pci_device_resume(struct pci_dev *pdev)
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
/**
* ata_platform_remove_one - Platform layer callback for device removal
* @pdev: Platform device that was removed
*
* Platform layer indicates to libata via this hook that hot-unplug or
* module unload event has occurred. Detach all ports. Resource
* release is handled via devres.
*
* LOCKING:
* Inherited from platform layer (may sleep).
*/
int ata_platform_remove_one(struct platform_device *pdev)
{
struct ata_host *host = platform_get_drvdata(pdev);
ata_host_detach(host);
return 0;
}
static int __init ata_parse_force_one(char **cur, static int __init ata_parse_force_one(char **cur,
struct ata_force_ent *force_ent, struct ata_force_ent *force_ent,
const char **reason) const char **reason)
...@@ -6877,6 +6898,8 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume); ...@@ -6877,6 +6898,8 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume);
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
EXPORT_SYMBOL_GPL(ata_platform_remove_one);
EXPORT_SYMBOL_GPL(__ata_ehi_push_desc); EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);
EXPORT_SYMBOL_GPL(ata_ehi_push_desc); EXPORT_SYMBOL_GPL(ata_ehi_push_desc);
EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); EXPORT_SYMBOL_GPL(ata_ehi_clear_desc);
......
...@@ -2657,6 +2657,7 @@ int ata_eh_reset(struct ata_link *link, int classify, ...@@ -2657,6 +2657,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
* bus as we may be talking too fast. * bus as we may be talking too fast.
*/ */
dev->pio_mode = XFER_PIO_0; dev->pio_mode = XFER_PIO_0;
dev->dma_mode = 0xff;
/* If the controller has a pio mode setup function /* If the controller has a pio mode setup function
* then use it to set the chipset to rights. Don't * then use it to set the chipset to rights. Don't
......
...@@ -309,7 +309,8 @@ ata_scsi_activity_show(struct device *dev, struct device_attribute *attr, ...@@ -309,7 +309,8 @@ ata_scsi_activity_show(struct device *dev, struct device_attribute *attr,
struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); struct ata_device *atadev = ata_scsi_find_dev(ap, sdev);
if (ap->ops->sw_activity_show && (ap->flags & ATA_FLAG_SW_ACTIVITY)) if (atadev && ap->ops->sw_activity_show &&
(ap->flags & ATA_FLAG_SW_ACTIVITY))
return ap->ops->sw_activity_show(atadev, buf); return ap->ops->sw_activity_show(atadev, buf);
return -EINVAL; return -EINVAL;
} }
...@@ -324,7 +325,8 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr, ...@@ -324,7 +325,8 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr,
enum sw_activity val; enum sw_activity val;
int rc; int rc;
if (ap->ops->sw_activity_store && (ap->flags & ATA_FLAG_SW_ACTIVITY)) { if (atadev && ap->ops->sw_activity_store &&
(ap->flags & ATA_FLAG_SW_ACTIVITY)) {
val = simple_strtoul(buf, NULL, 0); val = simple_strtoul(buf, NULL, 0);
switch (val) { switch (val) {
case OFF: case BLINK_ON: case BLINK_OFF: case OFF: case BLINK_ON: case BLINK_OFF:
......
...@@ -674,13 +674,16 @@ void arasan_cf_error_handler(struct ata_port *ap) ...@@ -674,13 +674,16 @@ void arasan_cf_error_handler(struct ata_port *ap)
static void arasan_cf_dma_start(struct arasan_cf_dev *acdev) static void arasan_cf_dma_start(struct arasan_cf_dev *acdev)
{ {
struct ata_queued_cmd *qc = acdev->qc;
struct ata_port *ap = qc->ap;
struct ata_taskfile *tf = &qc->tf;
u32 xfer_ctr = readl(acdev->vbase + XFER_CTR) & ~XFER_DIR_MASK; u32 xfer_ctr = readl(acdev->vbase + XFER_CTR) & ~XFER_DIR_MASK;
u32 write = acdev->qc->tf.flags & ATA_TFLAG_WRITE; u32 write = tf->flags & ATA_TFLAG_WRITE;
xfer_ctr |= write ? XFER_WRITE : XFER_READ; xfer_ctr |= write ? XFER_WRITE : XFER_READ;
writel(xfer_ctr, acdev->vbase + XFER_CTR); writel(xfer_ctr, acdev->vbase + XFER_CTR);
acdev->qc->ap->ops->sff_exec_command(acdev->qc->ap, &acdev->qc->tf); ap->ops->sff_exec_command(ap, tf);
ata_sff_queue_work(&acdev->work); ata_sff_queue_work(&acdev->work);
} }
......
...@@ -474,14 +474,14 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -474,14 +474,14 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
/* check for enabled ports */ /* check for enabled ports */
pci_read_config_byte(pdev, CNTRL, &reg); pci_read_config_byte(pdev, CNTRL, &reg);
if (!port_ok) if (!port_ok)
dev_printk(KERN_NOTICE, &pdev->dev, "Mobility Bridge detected, ignoring CNTRL port enable/disable\n"); dev_notice(&pdev->dev, "Mobility Bridge detected, ignoring CNTRL port enable/disable\n");
if (port_ok && cntrl_ch0_ok && !(reg & CNTRL_CH0)) { if (port_ok && cntrl_ch0_ok && !(reg & CNTRL_CH0)) {
dev_printk(KERN_NOTICE, &pdev->dev, "Primary port is disabled\n"); dev_notice(&pdev->dev, "Primary port is disabled\n");
ppi[0] = &ata_dummy_port_info; ppi[0] = &ata_dummy_port_info;
} }
if (port_ok && !(reg & CNTRL_CH1)) { if (port_ok && !(reg & CNTRL_CH1)) {
dev_printk(KERN_NOTICE, &pdev->dev, "Secondary port is disabled\n"); dev_notice(&pdev->dev, "Secondary port is disabled\n");
ppi[1] = &ata_dummy_port_info; ppi[1] = &ata_dummy_port_info;
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/libata.h> #include <linux/libata.h>
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <linux/dmi.h>
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
#include <asm/msr.h> #include <asm/msr.h>
...@@ -80,6 +81,21 @@ enum { ...@@ -80,6 +81,21 @@ enum {
IDE_ETC_UDMA_MASK = 0xc0, IDE_ETC_UDMA_MASK = 0xc0,
}; };
/* Some Bachmann OT200 devices have a non working UDMA support due a
* missing resistor.
*/
static const struct dmi_system_id udma_quirk_dmi_table[] = {
{
.ident = "Bachmann electronic OT200",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Bachmann electronic"),
DMI_MATCH(DMI_PRODUCT_NAME, "OT200"),
DMI_MATCH(DMI_PRODUCT_VERSION, "1")
},
},
{ }
};
static int cs5536_read(struct pci_dev *pdev, int reg, u32 *val) static int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
{ {
if (unlikely(use_msr)) { if (unlikely(use_msr)) {
...@@ -242,9 +258,23 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -242,9 +258,23 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &cs5536_port_ops, .port_ops = &cs5536_port_ops,
}; };
const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; static const struct ata_port_info no_udma_info = {
.flags = ATA_FLAG_SLAVE_POSS,
.pio_mask = ATA_PIO4,
.port_ops = &cs5536_port_ops,
};
const struct ata_port_info *ppi[2];
u32 cfg; u32 cfg;
if (dmi_check_system(udma_quirk_dmi_table))
ppi[0] = &no_udma_info;
else
ppi[0] = &info;
ppi[1] = &ata_dummy_port_info;
if (use_msr) if (use_msr)
printk(KERN_ERR DRV_NAME ": Using MSR regs instead of PCI\n"); printk(KERN_ERR DRV_NAME ": Using MSR regs instead of PCI\n");
......
...@@ -822,8 +822,7 @@ static int ep93xx_pata_softreset(struct ata_link *al, unsigned int *classes, ...@@ -822,8 +822,7 @@ static int ep93xx_pata_softreset(struct ata_link *al, unsigned int *classes,
rc = ep93xx_pata_bus_softreset(ap, devmask, deadline); rc = ep93xx_pata_bus_softreset(ap, devmask, deadline);
/* if link is ocuppied, -ENODEV too is an error */ /* if link is ocuppied, -ENODEV too is an error */
if (rc && (rc != -ENODEV || sata_scr_valid(al))) { if (rc && (rc != -ENODEV || sata_scr_valid(al))) {
ata_link_printk(al, KERN_ERR, "SRST failed (errno=%d)\n", ata_link_err(al, "SRST failed (errno=%d)\n", rc);
rc);
return rc; return rc;
} }
...@@ -857,8 +856,7 @@ static void ep93xx_pata_drain_fifo(struct ata_queued_cmd *qc) ...@@ -857,8 +856,7 @@ static void ep93xx_pata_drain_fifo(struct ata_queued_cmd *qc)
/* Can become DEBUG later */ /* Can become DEBUG later */
if (count) if (count)
ata_port_printk(ap, KERN_DEBUG, ata_port_dbg(ap, "drained %d bytes to clear DRQ.\n", count);
"drained %d bytes to clear DRQ.\n", count);
} }
......
...@@ -60,7 +60,7 @@ static int pata_imx_set_mode(struct ata_link *link, struct ata_device **unused) ...@@ -60,7 +60,7 @@ static int pata_imx_set_mode(struct ata_link *link, struct ata_device **unused)
val &= ~PATA_IMX_ATA_CTRL_IORDY_EN; val &= ~PATA_IMX_ATA_CTRL_IORDY_EN;
__raw_writel(val, priv->host_regs + PATA_IMX_ATA_CONTROL); __raw_writel(val, priv->host_regs + PATA_IMX_ATA_CONTROL);
ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); ata_dev_info(dev, "configured for PIO\n");
} }
return 0; return 0;
} }
......
...@@ -187,22 +187,13 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) ...@@ -187,22 +187,13 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht); return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht);
} }
static __devexit int ixp4xx_pata_remove(struct platform_device *dev)
{
struct ata_host *host = platform_get_drvdata(dev);
ata_host_detach(host);
return 0;
}
static struct platform_driver ixp4xx_pata_platform_driver = { static struct platform_driver ixp4xx_pata_platform_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = ixp4xx_pata_probe, .probe = ixp4xx_pata_probe,
.remove = __devexit_p(ixp4xx_pata_remove), .remove = ata_platform_remove_one,
}; };
module_platform_driver(ixp4xx_pata_platform_driver); module_platform_driver(ixp4xx_pata_platform_driver);
......
...@@ -663,18 +663,6 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv, ...@@ -663,18 +663,6 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv,
&mpc52xx_ata_sht); &mpc52xx_ata_sht);
} }
static struct mpc52xx_ata_priv *
mpc52xx_ata_remove_one(struct device *dev)
{
struct ata_host *host = dev_get_drvdata(dev);
struct mpc52xx_ata_priv *priv = host->private_data;
ata_host_detach(host);
return priv;
}
/* ======================================================================== */ /* ======================================================================== */
/* OF Platform driver */ /* OF Platform driver */
/* ======================================================================== */ /* ======================================================================== */
...@@ -815,11 +803,12 @@ mpc52xx_ata_probe(struct platform_device *op) ...@@ -815,11 +803,12 @@ mpc52xx_ata_probe(struct platform_device *op)
static int static int
mpc52xx_ata_remove(struct platform_device *op) mpc52xx_ata_remove(struct platform_device *op)
{ {
struct mpc52xx_ata_priv *priv; struct ata_host *host = platform_get_drvdata(op);
struct mpc52xx_ata_priv *priv = host->private_data;
int task_irq; int task_irq;
/* Deregister the ATA interface */ /* Deregister the ATA interface */
priv = mpc52xx_ata_remove_one(&op->dev); ata_platform_remove_one(op);
/* Clean up DMA */ /* Clean up DMA */
task_irq = bcom_get_task_irq(priv->dmatsk); task_irq = bcom_get_task_irq(priv->dmatsk);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <linux/libata.h>
static int __devinit pata_of_platform_probe(struct platform_device *ofdev) static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
{ {
...@@ -76,11 +77,6 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev) ...@@ -76,11 +77,6 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
reg_shift, pio_mask); reg_shift, pio_mask);
} }
static int __devexit pata_of_platform_remove(struct platform_device *ofdev)
{
return __pata_platform_remove(&ofdev->dev);
}
static struct of_device_id pata_of_platform_match[] = { static struct of_device_id pata_of_platform_match[] = {
{ .compatible = "ata-generic", }, { .compatible = "ata-generic", },
{ .compatible = "electra-ide", }, { .compatible = "electra-ide", },
...@@ -95,7 +91,7 @@ static struct platform_driver pata_of_platform_driver = { ...@@ -95,7 +91,7 @@ static struct platform_driver pata_of_platform_driver = {
.of_match_table = pata_of_platform_match, .of_match_table = pata_of_platform_match,
}, },
.probe = pata_of_platform_probe, .probe = pata_of_platform_probe,
.remove = __devexit_p(pata_of_platform_remove), .remove = ata_platform_remove_one,
}; };
module_platform_driver(pata_of_platform_driver); module_platform_driver(pata_of_platform_driver);
......
...@@ -111,9 +111,7 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev) ...@@ -111,9 +111,7 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)
static __devexit int palmld_pata_remove(struct platform_device *dev) static __devexit int palmld_pata_remove(struct platform_device *dev)
{ {
struct ata_host *host = platform_get_drvdata(dev); ata_platform_remove_one(dev);
ata_host_detach(host);
/* power down the HDD */ /* power down the HDD */
gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0);
......
...@@ -178,23 +178,6 @@ int __devinit __pata_platform_probe(struct device *dev, ...@@ -178,23 +178,6 @@ int __devinit __pata_platform_probe(struct device *dev,
} }
EXPORT_SYMBOL_GPL(__pata_platform_probe); EXPORT_SYMBOL_GPL(__pata_platform_probe);
/**
* __pata_platform_remove - unplug a platform interface
* @dev: device
*
* A platform bus ATA device has been unplugged. Perform the needed
* cleanup. Also called on module unload for any active devices.
*/
int __pata_platform_remove(struct device *dev)
{
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
return 0;
}
EXPORT_SYMBOL_GPL(__pata_platform_remove);
static int __devinit pata_platform_probe(struct platform_device *pdev) static int __devinit pata_platform_probe(struct platform_device *pdev)
{ {
struct resource *io_res; struct resource *io_res;
...@@ -242,14 +225,9 @@ static int __devinit pata_platform_probe(struct platform_device *pdev) ...@@ -242,14 +225,9 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
pio_mask); pio_mask);
} }
static int __devexit pata_platform_remove(struct platform_device *pdev)
{
return __pata_platform_remove(&pdev->dev);
}
static struct platform_driver pata_platform_driver = { static struct platform_driver pata_platform_driver = {
.probe = pata_platform_probe, .probe = pata_platform_probe,
.remove = __devexit_p(pata_platform_remove), .remove = ata_platform_remove_one,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -327,7 +327,6 @@ static int __devinit rdc_init_one(struct pci_dev *pdev, ...@@ -327,7 +327,6 @@ static int __devinit rdc_init_one(struct pci_dev *pdev,
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ata_port_info port_info[2]; struct ata_port_info port_info[2];
const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
unsigned long port_flags;
struct ata_host *host; struct ata_host *host;
struct rdc_host_priv *hpriv; struct rdc_host_priv *hpriv;
int rc; int rc;
...@@ -337,8 +336,6 @@ static int __devinit rdc_init_one(struct pci_dev *pdev, ...@@ -337,8 +336,6 @@ static int __devinit rdc_init_one(struct pci_dev *pdev,
port_info[0] = rdc_port_info; port_info[0] = rdc_port_info;
port_info[1] = rdc_port_info; port_info[1] = rdc_port_info;
port_flags = port_info[0].flags;
/* enable device and prepare host */ /* enable device and prepare host */
rc = pcim_enable_device(pdev); rc = pcim_enable_device(pdev);
if (rc) if (rc)
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
/* These two are defined in "libata.h" */ /* These two are defined in "libata.h" */
#undef DRV_NAME #undef DRV_NAME
#undef DRV_VERSION #undef DRV_VERSION
#define DRV_NAME "sata-dwc" #define DRV_NAME "sata-dwc"
#define DRV_VERSION "1.3" #define DRV_VERSION "1.3"
......
...@@ -213,7 +213,7 @@ static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class, ...@@ -213,7 +213,7 @@ static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
/* clear D2H reception area to properly wait for D2H FIS */ /* clear D2H reception area to properly wait for D2H FIS */
ata_tf_init(link->device, &tf); ata_tf_init(link->device, &tf);
tf.command = 0x80; tf.command = ATA_BUSY;
ata_tf_to_fis(&tf, 0, 0, d2h_fis); ata_tf_to_fis(&tf, 0, 0, d2h_fis);
do { do {
...@@ -368,16 +368,6 @@ static int __devinit ahci_highbank_probe(struct platform_device *pdev) ...@@ -368,16 +368,6 @@ static int __devinit ahci_highbank_probe(struct platform_device *pdev)
return rc; return rc;
} }
static int __devexit ahci_highbank_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
return 0;
}
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int ahci_highbank_suspend(struct device *dev) static int ahci_highbank_suspend(struct device *dev)
{ {
...@@ -432,7 +422,7 @@ SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops, ...@@ -432,7 +422,7 @@ SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops,
ahci_highbank_suspend, ahci_highbank_resume); ahci_highbank_suspend, ahci_highbank_resume);
static struct platform_driver ahci_highbank_driver = { static struct platform_driver ahci_highbank_driver = {
.remove = __devexit_p(ahci_highbank_remove), .remove = ata_platform_remove_one,
.driver = { .driver = {
.name = "highbank-ahci", .name = "highbank-ahci",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -273,12 +273,10 @@ static void inic_reset_port(void __iomem *port_base) ...@@ -273,12 +273,10 @@ static void inic_reset_port(void __iomem *port_base)
static int inic_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val) static int inic_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val)
{ {
void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR; void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR;
void __iomem *addr;
if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
return -EINVAL; return -EINVAL;
addr = scr_addr + scr_map[sc_reg] * 4;
*val = readl(scr_addr + scr_map[sc_reg] * 4); *val = readl(scr_addr + scr_map[sc_reg] * 4);
/* this controller has stuck DIAG.N, ignore it */ /* this controller has stuck DIAG.N, ignore it */
......
...@@ -147,6 +147,10 @@ struct pdc_port_priv { ...@@ -147,6 +147,10 @@ struct pdc_port_priv {
dma_addr_t pkt_dma; dma_addr_t pkt_dma;
}; };
struct pdc_host_priv {
spinlock_t hard_reset_lock;
};
static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
...@@ -801,9 +805,10 @@ static void pdc_hard_reset_port(struct ata_port *ap) ...@@ -801,9 +805,10 @@ static void pdc_hard_reset_port(struct ata_port *ap)
void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR];
void __iomem *pcictl_b1_mmio = host_mmio + PDC_PCI_CTL + 1; void __iomem *pcictl_b1_mmio = host_mmio + PDC_PCI_CTL + 1;
unsigned int ata_no = pdc_ata_port_to_ata_no(ap); unsigned int ata_no = pdc_ata_port_to_ata_no(ap);
struct pdc_host_priv *hpriv = ap->host->private_data;
u8 tmp; u8 tmp;
spin_lock(&ap->host->lock); spin_lock(&hpriv->hard_reset_lock);
tmp = readb(pcictl_b1_mmio); tmp = readb(pcictl_b1_mmio);
tmp &= ~(0x10 << ata_no); tmp &= ~(0x10 << ata_no);
...@@ -814,7 +819,7 @@ static void pdc_hard_reset_port(struct ata_port *ap) ...@@ -814,7 +819,7 @@ static void pdc_hard_reset_port(struct ata_port *ap)
writeb(tmp, pcictl_b1_mmio); writeb(tmp, pcictl_b1_mmio);
readb(pcictl_b1_mmio); /* flush */ readb(pcictl_b1_mmio); /* flush */
spin_unlock(&ap->host->lock); spin_unlock(&hpriv->hard_reset_lock);
} }
static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class,
...@@ -1182,6 +1187,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, ...@@ -1182,6 +1187,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; const struct ata_port_info *pi = &pdc_port_info[ent->driver_data];
const struct ata_port_info *ppi[PDC_MAX_PORTS]; const struct ata_port_info *ppi[PDC_MAX_PORTS];
struct ata_host *host; struct ata_host *host;
struct pdc_host_priv *hpriv;
void __iomem *host_mmio; void __iomem *host_mmio;
int n_ports, i, rc; int n_ports, i, rc;
int is_sataii_tx4; int is_sataii_tx4;
...@@ -1218,6 +1224,11 @@ static int pdc_ata_init_one(struct pci_dev *pdev, ...@@ -1218,6 +1224,11 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
dev_err(&pdev->dev, "failed to allocate host\n"); dev_err(&pdev->dev, "failed to allocate host\n");
return -ENOMEM; return -ENOMEM;
} }
hpriv = devm_kzalloc(&pdev->dev, sizeof *hpriv, GFP_KERNEL);
if (!hpriv)
return -ENOMEM;
spin_lock_init(&hpriv->hard_reset_lock);
host->private_data = hpriv;
host->iomap = pcim_iomap_table(pdev); host->iomap = pcim_iomap_table(pdev);
is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags); is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags);
......
...@@ -506,8 +506,6 @@ static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val) ...@@ -506,8 +506,6 @@ static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val)
void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL; void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL;
if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { if (sc_reg < ARRAY_SIZE(sil24_scr_map)) {
void __iomem *addr;
addr = scr_addr + sil24_scr_map[sc_reg] * 4;
*val = readl(scr_addr + sil24_scr_map[sc_reg] * 4); *val = readl(scr_addr + sil24_scr_map[sc_reg] * 4);
return 0; return 0;
} }
...@@ -519,8 +517,6 @@ static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val) ...@@ -519,8 +517,6 @@ static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val)
void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL; void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL;
if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { if (sc_reg < ARRAY_SIZE(sil24_scr_map)) {
void __iomem *addr;
addr = scr_addr + sil24_scr_map[sc_reg] * 4;
writel(val, scr_addr + sil24_scr_map[sc_reg] * 4); writel(val, scr_addr + sil24_scr_map[sc_reg] * 4);
return 0; return 0;
} }
......
...@@ -315,9 +315,8 @@ static int pdc_port_start(struct ata_port *ap) ...@@ -315,9 +315,8 @@ static int pdc_port_start(struct ata_port *ap)
return 0; return 0;
} }
static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, static inline void pdc20621_ata_sg(u8 *buf, unsigned int portno,
unsigned int portno, unsigned int total_len)
unsigned int total_len)
{ {
u32 addr; u32 addr;
unsigned int dw = PDC_DIMM_APKT_PRD >> 2; unsigned int dw = PDC_DIMM_APKT_PRD >> 2;
...@@ -337,9 +336,8 @@ static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, ...@@ -337,9 +336,8 @@ static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
buf32[dw], buf32[dw + 1]); buf32[dw], buf32[dw + 1]);
} }
static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf, static inline void pdc20621_host_sg(u8 *buf, unsigned int portno,
unsigned int portno, unsigned int total_len)
unsigned int total_len)
{ {
u32 addr; u32 addr;
unsigned int dw = PDC_DIMM_HPKT_PRD >> 2; unsigned int dw = PDC_DIMM_HPKT_PRD >> 2;
...@@ -486,10 +484,10 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc) ...@@ -486,10 +484,10 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
/* /*
* Build ATA, host DMA packets * Build ATA, host DMA packets
*/ */
pdc20621_host_sg(&qc->tf, &pp->dimm_buf[0], portno, total_len); pdc20621_host_sg(&pp->dimm_buf[0], portno, total_len);
pdc20621_host_pkt(&qc->tf, &pp->dimm_buf[0], portno); pdc20621_host_pkt(&qc->tf, &pp->dimm_buf[0], portno);
pdc20621_ata_sg(&qc->tf, &pp->dimm_buf[0], portno, total_len); pdc20621_ata_sg(&pp->dimm_buf[0], portno, total_len);
i = pdc20621_ata_pkt(&qc->tf, qc->dev->devno, &pp->dimm_buf[0], portno); i = pdc20621_ata_pkt(&qc->tf, qc->dev->devno, &pp->dimm_buf[0], portno);
if (qc->tf.flags & ATA_TFLAG_LBA48) if (qc->tf.flags & ATA_TFLAG_LBA48)
......
...@@ -22,8 +22,6 @@ extern int __devinit __pata_platform_probe(struct device *dev, ...@@ -22,8 +22,6 @@ extern int __devinit __pata_platform_probe(struct device *dev,
unsigned int ioport_shift, unsigned int ioport_shift,
int __pio_mask); int __pio_mask);
extern int __devexit __pata_platform_remove(struct device *dev);
/* /*
* Marvell SATA private data * Marvell SATA private data
*/ */
......
...@@ -163,6 +163,7 @@ enum { ...@@ -163,6 +163,7 @@ enum {
ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */ ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */
ATA_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_UNKNOWN = 0, /* unknown device */
ATA_DEV_ATA = 1, /* ATA device */ ATA_DEV_ATA = 1, /* ATA device */
...@@ -1114,6 +1115,10 @@ extern int ata_pci_device_resume(struct pci_dev *pdev); ...@@ -1114,6 +1115,10 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
struct platform_device;
extern int ata_platform_remove_one(struct platform_device *pdev);
/* /*
* ACPI - drivers/ata/libata-acpi.c * ACPI - drivers/ata/libata-acpi.c
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment