ata: sata_rcar: really mask all interrupts on Gen2 and later

Since R-Car Gen2, a new bit has been introduced to the interrupt mask
register. Update the code to handle it properly as well.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Wolfram Sang 2018-08-06 12:40:05 +02:00 committed by Tejun Heo
parent eac7e072d7
commit e207610fff

View File

@ -109,6 +109,8 @@
#define SATAINTMASK_ERRMSK BIT(2) #define SATAINTMASK_ERRMSK BIT(2)
#define SATAINTMASK_ERRCRTMSK BIT(1) #define SATAINTMASK_ERRCRTMSK BIT(1)
#define SATAINTMASK_ATAMSK BIT(0) #define SATAINTMASK_ATAMSK BIT(0)
#define SATAINTMASK_ALL_GEN1 0x7ff
#define SATAINTMASK_ALL_GEN2 0xfff
#define SATA_RCAR_INT_MASK (SATAINTMASK_SERRMSK | \ #define SATA_RCAR_INT_MASK (SATAINTMASK_SERRMSK | \
SATAINTMASK_ATAMSK) SATAINTMASK_ATAMSK)
@ -152,6 +154,7 @@ enum sata_rcar_type {
struct sata_rcar_priv { struct sata_rcar_priv {
void __iomem *base; void __iomem *base;
u32 sataint_mask;
enum sata_rcar_type type; enum sata_rcar_type type;
}; };
@ -225,7 +228,7 @@ static void sata_rcar_freeze(struct ata_port *ap)
struct sata_rcar_priv *priv = ap->host->private_data; struct sata_rcar_priv *priv = ap->host->private_data;
/* mask */ /* mask */
iowrite32(0x7ff, priv->base + SATAINTMASK_REG); iowrite32(priv->sataint_mask, priv->base + SATAINTMASK_REG);
ata_sff_freeze(ap); ata_sff_freeze(ap);
} }
@ -241,7 +244,7 @@ static void sata_rcar_thaw(struct ata_port *ap)
ata_sff_thaw(ap); ata_sff_thaw(ap);
/* unmask */ /* unmask */
iowrite32(0x7ff & ~SATA_RCAR_INT_MASK, base + SATAINTMASK_REG); iowrite32(priv->sataint_mask & ~SATA_RCAR_INT_MASK, base + SATAINTMASK_REG);
} }
static void sata_rcar_ioread16_rep(void __iomem *reg, void *buffer, int count) static void sata_rcar_ioread16_rep(void __iomem *reg, void *buffer, int count)
@ -735,7 +738,7 @@ static irqreturn_t sata_rcar_interrupt(int irq, void *dev_instance)
if (!sataintstat) if (!sataintstat)
goto done; goto done;
/* ack */ /* ack */
iowrite32(~sataintstat & 0x7ff, base + SATAINTSTAT_REG); iowrite32(~sataintstat & priv->sataint_mask, base + SATAINTSTAT_REG);
ap = host->ports[0]; ap = host->ports[0];
@ -808,7 +811,7 @@ static void sata_rcar_init_module(struct sata_rcar_priv *priv)
/* ack and mask */ /* ack and mask */
iowrite32(0, base + SATAINTSTAT_REG); iowrite32(0, base + SATAINTSTAT_REG);
iowrite32(0x7ff, base + SATAINTMASK_REG); iowrite32(priv->sataint_mask, base + SATAINTMASK_REG);
/* enable interrupts */ /* enable interrupts */
iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG); iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
@ -818,9 +821,12 @@ static void sata_rcar_init_controller(struct ata_host *host)
{ {
struct sata_rcar_priv *priv = host->private_data; struct sata_rcar_priv *priv = host->private_data;
priv->sataint_mask = SATAINTMASK_ALL_GEN2;
/* reset and setup phy */ /* reset and setup phy */
switch (priv->type) { switch (priv->type) {
case RCAR_GEN1_SATA: case RCAR_GEN1_SATA:
priv->sataint_mask = SATAINTMASK_ALL_GEN1;
sata_rcar_gen1_phy_init(priv); sata_rcar_gen1_phy_init(priv);
break; break;
case RCAR_GEN2_SATA: case RCAR_GEN2_SATA:
@ -948,7 +954,7 @@ static int sata_rcar_remove(struct platform_device *pdev)
iowrite32(0, base + ATAPI_INT_ENABLE_REG); iowrite32(0, base + ATAPI_INT_ENABLE_REG);
/* ack and mask */ /* ack and mask */
iowrite32(0, base + SATAINTSTAT_REG); iowrite32(0, base + SATAINTSTAT_REG);
iowrite32(0x7ff, base + SATAINTMASK_REG); iowrite32(priv->sataint_mask, base + SATAINTMASK_REG);
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
@ -969,7 +975,7 @@ static int sata_rcar_suspend(struct device *dev)
/* disable interrupts */ /* disable interrupts */
iowrite32(0, base + ATAPI_INT_ENABLE_REG); iowrite32(0, base + ATAPI_INT_ENABLE_REG);
/* mask */ /* mask */
iowrite32(0x7ff, base + SATAINTMASK_REG); iowrite32(priv->sataint_mask, base + SATAINTMASK_REG);
pm_runtime_put(dev); pm_runtime_put(dev);
} }
@ -994,7 +1000,7 @@ static int sata_rcar_resume(struct device *dev)
} else { } else {
/* ack and mask */ /* ack and mask */
iowrite32(0, base + SATAINTSTAT_REG); iowrite32(0, base + SATAINTSTAT_REG);
iowrite32(0x7ff, base + SATAINTMASK_REG); iowrite32(priv->sataint_mask, base + SATAINTMASK_REG);
/* enable interrupts */ /* enable interrupts */
iowrite32(ATAPI_INT_ENABLE_SATAINT, iowrite32(ATAPI_INT_ENABLE_SATAINT,