Merge tag 'ecryptfs-3.11-rc1-cleanup' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / drivers / ata / libahci.c
index a70ff154f586753d6c096b858ae5dbee0ad869c3..acfd0f711069e9da304c95179b14127e20ae1c9c 100644 (file)
@@ -173,6 +173,7 @@ struct ata_port_operations ahci_ops = {
        .em_store               = ahci_led_store,
        .sw_activity_show       = ahci_activity_show,
        .sw_activity_store      = ahci_activity_store,
+       .transmit_led_message   = ahci_transmit_led_message,
 #ifdef CONFIG_PM
        .port_suspend           = ahci_port_suspend,
        .port_resume            = ahci_port_resume,
@@ -774,7 +775,7 @@ static void ahci_start_port(struct ata_port *ap)
 
                        /* EM Transmit bit maybe busy during init */
                        for (i = 0; i < EM_MAX_RETRY; i++) {
-                               rc = ahci_transmit_led_message(ap,
+                               rc = ap->ops->transmit_led_message(ap,
                                                               emp->led_state,
                                                               4);
                                if (rc == -EBUSY)
@@ -915,7 +916,7 @@ static void ahci_sw_activity_blink(unsigned long arg)
                        led_message |= (1 << 16);
        }
        spin_unlock_irqrestore(ap->lock, flags);
-       ahci_transmit_led_message(ap, led_message, 4);
+       ap->ops->transmit_led_message(ap, led_message, 4);
 }
 
 static void ahci_init_sw_activity(struct ata_link *link)
@@ -1044,7 +1045,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
        if (emp->blink_policy)
                state &= ~EM_MSG_LED_VALUE_ACTIVITY;
 
-       return ahci_transmit_led_message(ap, state, size);
+       return ap->ops->transmit_led_message(ap, state, size);
 }
 
 static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val)
@@ -1063,7 +1064,7 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val)
                /* set the LED to OFF */
                port_led_state &= EM_MSG_LED_VALUE_OFF;
                port_led_state |= (ap->port_no | (link->pmp << 8));
-               ahci_transmit_led_message(ap, port_led_state, 4);
+               ap->ops->transmit_led_message(ap, port_led_state, 4);
        } else {
                link->flags |= ATA_LFLAG_SW_ACTIVITY;
                if (val == BLINK_OFF) {
@@ -1071,7 +1072,7 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val)
                        port_led_state &= EM_MSG_LED_VALUE_OFF;
                        port_led_state |= (ap->port_no | (link->pmp << 8));
                        port_led_state |= EM_MSG_LED_VALUE_ON; /* check this */
-                       ahci_transmit_led_message(ap, port_led_state, 4);
+                       ap->ops->transmit_led_message(ap, port_led_state, 4);
                }
        }
        emp->blink_policy = val;
@@ -1412,7 +1413,7 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
 
        /* clear D2H reception area to properly wait for D2H FIS */
        ata_tf_init(link->device, &tf);
-       tf.command = 0x80;
+       tf.command = ATA_BUSY;
        ata_tf_to_fis(&tf, 0, 0, d2h_fis);
 
        rc = sata_link_hardreset(link, timing, deadline, &online,
@@ -1560,8 +1561,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
                u32 fbs = readl(port_mmio + PORT_FBS);
                int pmp = fbs >> PORT_FBS_DWE_OFFSET;
 
-               if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
-                   ata_link_online(&ap->pmp_link[pmp])) {
+               if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) {
                        link = &ap->pmp_link[pmp];
                        fbs_need_dec = true;
                }
@@ -2234,6 +2234,16 @@ static int ahci_port_start(struct ata_port *ap)
        if (!pp)
                return -ENOMEM;
 
+       if (ap->host->n_ports > 1) {
+               pp->irq_desc = devm_kzalloc(dev, 8, GFP_KERNEL);
+               if (!pp->irq_desc) {
+                       devm_kfree(dev, pp);
+                       return -ENOMEM;
+               }
+               snprintf(pp->irq_desc, 8,
+                        "%s%d", dev_driver_string(dev), ap->port_no);
+       }
+
        /* check FBS capability */
        if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) {
                void __iomem *port_mmio = ahci_port_base(ap);