hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/ata/libahci.c
....@@ -1199,6 +1199,26 @@
11991199 return sprintf(buf, "%d\n", emp->blink_policy);
12001200 }
12011201
1202
+static void ahci_port_clear_pending_irq(struct ata_port *ap)
1203
+{
1204
+ struct ahci_host_priv *hpriv = ap->host->private_data;
1205
+ void __iomem *port_mmio = ahci_port_base(ap);
1206
+ u32 tmp;
1207
+
1208
+ /* clear SError */
1209
+ tmp = readl(port_mmio + PORT_SCR_ERR);
1210
+ dev_dbg(ap->host->dev, "PORT_SCR_ERR 0x%x\n", tmp);
1211
+ writel(tmp, port_mmio + PORT_SCR_ERR);
1212
+
1213
+ /* clear port IRQ */
1214
+ tmp = readl(port_mmio + PORT_IRQ_STAT);
1215
+ dev_dbg(ap->host->dev, "PORT_IRQ_STAT 0x%x\n", tmp);
1216
+ if (tmp)
1217
+ writel(tmp, port_mmio + PORT_IRQ_STAT);
1218
+
1219
+ writel(1 << ap->port_no, hpriv->mmio + HOST_IRQ_STAT);
1220
+}
1221
+
12021222 static void ahci_port_init(struct device *dev, struct ata_port *ap,
12031223 int port_no, void __iomem *mmio,
12041224 void __iomem *port_mmio)
....@@ -1213,18 +1233,7 @@
12131233 if (rc)
12141234 dev_warn(dev, "%s (%d)\n", emsg, rc);
12151235
1216
- /* clear SError */
1217
- tmp = readl(port_mmio + PORT_SCR_ERR);
1218
- VPRINTK("PORT_SCR_ERR 0x%x\n", tmp);
1219
- writel(tmp, port_mmio + PORT_SCR_ERR);
1220
-
1221
- /* clear port IRQ */
1222
- tmp = readl(port_mmio + PORT_IRQ_STAT);
1223
- VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp);
1224
- if (tmp)
1225
- writel(tmp, port_mmio + PORT_IRQ_STAT);
1226
-
1227
- writel(1 << port_no, mmio + HOST_IRQ_STAT);
1236
+ ahci_port_clear_pending_irq(ap);
12281237
12291238 /* mark esata ports */
12301239 tmp = readl(port_mmio + PORT_CMD);
....@@ -1251,10 +1260,10 @@
12511260 }
12521261
12531262 tmp = readl(mmio + HOST_CTL);
1254
- VPRINTK("HOST_CTL 0x%x\n", tmp);
1263
+ dev_dbg(host->dev, "HOST_CTL 0x%x\n", tmp);
12551264 writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL);
12561265 tmp = readl(mmio + HOST_CTL);
1257
- VPRINTK("HOST_CTL 0x%x\n", tmp);
1266
+ dev_dbg(host->dev, "HOST_CTL 0x%x\n", tmp);
12581267 }
12591268 EXPORT_SYMBOL_GPL(ahci_init_controller);
12601269
....@@ -1553,6 +1562,8 @@
15531562 ata_tf_init(link->device, &tf);
15541563 tf.command = ATA_BUSY;
15551564 ata_tf_to_fis(&tf, 0, 0, d2h_fis);
1565
+
1566
+ ahci_port_clear_pending_irq(ap);
15561567
15571568 rc = sata_link_hardreset(link, timing, deadline, online,
15581569 ahci_check_ready);
....@@ -1905,16 +1916,12 @@
19051916 void __iomem *port_mmio = ahci_port_base(ap);
19061917 u32 status;
19071918
1908
- VPRINTK("ENTER\n");
1909
-
19101919 status = readl(port_mmio + PORT_IRQ_STAT);
19111920 writel(status, port_mmio + PORT_IRQ_STAT);
19121921
19131922 spin_lock(ap->lock);
19141923 ahci_handle_port_interrupt(ap, port_mmio, status);
19151924 spin_unlock(ap->lock);
1916
-
1917
- VPRINTK("EXIT\n");
19181925
19191926 return IRQ_HANDLED;
19201927 }
....@@ -1932,9 +1939,7 @@
19321939 ap = host->ports[i];
19331940 if (ap) {
19341941 ahci_port_intr(ap);
1935
- VPRINTK("port %u\n", i);
19361942 } else {
1937
- VPRINTK("port %u (no irq)\n", i);
19381943 if (ata_ratelimit())
19391944 dev_warn(host->dev,
19401945 "interrupt on disabled port %u\n", i);
....@@ -1954,8 +1959,6 @@
19541959 unsigned int rc = 0;
19551960 void __iomem *mmio;
19561961 u32 irq_stat, irq_masked;
1957
-
1958
- VPRINTK("ENTER\n");
19591962
19601963 hpriv = host->private_data;
19611964 mmio = hpriv->mmio;
....@@ -1983,8 +1986,6 @@
19831986 writel(irq_stat, mmio + HOST_IRQ_STAT);
19841987
19851988 spin_unlock(&host->lock);
1986
-
1987
- VPRINTK("EXIT\n");
19881989
19891990 return IRQ_RETVAL(rc);
19901991 }