Commit 203c75b8 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

libata: separate out ata_std_postreset() from ata_sff_postreset()

Separate out generic ATA portion from ata_sff_postreset() into
ata_std_postreset() and implement ata_sff_postreset() using the std
version.

ata_base_port_ops now has ata_std_postreset() for its postreset and
ata_sff_port_ops overrides it to ata_sff_postreset().

This change affects pdc_adma, ahci, sata_fsl and sata_sil24.  pdc_adma
now specifies postreset to ata_sff_postreset() explicitly.  sata_fsl
and sata_sil24 now use ata_std_postreset() which makes no difference
to them.  ahci now calls ata_std_postreset() from its own postreset
method, which causes no behavior difference.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent 0aa1113d
...@@ -1444,7 +1444,7 @@ static void ahci_postreset(struct ata_link *link, unsigned int *class) ...@@ -1444,7 +1444,7 @@ static void ahci_postreset(struct ata_link *link, unsigned int *class)
void __iomem *port_mmio = ahci_port_base(ap); void __iomem *port_mmio = ahci_port_base(ap);
u32 new_tmp, tmp; u32 new_tmp, tmp;
ata_sff_postreset(link, class); ata_std_postreset(link, class);
/* Make sure port's ATAPI bit is set appropriately */ /* Make sure port's ATAPI bit is set appropriately */
new_tmp = tmp = readl(port_mmio + PORT_CMD); new_tmp = tmp = readl(port_mmio + PORT_CMD);
......
...@@ -76,7 +76,7 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 }; ...@@ -76,7 +76,7 @@ const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };
const struct ata_port_operations ata_base_port_ops = { const struct ata_port_operations ata_base_port_ops = {
.prereset = ata_std_prereset, .prereset = ata_std_prereset,
.hardreset = sata_sff_hardreset, .hardreset = sata_sff_hardreset,
.postreset = ata_sff_postreset, .postreset = ata_std_postreset,
.error_handler = ata_std_error_handler, .error_handler = ata_std_error_handler,
}; };
...@@ -3516,7 +3516,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, ...@@ -3516,7 +3516,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
} }
/** /**
* ata_sff_postreset - standard postreset callback * ata_std_postreset - standard postreset callback
* @link: the target ata_link * @link: the target ata_link
* @classes: classes of attached devices * @classes: classes of attached devices
* *
...@@ -3527,9 +3527,8 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, ...@@ -3527,9 +3527,8 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
* LOCKING: * LOCKING:
* Kernel thread context (may sleep) * Kernel thread context (may sleep)
*/ */
void ata_sff_postreset(struct ata_link *link, unsigned int *classes) void ata_std_postreset(struct ata_link *link, unsigned int *classes)
{ {
struct ata_port *ap = link->ap;
u32 serror; u32 serror;
DPRINTK("ENTER\n"); DPRINTK("ENTER\n");
...@@ -3542,22 +3541,6 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes) ...@@ -3542,22 +3541,6 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
sata_scr_write(link, SCR_ERROR, serror); sata_scr_write(link, SCR_ERROR, serror);
link->eh_info.serror = 0; link->eh_info.serror = 0;
/* is double-select really necessary? */
if (classes[0] != ATA_DEV_NONE)
ap->ops->sff_dev_select(ap, 1);
if (classes[1] != ATA_DEV_NONE)
ap->ops->sff_dev_select(ap, 0);
/* bail out if no device is present */
if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
DPRINTK("EXIT, no device\n");
return;
}
/* set up device control */
if (ap->ioaddr.ctl_addr)
iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
DPRINTK("EXIT\n"); DPRINTK("EXIT\n");
} }
...@@ -6096,6 +6079,7 @@ EXPORT_SYMBOL_GPL(sata_link_debounce); ...@@ -6096,6 +6079,7 @@ EXPORT_SYMBOL_GPL(sata_link_debounce);
EXPORT_SYMBOL_GPL(sata_link_resume); EXPORT_SYMBOL_GPL(sata_link_resume);
EXPORT_SYMBOL_GPL(ata_std_prereset); EXPORT_SYMBOL_GPL(ata_std_prereset);
EXPORT_SYMBOL_GPL(sata_link_hardreset); EXPORT_SYMBOL_GPL(sata_link_hardreset);
EXPORT_SYMBOL_GPL(ata_std_postreset);
EXPORT_SYMBOL_GPL(ata_dev_classify); EXPORT_SYMBOL_GPL(ata_dev_classify);
EXPORT_SYMBOL_GPL(ata_dev_pair); EXPORT_SYMBOL_GPL(ata_dev_pair);
EXPORT_SYMBOL_GPL(ata_port_disable); EXPORT_SYMBOL_GPL(ata_port_disable);
......
...@@ -49,6 +49,7 @@ const struct ata_port_operations ata_sff_port_ops = { ...@@ -49,6 +49,7 @@ const struct ata_port_operations ata_sff_port_ops = {
.thaw = ata_sff_thaw, .thaw = ata_sff_thaw,
.prereset = ata_sff_prereset, .prereset = ata_sff_prereset,
.softreset = ata_sff_softreset, .softreset = ata_sff_softreset,
.postreset = ata_sff_postreset,
.error_handler = ata_sff_error_handler, .error_handler = ata_sff_error_handler,
.post_internal_cmd = ata_sff_post_internal_cmd, .post_internal_cmd = ata_sff_post_internal_cmd,
...@@ -2031,6 +2032,41 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class, ...@@ -2031,6 +2032,41 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
return 0; return 0;
} }
/**
* ata_sff_postreset - SFF postreset callback
* @link: the target SFF ata_link
* @classes: classes of attached devices
*
* This function is invoked after a successful reset. It first
* calls ata_std_postreset() and performs SFF specific postreset
* processing.
*
* LOCKING:
* Kernel thread context (may sleep)
*/
void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
{
struct ata_port *ap = link->ap;
ata_std_postreset(link, classes);
/* is double-select really necessary? */
if (classes[0] != ATA_DEV_NONE)
ap->ops->sff_dev_select(ap, 1);
if (classes[1] != ATA_DEV_NONE)
ap->ops->sff_dev_select(ap, 0);
/* bail out if no device is present */
if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
DPRINTK("EXIT, no device\n");
return;
}
/* set up device control */
if (ap->ioaddr.ctl_addr)
iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
}
/** /**
* ata_sff_error_handler - Stock error handler for BMDMA controller * ata_sff_error_handler - Stock error handler for BMDMA controller
* @ap: port to handle error for * @ap: port to handle error for
......
...@@ -831,6 +831,7 @@ extern int sata_link_resume(struct ata_link *link, const unsigned long *params, ...@@ -831,6 +831,7 @@ extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
unsigned long deadline); unsigned long deadline);
extern int sata_link_hardreset(struct ata_link *link, extern int sata_link_hardreset(struct ata_link *link,
const unsigned long *timing, unsigned long deadline); const unsigned long *timing, unsigned long deadline);
extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
extern void ata_port_disable(struct ata_port *); extern void ata_port_disable(struct ata_port *);
extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
......
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