libata: make SCR access ops per-link
Logically, SCR access ops should take @link; however, there was no compelling reason to convert all SCR access ops when adding @link abstraction as there's one-to-one mapping between a port and a non-PMP link. However, that assumption won't hold anymore with the scheduled addition of slave link. Make SCR access ops per-link. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
@@ -493,10 +493,10 @@ struct mv_hw_ops {
|
||||
void (*reset_bus)(struct ata_host *host, void __iomem *mmio);
|
||||
};
|
||||
|
||||
static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val);
|
||||
static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
|
||||
static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val);
|
||||
static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
|
||||
static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val);
|
||||
static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val);
|
||||
static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val);
|
||||
static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val);
|
||||
static int mv_port_start(struct ata_port *ap);
|
||||
static void mv_port_stop(struct ata_port *ap);
|
||||
static int mv_qc_defer(struct ata_queued_cmd *qc);
|
||||
@@ -1070,23 +1070,23 @@ static unsigned int mv_scr_offset(unsigned int sc_reg_in)
|
||||
return ofs;
|
||||
}
|
||||
|
||||
static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
|
||||
static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val)
|
||||
{
|
||||
unsigned int ofs = mv_scr_offset(sc_reg_in);
|
||||
|
||||
if (ofs != 0xffffffffU) {
|
||||
*val = readl(mv_ap_base(ap) + ofs);
|
||||
*val = readl(mv_ap_base(link->ap) + ofs);
|
||||
return 0;
|
||||
} else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
|
||||
static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
|
||||
{
|
||||
unsigned int ofs = mv_scr_offset(sc_reg_in);
|
||||
|
||||
if (ofs != 0xffffffffU) {
|
||||
writelfl(val, mv_ap_base(ap) + ofs);
|
||||
writelfl(val, mv_ap_base(link->ap) + ofs);
|
||||
return 0;
|
||||
} else
|
||||
return -EINVAL;
|
||||
@@ -2251,11 +2251,11 @@ static unsigned int mv5_scr_offset(unsigned int sc_reg_in)
|
||||
return ofs;
|
||||
}
|
||||
|
||||
static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
|
||||
static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val)
|
||||
{
|
||||
struct mv_host_priv *hpriv = ap->host->private_data;
|
||||
struct mv_host_priv *hpriv = link->ap->host->private_data;
|
||||
void __iomem *mmio = hpriv->base;
|
||||
void __iomem *addr = mv5_phy_base(mmio, ap->port_no);
|
||||
void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no);
|
||||
unsigned int ofs = mv5_scr_offset(sc_reg_in);
|
||||
|
||||
if (ofs != 0xffffffffU) {
|
||||
@@ -2265,11 +2265,11 @@ static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
|
||||
static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
|
||||
{
|
||||
struct mv_host_priv *hpriv = ap->host->private_data;
|
||||
struct mv_host_priv *hpriv = link->ap->host->private_data;
|
||||
void __iomem *mmio = hpriv->base;
|
||||
void __iomem *addr = mv5_phy_base(mmio, ap->port_no);
|
||||
void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no);
|
||||
unsigned int ofs = mv5_scr_offset(sc_reg_in);
|
||||
|
||||
if (ofs != 0xffffffffU) {
|
||||
|
Reference in New Issue
Block a user