diff options
Diffstat (limited to 'drivers')
241 files changed, 2654 insertions, 1298 deletions
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index ed122e17636e..7556e7c4a055 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -290,6 +290,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
290 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"), | 290 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"), |
291 | }, | 291 | }, |
292 | }, | 292 | }, |
293 | { | ||
294 | .callback = dmi_disable_osi_win8, | ||
295 | .ident = "Dell Vostro 3546", | ||
296 | .matches = { | ||
297 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
298 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3546"), | ||
299 | }, | ||
300 | }, | ||
293 | 301 | ||
294 | /* | 302 | /* |
295 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. | 303 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 143ec6ea1468..7db193160766 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -878,7 +878,7 @@ int acpi_dev_suspend_late(struct device *dev) | |||
878 | return 0; | 878 | return 0; |
879 | 879 | ||
880 | target_state = acpi_target_system_state(); | 880 | target_state = acpi_target_system_state(); |
881 | wakeup = device_may_wakeup(dev); | 881 | wakeup = device_may_wakeup(dev) && acpi_device_can_wakeup(adev); |
882 | error = acpi_device_wakeup(adev, target_state, wakeup); | 882 | error = acpi_device_wakeup(adev, target_state, wakeup); |
883 | if (wakeup && error) | 883 | if (wakeup && error) |
884 | return error; | 884 | return error; |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5f039f191067..e45f83789809 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -60,6 +60,7 @@ enum board_ids { | |||
60 | /* board IDs by feature in alphabetical order */ | 60 | /* board IDs by feature in alphabetical order */ |
61 | board_ahci, | 61 | board_ahci, |
62 | board_ahci_ign_iferr, | 62 | board_ahci_ign_iferr, |
63 | board_ahci_nomsi, | ||
63 | board_ahci_noncq, | 64 | board_ahci_noncq, |
64 | board_ahci_nosntf, | 65 | board_ahci_nosntf, |
65 | board_ahci_yes_fbs, | 66 | board_ahci_yes_fbs, |
@@ -121,6 +122,13 @@ static const struct ata_port_info ahci_port_info[] = { | |||
121 | .udma_mask = ATA_UDMA6, | 122 | .udma_mask = ATA_UDMA6, |
122 | .port_ops = &ahci_ops, | 123 | .port_ops = &ahci_ops, |
123 | }, | 124 | }, |
125 | [board_ahci_nomsi] = { | ||
126 | AHCI_HFLAGS (AHCI_HFLAG_NO_MSI), | ||
127 | .flags = AHCI_FLAG_COMMON, | ||
128 | .pio_mask = ATA_PIO4, | ||
129 | .udma_mask = ATA_UDMA6, | ||
130 | .port_ops = &ahci_ops, | ||
131 | }, | ||
124 | [board_ahci_noncq] = { | 132 | [board_ahci_noncq] = { |
125 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), | 133 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), |
126 | .flags = AHCI_FLAG_COMMON, | 134 | .flags = AHCI_FLAG_COMMON, |
@@ -313,6 +321,11 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
313 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ | 321 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ |
314 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ | 322 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ |
315 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ | 323 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ |
324 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ | ||
325 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ | ||
326 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ | ||
327 | { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ | ||
328 | { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ | ||
316 | 329 | ||
317 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 330 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
318 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 331 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -475,10 +488,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
475 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ | 488 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ |
476 | 489 | ||
477 | /* | 490 | /* |
478 | * Samsung SSDs found on some macbooks. NCQ times out. | 491 | * Samsung SSDs found on some macbooks. NCQ times out if MSI is |
479 | * https://bugzilla.kernel.org/show_bug.cgi?id=60731 | 492 | * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 |
480 | */ | 493 | */ |
481 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq }, | 494 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, |
482 | 495 | ||
483 | /* Enmotus */ | 496 | /* Enmotus */ |
484 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, | 497 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, |
@@ -514,12 +527,9 @@ MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)"); | |||
514 | static void ahci_pci_save_initial_config(struct pci_dev *pdev, | 527 | static void ahci_pci_save_initial_config(struct pci_dev *pdev, |
515 | struct ahci_host_priv *hpriv) | 528 | struct ahci_host_priv *hpriv) |
516 | { | 529 | { |
517 | unsigned int force_port_map = 0; | ||
518 | unsigned int mask_port_map = 0; | ||
519 | |||
520 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { | 530 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { |
521 | dev_info(&pdev->dev, "JMB361 has only one port\n"); | 531 | dev_info(&pdev->dev, "JMB361 has only one port\n"); |
522 | force_port_map = 1; | 532 | hpriv->force_port_map = 1; |
523 | } | 533 | } |
524 | 534 | ||
525 | /* | 535 | /* |
@@ -529,9 +539,9 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev, | |||
529 | */ | 539 | */ |
530 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 540 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
531 | if (pdev->device == 0x6121) | 541 | if (pdev->device == 0x6121) |
532 | mask_port_map = 0x3; | 542 | hpriv->mask_port_map = 0x3; |
533 | else | 543 | else |
534 | mask_port_map = 0xf; | 544 | hpriv->mask_port_map = 0xf; |
535 | dev_info(&pdev->dev, | 545 | dev_info(&pdev->dev, |
536 | "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); | 546 | "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); |
537 | } | 547 | } |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 5eb61c9e63da..97683e45ab04 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -1778,16 +1778,15 @@ static void ahci_handle_port_interrupt(struct ata_port *ap, | |||
1778 | } | 1778 | } |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | static void ahci_update_intr_status(struct ata_port *ap) | 1781 | static void ahci_port_intr(struct ata_port *ap) |
1782 | { | 1782 | { |
1783 | void __iomem *port_mmio = ahci_port_base(ap); | 1783 | void __iomem *port_mmio = ahci_port_base(ap); |
1784 | struct ahci_port_priv *pp = ap->private_data; | ||
1785 | u32 status; | 1784 | u32 status; |
1786 | 1785 | ||
1787 | status = readl(port_mmio + PORT_IRQ_STAT); | 1786 | status = readl(port_mmio + PORT_IRQ_STAT); |
1788 | writel(status, port_mmio + PORT_IRQ_STAT); | 1787 | writel(status, port_mmio + PORT_IRQ_STAT); |
1789 | 1788 | ||
1790 | atomic_or(status, &pp->intr_status); | 1789 | ahci_handle_port_interrupt(ap, port_mmio, status); |
1791 | } | 1790 | } |
1792 | 1791 | ||
1793 | static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) | 1792 | static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) |
@@ -1808,34 +1807,6 @@ static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) | |||
1808 | return IRQ_HANDLED; | 1807 | return IRQ_HANDLED; |
1809 | } | 1808 | } |
1810 | 1809 | ||
1811 | irqreturn_t ahci_thread_fn(int irq, void *dev_instance) | ||
1812 | { | ||
1813 | struct ata_host *host = dev_instance; | ||
1814 | struct ahci_host_priv *hpriv = host->private_data; | ||
1815 | u32 irq_masked = hpriv->port_map; | ||
1816 | unsigned int i; | ||
1817 | |||
1818 | for (i = 0; i < host->n_ports; i++) { | ||
1819 | struct ata_port *ap; | ||
1820 | |||
1821 | if (!(irq_masked & (1 << i))) | ||
1822 | continue; | ||
1823 | |||
1824 | ap = host->ports[i]; | ||
1825 | if (ap) { | ||
1826 | ahci_port_thread_fn(irq, ap); | ||
1827 | VPRINTK("port %u\n", i); | ||
1828 | } else { | ||
1829 | VPRINTK("port %u (no irq)\n", i); | ||
1830 | if (ata_ratelimit()) | ||
1831 | dev_warn(host->dev, | ||
1832 | "interrupt on disabled port %u\n", i); | ||
1833 | } | ||
1834 | } | ||
1835 | |||
1836 | return IRQ_HANDLED; | ||
1837 | } | ||
1838 | |||
1839 | static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) | 1810 | static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) |
1840 | { | 1811 | { |
1841 | struct ata_port *ap = dev_instance; | 1812 | struct ata_port *ap = dev_instance; |
@@ -1875,6 +1846,8 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1875 | 1846 | ||
1876 | irq_masked = irq_stat & hpriv->port_map; | 1847 | irq_masked = irq_stat & hpriv->port_map; |
1877 | 1848 | ||
1849 | spin_lock(&host->lock); | ||
1850 | |||
1878 | for (i = 0; i < host->n_ports; i++) { | 1851 | for (i = 0; i < host->n_ports; i++) { |
1879 | struct ata_port *ap; | 1852 | struct ata_port *ap; |
1880 | 1853 | ||
@@ -1883,7 +1856,7 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1883 | 1856 | ||
1884 | ap = host->ports[i]; | 1857 | ap = host->ports[i]; |
1885 | if (ap) { | 1858 | if (ap) { |
1886 | ahci_update_intr_status(ap); | 1859 | ahci_port_intr(ap); |
1887 | VPRINTK("port %u\n", i); | 1860 | VPRINTK("port %u\n", i); |
1888 | } else { | 1861 | } else { |
1889 | VPRINTK("port %u (no irq)\n", i); | 1862 | VPRINTK("port %u (no irq)\n", i); |
@@ -1906,9 +1879,11 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1906 | */ | 1879 | */ |
1907 | writel(irq_stat, mmio + HOST_IRQ_STAT); | 1880 | writel(irq_stat, mmio + HOST_IRQ_STAT); |
1908 | 1881 | ||
1882 | spin_unlock(&host->lock); | ||
1883 | |||
1909 | VPRINTK("EXIT\n"); | 1884 | VPRINTK("EXIT\n"); |
1910 | 1885 | ||
1911 | return handled ? IRQ_WAKE_THREAD : IRQ_NONE; | 1886 | return IRQ_RETVAL(handled); |
1912 | } | 1887 | } |
1913 | 1888 | ||
1914 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1889 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
@@ -2320,8 +2295,13 @@ static int ahci_port_start(struct ata_port *ap) | |||
2320 | */ | 2295 | */ |
2321 | pp->intr_mask = DEF_PORT_IRQ; | 2296 | pp->intr_mask = DEF_PORT_IRQ; |
2322 | 2297 | ||
2323 | spin_lock_init(&pp->lock); | 2298 | /* |
2324 | ap->lock = &pp->lock; | 2299 | * Switch to per-port locking in case each port has its own MSI vector. |
2300 | */ | ||
2301 | if ((hpriv->flags & AHCI_HFLAG_MULTI_MSI)) { | ||
2302 | spin_lock_init(&pp->lock); | ||
2303 | ap->lock = &pp->lock; | ||
2304 | } | ||
2325 | 2305 | ||
2326 | ap->private_data = pp; | 2306 | ap->private_data = pp; |
2327 | 2307 | ||
@@ -2482,31 +2462,6 @@ out_free_irqs: | |||
2482 | return rc; | 2462 | return rc; |
2483 | } | 2463 | } |
2484 | 2464 | ||
2485 | static int ahci_host_activate_single_irq(struct ata_host *host, int irq, | ||
2486 | struct scsi_host_template *sht) | ||
2487 | { | ||
2488 | int i, rc; | ||
2489 | |||
2490 | rc = ata_host_start(host); | ||
2491 | if (rc) | ||
2492 | return rc; | ||
2493 | |||
2494 | rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr, | ||
2495 | ahci_thread_fn, IRQF_SHARED, | ||
2496 | dev_driver_string(host->dev), host); | ||
2497 | if (rc) | ||
2498 | return rc; | ||
2499 | |||
2500 | for (i = 0; i < host->n_ports; i++) | ||
2501 | ata_port_desc(host->ports[i], "irq %d", irq); | ||
2502 | |||
2503 | rc = ata_host_register(host, sht); | ||
2504 | if (rc) | ||
2505 | devm_free_irq(host->dev, irq, host); | ||
2506 | |||
2507 | return rc; | ||
2508 | } | ||
2509 | |||
2510 | /** | 2465 | /** |
2511 | * ahci_host_activate - start AHCI host, request IRQs and register it | 2466 | * ahci_host_activate - start AHCI host, request IRQs and register it |
2512 | * @host: target ATA host | 2467 | * @host: target ATA host |
@@ -2532,7 +2487,8 @@ int ahci_host_activate(struct ata_host *host, int irq, | |||
2532 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) | 2487 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) |
2533 | rc = ahci_host_activate_multi_irqs(host, irq, sht); | 2488 | rc = ahci_host_activate_multi_irqs(host, irq, sht); |
2534 | else | 2489 | else |
2535 | rc = ahci_host_activate_single_irq(host, irq, sht); | 2490 | rc = ata_host_activate(host, irq, ahci_single_irq_intr, |
2491 | IRQF_SHARED, sht); | ||
2536 | return rc; | 2492 | return rc; |
2537 | } | 2493 | } |
2538 | EXPORT_SYMBOL_GPL(ahci_host_activate); | 2494 | EXPORT_SYMBOL_GPL(ahci_host_activate); |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 61eb6d77dac7..ea1fbc1d4c5f 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -146,6 +146,7 @@ | |||
146 | enum sata_rcar_type { | 146 | enum sata_rcar_type { |
147 | RCAR_GEN1_SATA, | 147 | RCAR_GEN1_SATA, |
148 | RCAR_GEN2_SATA, | 148 | RCAR_GEN2_SATA, |
149 | RCAR_R8A7790_ES1_SATA, | ||
149 | }; | 150 | }; |
150 | 151 | ||
151 | struct sata_rcar_priv { | 152 | struct sata_rcar_priv { |
@@ -763,6 +764,9 @@ static void sata_rcar_setup_port(struct ata_host *host) | |||
763 | ap->udma_mask = ATA_UDMA6; | 764 | ap->udma_mask = ATA_UDMA6; |
764 | ap->flags |= ATA_FLAG_SATA; | 765 | ap->flags |= ATA_FLAG_SATA; |
765 | 766 | ||
767 | if (priv->type == RCAR_R8A7790_ES1_SATA) | ||
768 | ap->flags |= ATA_FLAG_NO_DIPM; | ||
769 | |||
766 | ioaddr->cmd_addr = base + SDATA_REG; | 770 | ioaddr->cmd_addr = base + SDATA_REG; |
767 | ioaddr->ctl_addr = base + SSDEVCON_REG; | 771 | ioaddr->ctl_addr = base + SSDEVCON_REG; |
768 | ioaddr->scr_addr = base + SCRSSTS_REG; | 772 | ioaddr->scr_addr = base + SCRSSTS_REG; |
@@ -792,6 +796,7 @@ static void sata_rcar_init_controller(struct ata_host *host) | |||
792 | sata_rcar_gen1_phy_init(priv); | 796 | sata_rcar_gen1_phy_init(priv); |
793 | break; | 797 | break; |
794 | case RCAR_GEN2_SATA: | 798 | case RCAR_GEN2_SATA: |
799 | case RCAR_R8A7790_ES1_SATA: | ||
795 | sata_rcar_gen2_phy_init(priv); | 800 | sata_rcar_gen2_phy_init(priv); |
796 | break; | 801 | break; |
797 | default: | 802 | default: |
@@ -838,9 +843,17 @@ static struct of_device_id sata_rcar_match[] = { | |||
838 | .data = (void *)RCAR_GEN2_SATA | 843 | .data = (void *)RCAR_GEN2_SATA |
839 | }, | 844 | }, |
840 | { | 845 | { |
846 | .compatible = "renesas,sata-r8a7790-es1", | ||
847 | .data = (void *)RCAR_R8A7790_ES1_SATA | ||
848 | }, | ||
849 | { | ||
841 | .compatible = "renesas,sata-r8a7791", | 850 | .compatible = "renesas,sata-r8a7791", |
842 | .data = (void *)RCAR_GEN2_SATA | 851 | .data = (void *)RCAR_GEN2_SATA |
843 | }, | 852 | }, |
853 | { | ||
854 | .compatible = "renesas,sata-r8a7793", | ||
855 | .data = (void *)RCAR_GEN2_SATA | ||
856 | }, | ||
844 | { }, | 857 | { }, |
845 | }; | 858 | }; |
846 | MODULE_DEVICE_TABLE(of, sata_rcar_match); | 859 | MODULE_DEVICE_TABLE(of, sata_rcar_match); |
@@ -849,7 +862,9 @@ static const struct platform_device_id sata_rcar_id_table[] = { | |||
849 | { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ | 862 | { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ |
850 | { "sata-r8a7779", RCAR_GEN1_SATA }, | 863 | { "sata-r8a7779", RCAR_GEN1_SATA }, |
851 | { "sata-r8a7790", RCAR_GEN2_SATA }, | 864 | { "sata-r8a7790", RCAR_GEN2_SATA }, |
865 | { "sata-r8a7790-es1", RCAR_R8A7790_ES1_SATA }, | ||
852 | { "sata-r8a7791", RCAR_GEN2_SATA }, | 866 | { "sata-r8a7791", RCAR_GEN2_SATA }, |
867 | { "sata-r8a7793", RCAR_GEN2_SATA }, | ||
853 | { }, | 868 | { }, |
854 | }; | 869 | }; |
855 | MODULE_DEVICE_TABLE(platform, sata_rcar_id_table); | 870 | MODULE_DEVICE_TABLE(platform, sata_rcar_id_table); |
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 7652e8dc188f..21b0bc6a9c96 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -1225,11 +1225,13 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1225 | card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); | 1225 | card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); |
1226 | if (!card->config_regs) { | 1226 | if (!card->config_regs) { |
1227 | dev_warn(&dev->dev, "Failed to ioremap config registers\n"); | 1227 | dev_warn(&dev->dev, "Failed to ioremap config registers\n"); |
1228 | err = -ENOMEM; | ||
1228 | goto out_release_regions; | 1229 | goto out_release_regions; |
1229 | } | 1230 | } |
1230 | card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); | 1231 | card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); |
1231 | if (!card->buffers) { | 1232 | if (!card->buffers) { |
1232 | dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); | 1233 | dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); |
1234 | err = -ENOMEM; | ||
1233 | goto out_unmap_config; | 1235 | goto out_unmap_config; |
1234 | } | 1236 | } |
1235 | 1237 | ||
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 40bc2f4072cc..fb83d4acd400 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -361,9 +361,19 @@ static int __pm_genpd_save_device(struct pm_domain_data *pdd, | |||
361 | struct device *dev = pdd->dev; | 361 | struct device *dev = pdd->dev; |
362 | int ret = 0; | 362 | int ret = 0; |
363 | 363 | ||
364 | if (gpd_data->need_restore) | 364 | if (gpd_data->need_restore > 0) |
365 | return 0; | 365 | return 0; |
366 | 366 | ||
367 | /* | ||
368 | * If the value of the need_restore flag is still unknown at this point, | ||
369 | * we trust that pm_genpd_poweroff() has verified that the device is | ||
370 | * already runtime PM suspended. | ||
371 | */ | ||
372 | if (gpd_data->need_restore < 0) { | ||
373 | gpd_data->need_restore = 1; | ||
374 | return 0; | ||
375 | } | ||
376 | |||
367 | mutex_unlock(&genpd->lock); | 377 | mutex_unlock(&genpd->lock); |
368 | 378 | ||
369 | genpd_start_dev(genpd, dev); | 379 | genpd_start_dev(genpd, dev); |
@@ -373,7 +383,7 @@ static int __pm_genpd_save_device(struct pm_domain_data *pdd, | |||
373 | mutex_lock(&genpd->lock); | 383 | mutex_lock(&genpd->lock); |
374 | 384 | ||
375 | if (!ret) | 385 | if (!ret) |
376 | gpd_data->need_restore = true; | 386 | gpd_data->need_restore = 1; |
377 | 387 | ||
378 | return ret; | 388 | return ret; |
379 | } | 389 | } |
@@ -389,12 +399,17 @@ static void __pm_genpd_restore_device(struct pm_domain_data *pdd, | |||
389 | { | 399 | { |
390 | struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd); | 400 | struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd); |
391 | struct device *dev = pdd->dev; | 401 | struct device *dev = pdd->dev; |
392 | bool need_restore = gpd_data->need_restore; | 402 | int need_restore = gpd_data->need_restore; |
393 | 403 | ||
394 | gpd_data->need_restore = false; | 404 | gpd_data->need_restore = 0; |
395 | mutex_unlock(&genpd->lock); | 405 | mutex_unlock(&genpd->lock); |
396 | 406 | ||
397 | genpd_start_dev(genpd, dev); | 407 | genpd_start_dev(genpd, dev); |
408 | |||
409 | /* | ||
410 | * Call genpd_restore_dev() for recently added devices too (need_restore | ||
411 | * is negative then). | ||
412 | */ | ||
398 | if (need_restore) | 413 | if (need_restore) |
399 | genpd_restore_dev(genpd, dev); | 414 | genpd_restore_dev(genpd, dev); |
400 | 415 | ||
@@ -603,6 +618,7 @@ static void genpd_power_off_work_fn(struct work_struct *work) | |||
603 | static int pm_genpd_runtime_suspend(struct device *dev) | 618 | static int pm_genpd_runtime_suspend(struct device *dev) |
604 | { | 619 | { |
605 | struct generic_pm_domain *genpd; | 620 | struct generic_pm_domain *genpd; |
621 | struct generic_pm_domain_data *gpd_data; | ||
606 | bool (*stop_ok)(struct device *__dev); | 622 | bool (*stop_ok)(struct device *__dev); |
607 | int ret; | 623 | int ret; |
608 | 624 | ||
@@ -628,6 +644,16 @@ static int pm_genpd_runtime_suspend(struct device *dev) | |||
628 | return 0; | 644 | return 0; |
629 | 645 | ||
630 | mutex_lock(&genpd->lock); | 646 | mutex_lock(&genpd->lock); |
647 | |||
648 | /* | ||
649 | * If we have an unknown state of the need_restore flag, it means none | ||
650 | * of the runtime PM callbacks has been invoked yet. Let's update the | ||
651 | * flag to reflect that the current state is active. | ||
652 | */ | ||
653 | gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); | ||
654 | if (gpd_data->need_restore < 0) | ||
655 | gpd_data->need_restore = 0; | ||
656 | |||
631 | genpd->in_progress++; | 657 | genpd->in_progress++; |
632 | pm_genpd_poweroff(genpd); | 658 | pm_genpd_poweroff(genpd); |
633 | genpd->in_progress--; | 659 | genpd->in_progress--; |
@@ -1437,12 +1463,12 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, | |||
1437 | spin_unlock_irq(&dev->power.lock); | 1463 | spin_unlock_irq(&dev->power.lock); |
1438 | 1464 | ||
1439 | if (genpd->attach_dev) | 1465 | if (genpd->attach_dev) |
1440 | genpd->attach_dev(dev); | 1466 | genpd->attach_dev(genpd, dev); |
1441 | 1467 | ||
1442 | mutex_lock(&gpd_data->lock); | 1468 | mutex_lock(&gpd_data->lock); |
1443 | gpd_data->base.dev = dev; | 1469 | gpd_data->base.dev = dev; |
1444 | list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); | 1470 | list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); |
1445 | gpd_data->need_restore = genpd->status == GPD_STATE_POWER_OFF; | 1471 | gpd_data->need_restore = -1; |
1446 | gpd_data->td.constraint_changed = true; | 1472 | gpd_data->td.constraint_changed = true; |
1447 | gpd_data->td.effective_constraint_ns = -1; | 1473 | gpd_data->td.effective_constraint_ns = -1; |
1448 | mutex_unlock(&gpd_data->lock); | 1474 | mutex_unlock(&gpd_data->lock); |
@@ -1499,7 +1525,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, | |||
1499 | genpd->max_off_time_changed = true; | 1525 | genpd->max_off_time_changed = true; |
1500 | 1526 | ||
1501 | if (genpd->detach_dev) | 1527 | if (genpd->detach_dev) |
1502 | genpd->detach_dev(dev); | 1528 | genpd->detach_dev(genpd, dev); |
1503 | 1529 | ||
1504 | spin_lock_irq(&dev->power.lock); | 1530 | spin_lock_irq(&dev->power.lock); |
1505 | 1531 | ||
@@ -1546,7 +1572,7 @@ void pm_genpd_dev_need_restore(struct device *dev, bool val) | |||
1546 | 1572 | ||
1547 | psd = dev_to_psd(dev); | 1573 | psd = dev_to_psd(dev); |
1548 | if (psd && psd->domain_data) | 1574 | if (psd && psd->domain_data) |
1549 | to_gpd_data(psd->domain_data)->need_restore = val; | 1575 | to_gpd_data(psd->domain_data)->need_restore = val ? 1 : 0; |
1550 | 1576 | ||
1551 | spin_unlock_irqrestore(&dev->power.lock, flags); | 1577 | spin_unlock_irqrestore(&dev->power.lock, flags); |
1552 | } | 1578 | } |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 2ad0b5bce44b..3920ee45aa59 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -560,7 +560,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, | |||
560 | } | 560 | } |
561 | 561 | ||
562 | if (page_zero_filled(uncmem)) { | 562 | if (page_zero_filled(uncmem)) { |
563 | kunmap_atomic(user_mem); | 563 | if (user_mem) |
564 | kunmap_atomic(user_mem); | ||
564 | /* Free memory associated with this sector now. */ | 565 | /* Free memory associated with this sector now. */ |
565 | bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); | 566 | bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); |
566 | zram_free_page(zram, index); | 567 | zram_free_page(zram, index); |
diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c index 6226aa08c36a..bcf86f91800a 100644 --- a/drivers/char/hw_random/pseries-rng.c +++ b/drivers/char/hw_random/pseries-rng.c | |||
@@ -25,18 +25,21 @@ | |||
25 | #include <asm/vio.h> | 25 | #include <asm/vio.h> |
26 | 26 | ||
27 | 27 | ||
28 | static int pseries_rng_data_read(struct hwrng *rng, u32 *data) | 28 | static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) |
29 | { | 29 | { |
30 | u64 buffer[PLPAR_HCALL_BUFSIZE]; | ||
31 | size_t size = max < 8 ? max : 8; | ||
30 | int rc; | 32 | int rc; |
31 | 33 | ||
32 | rc = plpar_hcall(H_RANDOM, (unsigned long *)data); | 34 | rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer); |
33 | if (rc != H_SUCCESS) { | 35 | if (rc != H_SUCCESS) { |
34 | pr_err_ratelimited("H_RANDOM call failed %d\n", rc); | 36 | pr_err_ratelimited("H_RANDOM call failed %d\n", rc); |
35 | return -EIO; | 37 | return -EIO; |
36 | } | 38 | } |
39 | memcpy(data, buffer, size); | ||
37 | 40 | ||
38 | /* The hypervisor interface returns 64 bits */ | 41 | /* The hypervisor interface returns 64 bits */ |
39 | return 8; | 42 | return size; |
40 | } | 43 | } |
41 | 44 | ||
42 | /** | 45 | /** |
@@ -55,7 +58,7 @@ static unsigned long pseries_rng_get_desired_dma(struct vio_dev *vdev) | |||
55 | 58 | ||
56 | static struct hwrng pseries_rng = { | 59 | static struct hwrng pseries_rng = { |
57 | .name = KBUILD_MODNAME, | 60 | .name = KBUILD_MODNAME, |
58 | .data_read = pseries_rng_data_read, | 61 | .read = pseries_rng_read, |
59 | }; | 62 | }; |
60 | 63 | ||
61 | static int __init pseries_rng_probe(struct vio_dev *dev, | 64 | static int __init pseries_rng_probe(struct vio_dev *dev, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index bfa640023e64..cf7a561fad7c 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1449,8 +1449,6 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1449 | spin_lock_init(&port->outvq_lock); | 1449 | spin_lock_init(&port->outvq_lock); |
1450 | init_waitqueue_head(&port->waitqueue); | 1450 | init_waitqueue_head(&port->waitqueue); |
1451 | 1451 | ||
1452 | virtio_device_ready(portdev->vdev); | ||
1453 | |||
1454 | /* Fill the in_vq with buffers so the host can send us data. */ | 1452 | /* Fill the in_vq with buffers so the host can send us data. */ |
1455 | nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); | 1453 | nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); |
1456 | if (!nr_added_bufs) { | 1454 | if (!nr_added_bufs) { |
@@ -2026,6 +2024,8 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
2026 | spin_lock_init(&portdev->ports_lock); | 2024 | spin_lock_init(&portdev->ports_lock); |
2027 | INIT_LIST_HEAD(&portdev->ports); | 2025 | INIT_LIST_HEAD(&portdev->ports); |
2028 | 2026 | ||
2027 | virtio_device_ready(portdev->vdev); | ||
2028 | |||
2029 | if (multiport) { | 2029 | if (multiport) { |
2030 | unsigned int nr_added_bufs; | 2030 | unsigned int nr_added_bufs; |
2031 | 2031 | ||
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c index 24b5b020753a..a23ac0c724f0 100644 --- a/drivers/clk/at91/clk-usb.c +++ b/drivers/clk/at91/clk-usb.c | |||
@@ -52,29 +52,26 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw, | |||
52 | 52 | ||
53 | tmp = pmc_read(pmc, AT91_PMC_USB); | 53 | tmp = pmc_read(pmc, AT91_PMC_USB); |
54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; | 54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; |
55 | return parent_rate / (usbdiv + 1); | 55 | |
56 | return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1)); | ||
56 | } | 57 | } |
57 | 58 | ||
58 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | 59 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, |
59 | unsigned long *parent_rate) | 60 | unsigned long *parent_rate) |
60 | { | 61 | { |
61 | unsigned long div; | 62 | unsigned long div; |
62 | unsigned long bestrate; | 63 | |
63 | unsigned long tmp; | 64 | if (!rate) |
65 | return -EINVAL; | ||
64 | 66 | ||
65 | if (rate >= *parent_rate) | 67 | if (rate >= *parent_rate) |
66 | return *parent_rate; | 68 | return *parent_rate; |
67 | 69 | ||
68 | div = *parent_rate / rate; | 70 | div = DIV_ROUND_CLOSEST(*parent_rate, rate); |
69 | if (div >= SAM9X5_USB_MAX_DIV) | 71 | if (div > SAM9X5_USB_MAX_DIV + 1) |
70 | return *parent_rate / (SAM9X5_USB_MAX_DIV + 1); | 72 | div = SAM9X5_USB_MAX_DIV + 1; |
71 | |||
72 | bestrate = *parent_rate / div; | ||
73 | tmp = *parent_rate / (div + 1); | ||
74 | if (bestrate - rate > rate - tmp) | ||
75 | bestrate = tmp; | ||
76 | 73 | ||
77 | return bestrate; | 74 | return DIV_ROUND_CLOSEST(*parent_rate, div); |
78 | } | 75 | } |
79 | 76 | ||
80 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) | 77 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) |
@@ -106,9 +103,13 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | |||
106 | u32 tmp; | 103 | u32 tmp; |
107 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | 104 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); |
108 | struct at91_pmc *pmc = usb->pmc; | 105 | struct at91_pmc *pmc = usb->pmc; |
109 | unsigned long div = parent_rate / rate; | 106 | unsigned long div; |
107 | |||
108 | if (!rate) | ||
109 | return -EINVAL; | ||
110 | 110 | ||
111 | if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV) | 111 | div = DIV_ROUND_CLOSEST(parent_rate, rate); |
112 | if (div > SAM9X5_USB_MAX_DIV + 1 || !div) | ||
112 | return -EINVAL; | 113 | return -EINVAL; |
113 | 114 | ||
114 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; | 115 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; |
@@ -253,7 +254,7 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | |||
253 | 254 | ||
254 | tmp_parent_rate = rate * usb->divisors[i]; | 255 | tmp_parent_rate = rate * usb->divisors[i]; |
255 | tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); | 256 | tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); |
256 | tmprate = tmp_parent_rate / usb->divisors[i]; | 257 | tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]); |
257 | if (tmprate < rate) | 258 | if (tmprate < rate) |
258 | tmpdiff = rate - tmprate; | 259 | tmpdiff = rate - tmprate; |
259 | else | 260 | else |
@@ -281,10 +282,10 @@ static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | |||
281 | struct at91_pmc *pmc = usb->pmc; | 282 | struct at91_pmc *pmc = usb->pmc; |
282 | unsigned long div; | 283 | unsigned long div; |
283 | 284 | ||
284 | if (!rate || parent_rate % rate) | 285 | if (!rate) |
285 | return -EINVAL; | 286 | return -EINVAL; |
286 | 287 | ||
287 | div = parent_rate / rate; | 288 | div = DIV_ROUND_CLOSEST(parent_rate, rate); |
288 | 289 | ||
289 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { | 290 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { |
290 | if (usb->divisors[i] == div) { | 291 | if (usb->divisors[i] == div) { |
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 18a9de29df0e..c0a842b335c5 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c | |||
@@ -263,6 +263,14 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate, | |||
263 | if (!rate) | 263 | if (!rate) |
264 | rate = 1; | 264 | rate = 1; |
265 | 265 | ||
266 | /* if read only, just return current value */ | ||
267 | if (divider->flags & CLK_DIVIDER_READ_ONLY) { | ||
268 | bestdiv = readl(divider->reg) >> divider->shift; | ||
269 | bestdiv &= div_mask(divider); | ||
270 | bestdiv = _get_div(divider, bestdiv); | ||
271 | return bestdiv; | ||
272 | } | ||
273 | |||
266 | maxdiv = _get_maxdiv(divider); | 274 | maxdiv = _get_maxdiv(divider); |
267 | 275 | ||
268 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { | 276 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { |
@@ -361,11 +369,6 @@ const struct clk_ops clk_divider_ops = { | |||
361 | }; | 369 | }; |
362 | EXPORT_SYMBOL_GPL(clk_divider_ops); | 370 | EXPORT_SYMBOL_GPL(clk_divider_ops); |
363 | 371 | ||
364 | const struct clk_ops clk_divider_ro_ops = { | ||
365 | .recalc_rate = clk_divider_recalc_rate, | ||
366 | }; | ||
367 | EXPORT_SYMBOL_GPL(clk_divider_ro_ops); | ||
368 | |||
369 | static struct clk *_register_divider(struct device *dev, const char *name, | 372 | static struct clk *_register_divider(struct device *dev, const char *name, |
370 | const char *parent_name, unsigned long flags, | 373 | const char *parent_name, unsigned long flags, |
371 | void __iomem *reg, u8 shift, u8 width, | 374 | void __iomem *reg, u8 shift, u8 width, |
@@ -391,10 +394,7 @@ static struct clk *_register_divider(struct device *dev, const char *name, | |||
391 | } | 394 | } |
392 | 395 | ||
393 | init.name = name; | 396 | init.name = name; |
394 | if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) | 397 | init.ops = &clk_divider_ops; |
395 | init.ops = &clk_divider_ro_ops; | ||
396 | else | ||
397 | init.ops = &clk_divider_ops; | ||
398 | init.flags = flags | CLK_IS_BASIC; | 398 | init.flags = flags | CLK_IS_BASIC; |
399 | init.parent_names = (parent_name ? &parent_name: NULL); | 399 | init.parent_names = (parent_name ? &parent_name: NULL); |
400 | init.num_parents = (parent_name ? 1 : 0); | 400 | init.num_parents = (parent_name ? 1 : 0); |
diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c index b345cc791e5d..88b9fe13fa44 100644 --- a/drivers/clk/pxa/clk-pxa27x.c +++ b/drivers/clk/pxa/clk-pxa27x.c | |||
@@ -322,7 +322,7 @@ static unsigned long clk_pxa27x_memory_get_rate(struct clk_hw *hw, | |||
322 | unsigned long ccsr = CCSR; | 322 | unsigned long ccsr = CCSR; |
323 | 323 | ||
324 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); | 324 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); |
325 | a = cccr & CCCR_A_BIT; | 325 | a = cccr & (1 << CCCR_A_BIT); |
326 | l = ccsr & CCSR_L_MASK; | 326 | l = ccsr & CCSR_L_MASK; |
327 | 327 | ||
328 | if (osc_forced || a) | 328 | if (osc_forced || a) |
@@ -341,7 +341,7 @@ static u8 clk_pxa27x_memory_get_parent(struct clk_hw *hw) | |||
341 | unsigned long ccsr = CCSR; | 341 | unsigned long ccsr = CCSR; |
342 | 342 | ||
343 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); | 343 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); |
344 | a = cccr & CCCR_A_BIT; | 344 | a = cccr & (1 << CCCR_A_BIT); |
345 | if (osc_forced) | 345 | if (osc_forced) |
346 | return PXA_MEM_13Mhz; | 346 | return PXA_MEM_13Mhz; |
347 | if (a) | 347 | if (a) |
diff --git a/drivers/clk/qcom/mmcc-apq8084.c b/drivers/clk/qcom/mmcc-apq8084.c index dab988ab8cf1..157139a5c1ca 100644 --- a/drivers/clk/qcom/mmcc-apq8084.c +++ b/drivers/clk/qcom/mmcc-apq8084.c | |||
@@ -3122,7 +3122,7 @@ static struct clk_regmap *mmcc_apq8084_clocks[] = { | |||
3122 | [ESC1_CLK_SRC] = &esc1_clk_src.clkr, | 3122 | [ESC1_CLK_SRC] = &esc1_clk_src.clkr, |
3123 | [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, | 3123 | [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, |
3124 | [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, | 3124 | [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, |
3125 | [RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, | 3125 | [MMSS_RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, |
3126 | [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, | 3126 | [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, |
3127 | [MAPLE_CLK_SRC] = &maple_clk_src.clkr, | 3127 | [MAPLE_CLK_SRC] = &maple_clk_src.clkr, |
3128 | [VDP_CLK_SRC] = &vdp_clk_src.clkr, | 3128 | [VDP_CLK_SRC] = &vdp_clk_src.clkr, |
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 1e68bff481b8..880a266f0143 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c | |||
@@ -90,9 +90,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, | |||
90 | div->width = div_width; | 90 | div->width = div_width; |
91 | div->lock = lock; | 91 | div->lock = lock; |
92 | div->table = div_table; | 92 | div->table = div_table; |
93 | div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) | 93 | div_ops = &clk_divider_ops; |
94 | ? &clk_divider_ro_ops | ||
95 | : &clk_divider_ops; | ||
96 | } | 94 | } |
97 | 95 | ||
98 | clk = clk_register_composite(NULL, name, parent_names, num_parents, | 96 | clk = clk_register_composite(NULL, name, parent_names, num_parents, |
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c index efb17c3ee120..f4a9c0058b4d 100644 --- a/drivers/clocksource/sun4i_timer.c +++ b/drivers/clocksource/sun4i_timer.c | |||
@@ -182,6 +182,12 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
182 | /* Make sure timer is stopped before playing with interrupts */ | 182 | /* Make sure timer is stopped before playing with interrupts */ |
183 | sun4i_clkevt_time_stop(0); | 183 | sun4i_clkevt_time_stop(0); |
184 | 184 | ||
185 | sun4i_clockevent.cpumask = cpu_possible_mask; | ||
186 | sun4i_clockevent.irq = irq; | ||
187 | |||
188 | clockevents_config_and_register(&sun4i_clockevent, rate, | ||
189 | TIMER_SYNC_TICKS, 0xffffffff); | ||
190 | |||
185 | ret = setup_irq(irq, &sun4i_timer_irq); | 191 | ret = setup_irq(irq, &sun4i_timer_irq); |
186 | if (ret) | 192 | if (ret) |
187 | pr_warn("failed to setup irq %d\n", irq); | 193 | pr_warn("failed to setup irq %d\n", irq); |
@@ -189,12 +195,6 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
189 | /* Enable timer0 interrupt */ | 195 | /* Enable timer0 interrupt */ |
190 | val = readl(timer_base + TIMER_IRQ_EN_REG); | 196 | val = readl(timer_base + TIMER_IRQ_EN_REG); |
191 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); | 197 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); |
192 | |||
193 | sun4i_clockevent.cpumask = cpu_possible_mask; | ||
194 | sun4i_clockevent.irq = irq; | ||
195 | |||
196 | clockevents_config_and_register(&sun4i_clockevent, rate, | ||
197 | TIMER_SYNC_TICKS, 0xffffffff); | ||
198 | } | 198 | } |
199 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", | 199 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", |
200 | sun4i_timer_init); | 200 | sun4i_timer_init); |
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 23aaf40cf37f..f657c571b18e 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
@@ -166,8 +166,8 @@ try_again: | |||
166 | if (ret == -EPROBE_DEFER) | 166 | if (ret == -EPROBE_DEFER) |
167 | dev_dbg(cpu_dev, "cpu%d clock not ready, retry\n", cpu); | 167 | dev_dbg(cpu_dev, "cpu%d clock not ready, retry\n", cpu); |
168 | else | 168 | else |
169 | dev_err(cpu_dev, "failed to get cpu%d clock: %d\n", ret, | 169 | dev_err(cpu_dev, "failed to get cpu%d clock: %d\n", cpu, |
170 | cpu); | 170 | ret); |
171 | } else { | 171 | } else { |
172 | *cdev = cpu_dev; | 172 | *cdev = cpu_dev; |
173 | *creg = cpu_reg; | 173 | *creg = cpu_reg; |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 644b54e1e7d1..4473eba1d6b0 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1022,7 +1022,8 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) | |||
1022 | 1022 | ||
1023 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1023 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1024 | 1024 | ||
1025 | policy->governor = NULL; | 1025 | if (policy) |
1026 | policy->governor = NULL; | ||
1026 | 1027 | ||
1027 | return policy; | 1028 | return policy; |
1028 | } | 1029 | } |
diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c index 871703c49d2c..e1eaf4ff9762 100644 --- a/drivers/crypto/caam/key_gen.c +++ b/drivers/crypto/caam/key_gen.c | |||
@@ -48,23 +48,29 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
48 | u32 *desc; | 48 | u32 *desc; |
49 | struct split_key_result result; | 49 | struct split_key_result result; |
50 | dma_addr_t dma_addr_in, dma_addr_out; | 50 | dma_addr_t dma_addr_in, dma_addr_out; |
51 | int ret = 0; | 51 | int ret = -ENOMEM; |
52 | 52 | ||
53 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); | 53 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); |
54 | if (!desc) { | 54 | if (!desc) { |
55 | dev_err(jrdev, "unable to allocate key input memory\n"); | 55 | dev_err(jrdev, "unable to allocate key input memory\n"); |
56 | return -ENOMEM; | 56 | return ret; |
57 | } | 57 | } |
58 | 58 | ||
59 | init_job_desc(desc, 0); | ||
60 | |||
61 | dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, | 59 | dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, |
62 | DMA_TO_DEVICE); | 60 | DMA_TO_DEVICE); |
63 | if (dma_mapping_error(jrdev, dma_addr_in)) { | 61 | if (dma_mapping_error(jrdev, dma_addr_in)) { |
64 | dev_err(jrdev, "unable to map key input memory\n"); | 62 | dev_err(jrdev, "unable to map key input memory\n"); |
65 | kfree(desc); | 63 | goto out_free; |
66 | return -ENOMEM; | ||
67 | } | 64 | } |
65 | |||
66 | dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, | ||
67 | DMA_FROM_DEVICE); | ||
68 | if (dma_mapping_error(jrdev, dma_addr_out)) { | ||
69 | dev_err(jrdev, "unable to map key output memory\n"); | ||
70 | goto out_unmap_in; | ||
71 | } | ||
72 | |||
73 | init_job_desc(desc, 0); | ||
68 | append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); | 74 | append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); |
69 | 75 | ||
70 | /* Sets MDHA up into an HMAC-INIT */ | 76 | /* Sets MDHA up into an HMAC-INIT */ |
@@ -81,13 +87,6 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
81 | * FIFO_STORE with the explicit split-key content store | 87 | * FIFO_STORE with the explicit split-key content store |
82 | * (0x26 output type) | 88 | * (0x26 output type) |
83 | */ | 89 | */ |
84 | dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, | ||
85 | DMA_FROM_DEVICE); | ||
86 | if (dma_mapping_error(jrdev, dma_addr_out)) { | ||
87 | dev_err(jrdev, "unable to map key output memory\n"); | ||
88 | kfree(desc); | ||
89 | return -ENOMEM; | ||
90 | } | ||
91 | append_fifo_store(desc, dma_addr_out, split_key_len, | 90 | append_fifo_store(desc, dma_addr_out, split_key_len, |
92 | LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); | 91 | LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); |
93 | 92 | ||
@@ -115,10 +114,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
115 | 114 | ||
116 | dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, | 115 | dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, |
117 | DMA_FROM_DEVICE); | 116 | DMA_FROM_DEVICE); |
117 | out_unmap_in: | ||
118 | dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); | 118 | dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); |
119 | 119 | out_free: | |
120 | kfree(desc); | 120 | kfree(desc); |
121 | |||
122 | return ret; | 121 | return ret; |
123 | } | 122 | } |
124 | EXPORT_SYMBOL(gen_split_key); | 123 | EXPORT_SYMBOL(gen_split_key); |
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h index 9282381b03ce..fe7b3f06f6e6 100644 --- a/drivers/crypto/qat/qat_common/adf_accel_devices.h +++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h | |||
@@ -198,8 +198,7 @@ struct adf_accel_dev { | |||
198 | struct dentry *debugfs_dir; | 198 | struct dentry *debugfs_dir; |
199 | struct list_head list; | 199 | struct list_head list; |
200 | struct module *owner; | 200 | struct module *owner; |
201 | uint8_t accel_id; | ||
202 | uint8_t numa_node; | ||
203 | struct adf_accel_pci accel_pci_dev; | 201 | struct adf_accel_pci accel_pci_dev; |
202 | uint8_t accel_id; | ||
204 | } __packed; | 203 | } __packed; |
205 | #endif | 204 | #endif |
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c index 5f3fa45348b4..9dd2cb72a4e8 100644 --- a/drivers/crypto/qat/qat_common/adf_transport.c +++ b/drivers/crypto/qat/qat_common/adf_transport.c | |||
@@ -419,9 +419,10 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev, | |||
419 | WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0); | 419 | WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0); |
420 | ring = &bank->rings[i]; | 420 | ring = &bank->rings[i]; |
421 | if (hw_data->tx_rings_mask & (1 << i)) { | 421 | if (hw_data->tx_rings_mask & (1 << i)) { |
422 | ring->inflights = kzalloc_node(sizeof(atomic_t), | 422 | ring->inflights = |
423 | GFP_KERNEL, | 423 | kzalloc_node(sizeof(atomic_t), |
424 | accel_dev->numa_node); | 424 | GFP_KERNEL, |
425 | dev_to_node(&GET_DEV(accel_dev))); | ||
425 | if (!ring->inflights) | 426 | if (!ring->inflights) |
426 | goto err; | 427 | goto err; |
427 | } else { | 428 | } else { |
@@ -469,13 +470,14 @@ int adf_init_etr_data(struct adf_accel_dev *accel_dev) | |||
469 | int i, ret; | 470 | int i, ret; |
470 | 471 | ||
471 | etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL, | 472 | etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL, |
472 | accel_dev->numa_node); | 473 | dev_to_node(&GET_DEV(accel_dev))); |
473 | if (!etr_data) | 474 | if (!etr_data) |
474 | return -ENOMEM; | 475 | return -ENOMEM; |
475 | 476 | ||
476 | num_banks = GET_MAX_BANKS(accel_dev); | 477 | num_banks = GET_MAX_BANKS(accel_dev); |
477 | size = num_banks * sizeof(struct adf_etr_bank_data); | 478 | size = num_banks * sizeof(struct adf_etr_bank_data); |
478 | etr_data->banks = kzalloc_node(size, GFP_KERNEL, accel_dev->numa_node); | 479 | etr_data->banks = kzalloc_node(size, GFP_KERNEL, |
480 | dev_to_node(&GET_DEV(accel_dev))); | ||
479 | if (!etr_data->banks) { | 481 | if (!etr_data->banks) { |
480 | ret = -ENOMEM; | 482 | ret = -ENOMEM; |
481 | goto err_bank; | 483 | goto err_bank; |
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index f2e2f158cfbe..9e9619cd4a79 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c | |||
@@ -596,7 +596,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | |||
596 | if (unlikely(!n)) | 596 | if (unlikely(!n)) |
597 | return -EINVAL; | 597 | return -EINVAL; |
598 | 598 | ||
599 | bufl = kmalloc_node(sz, GFP_ATOMIC, inst->accel_dev->numa_node); | 599 | bufl = kmalloc_node(sz, GFP_ATOMIC, |
600 | dev_to_node(&GET_DEV(inst->accel_dev))); | ||
600 | if (unlikely(!bufl)) | 601 | if (unlikely(!bufl)) |
601 | return -ENOMEM; | 602 | return -ENOMEM; |
602 | 603 | ||
@@ -605,6 +606,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | |||
605 | goto err; | 606 | goto err; |
606 | 607 | ||
607 | for_each_sg(assoc, sg, assoc_n, i) { | 608 | for_each_sg(assoc, sg, assoc_n, i) { |
609 | if (!sg->length) | ||
610 | continue; | ||
608 | bufl->bufers[bufs].addr = dma_map_single(dev, | 611 | bufl->bufers[bufs].addr = dma_map_single(dev, |
609 | sg_virt(sg), | 612 | sg_virt(sg), |
610 | sg->length, | 613 | sg->length, |
@@ -640,7 +643,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | |||
640 | struct qat_alg_buf *bufers; | 643 | struct qat_alg_buf *bufers; |
641 | 644 | ||
642 | buflout = kmalloc_node(sz, GFP_ATOMIC, | 645 | buflout = kmalloc_node(sz, GFP_ATOMIC, |
643 | inst->accel_dev->numa_node); | 646 | dev_to_node(&GET_DEV(inst->accel_dev))); |
644 | if (unlikely(!buflout)) | 647 | if (unlikely(!buflout)) |
645 | goto err; | 648 | goto err; |
646 | bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE); | 649 | bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE); |
diff --git a/drivers/crypto/qat/qat_common/qat_crypto.c b/drivers/crypto/qat/qat_common/qat_crypto.c index 0d59bcb50de1..828f2a686aab 100644 --- a/drivers/crypto/qat/qat_common/qat_crypto.c +++ b/drivers/crypto/qat/qat_common/qat_crypto.c | |||
@@ -109,12 +109,14 @@ struct qat_crypto_instance *qat_crypto_get_instance_node(int node) | |||
109 | 109 | ||
110 | list_for_each(itr, adf_devmgr_get_head()) { | 110 | list_for_each(itr, adf_devmgr_get_head()) { |
111 | accel_dev = list_entry(itr, struct adf_accel_dev, list); | 111 | accel_dev = list_entry(itr, struct adf_accel_dev, list); |
112 | if (accel_dev->numa_node == node && adf_dev_started(accel_dev)) | 112 | if ((node == dev_to_node(&GET_DEV(accel_dev)) || |
113 | dev_to_node(&GET_DEV(accel_dev)) < 0) | ||
114 | && adf_dev_started(accel_dev)) | ||
113 | break; | 115 | break; |
114 | accel_dev = NULL; | 116 | accel_dev = NULL; |
115 | } | 117 | } |
116 | if (!accel_dev) { | 118 | if (!accel_dev) { |
117 | pr_err("QAT: Could not find device on give node\n"); | 119 | pr_err("QAT: Could not find device on node %d\n", node); |
118 | accel_dev = adf_devmgr_get_first(); | 120 | accel_dev = adf_devmgr_get_first(); |
119 | } | 121 | } |
120 | if (!accel_dev || !adf_dev_started(accel_dev)) | 122 | if (!accel_dev || !adf_dev_started(accel_dev)) |
@@ -164,7 +166,7 @@ static int qat_crypto_create_instances(struct adf_accel_dev *accel_dev) | |||
164 | 166 | ||
165 | for (i = 0; i < num_inst; i++) { | 167 | for (i = 0; i < num_inst; i++) { |
166 | inst = kzalloc_node(sizeof(*inst), GFP_KERNEL, | 168 | inst = kzalloc_node(sizeof(*inst), GFP_KERNEL, |
167 | accel_dev->numa_node); | 169 | dev_to_node(&GET_DEV(accel_dev))); |
168 | if (!inst) | 170 | if (!inst) |
169 | goto err; | 171 | goto err; |
170 | 172 | ||
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c index 978d6c56639d..53c491b59f07 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c | |||
@@ -108,7 +108,7 @@ int adf_init_admin_comms(struct adf_accel_dev *accel_dev) | |||
108 | uint64_t reg_val; | 108 | uint64_t reg_val; |
109 | 109 | ||
110 | admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL, | 110 | admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL, |
111 | accel_dev->numa_node); | 111 | dev_to_node(&GET_DEV(accel_dev))); |
112 | if (!admin) | 112 | if (!admin) |
113 | return -ENOMEM; | 113 | return -ENOMEM; |
114 | admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, | 114 | admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c index 0d0435a41be9..948f66be262b 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c | |||
@@ -119,21 +119,6 @@ static void adf_cleanup_accel(struct adf_accel_dev *accel_dev) | |||
119 | kfree(accel_dev); | 119 | kfree(accel_dev); |
120 | } | 120 | } |
121 | 121 | ||
122 | static uint8_t adf_get_dev_node_id(struct pci_dev *pdev) | ||
123 | { | ||
124 | unsigned int bus_per_cpu = 0; | ||
125 | struct cpuinfo_x86 *c = &cpu_data(num_online_cpus() - 1); | ||
126 | |||
127 | if (!c->phys_proc_id) | ||
128 | return 0; | ||
129 | |||
130 | bus_per_cpu = 256 / (c->phys_proc_id + 1); | ||
131 | |||
132 | if (bus_per_cpu != 0) | ||
133 | return pdev->bus->number / bus_per_cpu; | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | static int qat_dev_start(struct adf_accel_dev *accel_dev) | 122 | static int qat_dev_start(struct adf_accel_dev *accel_dev) |
138 | { | 123 | { |
139 | int cpus = num_online_cpus(); | 124 | int cpus = num_online_cpus(); |
@@ -235,7 +220,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
235 | void __iomem *pmisc_bar_addr = NULL; | 220 | void __iomem *pmisc_bar_addr = NULL; |
236 | char name[ADF_DEVICE_NAME_LENGTH]; | 221 | char name[ADF_DEVICE_NAME_LENGTH]; |
237 | unsigned int i, bar_nr; | 222 | unsigned int i, bar_nr; |
238 | uint8_t node; | ||
239 | int ret; | 223 | int ret; |
240 | 224 | ||
241 | switch (ent->device) { | 225 | switch (ent->device) { |
@@ -246,12 +230,19 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
246 | return -ENODEV; | 230 | return -ENODEV; |
247 | } | 231 | } |
248 | 232 | ||
249 | node = adf_get_dev_node_id(pdev); | 233 | if (num_possible_nodes() > 1 && dev_to_node(&pdev->dev) < 0) { |
250 | accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, node); | 234 | /* If the accelerator is connected to a node with no memory |
235 | * there is no point in using the accelerator since the remote | ||
236 | * memory transaction will be very slow. */ | ||
237 | dev_err(&pdev->dev, "Invalid NUMA configuration.\n"); | ||
238 | return -EINVAL; | ||
239 | } | ||
240 | |||
241 | accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, | ||
242 | dev_to_node(&pdev->dev)); | ||
251 | if (!accel_dev) | 243 | if (!accel_dev) |
252 | return -ENOMEM; | 244 | return -ENOMEM; |
253 | 245 | ||
254 | accel_dev->numa_node = node; | ||
255 | INIT_LIST_HEAD(&accel_dev->crypto_list); | 246 | INIT_LIST_HEAD(&accel_dev->crypto_list); |
256 | 247 | ||
257 | /* Add accel device to accel table. | 248 | /* Add accel device to accel table. |
@@ -264,7 +255,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
264 | 255 | ||
265 | accel_dev->owner = THIS_MODULE; | 256 | accel_dev->owner = THIS_MODULE; |
266 | /* Allocate and configure device configuration structure */ | 257 | /* Allocate and configure device configuration structure */ |
267 | hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, node); | 258 | hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, |
259 | dev_to_node(&pdev->dev)); | ||
268 | if (!hw_data) { | 260 | if (!hw_data) { |
269 | ret = -ENOMEM; | 261 | ret = -ENOMEM; |
270 | goto out_err; | 262 | goto out_err; |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c index 67ec61e51185..d96ee21b9b77 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c | |||
@@ -168,7 +168,7 @@ static int adf_isr_alloc_msix_entry_table(struct adf_accel_dev *accel_dev) | |||
168 | uint32_t msix_num_entries = hw_data->num_banks + 1; | 168 | uint32_t msix_num_entries = hw_data->num_banks + 1; |
169 | 169 | ||
170 | entries = kzalloc_node(msix_num_entries * sizeof(*entries), | 170 | entries = kzalloc_node(msix_num_entries * sizeof(*entries), |
171 | GFP_KERNEL, accel_dev->numa_node); | 171 | GFP_KERNEL, dev_to_node(&GET_DEV(accel_dev))); |
172 | if (!entries) | 172 | if (!entries) |
173 | return -ENOMEM; | 173 | return -ENOMEM; |
174 | 174 | ||
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 4839bfa74a10..19a99743cf52 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -271,7 +271,7 @@ struct pl330_config { | |||
271 | #define DMAC_MODE_NS (1 << 0) | 271 | #define DMAC_MODE_NS (1 << 0) |
272 | unsigned int mode; | 272 | unsigned int mode; |
273 | unsigned int data_bus_width:10; /* In number of bits */ | 273 | unsigned int data_bus_width:10; /* In number of bits */ |
274 | unsigned int data_buf_dep:10; | 274 | unsigned int data_buf_dep:11; |
275 | unsigned int num_chan:4; | 275 | unsigned int num_chan:4; |
276 | unsigned int num_peri:6; | 276 | unsigned int num_peri:6; |
277 | u32 peri_ns; | 277 | u32 peri_ns; |
@@ -2336,7 +2336,7 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len) | |||
2336 | int burst_len; | 2336 | int burst_len; |
2337 | 2337 | ||
2338 | burst_len = pl330->pcfg.data_bus_width / 8; | 2338 | burst_len = pl330->pcfg.data_bus_width / 8; |
2339 | burst_len *= pl330->pcfg.data_buf_dep; | 2339 | burst_len *= pl330->pcfg.data_buf_dep / pl330->pcfg.num_chan; |
2340 | burst_len >>= desc->rqcfg.brst_size; | 2340 | burst_len >>= desc->rqcfg.brst_size; |
2341 | 2341 | ||
2342 | /* src/dst_burst_len can't be more than 16 */ | 2342 | /* src/dst_burst_len can't be more than 16 */ |
@@ -2459,16 +2459,25 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, | |||
2459 | /* Select max possible burst size */ | 2459 | /* Select max possible burst size */ |
2460 | burst = pl330->pcfg.data_bus_width / 8; | 2460 | burst = pl330->pcfg.data_bus_width / 8; |
2461 | 2461 | ||
2462 | while (burst > 1) { | 2462 | /* |
2463 | if (!(len % burst)) | 2463 | * Make sure we use a burst size that aligns with all the memcpy |
2464 | break; | 2464 | * parameters because our DMA programming algorithm doesn't cope with |
2465 | * transfers which straddle an entry in the DMA device's MFIFO. | ||
2466 | */ | ||
2467 | while ((src | dst | len) & (burst - 1)) | ||
2465 | burst /= 2; | 2468 | burst /= 2; |
2466 | } | ||
2467 | 2469 | ||
2468 | desc->rqcfg.brst_size = 0; | 2470 | desc->rqcfg.brst_size = 0; |
2469 | while (burst != (1 << desc->rqcfg.brst_size)) | 2471 | while (burst != (1 << desc->rqcfg.brst_size)) |
2470 | desc->rqcfg.brst_size++; | 2472 | desc->rqcfg.brst_size++; |
2471 | 2473 | ||
2474 | /* | ||
2475 | * If burst size is smaller than bus width then make sure we only | ||
2476 | * transfer one at a time to avoid a burst stradling an MFIFO entry. | ||
2477 | */ | ||
2478 | if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) | ||
2479 | desc->rqcfg.brst_len = 1; | ||
2480 | |||
2472 | desc->rqcfg.brst_len = get_burst_len(desc, len); | 2481 | desc->rqcfg.brst_len = get_burst_len(desc, len); |
2473 | 2482 | ||
2474 | desc->txd.flags = flags; | 2483 | desc->txd.flags = flags; |
@@ -2732,7 +2741,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2732 | 2741 | ||
2733 | 2742 | ||
2734 | dev_info(&adev->dev, | 2743 | dev_info(&adev->dev, |
2735 | "Loaded driver for PL330 DMAC-%d\n", adev->periphid); | 2744 | "Loaded driver for PL330 DMAC-%x\n", adev->periphid); |
2736 | dev_info(&adev->dev, | 2745 | dev_info(&adev->dev, |
2737 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", | 2746 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", |
2738 | pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, | 2747 | pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, |
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 3aa10b328254..91292f5513ff 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c | |||
@@ -230,30 +230,25 @@ static inline void sun6i_dma_dump_chan_regs(struct sun6i_dma_dev *sdev, | |||
230 | readl(pchan->base + DMA_CHAN_CUR_PARA)); | 230 | readl(pchan->base + DMA_CHAN_CUR_PARA)); |
231 | } | 231 | } |
232 | 232 | ||
233 | static inline int convert_burst(u32 maxburst, u8 *burst) | 233 | static inline s8 convert_burst(u32 maxburst) |
234 | { | 234 | { |
235 | switch (maxburst) { | 235 | switch (maxburst) { |
236 | case 1: | 236 | case 1: |
237 | *burst = 0; | 237 | return 0; |
238 | break; | ||
239 | case 8: | 238 | case 8: |
240 | *burst = 2; | 239 | return 2; |
241 | break; | ||
242 | default: | 240 | default: |
243 | return -EINVAL; | 241 | return -EINVAL; |
244 | } | 242 | } |
245 | |||
246 | return 0; | ||
247 | } | 243 | } |
248 | 244 | ||
249 | static inline int convert_buswidth(enum dma_slave_buswidth addr_width, u8 *width) | 245 | static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width) |
250 | { | 246 | { |
251 | if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || | 247 | if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || |
252 | (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) | 248 | (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) |
253 | return -EINVAL; | 249 | return -EINVAL; |
254 | 250 | ||
255 | *width = addr_width >> 1; | 251 | return addr_width >> 1; |
256 | return 0; | ||
257 | } | 252 | } |
258 | 253 | ||
259 | static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, | 254 | static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, |
@@ -284,26 +279,25 @@ static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli, | |||
284 | struct dma_slave_config *config) | 279 | struct dma_slave_config *config) |
285 | { | 280 | { |
286 | u8 src_width, dst_width, src_burst, dst_burst; | 281 | u8 src_width, dst_width, src_burst, dst_burst; |
287 | int ret; | ||
288 | 282 | ||
289 | if (!config) | 283 | if (!config) |
290 | return -EINVAL; | 284 | return -EINVAL; |
291 | 285 | ||
292 | ret = convert_burst(config->src_maxburst, &src_burst); | 286 | src_burst = convert_burst(config->src_maxburst); |
293 | if (ret) | 287 | if (src_burst) |
294 | return ret; | 288 | return src_burst; |
295 | 289 | ||
296 | ret = convert_burst(config->dst_maxburst, &dst_burst); | 290 | dst_burst = convert_burst(config->dst_maxburst); |
297 | if (ret) | 291 | if (dst_burst) |
298 | return ret; | 292 | return dst_burst; |
299 | 293 | ||
300 | ret = convert_buswidth(config->src_addr_width, &src_width); | 294 | src_width = convert_buswidth(config->src_addr_width); |
301 | if (ret) | 295 | if (src_width) |
302 | return ret; | 296 | return src_width; |
303 | 297 | ||
304 | ret = convert_buswidth(config->dst_addr_width, &dst_width); | 298 | dst_width = convert_buswidth(config->dst_addr_width); |
305 | if (ret) | 299 | if (dst_width) |
306 | return ret; | 300 | return dst_width; |
307 | 301 | ||
308 | lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | | 302 | lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | |
309 | DMA_CHAN_CFG_SRC_WIDTH(src_width) | | 303 | DMA_CHAN_CFG_SRC_WIDTH(src_width) | |
@@ -542,11 +536,10 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
542 | { | 536 | { |
543 | struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); | 537 | struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); |
544 | struct sun6i_vchan *vchan = to_sun6i_vchan(chan); | 538 | struct sun6i_vchan *vchan = to_sun6i_vchan(chan); |
545 | struct dma_slave_config *sconfig = &vchan->cfg; | ||
546 | struct sun6i_dma_lli *v_lli; | 539 | struct sun6i_dma_lli *v_lli; |
547 | struct sun6i_desc *txd; | 540 | struct sun6i_desc *txd; |
548 | dma_addr_t p_lli; | 541 | dma_addr_t p_lli; |
549 | int ret; | 542 | s8 burst, width; |
550 | 543 | ||
551 | dev_dbg(chan2dev(chan), | 544 | dev_dbg(chan2dev(chan), |
552 | "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", | 545 | "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", |
@@ -565,14 +558,21 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
565 | goto err_txd_free; | 558 | goto err_txd_free; |
566 | } | 559 | } |
567 | 560 | ||
568 | ret = sun6i_dma_cfg_lli(v_lli, src, dest, len, sconfig); | 561 | v_lli->src = src; |
569 | if (ret) | 562 | v_lli->dst = dest; |
570 | goto err_dma_free; | 563 | v_lli->len = len; |
564 | v_lli->para = NORMAL_WAIT; | ||
571 | 565 | ||
566 | burst = convert_burst(8); | ||
567 | width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); | ||
572 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | | 568 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | |
573 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | | 569 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | |
574 | DMA_CHAN_CFG_DST_LINEAR_MODE | | 570 | DMA_CHAN_CFG_DST_LINEAR_MODE | |
575 | DMA_CHAN_CFG_SRC_LINEAR_MODE; | 571 | DMA_CHAN_CFG_SRC_LINEAR_MODE | |
572 | DMA_CHAN_CFG_SRC_BURST(burst) | | ||
573 | DMA_CHAN_CFG_SRC_WIDTH(width) | | ||
574 | DMA_CHAN_CFG_DST_BURST(burst) | | ||
575 | DMA_CHAN_CFG_DST_WIDTH(width); | ||
576 | 576 | ||
577 | sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); | 577 | sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); |
578 | 578 | ||
@@ -580,8 +580,6 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
580 | 580 | ||
581 | return vchan_tx_prep(&vchan->vc, &txd->vd, flags); | 581 | return vchan_tx_prep(&vchan->vc, &txd->vd, flags); |
582 | 582 | ||
583 | err_dma_free: | ||
584 | dma_pool_free(sdev->pool, v_lli, p_lli); | ||
585 | err_txd_free: | 583 | err_txd_free: |
586 | kfree(txd); | 584 | kfree(txd); |
587 | return NULL; | 585 | return NULL; |
@@ -915,6 +913,7 @@ static int sun6i_dma_probe(struct platform_device *pdev) | |||
915 | sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; | 913 | sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; |
916 | sdc->slave.device_control = sun6i_dma_control; | 914 | sdc->slave.device_control = sun6i_dma_control; |
917 | sdc->slave.chancnt = NR_MAX_VCHANS; | 915 | sdc->slave.chancnt = NR_MAX_VCHANS; |
916 | sdc->slave.copy_align = 4; | ||
918 | 917 | ||
919 | sdc->slave.dev = &pdev->dev; | 918 | sdc->slave.dev = &pdev->dev; |
920 | 919 | ||
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 5d997a33907e..2a3973a7c441 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -1637,8 +1637,7 @@ static int dispatch_ioctl(struct client *client, | |||
1637 | _IOC_SIZE(cmd) > sizeof(buffer)) | 1637 | _IOC_SIZE(cmd) > sizeof(buffer)) |
1638 | return -ENOTTY; | 1638 | return -ENOTTY; |
1639 | 1639 | ||
1640 | if (_IOC_DIR(cmd) == _IOC_READ) | 1640 | memset(&buffer, 0, sizeof(buffer)); |
1641 | memset(&buffer, 0, _IOC_SIZE(cmd)); | ||
1642 | 1641 | ||
1643 | if (_IOC_DIR(cmd) & _IOC_WRITE) | 1642 | if (_IOC_DIR(cmd) & _IOC_WRITE) |
1644 | if (copy_from_user(&buffer, arg, _IOC_SIZE(cmd))) | 1643 | if (copy_from_user(&buffer, arg, _IOC_SIZE(cmd))) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index d71fb54582d2..25ba3628960a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -646,6 +646,18 @@ static int exynos_drm_init(void) | |||
646 | if (!is_exynos) | 646 | if (!is_exynos) |
647 | return -ENODEV; | 647 | return -ENODEV; |
648 | 648 | ||
649 | /* | ||
650 | * Register device object only in case of Exynos SoC. | ||
651 | * | ||
652 | * Below codes resolves temporarily infinite loop issue incurred | ||
653 | * by Exynos drm driver when using multi-platform kernel. | ||
654 | * So these codes will be replaced with more generic way later. | ||
655 | */ | ||
656 | if (!of_machine_is_compatible("samsung,exynos3") && | ||
657 | !of_machine_is_compatible("samsung,exynos4") && | ||
658 | !of_machine_is_compatible("samsung,exynos5")) | ||
659 | return -ENODEV; | ||
660 | |||
649 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, | 661 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, |
650 | NULL, 0); | 662 | NULL, 0); |
651 | if (IS_ERR(exynos_drm_pdev)) | 663 | if (IS_ERR(exynos_drm_pdev)) |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 9a7353302b3f..7a966f3c9950 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1663,15 +1663,17 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1663 | goto out_regs; | 1663 | goto out_regs; |
1664 | 1664 | ||
1665 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1665 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1666 | ret = i915_kick_out_vgacon(dev_priv); | 1666 | /* WARNING: Apparently we must kick fbdev drivers before vgacon, |
1667 | * otherwise the vga fbdev driver falls over. */ | ||
1668 | ret = i915_kick_out_firmware_fb(dev_priv); | ||
1667 | if (ret) { | 1669 | if (ret) { |
1668 | DRM_ERROR("failed to remove conflicting VGA console\n"); | 1670 | DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); |
1669 | goto out_gtt; | 1671 | goto out_gtt; |
1670 | } | 1672 | } |
1671 | 1673 | ||
1672 | ret = i915_kick_out_firmware_fb(dev_priv); | 1674 | ret = i915_kick_out_vgacon(dev_priv); |
1673 | if (ret) { | 1675 | if (ret) { |
1674 | DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); | 1676 | DRM_ERROR("failed to remove conflicting VGA console\n"); |
1675 | goto out_gtt; | 1677 | goto out_gtt; |
1676 | } | 1678 | } |
1677 | } | 1679 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index de12017c809b..c1cf3329108c 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1920,6 +1920,22 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv) | |||
1920 | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | | 1920 | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | |
1921 | GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); | 1921 | GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); |
1922 | 1922 | ||
1923 | if (!USES_PPGTT(dev_priv->dev)) | ||
1924 | /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry, | ||
1925 | * so RTL will always use the value corresponding to | ||
1926 | * pat_sel = 000". | ||
1927 | * So let's disable cache for GGTT to avoid screen corruptions. | ||
1928 | * MOCS still can be used though. | ||
1929 | * - System agent ggtt writes (i.e. cpu gtt mmaps) already work | ||
1930 | * before this patch, i.e. the same uncached + snooping access | ||
1931 | * like on gen6/7 seems to be in effect. | ||
1932 | * - So this just fixes blitter/render access. Again it looks | ||
1933 | * like it's not just uncached access, but uncached + snooping. | ||
1934 | * So we can still hold onto all our assumptions wrt cpu | ||
1935 | * clflushing on LLC machines. | ||
1936 | */ | ||
1937 | pat = GEN8_PPAT(0, GEN8_PPAT_UC); | ||
1938 | |||
1923 | /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b | 1939 | /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b |
1924 | * write would work. */ | 1940 | * write would work. */ |
1925 | I915_WRITE(GEN8_PRIVATE_PAT, pat); | 1941 | I915_WRITE(GEN8_PRIVATE_PAT, pat); |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 749ab485569e..cd7f4734c9f8 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -375,22 +375,9 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
375 | * has to also include the unfenced register the GPU uses | 375 | * has to also include the unfenced register the GPU uses |
376 | * whilst executing a fenced command for an untiled object. | 376 | * whilst executing a fenced command for an untiled object. |
377 | */ | 377 | */ |
378 | 378 | if (obj->map_and_fenceable && | |
379 | obj->map_and_fenceable = | 379 | !i915_gem_object_fence_ok(obj, args->tiling_mode)) |
380 | !i915_gem_obj_ggtt_bound(obj) || | 380 | ret = i915_gem_object_ggtt_unbind(obj); |
381 | (i915_gem_obj_ggtt_offset(obj) + | ||
382 | obj->base.size <= dev_priv->gtt.mappable_end && | ||
383 | i915_gem_object_fence_ok(obj, args->tiling_mode)); | ||
384 | |||
385 | /* Rebind if we need a change of alignment */ | ||
386 | if (!obj->map_and_fenceable) { | ||
387 | u32 unfenced_align = | ||
388 | i915_gem_get_gtt_alignment(dev, obj->base.size, | ||
389 | args->tiling_mode, | ||
390 | false); | ||
391 | if (i915_gem_obj_ggtt_offset(obj) & (unfenced_align - 1)) | ||
392 | ret = i915_gem_object_ggtt_unbind(obj); | ||
393 | } | ||
394 | 381 | ||
395 | if (ret == 0) { | 382 | if (ret == 0) { |
396 | obj->fence_dirty = | 383 | obj->fence_dirty = |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 947144985700..e9a0df8a437b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -9066,6 +9066,10 @@ static bool page_flip_finished(struct intel_crtc *crtc) | |||
9066 | struct drm_device *dev = crtc->base.dev; | 9066 | struct drm_device *dev = crtc->base.dev; |
9067 | struct drm_i915_private *dev_priv = dev->dev_private; | 9067 | struct drm_i915_private *dev_priv = dev->dev_private; |
9068 | 9068 | ||
9069 | if (i915_reset_in_progress(&dev_priv->gpu_error) || | ||
9070 | crtc->reset_counter != atomic_read(&dev_priv->gpu_error.reset_counter)) | ||
9071 | return true; | ||
9072 | |||
9069 | /* | 9073 | /* |
9070 | * The relevant registers doen't exist on pre-ctg. | 9074 | * The relevant registers doen't exist on pre-ctg. |
9071 | * As the flip done interrupt doesn't trigger for mmio | 9075 | * As the flip done interrupt doesn't trigger for mmio |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ceb528f07c25..49288437e52a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -4686,6 +4686,7 @@ static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) | |||
4686 | * vdd might still be enabled do to the delayed vdd off. | 4686 | * vdd might still be enabled do to the delayed vdd off. |
4687 | * Make sure vdd is actually turned off here. | 4687 | * Make sure vdd is actually turned off here. |
4688 | */ | 4688 | */ |
4689 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | ||
4689 | pps_lock(intel_dp); | 4690 | pps_lock(intel_dp); |
4690 | edp_panel_vdd_off_sync(intel_dp); | 4691 | edp_panel_vdd_off_sync(intel_dp); |
4691 | pps_unlock(intel_dp); | 4692 | pps_unlock(intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index e18b3f49074c..b001c90312e7 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -1094,12 +1094,25 @@ static u32 get_backlight_min_vbt(struct intel_connector *connector) | |||
1094 | struct drm_device *dev = connector->base.dev; | 1094 | struct drm_device *dev = connector->base.dev; |
1095 | struct drm_i915_private *dev_priv = dev->dev_private; | 1095 | struct drm_i915_private *dev_priv = dev->dev_private; |
1096 | struct intel_panel *panel = &connector->panel; | 1096 | struct intel_panel *panel = &connector->panel; |
1097 | int min; | ||
1097 | 1098 | ||
1098 | WARN_ON(panel->backlight.max == 0); | 1099 | WARN_ON(panel->backlight.max == 0); |
1099 | 1100 | ||
1101 | /* | ||
1102 | * XXX: If the vbt value is 255, it makes min equal to max, which leads | ||
1103 | * to problems. There are such machines out there. Either our | ||
1104 | * interpretation is wrong or the vbt has bogus data. Or both. Safeguard | ||
1105 | * against this by letting the minimum be at most (arbitrarily chosen) | ||
1106 | * 25% of the max. | ||
1107 | */ | ||
1108 | min = clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64); | ||
1109 | if (min != dev_priv->vbt.backlight.min_brightness) { | ||
1110 | DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n", | ||
1111 | dev_priv->vbt.backlight.min_brightness, min); | ||
1112 | } | ||
1113 | |||
1100 | /* vbt value is a coefficient in range [0..255] */ | 1114 | /* vbt value is a coefficient in range [0..255] */ |
1101 | return scale(dev_priv->vbt.backlight.min_brightness, 0, 255, | 1115 | return scale(min, 0, 255, 0, panel->backlight.max); |
1102 | 0, panel->backlight.max); | ||
1103 | } | 1116 | } |
1104 | 1117 | ||
1105 | static int bdw_setup_backlight(struct intel_connector *connector) | 1118 | static int bdw_setup_backlight(struct intel_connector *connector) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 300d7e503f96..8a0788dcf106 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -6533,11 +6533,6 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
6533 | I915_WRITE(_3D_CHICKEN, | 6533 | I915_WRITE(_3D_CHICKEN, |
6534 | _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); | 6534 | _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); |
6535 | 6535 | ||
6536 | /* WaSetupGtModeTdRowDispatch:snb */ | ||
6537 | if (IS_SNB_GT1(dev)) | ||
6538 | I915_WRITE(GEN6_GT_MODE, | ||
6539 | _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE)); | ||
6540 | |||
6541 | /* WaDisable_RenderCache_OperationalFlush:snb */ | 6536 | /* WaDisable_RenderCache_OperationalFlush:snb */ |
6542 | I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); | 6537 | I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
6543 | 6538 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c index a16024a74771..fde42e4d1b56 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c | |||
@@ -27,6 +27,20 @@ struct gk20a_fb_priv { | |||
27 | }; | 27 | }; |
28 | 28 | ||
29 | static int | 29 | static int |
30 | gk20a_fb_init(struct nouveau_object *object) | ||
31 | { | ||
32 | struct gk20a_fb_priv *priv = (void *)object; | ||
33 | int ret; | ||
34 | |||
35 | ret = nouveau_fb_init(&priv->base); | ||
36 | if (ret) | ||
37 | return ret; | ||
38 | |||
39 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | static int | ||
30 | gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | 44 | gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
31 | struct nouveau_oclass *oclass, void *data, u32 size, | 45 | struct nouveau_oclass *oclass, void *data, u32 size, |
32 | struct nouveau_object **pobject) | 46 | struct nouveau_object **pobject) |
@@ -48,7 +62,7 @@ gk20a_fb_oclass = &(struct nouveau_fb_impl) { | |||
48 | .base.ofuncs = &(struct nouveau_ofuncs) { | 62 | .base.ofuncs = &(struct nouveau_ofuncs) { |
49 | .ctor = gk20a_fb_ctor, | 63 | .ctor = gk20a_fb_ctor, |
50 | .dtor = _nouveau_fb_dtor, | 64 | .dtor = _nouveau_fb_dtor, |
51 | .init = _nouveau_fb_init, | 65 | .init = gk20a_fb_init, |
52 | .fini = _nouveau_fb_fini, | 66 | .fini = _nouveau_fb_fini, |
53 | }, | 67 | }, |
54 | .memtype = nvc0_fb_memtype_valid, | 68 | .memtype = nvc0_fb_memtype_valid, |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 76b8c4f980ea..5beae7596f62 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -792,6 +792,22 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update) | |||
792 | } | 792 | } |
793 | 793 | ||
794 | static int | 794 | static int |
795 | nv50_crtc_set_raster_vblank_dmi(struct nouveau_crtc *nv_crtc, u32 usec) | ||
796 | { | ||
797 | struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); | ||
798 | u32 *push; | ||
799 | |||
800 | push = evo_wait(mast, 8); | ||
801 | if (!push) | ||
802 | return -ENOMEM; | ||
803 | |||
804 | evo_mthd(push, 0x0828 + (nv_crtc->index * 0x400), 1); | ||
805 | evo_data(push, usec); | ||
806 | evo_kick(push, mast); | ||
807 | return 0; | ||
808 | } | ||
809 | |||
810 | static int | ||
795 | nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) | 811 | nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) |
796 | { | 812 | { |
797 | struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); | 813 | struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); |
@@ -1105,14 +1121,14 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode, | |||
1105 | evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); | 1121 | evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); |
1106 | evo_data(push, 0x00800000 | mode->clock); | 1122 | evo_data(push, 0x00800000 | mode->clock); |
1107 | evo_data(push, (ilace == 2) ? 2 : 0); | 1123 | evo_data(push, (ilace == 2) ? 2 : 0); |
1108 | evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 8); | 1124 | evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 6); |
1109 | evo_data(push, 0x00000000); | 1125 | evo_data(push, 0x00000000); |
1110 | evo_data(push, (vactive << 16) | hactive); | 1126 | evo_data(push, (vactive << 16) | hactive); |
1111 | evo_data(push, ( vsynce << 16) | hsynce); | 1127 | evo_data(push, ( vsynce << 16) | hsynce); |
1112 | evo_data(push, (vblanke << 16) | hblanke); | 1128 | evo_data(push, (vblanke << 16) | hblanke); |
1113 | evo_data(push, (vblanks << 16) | hblanks); | 1129 | evo_data(push, (vblanks << 16) | hblanks); |
1114 | evo_data(push, (vblan2e << 16) | vblan2s); | 1130 | evo_data(push, (vblan2e << 16) | vblan2s); |
1115 | evo_data(push, vblankus); | 1131 | evo_mthd(push, 0x082c + (nv_crtc->index * 0x400), 1); |
1116 | evo_data(push, 0x00000000); | 1132 | evo_data(push, 0x00000000); |
1117 | evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); | 1133 | evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); |
1118 | evo_data(push, 0x00000311); | 1134 | evo_data(push, 0x00000311); |
@@ -1142,6 +1158,11 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode, | |||
1142 | nv_connector = nouveau_crtc_connector_get(nv_crtc); | 1158 | nv_connector = nouveau_crtc_connector_get(nv_crtc); |
1143 | nv50_crtc_set_dither(nv_crtc, false); | 1159 | nv50_crtc_set_dither(nv_crtc, false); |
1144 | nv50_crtc_set_scale(nv_crtc, false); | 1160 | nv50_crtc_set_scale(nv_crtc, false); |
1161 | |||
1162 | /* G94 only accepts this after setting scale */ | ||
1163 | if (nv50_vers(mast) < GF110_DISP_CORE_CHANNEL_DMA) | ||
1164 | nv50_crtc_set_raster_vblank_dmi(nv_crtc, vblankus); | ||
1165 | |||
1145 | nv50_crtc_set_color_vibrance(nv_crtc, false); | 1166 | nv50_crtc_set_color_vibrance(nv_crtc, false); |
1146 | nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); | 1167 | nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); |
1147 | return 0; | 1168 | return 0; |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 15da7ef344a4..ec1593a6a561 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1217,7 +1217,7 @@ free: | |||
1217 | return ret; | 1217 | return ret; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | 1220 | int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t * params) |
1221 | { | 1221 | { |
1222 | int r; | 1222 | int r; |
1223 | 1223 | ||
@@ -1238,6 +1238,15 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | |||
1238 | return r; | 1238 | return r; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | ||
1242 | { | ||
1243 | int r; | ||
1244 | mutex_lock(&ctx->scratch_mutex); | ||
1245 | r = atom_execute_table_scratch_unlocked(ctx, index, params); | ||
1246 | mutex_unlock(&ctx->scratch_mutex); | ||
1247 | return r; | ||
1248 | } | ||
1249 | |||
1241 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; | 1250 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
1242 | 1251 | ||
1243 | static void atom_index_iio(struct atom_context *ctx, int base) | 1252 | static void atom_index_iio(struct atom_context *ctx, int base) |
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index feba6b8d36b3..6d014ddb6b78 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h | |||
@@ -125,6 +125,7 @@ struct card_info { | |||
125 | struct atom_context { | 125 | struct atom_context { |
126 | struct card_info *card; | 126 | struct card_info *card; |
127 | struct mutex mutex; | 127 | struct mutex mutex; |
128 | struct mutex scratch_mutex; | ||
128 | void *bios; | 129 | void *bios; |
129 | uint32_t cmd_table, data_table; | 130 | uint32_t cmd_table, data_table; |
130 | uint16_t *iio; | 131 | uint16_t *iio; |
@@ -145,6 +146,7 @@ extern int atom_debug; | |||
145 | 146 | ||
146 | struct atom_context *atom_parse(struct card_info *, void *); | 147 | struct atom_context *atom_parse(struct card_info *, void *); |
147 | int atom_execute_table(struct atom_context *, int, uint32_t *); | 148 | int atom_execute_table(struct atom_context *, int, uint32_t *); |
149 | int atom_execute_table_scratch_unlocked(struct atom_context *, int, uint32_t *); | ||
148 | int atom_asic_init(struct atom_context *); | 150 | int atom_asic_init(struct atom_context *); |
149 | void atom_destroy(struct atom_context *); | 151 | void atom_destroy(struct atom_context *); |
150 | bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, | 152 | bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 95d5d4ab3335..11ba9d21b89b 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -100,6 +100,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
100 | memset(&args, 0, sizeof(args)); | 100 | memset(&args, 0, sizeof(args)); |
101 | 101 | ||
102 | mutex_lock(&chan->mutex); | 102 | mutex_lock(&chan->mutex); |
103 | mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); | ||
103 | 104 | ||
104 | base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); | 105 | base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); |
105 | 106 | ||
@@ -113,7 +114,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
113 | if (ASIC_IS_DCE4(rdev)) | 114 | if (ASIC_IS_DCE4(rdev)) |
114 | args.v2.ucHPD_ID = chan->rec.hpd; | 115 | args.v2.ucHPD_ID = chan->rec.hpd; |
115 | 116 | ||
116 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 117 | atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
117 | 118 | ||
118 | *ack = args.v1.ucReplyStatus; | 119 | *ack = args.v1.ucReplyStatus; |
119 | 120 | ||
@@ -147,6 +148,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
147 | 148 | ||
148 | r = recv_bytes; | 149 | r = recv_bytes; |
149 | done: | 150 | done: |
151 | mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); | ||
150 | mutex_unlock(&chan->mutex); | 152 | mutex_unlock(&chan->mutex); |
151 | 153 | ||
152 | return r; | 154 | return r; |
diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c index 9c570fb15b8c..4157780585a0 100644 --- a/drivers/gpu/drm/radeon/atombios_i2c.c +++ b/drivers/gpu/drm/radeon/atombios_i2c.c | |||
@@ -48,6 +48,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
48 | memset(&args, 0, sizeof(args)); | 48 | memset(&args, 0, sizeof(args)); |
49 | 49 | ||
50 | mutex_lock(&chan->mutex); | 50 | mutex_lock(&chan->mutex); |
51 | mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); | ||
51 | 52 | ||
52 | base = (unsigned char *)rdev->mode_info.atom_context->scratch; | 53 | base = (unsigned char *)rdev->mode_info.atom_context->scratch; |
53 | 54 | ||
@@ -82,7 +83,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
82 | args.ucSlaveAddr = slave_addr << 1; | 83 | args.ucSlaveAddr = slave_addr << 1; |
83 | args.ucLineNumber = chan->rec.i2c_id; | 84 | args.ucLineNumber = chan->rec.i2c_id; |
84 | 85 | ||
85 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 86 | atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
86 | 87 | ||
87 | /* error */ | 88 | /* error */ |
88 | if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { | 89 | if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { |
@@ -95,6 +96,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
95 | radeon_atom_copy_swap(buf, base, num, false); | 96 | radeon_atom_copy_swap(buf, base, num, false); |
96 | 97 | ||
97 | done: | 98 | done: |
99 | mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); | ||
98 | mutex_unlock(&chan->mutex); | 100 | mutex_unlock(&chan->mutex); |
99 | 101 | ||
100 | return r; | 102 | return r; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 3deeed33322f..6dcde3798b45 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -4333,8 +4333,8 @@ static int cik_cp_gfx_start(struct radeon_device *rdev) | |||
4333 | /* init the CE partitions. CE only used for gfx on CIK */ | 4333 | /* init the CE partitions. CE only used for gfx on CIK */ |
4334 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); | 4334 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); |
4335 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); | 4335 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); |
4336 | radeon_ring_write(ring, 0xc000); | 4336 | radeon_ring_write(ring, 0x8000); |
4337 | radeon_ring_write(ring, 0xc000); | 4337 | radeon_ring_write(ring, 0x8000); |
4338 | 4338 | ||
4339 | /* setup clear context state */ | 4339 | /* setup clear context state */ |
4340 | radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); | 4340 | radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); |
@@ -9417,6 +9417,9 @@ void dce8_bandwidth_update(struct radeon_device *rdev) | |||
9417 | u32 num_heads = 0, lb_size; | 9417 | u32 num_heads = 0, lb_size; |
9418 | int i; | 9418 | int i; |
9419 | 9419 | ||
9420 | if (!rdev->mode_info.mode_config_initialized) | ||
9421 | return; | ||
9422 | |||
9420 | radeon_update_display_priority(rdev); | 9423 | radeon_update_display_priority(rdev); |
9421 | 9424 | ||
9422 | for (i = 0; i < rdev->num_crtc; i++) { | 9425 | for (i = 0; i < rdev->num_crtc; i++) { |
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 54b98379188d..dde5c7e29eb2 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -663,17 +663,20 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
663 | { | 663 | { |
664 | struct radeon_ib ib; | 664 | struct radeon_ib ib; |
665 | unsigned i; | 665 | unsigned i; |
666 | unsigned index; | ||
666 | int r; | 667 | int r; |
667 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | ||
668 | u32 tmp = 0; | 668 | u32 tmp = 0; |
669 | u64 gpu_addr; | ||
669 | 670 | ||
670 | if (!ptr) { | 671 | if (ring->idx == R600_RING_TYPE_DMA_INDEX) |
671 | DRM_ERROR("invalid vram scratch pointer\n"); | 672 | index = R600_WB_DMA_RING_TEST_OFFSET; |
672 | return -EINVAL; | 673 | else |
673 | } | 674 | index = CAYMAN_WB_DMA1_RING_TEST_OFFSET; |
675 | |||
676 | gpu_addr = rdev->wb.gpu_addr + index; | ||
674 | 677 | ||
675 | tmp = 0xCAFEDEAD; | 678 | tmp = 0xCAFEDEAD; |
676 | writel(tmp, ptr); | 679 | rdev->wb.wb[index/4] = cpu_to_le32(tmp); |
677 | 680 | ||
678 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); | 681 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); |
679 | if (r) { | 682 | if (r) { |
@@ -682,8 +685,8 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
682 | } | 685 | } |
683 | 686 | ||
684 | ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0); | 687 | ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0); |
685 | ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; | 688 | ib.ptr[1] = lower_32_bits(gpu_addr); |
686 | ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr); | 689 | ib.ptr[2] = upper_32_bits(gpu_addr); |
687 | ib.ptr[3] = 1; | 690 | ib.ptr[3] = 1; |
688 | ib.ptr[4] = 0xDEADBEEF; | 691 | ib.ptr[4] = 0xDEADBEEF; |
689 | ib.length_dw = 5; | 692 | ib.length_dw = 5; |
@@ -700,7 +703,7 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
700 | return r; | 703 | return r; |
701 | } | 704 | } |
702 | for (i = 0; i < rdev->usec_timeout; i++) { | 705 | for (i = 0; i < rdev->usec_timeout; i++) { |
703 | tmp = readl(ptr); | 706 | tmp = le32_to_cpu(rdev->wb.wb[index/4]); |
704 | if (tmp == 0xDEADBEEF) | 707 | if (tmp == 0xDEADBEEF) |
705 | break; | 708 | break; |
706 | DRM_UDELAY(1); | 709 | DRM_UDELAY(1); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index f37d39d2bbbc..85995b4e3338 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2345,6 +2345,9 @@ void evergreen_bandwidth_update(struct radeon_device *rdev) | |||
2345 | u32 num_heads = 0, lb_size; | 2345 | u32 num_heads = 0, lb_size; |
2346 | int i; | 2346 | int i; |
2347 | 2347 | ||
2348 | if (!rdev->mode_info.mode_config_initialized) | ||
2349 | return; | ||
2350 | |||
2348 | radeon_update_display_priority(rdev); | 2351 | radeon_update_display_priority(rdev); |
2349 | 2352 | ||
2350 | for (i = 0; i < rdev->num_crtc; i++) { | 2353 | for (i = 0; i < rdev->num_crtc; i++) { |
@@ -2552,6 +2555,7 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav | |||
2552 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); | 2555 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); |
2553 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; | 2556 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; |
2554 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); | 2557 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); |
2558 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); | ||
2555 | } | 2559 | } |
2556 | } else { | 2560 | } else { |
2557 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); | 2561 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 10f8be0ee173..b53b31a7b76f 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3207,6 +3207,9 @@ void r100_bandwidth_update(struct radeon_device *rdev) | |||
3207 | uint32_t pixel_bytes1 = 0; | 3207 | uint32_t pixel_bytes1 = 0; |
3208 | uint32_t pixel_bytes2 = 0; | 3208 | uint32_t pixel_bytes2 = 0; |
3209 | 3209 | ||
3210 | if (!rdev->mode_info.mode_config_initialized) | ||
3211 | return; | ||
3212 | |||
3210 | radeon_update_display_priority(rdev); | 3213 | radeon_update_display_priority(rdev); |
3211 | 3214 | ||
3212 | if (rdev->mode_info.crtcs[0]->base.enabled) { | 3215 | if (rdev->mode_info.crtcs[0]->base.enabled) { |
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c index 3a58b8073f49..d2dd29ab24fa 100644 --- a/drivers/gpu/drm/radeon/r600_dma.c +++ b/drivers/gpu/drm/radeon/r600_dma.c | |||
@@ -338,17 +338,17 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
338 | { | 338 | { |
339 | struct radeon_ib ib; | 339 | struct radeon_ib ib; |
340 | unsigned i; | 340 | unsigned i; |
341 | unsigned index; | ||
341 | int r; | 342 | int r; |
342 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | ||
343 | u32 tmp = 0; | 343 | u32 tmp = 0; |
344 | u64 gpu_addr; | ||
344 | 345 | ||
345 | if (!ptr) { | 346 | if (ring->idx == R600_RING_TYPE_DMA_INDEX) |
346 | DRM_ERROR("invalid vram scratch pointer\n"); | 347 | index = R600_WB_DMA_RING_TEST_OFFSET; |
347 | return -EINVAL; | 348 | else |
348 | } | 349 | index = CAYMAN_WB_DMA1_RING_TEST_OFFSET; |
349 | 350 | ||
350 | tmp = 0xCAFEDEAD; | 351 | gpu_addr = rdev->wb.gpu_addr + index; |
351 | writel(tmp, ptr); | ||
352 | 352 | ||
353 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); | 353 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); |
354 | if (r) { | 354 | if (r) { |
@@ -357,8 +357,8 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
357 | } | 357 | } |
358 | 358 | ||
359 | ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1); | 359 | ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1); |
360 | ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; | 360 | ib.ptr[1] = lower_32_bits(gpu_addr); |
361 | ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff; | 361 | ib.ptr[2] = upper_32_bits(gpu_addr) & 0xff; |
362 | ib.ptr[3] = 0xDEADBEEF; | 362 | ib.ptr[3] = 0xDEADBEEF; |
363 | ib.length_dw = 4; | 363 | ib.length_dw = 4; |
364 | 364 | ||
@@ -374,7 +374,7 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
374 | return r; | 374 | return r; |
375 | } | 375 | } |
376 | for (i = 0; i < rdev->usec_timeout; i++) { | 376 | for (i = 0; i < rdev->usec_timeout; i++) { |
377 | tmp = readl(ptr); | 377 | tmp = le32_to_cpu(rdev->wb.wb[index/4]); |
378 | if (tmp == 0xDEADBEEF) | 378 | if (tmp == 0xDEADBEEF) |
379 | break; | 379 | break; |
380 | DRM_UDELAY(1); | 380 | DRM_UDELAY(1); |
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index 76c6a17eeb2d..843b65f46ece 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -1265,7 +1265,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) | |||
1265 | (mode_info->atom_context->bios + data_offset + | 1265 | (mode_info->atom_context->bios + data_offset + |
1266 | le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); | 1266 | le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); |
1267 | rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = | 1267 | rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = |
1268 | ppt->usMaximumPowerDeliveryLimit; | 1268 | le16_to_cpu(ppt->usMaximumPowerDeliveryLimit); |
1269 | pt = &ppt->power_tune_table; | 1269 | pt = &ppt->power_tune_table; |
1270 | } else { | 1270 | } else { |
1271 | ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) | 1271 | ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 300c4b3d4669..26baa9c05f6c 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -322,6 +322,12 @@ static void radeon_connector_get_edid(struct drm_connector *connector) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | if (!radeon_connector->edid) { | 324 | if (!radeon_connector->edid) { |
325 | /* don't fetch the edid from the vbios if ddc fails and runpm is | ||
326 | * enabled so we report disconnected. | ||
327 | */ | ||
328 | if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) | ||
329 | return; | ||
330 | |||
325 | if (rdev->is_atom_bios) { | 331 | if (rdev->is_atom_bios) { |
326 | /* some laptops provide a hardcoded edid in rom for LCDs */ | 332 | /* some laptops provide a hardcoded edid in rom for LCDs */ |
327 | if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) || | 333 | if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) || |
@@ -826,6 +832,8 @@ static int radeon_lvds_mode_valid(struct drm_connector *connector, | |||
826 | static enum drm_connector_status | 832 | static enum drm_connector_status |
827 | radeon_lvds_detect(struct drm_connector *connector, bool force) | 833 | radeon_lvds_detect(struct drm_connector *connector, bool force) |
828 | { | 834 | { |
835 | struct drm_device *dev = connector->dev; | ||
836 | struct radeon_device *rdev = dev->dev_private; | ||
829 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 837 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
830 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 838 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
831 | enum drm_connector_status ret = connector_status_disconnected; | 839 | enum drm_connector_status ret = connector_status_disconnected; |
@@ -842,7 +850,11 @@ radeon_lvds_detect(struct drm_connector *connector, bool force) | |||
842 | /* check if panel is valid */ | 850 | /* check if panel is valid */ |
843 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) | 851 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) |
844 | ret = connector_status_connected; | 852 | ret = connector_status_connected; |
845 | 853 | /* don't fetch the edid from the vbios if ddc fails and runpm is | |
854 | * enabled so we report disconnected. | ||
855 | */ | ||
856 | if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) | ||
857 | ret = connector_status_disconnected; | ||
846 | } | 858 | } |
847 | 859 | ||
848 | /* check for edid as well */ | 860 | /* check for edid as well */ |
@@ -1589,6 +1601,11 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1589 | /* check if panel is valid */ | 1601 | /* check if panel is valid */ |
1590 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) | 1602 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) |
1591 | ret = connector_status_connected; | 1603 | ret = connector_status_connected; |
1604 | /* don't fetch the edid from the vbios if ddc fails and runpm is | ||
1605 | * enabled so we report disconnected. | ||
1606 | */ | ||
1607 | if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) | ||
1608 | ret = connector_status_disconnected; | ||
1592 | } | 1609 | } |
1593 | /* eDP is always DP */ | 1610 | /* eDP is always DP */ |
1594 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; | 1611 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ae87310fd96e..0ec65168f331 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -983,6 +983,7 @@ int radeon_atombios_init(struct radeon_device *rdev) | |||
983 | } | 983 | } |
984 | 984 | ||
985 | mutex_init(&rdev->mode_info.atom_context->mutex); | 985 | mutex_init(&rdev->mode_info.atom_context->mutex); |
986 | mutex_init(&rdev->mode_info.atom_context->scratch_mutex); | ||
986 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); | 987 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); |
987 | atom_allocate_fb_scratch(rdev->mode_info.atom_context); | 988 | atom_allocate_fb_scratch(rdev->mode_info.atom_context); |
988 | return 0; | 989 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 9a19e52cc655..6b670b0bc47b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -179,6 +179,9 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | |||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | 179 | (rdev->pdev->subsystem_vendor == 0x1734) && |
180 | (rdev->pdev->subsystem_device == 0x1107)) | 180 | (rdev->pdev->subsystem_device == 0x1107)) |
181 | use_bl = false; | 181 | use_bl = false; |
182 | /* disable native backlight control on older asics */ | ||
183 | else if (rdev->family < CHIP_R600) | ||
184 | use_bl = false; | ||
182 | else | 185 | else |
183 | use_bl = true; | 186 | use_bl = true; |
184 | } | 187 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 7784911d78ef..00fc59762e0d 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -185,6 +185,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
185 | if (rdev->flags & RADEON_IS_AGP) | 185 | if (rdev->flags & RADEON_IS_AGP) |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | /* | ||
189 | * Older chips have a HW limitation, they can only generate 40 bits | ||
190 | * of address for "64-bit" MSIs which breaks on some platforms, notably | ||
191 | * IBM POWER servers, so we limit them | ||
192 | */ | ||
193 | if (rdev->family < CHIP_BONAIRE) { | ||
194 | dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); | ||
195 | rdev->pdev->no_64bit_msi = 1; | ||
196 | } | ||
197 | |||
188 | /* force MSI on */ | 198 | /* force MSI on */ |
189 | if (radeon_msi == 1) | 199 | if (radeon_msi == 1) |
190 | return true; | 200 | return true; |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 5f6db4629aaa..9acb1c3c005b 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -879,6 +879,9 @@ void rs600_bandwidth_update(struct radeon_device *rdev) | |||
879 | u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; | 879 | u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; |
880 | /* FIXME: implement full support */ | 880 | /* FIXME: implement full support */ |
881 | 881 | ||
882 | if (!rdev->mode_info.mode_config_initialized) | ||
883 | return; | ||
884 | |||
882 | radeon_update_display_priority(rdev); | 885 | radeon_update_display_priority(rdev); |
883 | 886 | ||
884 | if (rdev->mode_info.crtcs[0]->base.enabled) | 887 | if (rdev->mode_info.crtcs[0]->base.enabled) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 3462b64369bf..0a2d36e81108 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -579,6 +579,9 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
579 | u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; | 579 | u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; |
580 | u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; | 580 | u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; |
581 | 581 | ||
582 | if (!rdev->mode_info.mode_config_initialized) | ||
583 | return; | ||
584 | |||
582 | radeon_update_display_priority(rdev); | 585 | radeon_update_display_priority(rdev); |
583 | 586 | ||
584 | if (rdev->mode_info.crtcs[0]->base.enabled) | 587 | if (rdev->mode_info.crtcs[0]->base.enabled) |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 8a477bf1fdb3..c55d653aaf5f 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -1277,6 +1277,9 @@ void rv515_bandwidth_update(struct radeon_device *rdev) | |||
1277 | struct drm_display_mode *mode0 = NULL; | 1277 | struct drm_display_mode *mode0 = NULL; |
1278 | struct drm_display_mode *mode1 = NULL; | 1278 | struct drm_display_mode *mode1 = NULL; |
1279 | 1279 | ||
1280 | if (!rdev->mode_info.mode_config_initialized) | ||
1281 | return; | ||
1282 | |||
1280 | radeon_update_display_priority(rdev); | 1283 | radeon_update_display_priority(rdev); |
1281 | 1284 | ||
1282 | if (rdev->mode_info.crtcs[0]->base.enabled) | 1285 | if (rdev->mode_info.crtcs[0]->base.enabled) |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 14896ce76324..60df444bd075 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2384,6 +2384,9 @@ void dce6_bandwidth_update(struct radeon_device *rdev) | |||
2384 | u32 num_heads = 0, lb_size; | 2384 | u32 num_heads = 0, lb_size; |
2385 | int i; | 2385 | int i; |
2386 | 2386 | ||
2387 | if (!rdev->mode_info.mode_config_initialized) | ||
2388 | return; | ||
2389 | |||
2387 | radeon_update_display_priority(rdev); | 2390 | radeon_update_display_priority(rdev); |
2388 | 2391 | ||
2389 | for (i = 0; i < rdev->num_crtc; i++) { | 2392 | for (i = 0; i < rdev->num_crtc; i++) { |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index b957908aec73..3367960286a6 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -906,7 +906,7 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) | |||
906 | } | 906 | } |
907 | } | 907 | } |
908 | 908 | ||
909 | drm_vblank_off(drm, dc->pipe); | 909 | drm_crtc_vblank_off(crtc); |
910 | tegra_dc_commit(dc); | 910 | tegra_dc_commit(dc); |
911 | } | 911 | } |
912 | 912 | ||
@@ -996,8 +996,6 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, | |||
996 | u32 value; | 996 | u32 value; |
997 | int err; | 997 | int err; |
998 | 998 | ||
999 | drm_vblank_pre_modeset(crtc->dev, dc->pipe); | ||
1000 | |||
1001 | err = tegra_crtc_setup_clk(crtc, mode); | 999 | err = tegra_crtc_setup_clk(crtc, mode); |
1002 | if (err) { | 1000 | if (err) { |
1003 | dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); | 1001 | dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); |
@@ -1051,6 +1049,8 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc) | |||
1051 | unsigned int syncpt; | 1049 | unsigned int syncpt; |
1052 | unsigned long value; | 1050 | unsigned long value; |
1053 | 1051 | ||
1052 | drm_crtc_vblank_off(crtc); | ||
1053 | |||
1054 | /* hardware initialization */ | 1054 | /* hardware initialization */ |
1055 | reset_control_deassert(dc->rst); | 1055 | reset_control_deassert(dc->rst); |
1056 | usleep_range(10000, 20000); | 1056 | usleep_range(10000, 20000); |
@@ -1091,7 +1091,7 @@ static void tegra_crtc_commit(struct drm_crtc *crtc) | |||
1091 | { | 1091 | { |
1092 | struct tegra_dc *dc = to_tegra_dc(crtc); | 1092 | struct tegra_dc *dc = to_tegra_dc(crtc); |
1093 | 1093 | ||
1094 | drm_vblank_post_modeset(crtc->dev, dc->pipe); | 1094 | drm_crtc_vblank_on(crtc); |
1095 | tegra_dc_commit(dc); | 1095 | tegra_dc_commit(dc); |
1096 | } | 1096 | } |
1097 | 1097 | ||
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 73bd9e2e42bc..3402033fa52a 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1659,6 +1659,7 @@ void hid_disconnect(struct hid_device *hdev) | |||
1659 | hdev->hiddev_disconnect(hdev); | 1659 | hdev->hiddev_disconnect(hdev); |
1660 | if (hdev->claimed & HID_CLAIMED_HIDRAW) | 1660 | if (hdev->claimed & HID_CLAIMED_HIDRAW) |
1661 | hidraw_disconnect(hdev); | 1661 | hidraw_disconnect(hdev); |
1662 | hdev->claimed = 0; | ||
1662 | } | 1663 | } |
1663 | EXPORT_SYMBOL_GPL(hid_disconnect); | 1664 | EXPORT_SYMBOL_GPL(hid_disconnect); |
1664 | 1665 | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index e23ab8b30626..7c863738e419 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -299,6 +299,7 @@ | |||
299 | #define USB_VENDOR_ID_ELAN 0x04f3 | 299 | #define USB_VENDOR_ID_ELAN 0x04f3 |
300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 | 300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 |
301 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b | 301 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b |
302 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 | ||
302 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f | 303 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f |
303 | 304 | ||
304 | #define USB_VENDOR_ID_ELECOM 0x056e | 305 | #define USB_VENDOR_ID_ELECOM 0x056e |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 5014bb567b29..552671ee7c5d 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -72,6 +72,7 @@ static const struct hid_blacklist { | |||
72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, | 73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, |
74 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, | 74 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, |
75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, | ||
75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, | 76 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, |
76 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 77 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
77 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 78 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index fcdbde4ec692..3057dfc7e3bc 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -234,7 +234,7 @@ static const struct pci_device_id fam15h_power_id_table[] = { | |||
234 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 234 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
235 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, | 235 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, |
236 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, | 236 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, |
237 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | 237 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, |
238 | {} | 238 | {} |
239 | }; | 239 | }; |
240 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); | 240 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); |
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c index 6aac695b1688..9b55e673b67c 100644 --- a/drivers/hwmon/g762.c +++ b/drivers/hwmon/g762.c | |||
@@ -1084,10 +1084,8 @@ static int g762_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1084 | if (ret) | 1084 | if (ret) |
1085 | goto clock_dis; | 1085 | goto clock_dis; |
1086 | 1086 | ||
1087 | data->hwmon_dev = devm_hwmon_device_register_with_groups(dev, | 1087 | data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, |
1088 | client->name, | 1088 | data, g762_groups); |
1089 | data, | ||
1090 | g762_groups); | ||
1091 | if (IS_ERR(data->hwmon_dev)) { | 1089 | if (IS_ERR(data->hwmon_dev)) { |
1092 | ret = PTR_ERR(data->hwmon_dev); | 1090 | ret = PTR_ERR(data->hwmon_dev); |
1093 | goto clock_dis; | 1091 | goto clock_dis; |
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index d2bf2c97ae70..6a30eeea94be 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c | |||
@@ -181,7 +181,7 @@ static int __init populate_attr_groups(struct platform_device *pdev) | |||
181 | 181 | ||
182 | opal = of_find_node_by_path("/ibm,opal/sensors"); | 182 | opal = of_find_node_by_path("/ibm,opal/sensors"); |
183 | if (!opal) { | 183 | if (!opal) { |
184 | dev_err(&pdev->dev, "Opal node 'sensors' not found\n"); | 184 | dev_dbg(&pdev->dev, "Opal node 'sensors' not found\n"); |
185 | return -ENODEV; | 185 | return -ENODEV; |
186 | } | 186 | } |
187 | 187 | ||
@@ -335,7 +335,9 @@ static int __init ibmpowernv_init(void) | |||
335 | 335 | ||
336 | err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe); | 336 | err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe); |
337 | if (err) { | 337 | if (err) { |
338 | pr_err("Platfrom driver probe failed\n"); | 338 | if (err != -ENODEV) |
339 | pr_err("Platform driver probe failed (%d)\n", err); | ||
340 | |||
339 | goto exit_device_del; | 341 | goto exit_device_del; |
340 | } | 342 | } |
341 | 343 | ||
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c index 823c877a1ec0..1991d9032c38 100644 --- a/drivers/hwmon/pwm-fan.c +++ b/drivers/hwmon/pwm-fan.c | |||
@@ -161,10 +161,17 @@ static int pwm_fan_suspend(struct device *dev) | |||
161 | static int pwm_fan_resume(struct device *dev) | 161 | static int pwm_fan_resume(struct device *dev) |
162 | { | 162 | { |
163 | struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); | 163 | struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); |
164 | unsigned long duty; | ||
165 | int ret; | ||
164 | 166 | ||
165 | if (ctx->pwm_value) | 167 | if (ctx->pwm_value == 0) |
166 | return pwm_enable(ctx->pwm); | 168 | return 0; |
167 | return 0; | 169 | |
170 | duty = DIV_ROUND_UP(ctx->pwm_value * (ctx->pwm->period - 1), MAX_PWM); | ||
171 | ret = pwm_config(ctx->pwm, duty, ctx->pwm->period); | ||
172 | if (ret) | ||
173 | return ret; | ||
174 | return pwm_enable(ctx->pwm); | ||
168 | } | 175 | } |
169 | #endif | 176 | #endif |
170 | 177 | ||
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 22c096ce39ad..513bd6d14293 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B | 45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B |
46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 | 46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 |
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_X BIT(0) | ||
48 | #define BMC150_ACCEL_ANY_MOTION_BIT_Y BIT(1) | ||
49 | #define BMC150_ACCEL_ANY_MOTION_BIT_Z BIT(2) | ||
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) | 50 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) |
48 | 51 | ||
49 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 | 52 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 |
@@ -92,9 +95,9 @@ | |||
92 | #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF | 95 | #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF |
93 | 96 | ||
94 | /* Slope duration in terms of number of samples */ | 97 | /* Slope duration in terms of number of samples */ |
95 | #define BMC150_ACCEL_DEF_SLOPE_DURATION 2 | 98 | #define BMC150_ACCEL_DEF_SLOPE_DURATION 1 |
96 | /* in terms of multiples of g's/LSB, based on range */ | 99 | /* in terms of multiples of g's/LSB, based on range */ |
97 | #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 5 | 100 | #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 1 |
98 | 101 | ||
99 | #define BMC150_ACCEL_REG_XOUT_L 0x02 | 102 | #define BMC150_ACCEL_REG_XOUT_L 0x02 |
100 | 103 | ||
@@ -536,6 +539,9 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on) | |||
536 | if (ret < 0) { | 539 | if (ret < 0) { |
537 | dev_err(&data->client->dev, | 540 | dev_err(&data->client->dev, |
538 | "Failed: bmc150_accel_set_power_state for %d\n", on); | 541 | "Failed: bmc150_accel_set_power_state for %d\n", on); |
542 | if (on) | ||
543 | pm_runtime_put_noidle(&data->client->dev); | ||
544 | |||
539 | return ret; | 545 | return ret; |
540 | } | 546 | } |
541 | 547 | ||
@@ -811,6 +817,7 @@ static int bmc150_accel_write_event_config(struct iio_dev *indio_dev, | |||
811 | 817 | ||
812 | ret = bmc150_accel_setup_any_motion_interrupt(data, state); | 818 | ret = bmc150_accel_setup_any_motion_interrupt(data, state); |
813 | if (ret < 0) { | 819 | if (ret < 0) { |
820 | bmc150_accel_set_power_state(data, false); | ||
814 | mutex_unlock(&data->mutex); | 821 | mutex_unlock(&data->mutex); |
815 | return ret; | 822 | return ret; |
816 | } | 823 | } |
@@ -846,7 +853,7 @@ static const struct attribute_group bmc150_accel_attrs_group = { | |||
846 | 853 | ||
847 | static const struct iio_event_spec bmc150_accel_event = { | 854 | static const struct iio_event_spec bmc150_accel_event = { |
848 | .type = IIO_EV_TYPE_ROC, | 855 | .type = IIO_EV_TYPE_ROC, |
849 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 856 | .dir = IIO_EV_DIR_EITHER, |
850 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | 857 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
851 | BIT(IIO_EV_INFO_ENABLE) | | 858 | BIT(IIO_EV_INFO_ENABLE) | |
852 | BIT(IIO_EV_INFO_PERIOD) | 859 | BIT(IIO_EV_INFO_PERIOD) |
@@ -1054,6 +1061,7 @@ static int bmc150_accel_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
1054 | else | 1061 | else |
1055 | ret = bmc150_accel_setup_new_data_interrupt(data, state); | 1062 | ret = bmc150_accel_setup_new_data_interrupt(data, state); |
1056 | if (ret < 0) { | 1063 | if (ret < 0) { |
1064 | bmc150_accel_set_power_state(data, false); | ||
1057 | mutex_unlock(&data->mutex); | 1065 | mutex_unlock(&data->mutex); |
1058 | return ret; | 1066 | return ret; |
1059 | } | 1067 | } |
@@ -1092,12 +1100,26 @@ static irqreturn_t bmc150_accel_event_handler(int irq, void *private) | |||
1092 | else | 1100 | else |
1093 | dir = IIO_EV_DIR_RISING; | 1101 | dir = IIO_EV_DIR_RISING; |
1094 | 1102 | ||
1095 | if (ret & BMC150_ACCEL_ANY_MOTION_MASK) | 1103 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X) |
1104 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1105 | 0, | ||
1106 | IIO_MOD_X, | ||
1107 | IIO_EV_TYPE_ROC, | ||
1108 | dir), | ||
1109 | data->timestamp); | ||
1110 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y) | ||
1096 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | 1111 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, |
1097 | 0, | 1112 | 0, |
1098 | IIO_MOD_X_OR_Y_OR_Z, | 1113 | IIO_MOD_Y, |
1099 | IIO_EV_TYPE_ROC, | 1114 | IIO_EV_TYPE_ROC, |
1100 | IIO_EV_DIR_EITHER), | 1115 | dir), |
1116 | data->timestamp); | ||
1117 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z) | ||
1118 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1119 | 0, | ||
1120 | IIO_MOD_Z, | ||
1121 | IIO_EV_TYPE_ROC, | ||
1122 | dir), | ||
1101 | data->timestamp); | 1123 | data->timestamp); |
1102 | ack_intr_status: | 1124 | ack_intr_status: |
1103 | if (!data->dready_trigger_on) | 1125 | if (!data->dready_trigger_on) |
@@ -1354,10 +1376,14 @@ static int bmc150_accel_runtime_suspend(struct device *dev) | |||
1354 | { | 1376 | { |
1355 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); | 1377 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
1356 | struct bmc150_accel_data *data = iio_priv(indio_dev); | 1378 | struct bmc150_accel_data *data = iio_priv(indio_dev); |
1379 | int ret; | ||
1357 | 1380 | ||
1358 | dev_dbg(&data->client->dev, __func__); | 1381 | dev_dbg(&data->client->dev, __func__); |
1382 | ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); | ||
1383 | if (ret < 0) | ||
1384 | return -EAGAIN; | ||
1359 | 1385 | ||
1360 | return bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); | 1386 | return 0; |
1361 | } | 1387 | } |
1362 | 1388 | ||
1363 | static int bmc150_accel_runtime_resume(struct device *dev) | 1389 | static int bmc150_accel_runtime_resume(struct device *dev) |
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index a23e58c4ed99..320aa72c0349 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c | |||
@@ -269,6 +269,8 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_index) | |||
269 | return ret; | 269 | return ret; |
270 | } | 270 | } |
271 | 271 | ||
272 | ret &= ~(KXCJK1013_REG_CTRL1_BIT_GSEL0 | | ||
273 | KXCJK1013_REG_CTRL1_BIT_GSEL1); | ||
272 | ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); | 274 | ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); |
273 | ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); | 275 | ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); |
274 | 276 | ||
diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index b58d6302521f..d095efe1ba14 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c | |||
@@ -152,6 +152,7 @@ static void men_z188_remove(struct mcb_device *dev) | |||
152 | 152 | ||
153 | static const struct mcb_device_id men_z188_ids[] = { | 153 | static const struct mcb_device_id men_z188_ids[] = { |
154 | { .device = 0xbc }, | 154 | { .device = 0xbc }, |
155 | { } | ||
155 | }; | 156 | }; |
156 | MODULE_DEVICE_TABLE(mcb, men_z188_ids); | 157 | MODULE_DEVICE_TABLE(mcb, men_z188_ids); |
157 | 158 | ||
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c index 1f967e0d688e..d2fa526740ca 100644 --- a/drivers/iio/gyro/bmg160.c +++ b/drivers/iio/gyro/bmg160.c | |||
@@ -67,6 +67,9 @@ | |||
67 | #define BMG160_REG_INT_EN_0 0x15 | 67 | #define BMG160_REG_INT_EN_0 0x15 |
68 | #define BMG160_DATA_ENABLE_INT BIT(7) | 68 | #define BMG160_DATA_ENABLE_INT BIT(7) |
69 | 69 | ||
70 | #define BMG160_REG_INT_EN_1 0x16 | ||
71 | #define BMG160_INT1_BIT_OD BIT(1) | ||
72 | |||
70 | #define BMG160_REG_XOUT_L 0x02 | 73 | #define BMG160_REG_XOUT_L 0x02 |
71 | #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) | 74 | #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) |
72 | 75 | ||
@@ -82,6 +85,9 @@ | |||
82 | 85 | ||
83 | #define BMG160_REG_INT_STATUS_2 0x0B | 86 | #define BMG160_REG_INT_STATUS_2 0x0B |
84 | #define BMG160_ANY_MOTION_MASK 0x07 | 87 | #define BMG160_ANY_MOTION_MASK 0x07 |
88 | #define BMG160_ANY_MOTION_BIT_X BIT(0) | ||
89 | #define BMG160_ANY_MOTION_BIT_Y BIT(1) | ||
90 | #define BMG160_ANY_MOTION_BIT_Z BIT(2) | ||
85 | 91 | ||
86 | #define BMG160_REG_TEMP 0x08 | 92 | #define BMG160_REG_TEMP 0x08 |
87 | #define BMG160_TEMP_CENTER_VAL 23 | 93 | #define BMG160_TEMP_CENTER_VAL 23 |
@@ -222,6 +228,19 @@ static int bmg160_chip_init(struct bmg160_data *data) | |||
222 | data->slope_thres = ret; | 228 | data->slope_thres = ret; |
223 | 229 | ||
224 | /* Set default interrupt mode */ | 230 | /* Set default interrupt mode */ |
231 | ret = i2c_smbus_read_byte_data(data->client, BMG160_REG_INT_EN_1); | ||
232 | if (ret < 0) { | ||
233 | dev_err(&data->client->dev, "Error reading reg_int_en_1\n"); | ||
234 | return ret; | ||
235 | } | ||
236 | ret &= ~BMG160_INT1_BIT_OD; | ||
237 | ret = i2c_smbus_write_byte_data(data->client, | ||
238 | BMG160_REG_INT_EN_1, ret); | ||
239 | if (ret < 0) { | ||
240 | dev_err(&data->client->dev, "Error writing reg_int_en_1\n"); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
225 | ret = i2c_smbus_write_byte_data(data->client, | 244 | ret = i2c_smbus_write_byte_data(data->client, |
226 | BMG160_REG_INT_RST_LATCH, | 245 | BMG160_REG_INT_RST_LATCH, |
227 | BMG160_INT_MODE_LATCH_INT | | 246 | BMG160_INT_MODE_LATCH_INT | |
@@ -250,6 +269,9 @@ static int bmg160_set_power_state(struct bmg160_data *data, bool on) | |||
250 | if (ret < 0) { | 269 | if (ret < 0) { |
251 | dev_err(&data->client->dev, | 270 | dev_err(&data->client->dev, |
252 | "Failed: bmg160_set_power_state for %d\n", on); | 271 | "Failed: bmg160_set_power_state for %d\n", on); |
272 | if (on) | ||
273 | pm_runtime_put_noidle(&data->client->dev); | ||
274 | |||
253 | return ret; | 275 | return ret; |
254 | } | 276 | } |
255 | #endif | 277 | #endif |
@@ -705,6 +727,7 @@ static int bmg160_write_event_config(struct iio_dev *indio_dev, | |||
705 | 727 | ||
706 | ret = bmg160_setup_any_motion_interrupt(data, state); | 728 | ret = bmg160_setup_any_motion_interrupt(data, state); |
707 | if (ret < 0) { | 729 | if (ret < 0) { |
730 | bmg160_set_power_state(data, false); | ||
708 | mutex_unlock(&data->mutex); | 731 | mutex_unlock(&data->mutex); |
709 | return ret; | 732 | return ret; |
710 | } | 733 | } |
@@ -743,7 +766,7 @@ static const struct attribute_group bmg160_attrs_group = { | |||
743 | 766 | ||
744 | static const struct iio_event_spec bmg160_event = { | 767 | static const struct iio_event_spec bmg160_event = { |
745 | .type = IIO_EV_TYPE_ROC, | 768 | .type = IIO_EV_TYPE_ROC, |
746 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 769 | .dir = IIO_EV_DIR_EITHER, |
747 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | | 770 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | |
748 | BIT(IIO_EV_INFO_ENABLE) | 771 | BIT(IIO_EV_INFO_ENABLE) |
749 | }; | 772 | }; |
@@ -871,6 +894,7 @@ static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
871 | else | 894 | else |
872 | ret = bmg160_setup_new_data_interrupt(data, state); | 895 | ret = bmg160_setup_new_data_interrupt(data, state); |
873 | if (ret < 0) { | 896 | if (ret < 0) { |
897 | bmg160_set_power_state(data, false); | ||
874 | mutex_unlock(&data->mutex); | 898 | mutex_unlock(&data->mutex); |
875 | return ret; | 899 | return ret; |
876 | } | 900 | } |
@@ -908,10 +932,24 @@ static irqreturn_t bmg160_event_handler(int irq, void *private) | |||
908 | else | 932 | else |
909 | dir = IIO_EV_DIR_FALLING; | 933 | dir = IIO_EV_DIR_FALLING; |
910 | 934 | ||
911 | if (ret & BMG160_ANY_MOTION_MASK) | 935 | if (ret & BMG160_ANY_MOTION_BIT_X) |
912 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | 936 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, |
913 | 0, | 937 | 0, |
914 | IIO_MOD_X_OR_Y_OR_Z, | 938 | IIO_MOD_X, |
939 | IIO_EV_TYPE_ROC, | ||
940 | dir), | ||
941 | data->timestamp); | ||
942 | if (ret & BMG160_ANY_MOTION_BIT_Y) | ||
943 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
944 | 0, | ||
945 | IIO_MOD_Y, | ||
946 | IIO_EV_TYPE_ROC, | ||
947 | dir), | ||
948 | data->timestamp); | ||
949 | if (ret & BMG160_ANY_MOTION_BIT_Z) | ||
950 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
951 | 0, | ||
952 | IIO_MOD_Z, | ||
915 | IIO_EV_TYPE_ROC, | 953 | IIO_EV_TYPE_ROC, |
916 | dir), | 954 | dir), |
917 | data->timestamp); | 955 | data->timestamp); |
@@ -1169,8 +1207,15 @@ static int bmg160_runtime_suspend(struct device *dev) | |||
1169 | { | 1207 | { |
1170 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); | 1208 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
1171 | struct bmg160_data *data = iio_priv(indio_dev); | 1209 | struct bmg160_data *data = iio_priv(indio_dev); |
1210 | int ret; | ||
1211 | |||
1212 | ret = bmg160_set_mode(data, BMG160_MODE_SUSPEND); | ||
1213 | if (ret < 0) { | ||
1214 | dev_err(&data->client->dev, "set mode failed\n"); | ||
1215 | return -EAGAIN; | ||
1216 | } | ||
1172 | 1217 | ||
1173 | return bmg160_set_mode(data, BMG160_MODE_SUSPEND); | 1218 | return 0; |
1174 | } | 1219 | } |
1175 | 1220 | ||
1176 | static int bmg160_runtime_resume(struct device *dev) | 1221 | static int bmg160_runtime_resume(struct device *dev) |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 3effa931fce2..10641b7816f4 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -115,9 +115,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id, | |||
115 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; | 115 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; |
116 | /* | 116 | /* |
117 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as | 117 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as |
118 | * work-around for RDMA_READ.. | 118 | * work-around for RDMA_READs with ConnectX-2. |
119 | * | ||
120 | * Also, still make sure to have at least two SGEs for | ||
121 | * outgoing control PDU responses. | ||
119 | */ | 122 | */ |
120 | attr.cap.max_send_sge = device->dev_attr.max_sge - 2; | 123 | attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); |
121 | isert_conn->max_sge = attr.cap.max_send_sge; | 124 | isert_conn->max_sge = attr.cap.max_send_sge; |
122 | 125 | ||
123 | attr.cap.max_recv_sge = 1; | 126 | attr.cap.max_recv_sge = 1; |
@@ -225,12 +228,16 @@ isert_create_device_ib_res(struct isert_device *device) | |||
225 | struct isert_cq_desc *cq_desc; | 228 | struct isert_cq_desc *cq_desc; |
226 | struct ib_device_attr *dev_attr; | 229 | struct ib_device_attr *dev_attr; |
227 | int ret = 0, i, j; | 230 | int ret = 0, i, j; |
231 | int max_rx_cqe, max_tx_cqe; | ||
228 | 232 | ||
229 | dev_attr = &device->dev_attr; | 233 | dev_attr = &device->dev_attr; |
230 | ret = isert_query_device(ib_dev, dev_attr); | 234 | ret = isert_query_device(ib_dev, dev_attr); |
231 | if (ret) | 235 | if (ret) |
232 | return ret; | 236 | return ret; |
233 | 237 | ||
238 | max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe); | ||
239 | max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe); | ||
240 | |||
234 | /* asign function handlers */ | 241 | /* asign function handlers */ |
235 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && | 242 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && |
236 | dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { | 243 | dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { |
@@ -272,7 +279,7 @@ isert_create_device_ib_res(struct isert_device *device) | |||
272 | isert_cq_rx_callback, | 279 | isert_cq_rx_callback, |
273 | isert_cq_event_callback, | 280 | isert_cq_event_callback, |
274 | (void *)&cq_desc[i], | 281 | (void *)&cq_desc[i], |
275 | ISER_MAX_RX_CQ_LEN, i); | 282 | max_rx_cqe, i); |
276 | if (IS_ERR(device->dev_rx_cq[i])) { | 283 | if (IS_ERR(device->dev_rx_cq[i])) { |
277 | ret = PTR_ERR(device->dev_rx_cq[i]); | 284 | ret = PTR_ERR(device->dev_rx_cq[i]); |
278 | device->dev_rx_cq[i] = NULL; | 285 | device->dev_rx_cq[i] = NULL; |
@@ -284,7 +291,7 @@ isert_create_device_ib_res(struct isert_device *device) | |||
284 | isert_cq_tx_callback, | 291 | isert_cq_tx_callback, |
285 | isert_cq_event_callback, | 292 | isert_cq_event_callback, |
286 | (void *)&cq_desc[i], | 293 | (void *)&cq_desc[i], |
287 | ISER_MAX_TX_CQ_LEN, i); | 294 | max_tx_cqe, i); |
288 | if (IS_ERR(device->dev_tx_cq[i])) { | 295 | if (IS_ERR(device->dev_tx_cq[i])) { |
289 | ret = PTR_ERR(device->dev_tx_cq[i]); | 296 | ret = PTR_ERR(device->dev_tx_cq[i]); |
290 | device->dev_tx_cq[i] = NULL; | 297 | device->dev_tx_cq[i] = NULL; |
@@ -803,14 +810,25 @@ wake_up: | |||
803 | complete(&isert_conn->conn_wait); | 810 | complete(&isert_conn->conn_wait); |
804 | } | 811 | } |
805 | 812 | ||
806 | static void | 813 | static int |
807 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) | 814 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) |
808 | { | 815 | { |
809 | struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; | 816 | struct isert_conn *isert_conn; |
817 | |||
818 | if (!cma_id->qp) { | ||
819 | struct isert_np *isert_np = cma_id->context; | ||
820 | |||
821 | isert_np->np_cm_id = NULL; | ||
822 | return -1; | ||
823 | } | ||
824 | |||
825 | isert_conn = (struct isert_conn *)cma_id->context; | ||
810 | 826 | ||
811 | isert_conn->disconnect = disconnect; | 827 | isert_conn->disconnect = disconnect; |
812 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); | 828 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); |
813 | schedule_work(&isert_conn->conn_logout_work); | 829 | schedule_work(&isert_conn->conn_logout_work); |
830 | |||
831 | return 0; | ||
814 | } | 832 | } |
815 | 833 | ||
816 | static int | 834 | static int |
@@ -825,6 +843,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
825 | switch (event->event) { | 843 | switch (event->event) { |
826 | case RDMA_CM_EVENT_CONNECT_REQUEST: | 844 | case RDMA_CM_EVENT_CONNECT_REQUEST: |
827 | ret = isert_connect_request(cma_id, event); | 845 | ret = isert_connect_request(cma_id, event); |
846 | if (ret) | ||
847 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
848 | event->event, ret); | ||
828 | break; | 849 | break; |
829 | case RDMA_CM_EVENT_ESTABLISHED: | 850 | case RDMA_CM_EVENT_ESTABLISHED: |
830 | isert_connected_handler(cma_id); | 851 | isert_connected_handler(cma_id); |
@@ -834,7 +855,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
834 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ | 855 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ |
835 | disconnect = true; | 856 | disconnect = true; |
836 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ | 857 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
837 | isert_disconnected_handler(cma_id, disconnect); | 858 | ret = isert_disconnected_handler(cma_id, disconnect); |
838 | break; | 859 | break; |
839 | case RDMA_CM_EVENT_CONNECT_ERROR: | 860 | case RDMA_CM_EVENT_CONNECT_ERROR: |
840 | default: | 861 | default: |
@@ -842,12 +863,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
842 | break; | 863 | break; |
843 | } | 864 | } |
844 | 865 | ||
845 | if (ret != 0) { | ||
846 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
847 | event->event, ret); | ||
848 | dump_stack(); | ||
849 | } | ||
850 | |||
851 | return ret; | 866 | return ret; |
852 | } | 867 | } |
853 | 868 | ||
@@ -3190,7 +3205,8 @@ isert_free_np(struct iscsi_np *np) | |||
3190 | { | 3205 | { |
3191 | struct isert_np *isert_np = (struct isert_np *)np->np_context; | 3206 | struct isert_np *isert_np = (struct isert_np *)np->np_context; |
3192 | 3207 | ||
3193 | rdma_destroy_id(isert_np->np_cm_id); | 3208 | if (isert_np->np_cm_id) |
3209 | rdma_destroy_id(isert_np->np_cm_id); | ||
3194 | 3210 | ||
3195 | np->np_context = NULL; | 3211 | np->np_context = NULL; |
3196 | kfree(isert_np); | 3212 | kfree(isert_np); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 7206547c13ce..dc829682701a 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -2092,6 +2092,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) | |||
2092 | if (!qp_init) | 2092 | if (!qp_init) |
2093 | goto out; | 2093 | goto out; |
2094 | 2094 | ||
2095 | retry: | ||
2095 | ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, | 2096 | ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, |
2096 | ch->rq_size + srp_sq_size, 0); | 2097 | ch->rq_size + srp_sq_size, 0); |
2097 | if (IS_ERR(ch->cq)) { | 2098 | if (IS_ERR(ch->cq)) { |
@@ -2115,6 +2116,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) | |||
2115 | ch->qp = ib_create_qp(sdev->pd, qp_init); | 2116 | ch->qp = ib_create_qp(sdev->pd, qp_init); |
2116 | if (IS_ERR(ch->qp)) { | 2117 | if (IS_ERR(ch->qp)) { |
2117 | ret = PTR_ERR(ch->qp); | 2118 | ret = PTR_ERR(ch->qp); |
2119 | if (ret == -ENOMEM) { | ||
2120 | srp_sq_size /= 2; | ||
2121 | if (srp_sq_size >= MIN_SRPT_SQ_SIZE) { | ||
2122 | ib_destroy_cq(ch->cq); | ||
2123 | goto retry; | ||
2124 | } | ||
2125 | } | ||
2118 | printk(KERN_ERR "failed to create_qp ret= %d\n", ret); | 2126 | printk(KERN_ERR "failed to create_qp ret= %d\n", ret); |
2119 | goto err_destroy_cq; | 2127 | goto err_destroy_cq; |
2120 | } | 2128 | } |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2ed7905a068f..fc55f0d15b70 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -1179,9 +1179,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; | 1181 | ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; |
1182 | usb_fill_bulk_urb(xpad->bulk_out, udev, | 1182 | if (usb_endpoint_is_bulk_out(ep_irq_in)) { |
1183 | usb_sndbulkpipe(udev, ep_irq_in->bEndpointAddress), | 1183 | usb_fill_bulk_urb(xpad->bulk_out, udev, |
1184 | xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad); | 1184 | usb_sndbulkpipe(udev, |
1185 | ep_irq_in->bEndpointAddress), | ||
1186 | xpad->bdata, XPAD_PKT_LEN, | ||
1187 | xpad_bulk_out, xpad); | ||
1188 | } else { | ||
1189 | usb_fill_int_urb(xpad->bulk_out, udev, | ||
1190 | usb_sndintpipe(udev, | ||
1191 | ep_irq_in->bEndpointAddress), | ||
1192 | xpad->bdata, XPAD_PKT_LEN, | ||
1193 | xpad_bulk_out, xpad, 0); | ||
1194 | } | ||
1185 | 1195 | ||
1186 | /* | 1196 | /* |
1187 | * Submit the int URB immediately rather than waiting for open | 1197 | * Submit the int URB immediately rather than waiting for open |
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index fb3b63b2f85c..8400a1a34d87 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c | |||
@@ -85,6 +85,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | platform_set_drvdata(pdev, pwr); | 87 | platform_set_drvdata(pdev, pwr); |
88 | device_init_wakeup(&pdev->dev, true); | ||
88 | 89 | ||
89 | return 0; | 90 | return 0; |
90 | } | 91 | } |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 2b0ae8cc8e51..d125a019383f 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -1156,7 +1156,13 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
1156 | { | 1156 | { |
1157 | struct alps_data *priv = psmouse->private; | 1157 | struct alps_data *priv = psmouse->private; |
1158 | 1158 | ||
1159 | if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */ | 1159 | /* |
1160 | * Check if we are dealing with a bare PS/2 packet, presumably from | ||
1161 | * a device connected to the external PS/2 port. Because bare PS/2 | ||
1162 | * protocol does not have enough constant bits to self-synchronize | ||
1163 | * properly we only do this if the device is fully synchronized. | ||
1164 | */ | ||
1165 | if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { | ||
1160 | if (psmouse->pktcnt == 3) { | 1166 | if (psmouse->pktcnt == 3) { |
1161 | alps_report_bare_ps2_packet(psmouse, psmouse->packet, | 1167 | alps_report_bare_ps2_packet(psmouse, psmouse->packet, |
1162 | true); | 1168 | true); |
@@ -1180,12 +1186,27 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
1180 | } | 1186 | } |
1181 | 1187 | ||
1182 | /* Bytes 2 - pktsize should have 0 in the highest bit */ | 1188 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
1183 | if ((priv->proto_version < ALPS_PROTO_V5) && | 1189 | if (priv->proto_version < ALPS_PROTO_V5 && |
1184 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | 1190 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && |
1185 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 1191 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
1186 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 1192 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
1187 | psmouse->pktcnt - 1, | 1193 | psmouse->pktcnt - 1, |
1188 | psmouse->packet[psmouse->pktcnt - 1]); | 1194 | psmouse->packet[psmouse->pktcnt - 1]); |
1195 | |||
1196 | if (priv->proto_version == ALPS_PROTO_V3 && | ||
1197 | psmouse->pktcnt == psmouse->pktsize) { | ||
1198 | /* | ||
1199 | * Some Dell boxes, such as Latitude E6440 or E7440 | ||
1200 | * with closed lid, quite often smash last byte of | ||
1201 | * otherwise valid packet with 0xff. Given that the | ||
1202 | * next packet is very likely to be valid let's | ||
1203 | * report PSMOUSE_FULL_PACKET but not process data, | ||
1204 | * rather than reporting PSMOUSE_BAD_DATA and | ||
1205 | * filling the logs. | ||
1206 | */ | ||
1207 | return PSMOUSE_FULL_PACKET; | ||
1208 | } | ||
1209 | |||
1189 | return PSMOUSE_BAD_DATA; | 1210 | return PSMOUSE_BAD_DATA; |
1190 | } | 1211 | } |
1191 | 1212 | ||
@@ -2389,6 +2410,9 @@ int alps_init(struct psmouse *psmouse) | |||
2389 | /* We are having trouble resyncing ALPS touchpads so disable it for now */ | 2410 | /* We are having trouble resyncing ALPS touchpads so disable it for now */ |
2390 | psmouse->resync_time = 0; | 2411 | psmouse->resync_time = 0; |
2391 | 2412 | ||
2413 | /* Allow 2 invalid packets without resetting device */ | ||
2414 | psmouse->resetafter = psmouse->pktsize * 2; | ||
2415 | |||
2392 | return 0; | 2416 | return 0; |
2393 | 2417 | ||
2394 | init_fail: | 2418 | init_fail: |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 06fc6e76ffbe..f2b978026407 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -428,14 +428,6 @@ static void elantech_report_trackpoint(struct psmouse *psmouse, | |||
428 | int x, y; | 428 | int x, y; |
429 | u32 t; | 429 | u32 t; |
430 | 430 | ||
431 | if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, | ||
432 | !tp_dev, | ||
433 | psmouse_fmt("Unexpected trackpoint message\n"))) { | ||
434 | if (etd->debug == 1) | ||
435 | elantech_packet_dump(psmouse); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | t = get_unaligned_le32(&packet[0]); | 431 | t = get_unaligned_le32(&packet[0]); |
440 | 432 | ||
441 | switch (t & ~7U) { | 433 | switch (t & ~7U) { |
@@ -563,6 +555,7 @@ static void elantech_input_sync_v4(struct psmouse *psmouse) | |||
563 | } else { | 555 | } else { |
564 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | 556 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); |
565 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | 557 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); |
558 | input_report_key(dev, BTN_MIDDLE, packet[0] & 0x04); | ||
566 | } | 559 | } |
567 | 560 | ||
568 | input_mt_report_pointer_emulation(dev, true); | 561 | input_mt_report_pointer_emulation(dev, true); |
@@ -792,6 +785,9 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) | |||
792 | unsigned char packet_type = packet[3] & 0x03; | 785 | unsigned char packet_type = packet[3] & 0x03; |
793 | bool sanity_check; | 786 | bool sanity_check; |
794 | 787 | ||
788 | if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) | ||
789 | return PACKET_TRACKPOINT; | ||
790 | |||
795 | /* | 791 | /* |
796 | * Sanity check based on the constant bits of a packet. | 792 | * Sanity check based on the constant bits of a packet. |
797 | * The constant bits change depending on the value of | 793 | * The constant bits change depending on the value of |
@@ -877,10 +873,19 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) | |||
877 | 873 | ||
878 | case 4: | 874 | case 4: |
879 | packet_type = elantech_packet_check_v4(psmouse); | 875 | packet_type = elantech_packet_check_v4(psmouse); |
880 | if (packet_type == PACKET_UNKNOWN) | 876 | switch (packet_type) { |
877 | case PACKET_UNKNOWN: | ||
881 | return PSMOUSE_BAD_DATA; | 878 | return PSMOUSE_BAD_DATA; |
882 | 879 | ||
883 | elantech_report_absolute_v4(psmouse, packet_type); | 880 | case PACKET_TRACKPOINT: |
881 | elantech_report_trackpoint(psmouse, packet_type); | ||
882 | break; | ||
883 | |||
884 | default: | ||
885 | elantech_report_absolute_v4(psmouse, packet_type); | ||
886 | break; | ||
887 | } | ||
888 | |||
884 | break; | 889 | break; |
885 | } | 890 | } |
886 | 891 | ||
@@ -1120,6 +1125,22 @@ static void elantech_set_buttonpad_prop(struct psmouse *psmouse) | |||
1120 | } | 1125 | } |
1121 | 1126 | ||
1122 | /* | 1127 | /* |
1128 | * Some hw_version 4 models do have a middle button | ||
1129 | */ | ||
1130 | static const struct dmi_system_id elantech_dmi_has_middle_button[] = { | ||
1131 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
1132 | { | ||
1133 | /* Fujitsu H730 has a middle button */ | ||
1134 | .matches = { | ||
1135 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
1136 | DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), | ||
1137 | }, | ||
1138 | }, | ||
1139 | #endif | ||
1140 | { } | ||
1141 | }; | ||
1142 | |||
1143 | /* | ||
1123 | * Set the appropriate event bits for the input subsystem | 1144 | * Set the appropriate event bits for the input subsystem |
1124 | */ | 1145 | */ |
1125 | static int elantech_set_input_params(struct psmouse *psmouse) | 1146 | static int elantech_set_input_params(struct psmouse *psmouse) |
@@ -1138,6 +1159,8 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1138 | __clear_bit(EV_REL, dev->evbit); | 1159 | __clear_bit(EV_REL, dev->evbit); |
1139 | 1160 | ||
1140 | __set_bit(BTN_LEFT, dev->keybit); | 1161 | __set_bit(BTN_LEFT, dev->keybit); |
1162 | if (dmi_check_system(elantech_dmi_has_middle_button)) | ||
1163 | __set_bit(BTN_MIDDLE, dev->keybit); | ||
1141 | __set_bit(BTN_RIGHT, dev->keybit); | 1164 | __set_bit(BTN_RIGHT, dev->keybit); |
1142 | 1165 | ||
1143 | __set_bit(BTN_TOUCH, dev->keybit); | 1166 | __set_bit(BTN_TOUCH, dev->keybit); |
@@ -1299,6 +1322,7 @@ ELANTECH_INT_ATTR(reg_25, 0x25); | |||
1299 | ELANTECH_INT_ATTR(reg_26, 0x26); | 1322 | ELANTECH_INT_ATTR(reg_26, 0x26); |
1300 | ELANTECH_INT_ATTR(debug, 0); | 1323 | ELANTECH_INT_ATTR(debug, 0); |
1301 | ELANTECH_INT_ATTR(paritycheck, 0); | 1324 | ELANTECH_INT_ATTR(paritycheck, 0); |
1325 | ELANTECH_INT_ATTR(crc_enabled, 0); | ||
1302 | 1326 | ||
1303 | static struct attribute *elantech_attrs[] = { | 1327 | static struct attribute *elantech_attrs[] = { |
1304 | &psmouse_attr_reg_07.dattr.attr, | 1328 | &psmouse_attr_reg_07.dattr.attr, |
@@ -1313,6 +1337,7 @@ static struct attribute *elantech_attrs[] = { | |||
1313 | &psmouse_attr_reg_26.dattr.attr, | 1337 | &psmouse_attr_reg_26.dattr.attr, |
1314 | &psmouse_attr_debug.dattr.attr, | 1338 | &psmouse_attr_debug.dattr.attr, |
1315 | &psmouse_attr_paritycheck.dattr.attr, | 1339 | &psmouse_attr_paritycheck.dattr.attr, |
1340 | &psmouse_attr_crc_enabled.dattr.attr, | ||
1316 | NULL | 1341 | NULL |
1317 | }; | 1342 | }; |
1318 | 1343 | ||
@@ -1439,6 +1464,22 @@ static int elantech_reconnect(struct psmouse *psmouse) | |||
1439 | } | 1464 | } |
1440 | 1465 | ||
1441 | /* | 1466 | /* |
1467 | * Some hw_version 4 models do not work with crc_disabled | ||
1468 | */ | ||
1469 | static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { | ||
1470 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
1471 | { | ||
1472 | /* Fujitsu H730 does not work with crc_enabled == 0 */ | ||
1473 | .matches = { | ||
1474 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
1475 | DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), | ||
1476 | }, | ||
1477 | }, | ||
1478 | #endif | ||
1479 | { } | ||
1480 | }; | ||
1481 | |||
1482 | /* | ||
1442 | * Some hw_version 3 models go into error state when we try to set | 1483 | * Some hw_version 3 models go into error state when we try to set |
1443 | * bit 3 and/or bit 1 of r10. | 1484 | * bit 3 and/or bit 1 of r10. |
1444 | */ | 1485 | */ |
@@ -1513,7 +1554,8 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1513 | * The signatures of v3 and v4 packets change depending on the | 1554 | * The signatures of v3 and v4 packets change depending on the |
1514 | * value of this hardware flag. | 1555 | * value of this hardware flag. |
1515 | */ | 1556 | */ |
1516 | etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000); | 1557 | etd->crc_enabled = (etd->fw_version & 0x4000) == 0x4000 || |
1558 | dmi_check_system(elantech_dmi_force_crc_enabled); | ||
1517 | 1559 | ||
1518 | /* Enable real hardware resolution on hw_version 3 ? */ | 1560 | /* Enable real hardware resolution on hw_version 3 ? */ |
1519 | etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); | 1561 | etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 9031a0a28ea4..f9472920d986 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -135,14 +135,18 @@ static const struct min_max_quirk min_max_pnpid_table[] = { | |||
135 | 1232, 5710, 1156, 4696 | 135 | 1232, 5710, 1156, 4696 |
136 | }, | 136 | }, |
137 | { | 137 | { |
138 | (const char * const []){"LEN0034", "LEN0036", "LEN2002", | 138 | (const char * const []){"LEN0034", "LEN0036", "LEN0039", |
139 | "LEN2004", NULL}, | 139 | "LEN2002", "LEN2004", NULL}, |
140 | 1024, 5112, 2024, 4832 | 140 | 1024, 5112, 2024, 4832 |
141 | }, | 141 | }, |
142 | { | 142 | { |
143 | (const char * const []){"LEN2001", NULL}, | 143 | (const char * const []){"LEN2001", NULL}, |
144 | 1024, 5022, 2508, 4832 | 144 | 1024, 5022, 2508, 4832 |
145 | }, | 145 | }, |
146 | { | ||
147 | (const char * const []){"LEN2006", NULL}, | ||
148 | 1264, 5675, 1171, 4688 | ||
149 | }, | ||
146 | { } | 150 | { } |
147 | }; | 151 | }; |
148 | 152 | ||
@@ -163,6 +167,7 @@ static const char * const topbuttonpad_pnp_ids[] = { | |||
163 | "LEN0036", /* T440 */ | 167 | "LEN0036", /* T440 */ |
164 | "LEN0037", | 168 | "LEN0037", |
165 | "LEN0038", | 169 | "LEN0038", |
170 | "LEN0039", /* T440s */ | ||
166 | "LEN0041", | 171 | "LEN0041", |
167 | "LEN0042", /* Yoga */ | 172 | "LEN0042", /* Yoga */ |
168 | "LEN0045", | 173 | "LEN0045", |
diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c index 6ae3cdee0681..cc4f9d80122e 100644 --- a/drivers/irqchip/irq-atmel-aic-common.c +++ b/drivers/irqchip/irq-atmel-aic-common.c | |||
@@ -217,8 +217,9 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
217 | } | 217 | } |
218 | 218 | ||
219 | ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, | 219 | ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, |
220 | handle_level_irq, 0, 0, | 220 | handle_fasteoi_irq, |
221 | IRQCHIP_SKIP_SET_WAKE); | 221 | IRQ_NOREQUEST | IRQ_NOPROBE | |
222 | IRQ_NOAUTOEN, 0, 0); | ||
222 | if (ret) | 223 | if (ret) |
223 | goto err_domain_remove; | 224 | goto err_domain_remove; |
224 | 225 | ||
@@ -230,7 +231,6 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
230 | gc->unused = 0; | 231 | gc->unused = 0; |
231 | gc->wake_enabled = ~0; | 232 | gc->wake_enabled = ~0; |
232 | gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; | 233 | gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; |
233 | gc->chip_types[0].handler = handle_fasteoi_irq; | ||
234 | gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; | 234 | gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; |
235 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; | 235 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; |
236 | gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown; | 236 | gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown; |
diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index b9f4fb808e49..5fb38a2ac226 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c | |||
@@ -101,9 +101,9 @@ static int bcm7120_l2_intc_init_one(struct device_node *dn, | |||
101 | int parent_irq; | 101 | int parent_irq; |
102 | 102 | ||
103 | parent_irq = irq_of_parse_and_map(dn, irq); | 103 | parent_irq = irq_of_parse_and_map(dn, irq); |
104 | if (parent_irq < 0) { | 104 | if (!parent_irq) { |
105 | pr_err("failed to map interrupt %d\n", irq); | 105 | pr_err("failed to map interrupt %d\n", irq); |
106 | return parent_irq; | 106 | return -EINVAL; |
107 | } | 107 | } |
108 | 108 | ||
109 | data->irq_map_mask |= be32_to_cpup(map_mask + irq); | 109 | data->irq_map_mask |= be32_to_cpup(map_mask + irq); |
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index c15c840987d2..14691a4cb84c 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c | |||
@@ -135,9 +135,9 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np, | |||
135 | __raw_writel(0xffffffff, data->base + CPU_CLEAR); | 135 | __raw_writel(0xffffffff, data->base + CPU_CLEAR); |
136 | 136 | ||
137 | data->parent_irq = irq_of_parse_and_map(np, 0); | 137 | data->parent_irq = irq_of_parse_and_map(np, 0); |
138 | if (data->parent_irq < 0) { | 138 | if (!data->parent_irq) { |
139 | pr_err("failed to find parent interrupt\n"); | 139 | pr_err("failed to find parent interrupt\n"); |
140 | ret = data->parent_irq; | 140 | ret = -EINVAL; |
141 | goto out_unmap; | 141 | goto out_unmap; |
142 | } | 142 | } |
143 | 143 | ||
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 825ca1f87639..afe79719ea32 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1434,9 +1434,9 @@ static void drop_buffers(struct dm_bufio_client *c) | |||
1434 | 1434 | ||
1435 | /* | 1435 | /* |
1436 | * Test if the buffer is unused and too old, and commit it. | 1436 | * Test if the buffer is unused and too old, and commit it. |
1437 | * At if noio is set, we must not do any I/O because we hold | 1437 | * And if GFP_NOFS is used, we must not do any I/O because we hold |
1438 | * dm_bufio_clients_lock and we would risk deadlock if the I/O gets rerouted to | 1438 | * dm_bufio_clients_lock and we would risk deadlock if the I/O gets |
1439 | * different bufio client. | 1439 | * rerouted to different bufio client. |
1440 | */ | 1440 | */ |
1441 | static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, | 1441 | static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, |
1442 | unsigned long max_jiffies) | 1442 | unsigned long max_jiffies) |
@@ -1444,7 +1444,7 @@ static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, | |||
1444 | if (jiffies - b->last_accessed < max_jiffies) | 1444 | if (jiffies - b->last_accessed < max_jiffies) |
1445 | return 0; | 1445 | return 0; |
1446 | 1446 | ||
1447 | if (!(gfp & __GFP_IO)) { | 1447 | if (!(gfp & __GFP_FS)) { |
1448 | if (test_bit(B_READING, &b->state) || | 1448 | if (test_bit(B_READING, &b->state) || |
1449 | test_bit(B_WRITING, &b->state) || | 1449 | test_bit(B_WRITING, &b->state) || |
1450 | test_bit(B_DIRTY, &b->state)) | 1450 | test_bit(B_DIRTY, &b->state)) |
@@ -1486,7 +1486,7 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) | |||
1486 | unsigned long freed; | 1486 | unsigned long freed; |
1487 | 1487 | ||
1488 | c = container_of(shrink, struct dm_bufio_client, shrinker); | 1488 | c = container_of(shrink, struct dm_bufio_client, shrinker); |
1489 | if (sc->gfp_mask & __GFP_IO) | 1489 | if (sc->gfp_mask & __GFP_FS) |
1490 | dm_bufio_lock(c); | 1490 | dm_bufio_lock(c); |
1491 | else if (!dm_bufio_trylock(c)) | 1491 | else if (!dm_bufio_trylock(c)) |
1492 | return SHRINK_STOP; | 1492 | return SHRINK_STOP; |
@@ -1503,7 +1503,7 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc) | |||
1503 | unsigned long count; | 1503 | unsigned long count; |
1504 | 1504 | ||
1505 | c = container_of(shrink, struct dm_bufio_client, shrinker); | 1505 | c = container_of(shrink, struct dm_bufio_client, shrinker); |
1506 | if (sc->gfp_mask & __GFP_IO) | 1506 | if (sc->gfp_mask & __GFP_FS) |
1507 | dm_bufio_lock(c); | 1507 | dm_bufio_lock(c); |
1508 | else if (!dm_bufio_trylock(c)) | 1508 | else if (!dm_bufio_trylock(c)) |
1509 | return 0; | 1509 | return 0; |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 4857fa4a5484..07c0fa0fa284 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -789,8 +789,7 @@ struct dm_raid_superblock { | |||
789 | __le32 layout; | 789 | __le32 layout; |
790 | __le32 stripe_sectors; | 790 | __le32 stripe_sectors; |
791 | 791 | ||
792 | __u8 pad[452]; /* Round struct to 512 bytes. */ | 792 | /* Remainder of a logical block is zero-filled when writing (see super_sync()). */ |
793 | /* Always set to 0 when writing. */ | ||
794 | } __packed; | 793 | } __packed; |
795 | 794 | ||
796 | static int read_disk_sb(struct md_rdev *rdev, int size) | 795 | static int read_disk_sb(struct md_rdev *rdev, int size) |
@@ -827,7 +826,7 @@ static void super_sync(struct mddev *mddev, struct md_rdev *rdev) | |||
827 | test_bit(Faulty, &(rs->dev[i].rdev.flags))) | 826 | test_bit(Faulty, &(rs->dev[i].rdev.flags))) |
828 | failed_devices |= (1ULL << i); | 827 | failed_devices |= (1ULL << i); |
829 | 828 | ||
830 | memset(sb, 0, sizeof(*sb)); | 829 | memset(sb + 1, 0, rdev->sb_size - sizeof(*sb)); |
831 | 830 | ||
832 | sb->magic = cpu_to_le32(DM_RAID_MAGIC); | 831 | sb->magic = cpu_to_le32(DM_RAID_MAGIC); |
833 | sb->features = cpu_to_le32(0); /* No features yet */ | 832 | sb->features = cpu_to_le32(0); /* No features yet */ |
@@ -862,7 +861,11 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev) | |||
862 | uint64_t events_sb, events_refsb; | 861 | uint64_t events_sb, events_refsb; |
863 | 862 | ||
864 | rdev->sb_start = 0; | 863 | rdev->sb_start = 0; |
865 | rdev->sb_size = sizeof(*sb); | 864 | rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev); |
865 | if (rdev->sb_size < sizeof(*sb) || rdev->sb_size > PAGE_SIZE) { | ||
866 | DMERR("superblock size of a logical block is no longer valid"); | ||
867 | return -EINVAL; | ||
868 | } | ||
866 | 869 | ||
867 | ret = read_disk_sb(rdev, rdev->sb_size); | 870 | ret = read_disk_sb(rdev, rdev->sb_size); |
868 | if (ret) | 871 | if (ret) |
@@ -1169,8 +1172,12 @@ static void configure_discard_support(struct dm_target *ti, struct raid_set *rs) | |||
1169 | raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); | 1172 | raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); |
1170 | 1173 | ||
1171 | for (i = 0; i < rs->md.raid_disks; i++) { | 1174 | for (i = 0; i < rs->md.raid_disks; i++) { |
1172 | struct request_queue *q = bdev_get_queue(rs->dev[i].rdev.bdev); | 1175 | struct request_queue *q; |
1176 | |||
1177 | if (!rs->dev[i].rdev.bdev) | ||
1178 | continue; | ||
1173 | 1179 | ||
1180 | q = bdev_get_queue(rs->dev[i].rdev.bdev); | ||
1174 | if (!q || !blk_queue_discard(q)) | 1181 | if (!q || !blk_queue_discard(q)) |
1175 | return; | 1182 | return; |
1176 | 1183 | ||
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index d1600d2aa2e2..f8b37d4c05d8 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -159,8 +159,10 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
159 | sc->stripes_shift = __ffs(stripes); | 159 | sc->stripes_shift = __ffs(stripes); |
160 | 160 | ||
161 | r = dm_set_target_max_io_len(ti, chunk_size); | 161 | r = dm_set_target_max_io_len(ti, chunk_size); |
162 | if (r) | 162 | if (r) { |
163 | kfree(sc); | ||
163 | return r; | 164 | return r; |
165 | } | ||
164 | 166 | ||
165 | ti->num_flush_bios = stripes; | 167 | ti->num_flush_bios = stripes; |
166 | ti->num_discard_bios = stripes; | 168 | ti->num_discard_bios = stripes; |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 4843801173fe..0f86d802b533 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1936,6 +1936,14 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1936 | return DM_MAPIO_SUBMITTED; | 1936 | return DM_MAPIO_SUBMITTED; |
1937 | } | 1937 | } |
1938 | 1938 | ||
1939 | /* | ||
1940 | * We must hold the virtual cell before doing the lookup, otherwise | ||
1941 | * there's a race with discard. | ||
1942 | */ | ||
1943 | build_virtual_key(tc->td, block, &key); | ||
1944 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) | ||
1945 | return DM_MAPIO_SUBMITTED; | ||
1946 | |||
1939 | r = dm_thin_find_block(td, block, 0, &result); | 1947 | r = dm_thin_find_block(td, block, 0, &result); |
1940 | 1948 | ||
1941 | /* | 1949 | /* |
@@ -1959,13 +1967,10 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1959 | * shared flag will be set in their case. | 1967 | * shared flag will be set in their case. |
1960 | */ | 1968 | */ |
1961 | thin_defer_bio(tc, bio); | 1969 | thin_defer_bio(tc, bio); |
1970 | cell_defer_no_holder_no_free(tc, &cell1); | ||
1962 | return DM_MAPIO_SUBMITTED; | 1971 | return DM_MAPIO_SUBMITTED; |
1963 | } | 1972 | } |
1964 | 1973 | ||
1965 | build_virtual_key(tc->td, block, &key); | ||
1966 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) | ||
1967 | return DM_MAPIO_SUBMITTED; | ||
1968 | |||
1969 | build_data_key(tc->td, result.block, &key); | 1974 | build_data_key(tc->td, result.block, &key); |
1970 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { | 1975 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { |
1971 | cell_defer_no_holder_no_free(tc, &cell1); | 1976 | cell_defer_no_holder_no_free(tc, &cell1); |
@@ -1986,6 +1991,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1986 | * of doing so. | 1991 | * of doing so. |
1987 | */ | 1992 | */ |
1988 | handle_unserviceable_bio(tc->pool, bio); | 1993 | handle_unserviceable_bio(tc->pool, bio); |
1994 | cell_defer_no_holder_no_free(tc, &cell1); | ||
1989 | return DM_MAPIO_SUBMITTED; | 1995 | return DM_MAPIO_SUBMITTED; |
1990 | } | 1996 | } |
1991 | /* fall through */ | 1997 | /* fall through */ |
@@ -1996,6 +2002,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1996 | * provide the hint to load the metadata into cache. | 2002 | * provide the hint to load the metadata into cache. |
1997 | */ | 2003 | */ |
1998 | thin_defer_bio(tc, bio); | 2004 | thin_defer_bio(tc, bio); |
2005 | cell_defer_no_holder_no_free(tc, &cell1); | ||
1999 | return DM_MAPIO_SUBMITTED; | 2006 | return DM_MAPIO_SUBMITTED; |
2000 | 2007 | ||
2001 | default: | 2008 | default: |
@@ -2005,6 +2012,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
2005 | * pool is switched to fail-io mode. | 2012 | * pool is switched to fail-io mode. |
2006 | */ | 2013 | */ |
2007 | bio_io_error(bio); | 2014 | bio_io_error(bio); |
2015 | cell_defer_no_holder_no_free(tc, &cell1); | ||
2008 | return DM_MAPIO_SUBMITTED; | 2016 | return DM_MAPIO_SUBMITTED; |
2009 | } | 2017 | } |
2010 | } | 2018 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 4dfa15da9cb8..9233c71138f1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5121,6 +5121,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) | |||
5121 | printk("md: %s still in use.\n",mdname(mddev)); | 5121 | printk("md: %s still in use.\n",mdname(mddev)); |
5122 | if (did_freeze) { | 5122 | if (did_freeze) { |
5123 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5123 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5124 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
5124 | md_wakeup_thread(mddev->thread); | 5125 | md_wakeup_thread(mddev->thread); |
5125 | } | 5126 | } |
5126 | err = -EBUSY; | 5127 | err = -EBUSY; |
@@ -5135,6 +5136,8 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) | |||
5135 | mddev->ro = 1; | 5136 | mddev->ro = 1; |
5136 | set_disk_ro(mddev->gendisk, 1); | 5137 | set_disk_ro(mddev->gendisk, 1); |
5137 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5138 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5139 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
5140 | md_wakeup_thread(mddev->thread); | ||
5138 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 5141 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
5139 | err = 0; | 5142 | err = 0; |
5140 | } | 5143 | } |
@@ -5178,6 +5181,7 @@ static int do_md_stop(struct mddev *mddev, int mode, | |||
5178 | mutex_unlock(&mddev->open_mutex); | 5181 | mutex_unlock(&mddev->open_mutex); |
5179 | if (did_freeze) { | 5182 | if (did_freeze) { |
5180 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5183 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5184 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
5181 | md_wakeup_thread(mddev->thread); | 5185 | md_wakeup_thread(mddev->thread); |
5182 | } | 5186 | } |
5183 | return -EBUSY; | 5187 | return -EBUSY; |
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h index 37d367bb9aa8..bf2b80d5c470 100644 --- a/drivers/md/persistent-data/dm-btree-internal.h +++ b/drivers/md/persistent-data/dm-btree-internal.h | |||
@@ -42,6 +42,12 @@ struct btree_node { | |||
42 | } __packed; | 42 | } __packed; |
43 | 43 | ||
44 | 44 | ||
45 | /* | ||
46 | * Locks a block using the btree node validator. | ||
47 | */ | ||
48 | int bn_read_lock(struct dm_btree_info *info, dm_block_t b, | ||
49 | struct dm_block **result); | ||
50 | |||
45 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, | 51 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
46 | struct dm_btree_value_type *vt); | 52 | struct dm_btree_value_type *vt); |
47 | 53 | ||
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c index cf9fd676ae44..1b5e13ec7f96 100644 --- a/drivers/md/persistent-data/dm-btree-spine.c +++ b/drivers/md/persistent-data/dm-btree-spine.c | |||
@@ -92,7 +92,7 @@ struct dm_block_validator btree_node_validator = { | |||
92 | 92 | ||
93 | /*----------------------------------------------------------------*/ | 93 | /*----------------------------------------------------------------*/ |
94 | 94 | ||
95 | static int bn_read_lock(struct dm_btree_info *info, dm_block_t b, | 95 | int bn_read_lock(struct dm_btree_info *info, dm_block_t b, |
96 | struct dm_block **result) | 96 | struct dm_block **result) |
97 | { | 97 | { |
98 | return dm_tm_read_lock(info->tm, b, &btree_node_validator, result); | 98 | return dm_tm_read_lock(info->tm, b, &btree_node_validator, result); |
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c index 416060c25709..200ac12a1d40 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c | |||
@@ -847,22 +847,26 @@ EXPORT_SYMBOL_GPL(dm_btree_find_lowest_key); | |||
847 | * FIXME: We shouldn't use a recursive algorithm when we have limited stack | 847 | * FIXME: We shouldn't use a recursive algorithm when we have limited stack |
848 | * space. Also this only works for single level trees. | 848 | * space. Also this only works for single level trees. |
849 | */ | 849 | */ |
850 | static int walk_node(struct ro_spine *s, dm_block_t block, | 850 | static int walk_node(struct dm_btree_info *info, dm_block_t block, |
851 | int (*fn)(void *context, uint64_t *keys, void *leaf), | 851 | int (*fn)(void *context, uint64_t *keys, void *leaf), |
852 | void *context) | 852 | void *context) |
853 | { | 853 | { |
854 | int r; | 854 | int r; |
855 | unsigned i, nr; | 855 | unsigned i, nr; |
856 | struct dm_block *node; | ||
856 | struct btree_node *n; | 857 | struct btree_node *n; |
857 | uint64_t keys; | 858 | uint64_t keys; |
858 | 859 | ||
859 | r = ro_step(s, block); | 860 | r = bn_read_lock(info, block, &node); |
860 | n = ro_node(s); | 861 | if (r) |
862 | return r; | ||
863 | |||
864 | n = dm_block_data(node); | ||
861 | 865 | ||
862 | nr = le32_to_cpu(n->header.nr_entries); | 866 | nr = le32_to_cpu(n->header.nr_entries); |
863 | for (i = 0; i < nr; i++) { | 867 | for (i = 0; i < nr; i++) { |
864 | if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { | 868 | if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { |
865 | r = walk_node(s, value64(n, i), fn, context); | 869 | r = walk_node(info, value64(n, i), fn, context); |
866 | if (r) | 870 | if (r) |
867 | goto out; | 871 | goto out; |
868 | } else { | 872 | } else { |
@@ -874,7 +878,7 @@ static int walk_node(struct ro_spine *s, dm_block_t block, | |||
874 | } | 878 | } |
875 | 879 | ||
876 | out: | 880 | out: |
877 | ro_pop(s); | 881 | dm_tm_unlock(info->tm, node); |
878 | return r; | 882 | return r; |
879 | } | 883 | } |
880 | 884 | ||
@@ -882,15 +886,7 @@ int dm_btree_walk(struct dm_btree_info *info, dm_block_t root, | |||
882 | int (*fn)(void *context, uint64_t *keys, void *leaf), | 886 | int (*fn)(void *context, uint64_t *keys, void *leaf), |
883 | void *context) | 887 | void *context) |
884 | { | 888 | { |
885 | int r; | ||
886 | struct ro_spine spine; | ||
887 | |||
888 | BUG_ON(info->levels > 1); | 889 | BUG_ON(info->levels > 1); |
889 | 890 | return walk_node(info, root, fn, context); | |
890 | init_ro_spine(&spine, info); | ||
891 | r = walk_node(&spine, root, fn, context); | ||
892 | exit_ro_spine(&spine); | ||
893 | |||
894 | return r; | ||
895 | } | 891 | } |
896 | EXPORT_SYMBOL_GPL(dm_btree_walk); | 892 | EXPORT_SYMBOL_GPL(dm_btree_walk); |
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index cf008f45968c..711773e8e64b 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
@@ -240,7 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
240 | goto err_irq_charger; | 240 | goto err_irq_charger; |
241 | } | 241 | } |
242 | 242 | ||
243 | ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, | 243 | ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq, |
244 | IRQF_ONESHOT | IRQF_SHARED | | 244 | IRQF_ONESHOT | IRQF_SHARED | |
245 | IRQF_TRIGGER_FALLING, 0, | 245 | IRQF_TRIGGER_FALLING, 0, |
246 | &max77693_muic_irq_chip, | 246 | &max77693_muic_irq_chip, |
@@ -250,6 +250,17 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
250 | goto err_irq_muic; | 250 | goto err_irq_muic; |
251 | } | 251 | } |
252 | 252 | ||
253 | /* Unmask interrupts from all blocks in interrupt source register */ | ||
254 | ret = regmap_update_bits(max77693->regmap, | ||
255 | MAX77693_PMIC_REG_INTSRC_MASK, | ||
256 | SRC_IRQ_ALL, (unsigned int)~SRC_IRQ_ALL); | ||
257 | if (ret < 0) { | ||
258 | dev_err(max77693->dev, | ||
259 | "Could not unmask interrupts in INTSRC: %d\n", | ||
260 | ret); | ||
261 | goto err_intsrc; | ||
262 | } | ||
263 | |||
253 | pm_runtime_set_active(max77693->dev); | 264 | pm_runtime_set_active(max77693->dev); |
254 | 265 | ||
255 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, | 266 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, |
@@ -261,6 +272,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
261 | 272 | ||
262 | err_mfd: | 273 | err_mfd: |
263 | mfd_remove_devices(max77693->dev); | 274 | mfd_remove_devices(max77693->dev); |
275 | err_intsrc: | ||
264 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); | 276 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); |
265 | err_irq_muic: | 277 | err_irq_muic: |
266 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); | 278 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); |
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index f2643c221d34..30f7ca89a0e6 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -947,6 +947,7 @@ static void rtsx_pci_idle_work(struct work_struct *work) | |||
947 | mutex_unlock(&pcr->pcr_mutex); | 947 | mutex_unlock(&pcr->pcr_mutex); |
948 | } | 948 | } |
949 | 949 | ||
950 | #ifdef CONFIG_PM | ||
950 | static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) | 951 | static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) |
951 | { | 952 | { |
952 | if (pcr->ops->turn_off_led) | 953 | if (pcr->ops->turn_off_led) |
@@ -961,6 +962,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) | |||
961 | if (pcr->ops->force_power_down) | 962 | if (pcr->ops->force_power_down) |
962 | pcr->ops->force_power_down(pcr, pm_state); | 963 | pcr->ops->force_power_down(pcr, pm_state); |
963 | } | 964 | } |
965 | #endif | ||
964 | 966 | ||
965 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | 967 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) |
966 | { | 968 | { |
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h index 2d045f26f193..bee0abf82040 100644 --- a/drivers/mfd/stmpe.h +++ b/drivers/mfd/stmpe.h | |||
@@ -269,7 +269,7 @@ int stmpe_remove(struct stmpe *stmpe); | |||
269 | #define STMPE24XX_REG_CHIP_ID 0x80 | 269 | #define STMPE24XX_REG_CHIP_ID 0x80 |
270 | #define STMPE24XX_REG_IEGPIOR_LSB 0x18 | 270 | #define STMPE24XX_REG_IEGPIOR_LSB 0x18 |
271 | #define STMPE24XX_REG_ISGPIOR_MSB 0x19 | 271 | #define STMPE24XX_REG_ISGPIOR_MSB 0x19 |
272 | #define STMPE24XX_REG_GPMR_LSB 0xA5 | 272 | #define STMPE24XX_REG_GPMR_LSB 0xA4 |
273 | #define STMPE24XX_REG_GPSR_LSB 0x85 | 273 | #define STMPE24XX_REG_GPSR_LSB 0x85 |
274 | #define STMPE24XX_REG_GPCR_LSB 0x88 | 274 | #define STMPE24XX_REG_GPCR_LSB 0x88 |
275 | #define STMPE24XX_REG_GPDR_LSB 0x8B | 275 | #define STMPE24XX_REG_GPDR_LSB 0x8B |
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index cf92a6d1c532..50f9091bcd38 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -44,6 +44,15 @@ static u8 twl4030_start_script_address = 0x2b; | |||
44 | #define PWR_DEVSLP BIT(1) | 44 | #define PWR_DEVSLP BIT(1) |
45 | #define PWR_DEVOFF BIT(0) | 45 | #define PWR_DEVOFF BIT(0) |
46 | 46 | ||
47 | /* Register bits for CFG_P1_TRANSITION (also for P2 and P3) */ | ||
48 | #define STARTON_SWBUG BIT(7) /* Start on watchdog */ | ||
49 | #define STARTON_VBUS BIT(5) /* Start on VBUS */ | ||
50 | #define STARTON_VBAT BIT(4) /* Start on battery insert */ | ||
51 | #define STARTON_RTC BIT(3) /* Start on RTC */ | ||
52 | #define STARTON_USB BIT(2) /* Start on USB host */ | ||
53 | #define STARTON_CHG BIT(1) /* Start on charger */ | ||
54 | #define STARTON_PWON BIT(0) /* Start on PWRON button */ | ||
55 | |||
47 | #define SEQ_OFFSYNC (1 << 0) | 56 | #define SEQ_OFFSYNC (1 << 0) |
48 | 57 | ||
49 | #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) | 58 | #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) |
@@ -606,6 +615,44 @@ twl4030_power_configure_resources(const struct twl4030_power_data *pdata) | |||
606 | return 0; | 615 | return 0; |
607 | } | 616 | } |
608 | 617 | ||
618 | static int twl4030_starton_mask_and_set(u8 bitmask, u8 bitvalues) | ||
619 | { | ||
620 | u8 regs[3] = { TWL4030_PM_MASTER_CFG_P1_TRANSITION, | ||
621 | TWL4030_PM_MASTER_CFG_P2_TRANSITION, | ||
622 | TWL4030_PM_MASTER_CFG_P3_TRANSITION, }; | ||
623 | u8 val; | ||
624 | int i, err; | ||
625 | |||
626 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, | ||
627 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
628 | if (err) | ||
629 | goto relock; | ||
630 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, | ||
631 | TWL4030_PM_MASTER_KEY_CFG2, | ||
632 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
633 | if (err) | ||
634 | goto relock; | ||
635 | |||
636 | for (i = 0; i < sizeof(regs); i++) { | ||
637 | err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, | ||
638 | &val, regs[i]); | ||
639 | if (err) | ||
640 | break; | ||
641 | val = (~bitmask & val) | (bitmask & bitvalues); | ||
642 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, | ||
643 | val, regs[i]); | ||
644 | if (err) | ||
645 | break; | ||
646 | } | ||
647 | |||
648 | if (err) | ||
649 | pr_err("TWL4030 Register access failed: %i\n", err); | ||
650 | |||
651 | relock: | ||
652 | return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, | ||
653 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
654 | } | ||
655 | |||
609 | /* | 656 | /* |
610 | * In master mode, start the power off sequence. | 657 | * In master mode, start the power off sequence. |
611 | * After a successful execution, TWL shuts down the power to the SoC | 658 | * After a successful execution, TWL shuts down the power to the SoC |
@@ -615,6 +662,11 @@ void twl4030_power_off(void) | |||
615 | { | 662 | { |
616 | int err; | 663 | int err; |
617 | 664 | ||
665 | /* Disable start on charger or VBUS as it can break poweroff */ | ||
666 | err = twl4030_starton_mask_and_set(STARTON_VBUS | STARTON_CHG, 0); | ||
667 | if (err) | ||
668 | pr_err("TWL4030 Unable to configure start-up\n"); | ||
669 | |||
618 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, | 670 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, |
619 | TWL4030_PM_MASTER_P1_SW_EVENTS); | 671 | TWL4030_PM_MASTER_P1_SW_EVENTS); |
620 | if (err) | 672 | if (err) |
diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c index e00f5340ed87..3c2b8f9e3c84 100644 --- a/drivers/mfd/viperboard.c +++ b/drivers/mfd/viperboard.c | |||
@@ -93,8 +93,9 @@ static int vprbrd_probe(struct usb_interface *interface, | |||
93 | version >> 8, version & 0xff, | 93 | version >> 8, version & 0xff, |
94 | vb->usb_dev->bus->busnum, vb->usb_dev->devnum); | 94 | vb->usb_dev->bus->busnum, vb->usb_dev->devnum); |
95 | 95 | ||
96 | ret = mfd_add_devices(&interface->dev, -1, vprbrd_devs, | 96 | ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO, |
97 | ARRAY_SIZE(vprbrd_devs), NULL, 0, NULL); | 97 | vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0, |
98 | NULL); | ||
98 | if (ret != 0) { | 99 | if (ret != 0) { |
99 | dev_err(&interface->dev, "Failed to add mfd devices to core."); | 100 | dev_err(&interface->dev, "Failed to add mfd devices to core."); |
100 | goto error; | 101 | goto error; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c9ac06cfe6b7..a5115fb7cf33 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2471,7 +2471,8 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2471 | bond_slave_state_change(bond); | 2471 | bond_slave_state_change(bond); |
2472 | if (BOND_MODE(bond) == BOND_MODE_XOR) | 2472 | if (BOND_MODE(bond) == BOND_MODE_XOR) |
2473 | bond_update_slave_arr(bond, NULL); | 2473 | bond_update_slave_arr(bond, NULL); |
2474 | } else if (do_failover) { | 2474 | } |
2475 | if (do_failover) { | ||
2475 | block_netpoll_tx(); | 2476 | block_netpoll_tx(); |
2476 | bond_select_active_slave(bond); | 2477 | bond_select_active_slave(bond); |
2477 | unblock_netpoll_tx(); | 2478 | unblock_netpoll_tx(); |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 02492d241e4c..2cfe5012e4e5 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -110,7 +110,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, | |||
110 | long rate; | 110 | long rate; |
111 | u64 v64; | 111 | u64 v64; |
112 | 112 | ||
113 | /* Use CIA recommended sample points */ | 113 | /* Use CiA recommended sample points */ |
114 | if (bt->sample_point) { | 114 | if (bt->sample_point) { |
115 | sampl_pt = bt->sample_point; | 115 | sampl_pt = bt->sample_point; |
116 | } else { | 116 | } else { |
@@ -382,7 +382,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx) | |||
382 | BUG_ON(idx >= priv->echo_skb_max); | 382 | BUG_ON(idx >= priv->echo_skb_max); |
383 | 383 | ||
384 | if (priv->echo_skb[idx]) { | 384 | if (priv->echo_skb[idx]) { |
385 | kfree_skb(priv->echo_skb[idx]); | 385 | dev_kfree_skb_any(priv->echo_skb[idx]); |
386 | priv->echo_skb[idx] = NULL; | 386 | priv->echo_skb[idx] = NULL; |
387 | } | 387 | } |
388 | } | 388 | } |
diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig index fca5482c09ac..04f20dd39007 100644 --- a/drivers/net/can/m_can/Kconfig +++ b/drivers/net/can/m_can/Kconfig | |||
@@ -1,4 +1,5 @@ | |||
1 | config CAN_M_CAN | 1 | config CAN_M_CAN |
2 | depends on HAS_IOMEM | ||
2 | tristate "Bosch M_CAN devices" | 3 | tristate "Bosch M_CAN devices" |
3 | ---help--- | 4 | ---help--- |
4 | Say Y here if you want to support for Bosch M_CAN controller. | 5 | Say Y here if you want to support for Bosch M_CAN controller. |
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 10d571eaed85..d7bc462aafdc 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c | |||
@@ -105,14 +105,36 @@ enum m_can_mram_cfg { | |||
105 | MRAM_CFG_NUM, | 105 | MRAM_CFG_NUM, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | /* Fast Bit Timing & Prescaler Register (FBTP) */ | ||
109 | #define FBTR_FBRP_MASK 0x1f | ||
110 | #define FBTR_FBRP_SHIFT 16 | ||
111 | #define FBTR_FTSEG1_SHIFT 8 | ||
112 | #define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT) | ||
113 | #define FBTR_FTSEG2_SHIFT 4 | ||
114 | #define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT) | ||
115 | #define FBTR_FSJW_SHIFT 0 | ||
116 | #define FBTR_FSJW_MASK 0x3 | ||
117 | |||
108 | /* Test Register (TEST) */ | 118 | /* Test Register (TEST) */ |
109 | #define TEST_LBCK BIT(4) | 119 | #define TEST_LBCK BIT(4) |
110 | 120 | ||
111 | /* CC Control Register(CCCR) */ | 121 | /* CC Control Register(CCCR) */ |
112 | #define CCCR_TEST BIT(7) | 122 | #define CCCR_TEST BIT(7) |
113 | #define CCCR_MON BIT(5) | 123 | #define CCCR_CMR_MASK 0x3 |
114 | #define CCCR_CCE BIT(1) | 124 | #define CCCR_CMR_SHIFT 10 |
115 | #define CCCR_INIT BIT(0) | 125 | #define CCCR_CMR_CANFD 0x1 |
126 | #define CCCR_CMR_CANFD_BRS 0x2 | ||
127 | #define CCCR_CMR_CAN 0x3 | ||
128 | #define CCCR_CME_MASK 0x3 | ||
129 | #define CCCR_CME_SHIFT 8 | ||
130 | #define CCCR_CME_CAN 0 | ||
131 | #define CCCR_CME_CANFD 0x1 | ||
132 | #define CCCR_CME_CANFD_BRS 0x2 | ||
133 | #define CCCR_TEST BIT(7) | ||
134 | #define CCCR_MON BIT(5) | ||
135 | #define CCCR_CCE BIT(1) | ||
136 | #define CCCR_INIT BIT(0) | ||
137 | #define CCCR_CANFD 0x10 | ||
116 | 138 | ||
117 | /* Bit Timing & Prescaler Register (BTP) */ | 139 | /* Bit Timing & Prescaler Register (BTP) */ |
118 | #define BTR_BRP_MASK 0x3ff | 140 | #define BTR_BRP_MASK 0x3ff |
@@ -204,6 +226,7 @@ enum m_can_mram_cfg { | |||
204 | 226 | ||
205 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ | 227 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ |
206 | #define M_CAN_RXESC_8BYTES 0x0 | 228 | #define M_CAN_RXESC_8BYTES 0x0 |
229 | #define M_CAN_RXESC_64BYTES 0x777 | ||
207 | 230 | ||
208 | /* Tx Buffer Configuration(TXBC) */ | 231 | /* Tx Buffer Configuration(TXBC) */ |
209 | #define TXBC_NDTB_OFF 16 | 232 | #define TXBC_NDTB_OFF 16 |
@@ -211,6 +234,7 @@ enum m_can_mram_cfg { | |||
211 | 234 | ||
212 | /* Tx Buffer Element Size Configuration(TXESC) */ | 235 | /* Tx Buffer Element Size Configuration(TXESC) */ |
213 | #define TXESC_TBDS_8BYTES 0x0 | 236 | #define TXESC_TBDS_8BYTES 0x0 |
237 | #define TXESC_TBDS_64BYTES 0x7 | ||
214 | 238 | ||
215 | /* Tx Event FIFO Con.guration (TXEFC) */ | 239 | /* Tx Event FIFO Con.guration (TXEFC) */ |
216 | #define TXEFC_EFS_OFF 16 | 240 | #define TXEFC_EFS_OFF 16 |
@@ -219,11 +243,11 @@ enum m_can_mram_cfg { | |||
219 | /* Message RAM Configuration (in bytes) */ | 243 | /* Message RAM Configuration (in bytes) */ |
220 | #define SIDF_ELEMENT_SIZE 4 | 244 | #define SIDF_ELEMENT_SIZE 4 |
221 | #define XIDF_ELEMENT_SIZE 8 | 245 | #define XIDF_ELEMENT_SIZE 8 |
222 | #define RXF0_ELEMENT_SIZE 16 | 246 | #define RXF0_ELEMENT_SIZE 72 |
223 | #define RXF1_ELEMENT_SIZE 16 | 247 | #define RXF1_ELEMENT_SIZE 72 |
224 | #define RXB_ELEMENT_SIZE 16 | 248 | #define RXB_ELEMENT_SIZE 16 |
225 | #define TXE_ELEMENT_SIZE 8 | 249 | #define TXE_ELEMENT_SIZE 8 |
226 | #define TXB_ELEMENT_SIZE 16 | 250 | #define TXB_ELEMENT_SIZE 72 |
227 | 251 | ||
228 | /* Message RAM Elements */ | 252 | /* Message RAM Elements */ |
229 | #define M_CAN_FIFO_ID 0x0 | 253 | #define M_CAN_FIFO_ID 0x0 |
@@ -231,11 +255,17 @@ enum m_can_mram_cfg { | |||
231 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) | 255 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) |
232 | 256 | ||
233 | /* Rx Buffer Element */ | 257 | /* Rx Buffer Element */ |
258 | /* R0 */ | ||
234 | #define RX_BUF_ESI BIT(31) | 259 | #define RX_BUF_ESI BIT(31) |
235 | #define RX_BUF_XTD BIT(30) | 260 | #define RX_BUF_XTD BIT(30) |
236 | #define RX_BUF_RTR BIT(29) | 261 | #define RX_BUF_RTR BIT(29) |
262 | /* R1 */ | ||
263 | #define RX_BUF_ANMF BIT(31) | ||
264 | #define RX_BUF_EDL BIT(21) | ||
265 | #define RX_BUF_BRS BIT(20) | ||
237 | 266 | ||
238 | /* Tx Buffer Element */ | 267 | /* Tx Buffer Element */ |
268 | /* R0 */ | ||
239 | #define TX_BUF_XTD BIT(30) | 269 | #define TX_BUF_XTD BIT(30) |
240 | #define TX_BUF_RTR BIT(29) | 270 | #define TX_BUF_RTR BIT(29) |
241 | 271 | ||
@@ -296,6 +326,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv, | |||
296 | if (enable) { | 326 | if (enable) { |
297 | /* enable m_can configuration */ | 327 | /* enable m_can configuration */ |
298 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); | 328 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); |
329 | udelay(5); | ||
299 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ | 330 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ |
300 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); | 331 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); |
301 | } else { | 332 | } else { |
@@ -326,41 +357,67 @@ static inline void m_can_disable_all_interrupts(const struct m_can_priv *priv) | |||
326 | m_can_write(priv, M_CAN_ILE, 0x0); | 357 | m_can_write(priv, M_CAN_ILE, 0x0); |
327 | } | 358 | } |
328 | 359 | ||
329 | static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, | 360 | static void m_can_read_fifo(struct net_device *dev, u32 rxfs) |
330 | u32 rxfs) | ||
331 | { | 361 | { |
362 | struct net_device_stats *stats = &dev->stats; | ||
332 | struct m_can_priv *priv = netdev_priv(dev); | 363 | struct m_can_priv *priv = netdev_priv(dev); |
333 | u32 id, fgi; | 364 | struct canfd_frame *cf; |
365 | struct sk_buff *skb; | ||
366 | u32 id, fgi, dlc; | ||
367 | int i; | ||
334 | 368 | ||
335 | /* calculate the fifo get index for where to read data */ | 369 | /* calculate the fifo get index for where to read data */ |
336 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; | 370 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; |
371 | dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | ||
372 | if (dlc & RX_BUF_EDL) | ||
373 | skb = alloc_canfd_skb(dev, &cf); | ||
374 | else | ||
375 | skb = alloc_can_skb(dev, (struct can_frame **)&cf); | ||
376 | if (!skb) { | ||
377 | stats->rx_dropped++; | ||
378 | return; | ||
379 | } | ||
380 | |||
381 | if (dlc & RX_BUF_EDL) | ||
382 | cf->len = can_dlc2len((dlc >> 16) & 0x0F); | ||
383 | else | ||
384 | cf->len = get_can_dlc((dlc >> 16) & 0x0F); | ||
385 | |||
337 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); | 386 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); |
338 | if (id & RX_BUF_XTD) | 387 | if (id & RX_BUF_XTD) |
339 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; | 388 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; |
340 | else | 389 | else |
341 | cf->can_id = (id >> 18) & CAN_SFF_MASK; | 390 | cf->can_id = (id >> 18) & CAN_SFF_MASK; |
342 | 391 | ||
343 | if (id & RX_BUF_RTR) { | 392 | if (id & RX_BUF_ESI) { |
393 | cf->flags |= CANFD_ESI; | ||
394 | netdev_dbg(dev, "ESI Error\n"); | ||
395 | } | ||
396 | |||
397 | if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) { | ||
344 | cf->can_id |= CAN_RTR_FLAG; | 398 | cf->can_id |= CAN_RTR_FLAG; |
345 | } else { | 399 | } else { |
346 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | 400 | if (dlc & RX_BUF_BRS) |
347 | cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); | 401 | cf->flags |= CANFD_BRS; |
348 | *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, | 402 | |
349 | M_CAN_FIFO_DATA(0)); | 403 | for (i = 0; i < cf->len; i += 4) |
350 | *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, | 404 | *(u32 *)(cf->data + i) = |
351 | M_CAN_FIFO_DATA(1)); | 405 | m_can_fifo_read(priv, fgi, |
406 | M_CAN_FIFO_DATA(i / 4)); | ||
352 | } | 407 | } |
353 | 408 | ||
354 | /* acknowledge rx fifo 0 */ | 409 | /* acknowledge rx fifo 0 */ |
355 | m_can_write(priv, M_CAN_RXF0A, fgi); | 410 | m_can_write(priv, M_CAN_RXF0A, fgi); |
411 | |||
412 | stats->rx_packets++; | ||
413 | stats->rx_bytes += cf->len; | ||
414 | |||
415 | netif_receive_skb(skb); | ||
356 | } | 416 | } |
357 | 417 | ||
358 | static int m_can_do_rx_poll(struct net_device *dev, int quota) | 418 | static int m_can_do_rx_poll(struct net_device *dev, int quota) |
359 | { | 419 | { |
360 | struct m_can_priv *priv = netdev_priv(dev); | 420 | struct m_can_priv *priv = netdev_priv(dev); |
361 | struct net_device_stats *stats = &dev->stats; | ||
362 | struct sk_buff *skb; | ||
363 | struct can_frame *frame; | ||
364 | u32 pkts = 0; | 421 | u32 pkts = 0; |
365 | u32 rxfs; | 422 | u32 rxfs; |
366 | 423 | ||
@@ -374,18 +431,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) | |||
374 | if (rxfs & RXFS_RFL) | 431 | if (rxfs & RXFS_RFL) |
375 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); | 432 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); |
376 | 433 | ||
377 | skb = alloc_can_skb(dev, &frame); | 434 | m_can_read_fifo(dev, rxfs); |
378 | if (!skb) { | ||
379 | stats->rx_dropped++; | ||
380 | return pkts; | ||
381 | } | ||
382 | |||
383 | m_can_read_fifo(dev, frame, rxfs); | ||
384 | |||
385 | stats->rx_packets++; | ||
386 | stats->rx_bytes += frame->can_dlc; | ||
387 | |||
388 | netif_receive_skb(skb); | ||
389 | 435 | ||
390 | quota--; | 436 | quota--; |
391 | pkts++; | 437 | pkts++; |
@@ -481,11 +527,23 @@ static int m_can_handle_lec_err(struct net_device *dev, | |||
481 | return 1; | 527 | return 1; |
482 | } | 528 | } |
483 | 529 | ||
530 | static int __m_can_get_berr_counter(const struct net_device *dev, | ||
531 | struct can_berr_counter *bec) | ||
532 | { | ||
533 | struct m_can_priv *priv = netdev_priv(dev); | ||
534 | unsigned int ecr; | ||
535 | |||
536 | ecr = m_can_read(priv, M_CAN_ECR); | ||
537 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
538 | bec->txerr = ecr & ECR_TEC_MASK; | ||
539 | |||
540 | return 0; | ||
541 | } | ||
542 | |||
484 | static int m_can_get_berr_counter(const struct net_device *dev, | 543 | static int m_can_get_berr_counter(const struct net_device *dev, |
485 | struct can_berr_counter *bec) | 544 | struct can_berr_counter *bec) |
486 | { | 545 | { |
487 | struct m_can_priv *priv = netdev_priv(dev); | 546 | struct m_can_priv *priv = netdev_priv(dev); |
488 | unsigned int ecr; | ||
489 | int err; | 547 | int err; |
490 | 548 | ||
491 | err = clk_prepare_enable(priv->hclk); | 549 | err = clk_prepare_enable(priv->hclk); |
@@ -498,9 +556,7 @@ static int m_can_get_berr_counter(const struct net_device *dev, | |||
498 | return err; | 556 | return err; |
499 | } | 557 | } |
500 | 558 | ||
501 | ecr = m_can_read(priv, M_CAN_ECR); | 559 | __m_can_get_berr_counter(dev, bec); |
502 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
503 | bec->txerr = ecr & ECR_TEC_MASK; | ||
504 | 560 | ||
505 | clk_disable_unprepare(priv->cclk); | 561 | clk_disable_unprepare(priv->cclk); |
506 | clk_disable_unprepare(priv->hclk); | 562 | clk_disable_unprepare(priv->hclk); |
@@ -544,7 +600,7 @@ static int m_can_handle_state_change(struct net_device *dev, | |||
544 | if (unlikely(!skb)) | 600 | if (unlikely(!skb)) |
545 | return 0; | 601 | return 0; |
546 | 602 | ||
547 | m_can_get_berr_counter(dev, &bec); | 603 | __m_can_get_berr_counter(dev, &bec); |
548 | 604 | ||
549 | switch (new_state) { | 605 | switch (new_state) { |
550 | case CAN_STATE_ERROR_ACTIVE: | 606 | case CAN_STATE_ERROR_ACTIVE: |
@@ -596,14 +652,14 @@ static int m_can_handle_state_errors(struct net_device *dev, u32 psr) | |||
596 | 652 | ||
597 | if ((psr & PSR_EP) && | 653 | if ((psr & PSR_EP) && |
598 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { | 654 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { |
599 | netdev_dbg(dev, "entered error warning state\n"); | 655 | netdev_dbg(dev, "entered error passive state\n"); |
600 | work_done += m_can_handle_state_change(dev, | 656 | work_done += m_can_handle_state_change(dev, |
601 | CAN_STATE_ERROR_PASSIVE); | 657 | CAN_STATE_ERROR_PASSIVE); |
602 | } | 658 | } |
603 | 659 | ||
604 | if ((psr & PSR_BO) && | 660 | if ((psr & PSR_BO) && |
605 | (priv->can.state != CAN_STATE_BUS_OFF)) { | 661 | (priv->can.state != CAN_STATE_BUS_OFF)) { |
606 | netdev_dbg(dev, "entered error warning state\n"); | 662 | netdev_dbg(dev, "entered error bus off state\n"); |
607 | work_done += m_can_handle_state_change(dev, | 663 | work_done += m_can_handle_state_change(dev, |
608 | CAN_STATE_BUS_OFF); | 664 | CAN_STATE_BUS_OFF); |
609 | } | 665 | } |
@@ -615,7 +671,7 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus) | |||
615 | { | 671 | { |
616 | if (irqstatus & IR_WDI) | 672 | if (irqstatus & IR_WDI) |
617 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); | 673 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); |
618 | if (irqstatus & IR_BEU) | 674 | if (irqstatus & IR_ELO) |
619 | netdev_err(dev, "Error Logging Overflow\n"); | 675 | netdev_err(dev, "Error Logging Overflow\n"); |
620 | if (irqstatus & IR_BEU) | 676 | if (irqstatus & IR_BEU) |
621 | netdev_err(dev, "Bit Error Uncorrected\n"); | 677 | netdev_err(dev, "Bit Error Uncorrected\n"); |
@@ -733,10 +789,23 @@ static const struct can_bittiming_const m_can_bittiming_const = { | |||
733 | .brp_inc = 1, | 789 | .brp_inc = 1, |
734 | }; | 790 | }; |
735 | 791 | ||
792 | static const struct can_bittiming_const m_can_data_bittiming_const = { | ||
793 | .name = KBUILD_MODNAME, | ||
794 | .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ | ||
795 | .tseg1_max = 16, | ||
796 | .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ | ||
797 | .tseg2_max = 8, | ||
798 | .sjw_max = 4, | ||
799 | .brp_min = 1, | ||
800 | .brp_max = 32, | ||
801 | .brp_inc = 1, | ||
802 | }; | ||
803 | |||
736 | static int m_can_set_bittiming(struct net_device *dev) | 804 | static int m_can_set_bittiming(struct net_device *dev) |
737 | { | 805 | { |
738 | struct m_can_priv *priv = netdev_priv(dev); | 806 | struct m_can_priv *priv = netdev_priv(dev); |
739 | const struct can_bittiming *bt = &priv->can.bittiming; | 807 | const struct can_bittiming *bt = &priv->can.bittiming; |
808 | const struct can_bittiming *dbt = &priv->can.data_bittiming; | ||
740 | u16 brp, sjw, tseg1, tseg2; | 809 | u16 brp, sjw, tseg1, tseg2; |
741 | u32 reg_btp; | 810 | u32 reg_btp; |
742 | 811 | ||
@@ -747,7 +816,17 @@ static int m_can_set_bittiming(struct net_device *dev) | |||
747 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | | 816 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | |
748 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); | 817 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); |
749 | m_can_write(priv, M_CAN_BTP, reg_btp); | 818 | m_can_write(priv, M_CAN_BTP, reg_btp); |
750 | netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); | 819 | |
820 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
821 | brp = dbt->brp - 1; | ||
822 | sjw = dbt->sjw - 1; | ||
823 | tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1; | ||
824 | tseg2 = dbt->phase_seg2 - 1; | ||
825 | reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) | | ||
826 | (tseg1 << FBTR_FTSEG1_SHIFT) | | ||
827 | (tseg2 << FBTR_FTSEG2_SHIFT); | ||
828 | m_can_write(priv, M_CAN_FBTP, reg_btp); | ||
829 | } | ||
751 | 830 | ||
752 | return 0; | 831 | return 0; |
753 | } | 832 | } |
@@ -767,8 +846,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
767 | 846 | ||
768 | m_can_config_endisable(priv, true); | 847 | m_can_config_endisable(priv, true); |
769 | 848 | ||
770 | /* RX Buffer/FIFO Element Size 8 bytes data field */ | 849 | /* RX Buffer/FIFO Element Size 64 bytes data field */ |
771 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); | 850 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES); |
772 | 851 | ||
773 | /* Accept Non-matching Frames Into FIFO 0 */ | 852 | /* Accept Non-matching Frames Into FIFO 0 */ |
774 | m_can_write(priv, M_CAN_GFC, 0x0); | 853 | m_can_write(priv, M_CAN_GFC, 0x0); |
@@ -777,8 +856,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
777 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | | 856 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | |
778 | priv->mcfg[MRAM_TXB].off); | 857 | priv->mcfg[MRAM_TXB].off); |
779 | 858 | ||
780 | /* only support 8 bytes firstly */ | 859 | /* support 64 bytes payload */ |
781 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); | 860 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES); |
782 | 861 | ||
783 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | | 862 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | |
784 | priv->mcfg[MRAM_TXE].off); | 863 | priv->mcfg[MRAM_TXE].off); |
@@ -793,7 +872,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
793 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); | 872 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); |
794 | 873 | ||
795 | cccr = m_can_read(priv, M_CAN_CCCR); | 874 | cccr = m_can_read(priv, M_CAN_CCCR); |
796 | cccr &= ~(CCCR_TEST | CCCR_MON); | 875 | cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) | |
876 | (CCCR_CME_MASK << CCCR_CME_SHIFT)); | ||
797 | test = m_can_read(priv, M_CAN_TEST); | 877 | test = m_can_read(priv, M_CAN_TEST); |
798 | test &= ~TEST_LBCK; | 878 | test &= ~TEST_LBCK; |
799 | 879 | ||
@@ -805,6 +885,9 @@ static void m_can_chip_config(struct net_device *dev) | |||
805 | test |= TEST_LBCK; | 885 | test |= TEST_LBCK; |
806 | } | 886 | } |
807 | 887 | ||
888 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) | ||
889 | cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT; | ||
890 | |||
808 | m_can_write(priv, M_CAN_CCCR, cccr); | 891 | m_can_write(priv, M_CAN_CCCR, cccr); |
809 | m_can_write(priv, M_CAN_TEST, test); | 892 | m_can_write(priv, M_CAN_TEST, test); |
810 | 893 | ||
@@ -869,11 +952,13 @@ static struct net_device *alloc_m_can_dev(void) | |||
869 | 952 | ||
870 | priv->dev = dev; | 953 | priv->dev = dev; |
871 | priv->can.bittiming_const = &m_can_bittiming_const; | 954 | priv->can.bittiming_const = &m_can_bittiming_const; |
955 | priv->can.data_bittiming_const = &m_can_data_bittiming_const; | ||
872 | priv->can.do_set_mode = m_can_set_mode; | 956 | priv->can.do_set_mode = m_can_set_mode; |
873 | priv->can.do_get_berr_counter = m_can_get_berr_counter; | 957 | priv->can.do_get_berr_counter = m_can_get_berr_counter; |
874 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | | 958 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | |
875 | CAN_CTRLMODE_LISTENONLY | | 959 | CAN_CTRLMODE_LISTENONLY | |
876 | CAN_CTRLMODE_BERR_REPORTING; | 960 | CAN_CTRLMODE_BERR_REPORTING | |
961 | CAN_CTRLMODE_FD; | ||
877 | 962 | ||
878 | return dev; | 963 | return dev; |
879 | } | 964 | } |
@@ -956,8 +1041,9 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
956 | struct net_device *dev) | 1041 | struct net_device *dev) |
957 | { | 1042 | { |
958 | struct m_can_priv *priv = netdev_priv(dev); | 1043 | struct m_can_priv *priv = netdev_priv(dev); |
959 | struct can_frame *cf = (struct can_frame *)skb->data; | 1044 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; |
960 | u32 id; | 1045 | u32 id, cccr; |
1046 | int i; | ||
961 | 1047 | ||
962 | if (can_dropped_invalid_skb(dev, skb)) | 1048 | if (can_dropped_invalid_skb(dev, skb)) |
963 | return NETDEV_TX_OK; | 1049 | return NETDEV_TX_OK; |
@@ -976,11 +1062,28 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
976 | 1062 | ||
977 | /* message ram configuration */ | 1063 | /* message ram configuration */ |
978 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); | 1064 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); |
979 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); | 1065 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16); |
980 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); | 1066 | |
981 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); | 1067 | for (i = 0; i < cf->len; i += 4) |
1068 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4), | ||
1069 | *(u32 *)(cf->data + i)); | ||
1070 | |||
982 | can_put_echo_skb(skb, dev, 0); | 1071 | can_put_echo_skb(skb, dev, 0); |
983 | 1072 | ||
1073 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
1074 | cccr = m_can_read(priv, M_CAN_CCCR); | ||
1075 | cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); | ||
1076 | if (can_is_canfd_skb(skb)) { | ||
1077 | if (cf->flags & CANFD_BRS) | ||
1078 | cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT; | ||
1079 | else | ||
1080 | cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT; | ||
1081 | } else { | ||
1082 | cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT; | ||
1083 | } | ||
1084 | m_can_write(priv, M_CAN_CCCR, cccr); | ||
1085 | } | ||
1086 | |||
984 | /* enable first TX buffer to start transfer */ | 1087 | /* enable first TX buffer to start transfer */ |
985 | m_can_write(priv, M_CAN_TXBTIE, 0x1); | 1088 | m_can_write(priv, M_CAN_TXBTIE, 0x1); |
986 | m_can_write(priv, M_CAN_TXBAR, 0x1); | 1089 | m_can_write(priv, M_CAN_TXBAR, 0x1); |
@@ -992,6 +1095,7 @@ static const struct net_device_ops m_can_netdev_ops = { | |||
992 | .ndo_open = m_can_open, | 1095 | .ndo_open = m_can_open, |
993 | .ndo_stop = m_can_close, | 1096 | .ndo_stop = m_can_close, |
994 | .ndo_start_xmit = m_can_start_xmit, | 1097 | .ndo_start_xmit = m_can_start_xmit, |
1098 | .ndo_change_mtu = can_change_mtu, | ||
995 | }; | 1099 | }; |
996 | 1100 | ||
997 | static int register_m_can_dev(struct net_device *dev) | 1101 | static int register_m_can_dev(struct net_device *dev) |
@@ -1009,7 +1113,7 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
1009 | struct resource *res; | 1113 | struct resource *res; |
1010 | void __iomem *addr; | 1114 | void __iomem *addr; |
1011 | u32 out_val[MRAM_CFG_LEN]; | 1115 | u32 out_val[MRAM_CFG_LEN]; |
1012 | int ret; | 1116 | int i, start, end, ret; |
1013 | 1117 | ||
1014 | /* message ram could be shared */ | 1118 | /* message ram could be shared */ |
1015 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); | 1119 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); |
@@ -1060,6 +1164,15 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
1060 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, | 1164 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, |
1061 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); | 1165 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); |
1062 | 1166 | ||
1167 | /* initialize the entire Message RAM in use to avoid possible | ||
1168 | * ECC/parity checksum errors when reading an uninitialized buffer | ||
1169 | */ | ||
1170 | start = priv->mcfg[MRAM_SIDF].off; | ||
1171 | end = priv->mcfg[MRAM_TXB].off + | ||
1172 | priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; | ||
1173 | for (i = start; i < end; i += 4) | ||
1174 | writel(0x0, priv->mram_base + i); | ||
1175 | |||
1063 | return 0; | 1176 | return 0; |
1064 | } | 1177 | } |
1065 | 1178 | ||
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c index 1abe133d1594..9718248e55f1 100644 --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c | |||
@@ -628,6 +628,7 @@ static const struct net_device_ops rcar_can_netdev_ops = { | |||
628 | .ndo_open = rcar_can_open, | 628 | .ndo_open = rcar_can_open, |
629 | .ndo_stop = rcar_can_close, | 629 | .ndo_stop = rcar_can_close, |
630 | .ndo_start_xmit = rcar_can_start_xmit, | 630 | .ndo_start_xmit = rcar_can_start_xmit, |
631 | .ndo_change_mtu = can_change_mtu, | ||
631 | }; | 632 | }; |
632 | 633 | ||
633 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) | 634 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) |
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c index 8ff3424d5147..15c00faeec61 100644 --- a/drivers/net/can/sja1000/kvaser_pci.c +++ b/drivers/net/can/sja1000/kvaser_pci.c | |||
@@ -214,7 +214,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
214 | struct net_device *dev; | 214 | struct net_device *dev; |
215 | struct sja1000_priv *priv; | 215 | struct sja1000_priv *priv; |
216 | struct kvaser_pci *board; | 216 | struct kvaser_pci *board; |
217 | int err, init_step; | 217 | int err; |
218 | 218 | ||
219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); | 219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); |
220 | if (dev == NULL) | 220 | if (dev == NULL) |
@@ -235,7 +235,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
235 | if (channel == 0) { | 235 | if (channel == 0) { |
236 | board->xilinx_ver = | 236 | board->xilinx_ver = |
237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; | 237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; |
238 | init_step = 2; | ||
239 | 238 | ||
240 | /* Assert PTADR# - we're in passive mode so the other bits are | 239 | /* Assert PTADR# - we're in passive mode so the other bits are |
241 | not important */ | 240 | not important */ |
@@ -264,8 +263,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
264 | priv->irq_flags = IRQF_SHARED; | 263 | priv->irq_flags = IRQF_SHARED; |
265 | dev->irq = pdev->irq; | 264 | dev->irq = pdev->irq; |
266 | 265 | ||
267 | init_step = 4; | ||
268 | |||
269 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", | 266 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", |
270 | priv->reg_base, board->conf_addr, dev->irq); | 267 | priv->reg_base, board->conf_addr, dev->irq); |
271 | 268 | ||
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 00f2534dde73..29d3f0938eb8 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -434,10 +434,9 @@ static void ems_usb_read_bulk_callback(struct urb *urb) | |||
434 | if (urb->actual_length > CPC_HEADER_SIZE) { | 434 | if (urb->actual_length > CPC_HEADER_SIZE) { |
435 | struct ems_cpc_msg *msg; | 435 | struct ems_cpc_msg *msg; |
436 | u8 *ibuf = urb->transfer_buffer; | 436 | u8 *ibuf = urb->transfer_buffer; |
437 | u8 msg_count, again, start; | 437 | u8 msg_count, start; |
438 | 438 | ||
439 | msg_count = ibuf[0] & ~0x80; | 439 | msg_count = ibuf[0] & ~0x80; |
440 | again = ibuf[0] & 0x80; | ||
441 | 440 | ||
442 | start = CPC_HEADER_SIZE; | 441 | start = CPC_HEADER_SIZE; |
443 | 442 | ||
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index b7c9e8b11460..c063a54ab8dd 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -464,7 +464,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
464 | { | 464 | { |
465 | struct esd_tx_urb_context *context = urb->context; | 465 | struct esd_tx_urb_context *context = urb->context; |
466 | struct esd_usb2_net_priv *priv; | 466 | struct esd_usb2_net_priv *priv; |
467 | struct esd_usb2 *dev; | ||
468 | struct net_device *netdev; | 467 | struct net_device *netdev; |
469 | size_t size = sizeof(struct esd_usb2_msg); | 468 | size_t size = sizeof(struct esd_usb2_msg); |
470 | 469 | ||
@@ -472,7 +471,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
472 | 471 | ||
473 | priv = context->priv; | 472 | priv = context->priv; |
474 | netdev = priv->netdev; | 473 | netdev = priv->netdev; |
475 | dev = priv->usb2; | ||
476 | 474 | ||
477 | /* free up our allocated buffer */ | 475 | /* free up our allocated buffer */ |
478 | usb_free_coherent(urb->dev, size, | 476 | usb_free_coherent(urb->dev, size, |
@@ -1143,6 +1141,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf) | |||
1143 | } | 1141 | } |
1144 | } | 1142 | } |
1145 | unlink_all_urbs(dev); | 1143 | unlink_all_urbs(dev); |
1144 | kfree(dev); | ||
1146 | } | 1145 | } |
1147 | } | 1146 | } |
1148 | 1147 | ||
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 04b0f84612f0..009acc8641fc 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c | |||
@@ -718,6 +718,7 @@ static const struct net_device_ops gs_usb_netdev_ops = { | |||
718 | .ndo_open = gs_can_open, | 718 | .ndo_open = gs_can_open, |
719 | .ndo_stop = gs_can_close, | 719 | .ndo_stop = gs_can_close, |
720 | .ndo_start_xmit = gs_can_start_xmit, | 720 | .ndo_start_xmit = gs_can_start_xmit, |
721 | .ndo_change_mtu = can_change_mtu, | ||
721 | }; | 722 | }; |
722 | 723 | ||
723 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) | 724 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) |
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 5e8b5609c067..8a998e3884ce 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c | |||
@@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev) | |||
300 | static int xcan_chip_start(struct net_device *ndev) | 300 | static int xcan_chip_start(struct net_device *ndev) |
301 | { | 301 | { |
302 | struct xcan_priv *priv = netdev_priv(ndev); | 302 | struct xcan_priv *priv = netdev_priv(ndev); |
303 | u32 err, reg_msr, reg_sr_mask; | 303 | u32 reg_msr, reg_sr_mask; |
304 | int err; | ||
304 | unsigned long timeout; | 305 | unsigned long timeout; |
305 | 306 | ||
306 | /* Check if it is in reset mode */ | 307 | /* Check if it is in reset mode */ |
@@ -961,6 +962,7 @@ static const struct net_device_ops xcan_netdev_ops = { | |||
961 | .ndo_open = xcan_open, | 962 | .ndo_open = xcan_open, |
962 | .ndo_stop = xcan_close, | 963 | .ndo_stop = xcan_close, |
963 | .ndo_start_xmit = xcan_start_xmit, | 964 | .ndo_start_xmit = xcan_start_xmit, |
965 | .ndo_change_mtu = can_change_mtu, | ||
964 | }; | 966 | }; |
965 | 967 | ||
966 | /** | 968 | /** |
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index b9625968daac..4f4c2a7888e5 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
@@ -377,6 +377,29 @@ static irqreturn_t bcm_sf2_switch_1_isr(int irq, void *dev_id) | |||
377 | return IRQ_HANDLED; | 377 | return IRQ_HANDLED; |
378 | } | 378 | } |
379 | 379 | ||
380 | static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) | ||
381 | { | ||
382 | unsigned int timeout = 1000; | ||
383 | u32 reg; | ||
384 | |||
385 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
386 | reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; | ||
387 | core_writel(priv, reg, CORE_WATCHDOG_CTRL); | ||
388 | |||
389 | do { | ||
390 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
391 | if (!(reg & SOFTWARE_RESET)) | ||
392 | break; | ||
393 | |||
394 | usleep_range(1000, 2000); | ||
395 | } while (timeout-- > 0); | ||
396 | |||
397 | if (timeout == 0) | ||
398 | return -ETIMEDOUT; | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
380 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) | 403 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) |
381 | { | 404 | { |
382 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; | 405 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; |
@@ -404,11 +427,18 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) | |||
404 | *base = of_iomap(dn, i); | 427 | *base = of_iomap(dn, i); |
405 | if (*base == NULL) { | 428 | if (*base == NULL) { |
406 | pr_err("unable to find register: %s\n", reg_names[i]); | 429 | pr_err("unable to find register: %s\n", reg_names[i]); |
407 | return -ENODEV; | 430 | ret = -ENOMEM; |
431 | goto out_unmap; | ||
408 | } | 432 | } |
409 | base++; | 433 | base++; |
410 | } | 434 | } |
411 | 435 | ||
436 | ret = bcm_sf2_sw_rst(priv); | ||
437 | if (ret) { | ||
438 | pr_err("unable to software reset switch: %d\n", ret); | ||
439 | goto out_unmap; | ||
440 | } | ||
441 | |||
412 | /* Disable all interrupts and request them */ | 442 | /* Disable all interrupts and request them */ |
413 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | 443 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); |
414 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | 444 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); |
@@ -484,7 +514,8 @@ out_free_irq0: | |||
484 | out_unmap: | 514 | out_unmap: |
485 | base = &priv->core; | 515 | base = &priv->core; |
486 | for (i = 0; i < BCM_SF2_REGS_NUM; i++) { | 516 | for (i = 0; i < BCM_SF2_REGS_NUM; i++) { |
487 | iounmap(*base); | 517 | if (*base) |
518 | iounmap(*base); | ||
488 | base++; | 519 | base++; |
489 | } | 520 | } |
490 | return ret; | 521 | return ret; |
@@ -733,29 +764,6 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) | |||
733 | return 0; | 764 | return 0; |
734 | } | 765 | } |
735 | 766 | ||
736 | static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) | ||
737 | { | ||
738 | unsigned int timeout = 1000; | ||
739 | u32 reg; | ||
740 | |||
741 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
742 | reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; | ||
743 | core_writel(priv, reg, CORE_WATCHDOG_CTRL); | ||
744 | |||
745 | do { | ||
746 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
747 | if (!(reg & SOFTWARE_RESET)) | ||
748 | break; | ||
749 | |||
750 | usleep_range(1000, 2000); | ||
751 | } while (timeout-- > 0); | ||
752 | |||
753 | if (timeout == 0) | ||
754 | return -ETIMEDOUT; | ||
755 | |||
756 | return 0; | ||
757 | } | ||
758 | |||
759 | static int bcm_sf2_sw_resume(struct dsa_switch *ds) | 767 | static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
760 | { | 768 | { |
761 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | 769 | struct bcm_sf2_priv *priv = ds_to_priv(ds); |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index 63ea1941e973..7ba83ffb08ac 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | |||
@@ -575,10 +575,24 @@ static void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata) | |||
575 | xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN); | 575 | xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN); |
576 | } | 576 | } |
577 | 577 | ||
578 | static void xgene_enet_reset(struct xgene_enet_pdata *pdata) | 578 | bool xgene_ring_mgr_init(struct xgene_enet_pdata *p) |
579 | { | ||
580 | if (!ioread32(p->ring_csr_addr + CLKEN_ADDR)) | ||
581 | return false; | ||
582 | |||
583 | if (ioread32(p->ring_csr_addr + SRST_ADDR)) | ||
584 | return false; | ||
585 | |||
586 | return true; | ||
587 | } | ||
588 | |||
589 | static int xgene_enet_reset(struct xgene_enet_pdata *pdata) | ||
579 | { | 590 | { |
580 | u32 val; | 591 | u32 val; |
581 | 592 | ||
593 | if (!xgene_ring_mgr_init(pdata)) | ||
594 | return -ENODEV; | ||
595 | |||
582 | clk_prepare_enable(pdata->clk); | 596 | clk_prepare_enable(pdata->clk); |
583 | clk_disable_unprepare(pdata->clk); | 597 | clk_disable_unprepare(pdata->clk); |
584 | clk_prepare_enable(pdata->clk); | 598 | clk_prepare_enable(pdata->clk); |
@@ -590,6 +604,8 @@ static void xgene_enet_reset(struct xgene_enet_pdata *pdata) | |||
590 | val |= SCAN_AUTO_INCR; | 604 | val |= SCAN_AUTO_INCR; |
591 | MGMT_CLOCK_SEL_SET(&val, 1); | 605 | MGMT_CLOCK_SEL_SET(&val, 1); |
592 | xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val); | 606 | xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val); |
607 | |||
608 | return 0; | ||
593 | } | 609 | } |
594 | 610 | ||
595 | static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata) | 611 | static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata) |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h index 38558584080e..ec45f3256f0e 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | |||
@@ -104,6 +104,9 @@ enum xgene_enet_rm { | |||
104 | #define BLOCK_ETH_MAC_OFFSET 0x0000 | 104 | #define BLOCK_ETH_MAC_OFFSET 0x0000 |
105 | #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800 | 105 | #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800 |
106 | 106 | ||
107 | #define CLKEN_ADDR 0xc208 | ||
108 | #define SRST_ADDR 0xc200 | ||
109 | |||
107 | #define MAC_ADDR_REG_OFFSET 0x00 | 110 | #define MAC_ADDR_REG_OFFSET 0x00 |
108 | #define MAC_COMMAND_REG_OFFSET 0x04 | 111 | #define MAC_COMMAND_REG_OFFSET 0x04 |
109 | #define MAC_WRITE_REG_OFFSET 0x08 | 112 | #define MAC_WRITE_REG_OFFSET 0x08 |
@@ -318,6 +321,7 @@ void xgene_enet_parse_error(struct xgene_enet_desc_ring *ring, | |||
318 | 321 | ||
319 | int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata); | 322 | int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata); |
320 | void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata); | 323 | void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata); |
324 | bool xgene_ring_mgr_init(struct xgene_enet_pdata *p); | ||
321 | 325 | ||
322 | extern struct xgene_mac_ops xgene_gmac_ops; | 326 | extern struct xgene_mac_ops xgene_gmac_ops; |
323 | extern struct xgene_port_ops xgene_gport_ops; | 327 | extern struct xgene_port_ops xgene_gport_ops; |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 3c208cc6f6bb..123669696184 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c | |||
@@ -639,9 +639,9 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) | |||
639 | struct device *dev = ndev_to_dev(ndev); | 639 | struct device *dev = ndev_to_dev(ndev); |
640 | struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring; | 640 | struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring; |
641 | struct xgene_enet_desc_ring *buf_pool = NULL; | 641 | struct xgene_enet_desc_ring *buf_pool = NULL; |
642 | u8 cpu_bufnum = 0, eth_bufnum = 0; | 642 | u8 cpu_bufnum = 0, eth_bufnum = START_ETH_BUFNUM; |
643 | u8 bp_bufnum = 0x20; | 643 | u8 bp_bufnum = START_BP_BUFNUM; |
644 | u16 ring_id, ring_num = 0; | 644 | u16 ring_id, ring_num = START_RING_NUM; |
645 | int ret; | 645 | int ret; |
646 | 646 | ||
647 | /* allocate rx descriptor ring */ | 647 | /* allocate rx descriptor ring */ |
@@ -852,7 +852,9 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata) | |||
852 | u16 dst_ring_num; | 852 | u16 dst_ring_num; |
853 | int ret; | 853 | int ret; |
854 | 854 | ||
855 | pdata->port_ops->reset(pdata); | 855 | ret = pdata->port_ops->reset(pdata); |
856 | if (ret) | ||
857 | return ret; | ||
856 | 858 | ||
857 | ret = xgene_enet_create_desc_rings(ndev); | 859 | ret = xgene_enet_create_desc_rings(ndev); |
858 | if (ret) { | 860 | if (ret) { |
@@ -954,6 +956,7 @@ static int xgene_enet_probe(struct platform_device *pdev) | |||
954 | 956 | ||
955 | return ret; | 957 | return ret; |
956 | err: | 958 | err: |
959 | unregister_netdev(ndev); | ||
957 | free_netdev(ndev); | 960 | free_netdev(ndev); |
958 | return ret; | 961 | return ret; |
959 | } | 962 | } |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h index 874e5a01161f..f9958fae6ffd 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h | |||
@@ -38,6 +38,9 @@ | |||
38 | #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) | 38 | #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) |
39 | #define NUM_PKT_BUF 64 | 39 | #define NUM_PKT_BUF 64 |
40 | #define NUM_BUFPOOL 32 | 40 | #define NUM_BUFPOOL 32 |
41 | #define START_ETH_BUFNUM 2 | ||
42 | #define START_BP_BUFNUM 0x22 | ||
43 | #define START_RING_NUM 8 | ||
41 | 44 | ||
42 | #define PHY_POLL_LINK_ON (10 * HZ) | 45 | #define PHY_POLL_LINK_ON (10 * HZ) |
43 | #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) | 46 | #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) |
@@ -83,7 +86,7 @@ struct xgene_mac_ops { | |||
83 | }; | 86 | }; |
84 | 87 | ||
85 | struct xgene_port_ops { | 88 | struct xgene_port_ops { |
86 | void (*reset)(struct xgene_enet_pdata *pdata); | 89 | int (*reset)(struct xgene_enet_pdata *pdata); |
87 | void (*cle_bypass)(struct xgene_enet_pdata *pdata, | 90 | void (*cle_bypass)(struct xgene_enet_pdata *pdata, |
88 | u32 dst_ring_num, u16 bufpool_id); | 91 | u32 dst_ring_num, u16 bufpool_id); |
89 | void (*shutdown)(struct xgene_enet_pdata *pdata); | 92 | void (*shutdown)(struct xgene_enet_pdata *pdata); |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c index c22f32622fa9..f5d4f68c288c 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | |||
@@ -311,14 +311,19 @@ static void xgene_sgmac_tx_disable(struct xgene_enet_pdata *p) | |||
311 | xgene_sgmac_rxtx(p, TX_EN, false); | 311 | xgene_sgmac_rxtx(p, TX_EN, false); |
312 | } | 312 | } |
313 | 313 | ||
314 | static void xgene_enet_reset(struct xgene_enet_pdata *p) | 314 | static int xgene_enet_reset(struct xgene_enet_pdata *p) |
315 | { | 315 | { |
316 | if (!xgene_ring_mgr_init(p)) | ||
317 | return -ENODEV; | ||
318 | |||
316 | clk_prepare_enable(p->clk); | 319 | clk_prepare_enable(p->clk); |
317 | clk_disable_unprepare(p->clk); | 320 | clk_disable_unprepare(p->clk); |
318 | clk_prepare_enable(p->clk); | 321 | clk_prepare_enable(p->clk); |
319 | 322 | ||
320 | xgene_enet_ecc_init(p); | 323 | xgene_enet_ecc_init(p); |
321 | xgene_enet_config_ring_if_assoc(p); | 324 | xgene_enet_config_ring_if_assoc(p); |
325 | |||
326 | return 0; | ||
322 | } | 327 | } |
323 | 328 | ||
324 | static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p, | 329 | static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p, |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c index 67d07206b3c7..a18a9d1f1143 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | |||
@@ -252,14 +252,19 @@ static void xgene_xgmac_tx_disable(struct xgene_enet_pdata *pdata) | |||
252 | xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN); | 252 | xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN); |
253 | } | 253 | } |
254 | 254 | ||
255 | static void xgene_enet_reset(struct xgene_enet_pdata *pdata) | 255 | static int xgene_enet_reset(struct xgene_enet_pdata *pdata) |
256 | { | 256 | { |
257 | if (!xgene_ring_mgr_init(pdata)) | ||
258 | return -ENODEV; | ||
259 | |||
257 | clk_prepare_enable(pdata->clk); | 260 | clk_prepare_enable(pdata->clk); |
258 | clk_disable_unprepare(pdata->clk); | 261 | clk_disable_unprepare(pdata->clk); |
259 | clk_prepare_enable(pdata->clk); | 262 | clk_prepare_enable(pdata->clk); |
260 | 263 | ||
261 | xgene_enet_ecc_init(pdata); | 264 | xgene_enet_ecc_init(pdata); |
262 | xgene_enet_config_ring_if_assoc(pdata); | 265 | xgene_enet_config_ring_if_assoc(pdata); |
266 | |||
267 | return 0; | ||
263 | } | 268 | } |
264 | 269 | ||
265 | static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata, | 270 | static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata, |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 3a6778a667f4..531bb7c57531 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1110,7 +1110,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, | |||
1110 | /* We just need one DMA descriptor which is DMA-able, since writing to | 1110 | /* We just need one DMA descriptor which is DMA-able, since writing to |
1111 | * the port will allocate a new descriptor in its internal linked-list | 1111 | * the port will allocate a new descriptor in its internal linked-list |
1112 | */ | 1112 | */ |
1113 | p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL); | 1113 | p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, |
1114 | GFP_KERNEL); | ||
1114 | if (!p) { | 1115 | if (!p) { |
1115 | netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); | 1116 | netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); |
1116 | return -ENOMEM; | 1117 | return -ENOMEM; |
@@ -1174,6 +1175,13 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv, | |||
1174 | if (!(reg & TDMA_DISABLED)) | 1175 | if (!(reg & TDMA_DISABLED)) |
1175 | netdev_warn(priv->netdev, "TDMA not stopped!\n"); | 1176 | netdev_warn(priv->netdev, "TDMA not stopped!\n"); |
1176 | 1177 | ||
1178 | /* ring->cbs is the last part in bcm_sysport_init_tx_ring which could | ||
1179 | * fail, so by checking this pointer we know whether the TX ring was | ||
1180 | * fully initialized or not. | ||
1181 | */ | ||
1182 | if (!ring->cbs) | ||
1183 | return; | ||
1184 | |||
1177 | napi_disable(&ring->napi); | 1185 | napi_disable(&ring->napi); |
1178 | netif_napi_del(&ring->napi); | 1186 | netif_napi_del(&ring->napi); |
1179 | 1187 | ||
@@ -1183,7 +1191,8 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv, | |||
1183 | ring->cbs = NULL; | 1191 | ring->cbs = NULL; |
1184 | 1192 | ||
1185 | if (ring->desc_dma) { | 1193 | if (ring->desc_dma) { |
1186 | dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma); | 1194 | dma_free_coherent(kdev, sizeof(struct dma_desc), |
1195 | ring->desc_cpu, ring->desc_dma); | ||
1187 | ring->desc_dma = 0; | 1196 | ring->desc_dma = 0; |
1188 | } | 1197 | } |
1189 | ring->size = 0; | 1198 | ring->size = 0; |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index fdc9ec09e453..da1a2500c91c 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -2140,6 +2140,12 @@ static int bcmgenet_open(struct net_device *dev) | |||
2140 | goto err_irq0; | 2140 | goto err_irq0; |
2141 | } | 2141 | } |
2142 | 2142 | ||
2143 | /* Re-configure the port multiplexer towards the PHY device */ | ||
2144 | bcmgenet_mii_config(priv->dev, false); | ||
2145 | |||
2146 | phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup, | ||
2147 | priv->phy_interface); | ||
2148 | |||
2143 | bcmgenet_netif_start(dev); | 2149 | bcmgenet_netif_start(dev); |
2144 | 2150 | ||
2145 | return 0; | 2151 | return 0; |
@@ -2184,6 +2190,9 @@ static int bcmgenet_close(struct net_device *dev) | |||
2184 | 2190 | ||
2185 | bcmgenet_netif_stop(dev); | 2191 | bcmgenet_netif_stop(dev); |
2186 | 2192 | ||
2193 | /* Really kill the PHY state machine and disconnect from it */ | ||
2194 | phy_disconnect(priv->phydev); | ||
2195 | |||
2187 | /* Disable MAC receive */ | 2196 | /* Disable MAC receive */ |
2188 | umac_enable_set(priv, CMD_RX_EN, false); | 2197 | umac_enable_set(priv, CMD_RX_EN, false); |
2189 | 2198 | ||
@@ -2685,7 +2694,7 @@ static int bcmgenet_resume(struct device *d) | |||
2685 | 2694 | ||
2686 | phy_init_hw(priv->phydev); | 2695 | phy_init_hw(priv->phydev); |
2687 | /* Speed settings must be restored */ | 2696 | /* Speed settings must be restored */ |
2688 | bcmgenet_mii_config(priv->dev); | 2697 | bcmgenet_mii_config(priv->dev, false); |
2689 | 2698 | ||
2690 | /* disable ethernet MAC while updating its registers */ | 2699 | /* disable ethernet MAC while updating its registers */ |
2691 | umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); | 2700 | umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index dbf524ea3b19..31b2da5f9b82 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
@@ -617,9 +617,10 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF); | |||
617 | 617 | ||
618 | /* MDIO routines */ | 618 | /* MDIO routines */ |
619 | int bcmgenet_mii_init(struct net_device *dev); | 619 | int bcmgenet_mii_init(struct net_device *dev); |
620 | int bcmgenet_mii_config(struct net_device *dev); | 620 | int bcmgenet_mii_config(struct net_device *dev, bool init); |
621 | void bcmgenet_mii_exit(struct net_device *dev); | 621 | void bcmgenet_mii_exit(struct net_device *dev); |
622 | void bcmgenet_mii_reset(struct net_device *dev); | 622 | void bcmgenet_mii_reset(struct net_device *dev); |
623 | void bcmgenet_mii_setup(struct net_device *dev); | ||
623 | 624 | ||
624 | /* Wake-on-LAN routines */ | 625 | /* Wake-on-LAN routines */ |
625 | void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol); | 626 | void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 9ff799a9f801..933cd7e7cd33 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c | |||
@@ -77,7 +77,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id, | |||
77 | /* setup netdev link state when PHY link status change and | 77 | /* setup netdev link state when PHY link status change and |
78 | * update UMAC and RGMII block when link up | 78 | * update UMAC and RGMII block when link up |
79 | */ | 79 | */ |
80 | static void bcmgenet_mii_setup(struct net_device *dev) | 80 | void bcmgenet_mii_setup(struct net_device *dev) |
81 | { | 81 | { |
82 | struct bcmgenet_priv *priv = netdev_priv(dev); | 82 | struct bcmgenet_priv *priv = netdev_priv(dev); |
83 | struct phy_device *phydev = priv->phydev; | 83 | struct phy_device *phydev = priv->phydev; |
@@ -211,7 +211,7 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) | |||
211 | bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL); | 211 | bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL); |
212 | } | 212 | } |
213 | 213 | ||
214 | int bcmgenet_mii_config(struct net_device *dev) | 214 | int bcmgenet_mii_config(struct net_device *dev, bool init) |
215 | { | 215 | { |
216 | struct bcmgenet_priv *priv = netdev_priv(dev); | 216 | struct bcmgenet_priv *priv = netdev_priv(dev); |
217 | struct phy_device *phydev = priv->phydev; | 217 | struct phy_device *phydev = priv->phydev; |
@@ -298,7 +298,8 @@ int bcmgenet_mii_config(struct net_device *dev) | |||
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | } | 299 | } |
300 | 300 | ||
301 | dev_info(kdev, "configuring instance for %s\n", phy_name); | 301 | if (init) |
302 | dev_info(kdev, "configuring instance for %s\n", phy_name); | ||
302 | 303 | ||
303 | return 0; | 304 | return 0; |
304 | } | 305 | } |
@@ -350,7 +351,7 @@ static int bcmgenet_mii_probe(struct net_device *dev) | |||
350 | * PHY speed which is needed for bcmgenet_mii_config() to configure | 351 | * PHY speed which is needed for bcmgenet_mii_config() to configure |
351 | * things appropriately. | 352 | * things appropriately. |
352 | */ | 353 | */ |
353 | ret = bcmgenet_mii_config(dev); | 354 | ret = bcmgenet_mii_config(dev, true); |
354 | if (ret) { | 355 | if (ret) { |
355 | phy_disconnect(priv->phydev); | 356 | phy_disconnect(priv->phydev); |
356 | return ret; | 357 | return ret; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index dbb41c1923e6..77f8f836cbbe 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8563,7 +8563,8 @@ static int tg3_init_rings(struct tg3 *tp) | |||
8563 | if (tnapi->rx_rcb) | 8563 | if (tnapi->rx_rcb) |
8564 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); | 8564 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); |
8565 | 8565 | ||
8566 | if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { | 8566 | if (tnapi->prodring.rx_std && |
8567 | tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { | ||
8567 | tg3_free_rings(tp); | 8568 | tg3_free_rings(tp); |
8568 | return -ENOMEM; | 8569 | return -ENOMEM; |
8569 | } | 8570 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c index 6fe300e316c3..4fe33606f372 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | |||
@@ -79,8 +79,9 @@ static void cxgb4_dcb_cleanup_apps(struct net_device *dev) | |||
79 | app.protocol = dcb->app_priority[i].protocolid; | 79 | app.protocol = dcb->app_priority[i].protocolid; |
80 | 80 | ||
81 | if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { | 81 | if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { |
82 | app.priority = dcb->app_priority[i].user_prio_map; | ||
82 | app.selector = dcb->app_priority[i].sel_field + 1; | 83 | app.selector = dcb->app_priority[i].sel_field + 1; |
83 | err = dcb_ieee_setapp(dev, &app); | 84 | err = dcb_ieee_delapp(dev, &app); |
84 | } else { | 85 | } else { |
85 | app.selector = !!(dcb->app_priority[i].sel_field); | 86 | app.selector = !!(dcb->app_priority[i].sel_field); |
86 | err = dcb_setapp(dev, &app); | 87 | err = dcb_setapp(dev, &app); |
@@ -122,7 +123,11 @@ void cxgb4_dcb_state_fsm(struct net_device *dev, | |||
122 | case CXGB4_DCB_INPUT_FW_ENABLED: { | 123 | case CXGB4_DCB_INPUT_FW_ENABLED: { |
123 | /* we're going to use Firmware DCB */ | 124 | /* we're going to use Firmware DCB */ |
124 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; | 125 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; |
125 | dcb->supported = CXGB4_DCBX_FW_SUPPORT; | 126 | dcb->supported = DCB_CAP_DCBX_LLD_MANAGED; |
127 | if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) | ||
128 | dcb->supported |= DCB_CAP_DCBX_VER_IEEE; | ||
129 | else | ||
130 | dcb->supported |= DCB_CAP_DCBX_VER_CEE; | ||
126 | break; | 131 | break; |
127 | } | 132 | } |
128 | 133 | ||
@@ -436,14 +441,17 @@ static void cxgb4_getpgtccfg(struct net_device *dev, int tc, | |||
436 | *up_tc_map = (1 << tc); | 441 | *up_tc_map = (1 << tc); |
437 | 442 | ||
438 | /* prio_type is link strict */ | 443 | /* prio_type is link strict */ |
439 | *prio_type = 0x2; | 444 | if (*pgid != 0xF) |
445 | *prio_type = 0x2; | ||
440 | } | 446 | } |
441 | 447 | ||
442 | static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc, | 448 | static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc, |
443 | u8 *prio_type, u8 *pgid, u8 *bw_per, | 449 | u8 *prio_type, u8 *pgid, u8 *bw_per, |
444 | u8 *up_tc_map) | 450 | u8 *up_tc_map) |
445 | { | 451 | { |
446 | return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 1); | 452 | /* tc 0 is written at MSB position */ |
453 | return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, | ||
454 | up_tc_map, 1); | ||
447 | } | 455 | } |
448 | 456 | ||
449 | 457 | ||
@@ -451,7 +459,9 @@ static void cxgb4_getpgtccfg_rx(struct net_device *dev, int tc, | |||
451 | u8 *prio_type, u8 *pgid, u8 *bw_per, | 459 | u8 *prio_type, u8 *pgid, u8 *bw_per, |
452 | u8 *up_tc_map) | 460 | u8 *up_tc_map) |
453 | { | 461 | { |
454 | return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 0); | 462 | /* tc 0 is written at MSB position */ |
463 | return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, | ||
464 | up_tc_map, 0); | ||
455 | } | 465 | } |
456 | 466 | ||
457 | static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, | 467 | static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, |
@@ -461,6 +471,7 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, | |||
461 | struct fw_port_cmd pcmd; | 471 | struct fw_port_cmd pcmd; |
462 | struct port_info *pi = netdev2pinfo(dev); | 472 | struct port_info *pi = netdev2pinfo(dev); |
463 | struct adapter *adap = pi->adapter; | 473 | struct adapter *adap = pi->adapter; |
474 | int fw_tc = 7 - tc; | ||
464 | u32 _pgid; | 475 | u32 _pgid; |
465 | int err; | 476 | int err; |
466 | 477 | ||
@@ -479,8 +490,8 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, | |||
479 | } | 490 | } |
480 | 491 | ||
481 | _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | 492 | _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); |
482 | _pgid &= ~(0xF << (tc * 4)); | 493 | _pgid &= ~(0xF << (fw_tc * 4)); |
483 | _pgid |= pgid << (tc * 4); | 494 | _pgid |= pgid << (fw_tc * 4); |
484 | pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid); | 495 | pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid); |
485 | 496 | ||
486 | INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); | 497 | INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); |
@@ -593,7 +604,7 @@ static void cxgb4_getpfccfg(struct net_device *dev, int priority, u8 *pfccfg) | |||
593 | priority >= CXGB4_MAX_PRIORITY) | 604 | priority >= CXGB4_MAX_PRIORITY) |
594 | *pfccfg = 0; | 605 | *pfccfg = 0; |
595 | else | 606 | else |
596 | *pfccfg = (pi->dcb.pfcen >> priority) & 1; | 607 | *pfccfg = (pi->dcb.pfcen >> (7 - priority)) & 1; |
597 | } | 608 | } |
598 | 609 | ||
599 | /* Enable/disable Priority Pause Frames for the specified Traffic Class | 610 | /* Enable/disable Priority Pause Frames for the specified Traffic Class |
@@ -618,9 +629,9 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg) | |||
618 | pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; | 629 | pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; |
619 | 630 | ||
620 | if (pfccfg) | 631 | if (pfccfg) |
621 | pcmd.u.dcb.pfc.pfcen |= (1 << priority); | 632 | pcmd.u.dcb.pfc.pfcen |= (1 << (7 - priority)); |
622 | else | 633 | else |
623 | pcmd.u.dcb.pfc.pfcen &= (~(1 << priority)); | 634 | pcmd.u.dcb.pfc.pfcen &= (~(1 << (7 - priority))); |
624 | 635 | ||
625 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); | 636 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); |
626 | if (err != FW_PORT_DCB_CFG_SUCCESS) { | 637 | if (err != FW_PORT_DCB_CFG_SUCCESS) { |
@@ -1071,7 +1082,7 @@ static int cxgb4_cee_peer_getpg(struct net_device *dev, struct cee_pg *pg) | |||
1071 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | 1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); |
1072 | 1083 | ||
1073 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) | 1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) |
1074 | pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; | 1085 | pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; |
1075 | 1086 | ||
1076 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | 1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); |
1077 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; | 1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index 5e1b314e11af..39f2b13e66c7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -2914,7 +2914,8 @@ static int t4_sge_init_hard(struct adapter *adap) | |||
2914 | int t4_sge_init(struct adapter *adap) | 2914 | int t4_sge_init(struct adapter *adap) |
2915 | { | 2915 | { |
2916 | struct sge *s = &adap->sge; | 2916 | struct sge *s = &adap->sge; |
2917 | u32 sge_control, sge_conm_ctrl; | 2917 | u32 sge_control, sge_control2, sge_conm_ctrl; |
2918 | unsigned int ingpadboundary, ingpackboundary; | ||
2918 | int ret, egress_threshold; | 2919 | int ret, egress_threshold; |
2919 | 2920 | ||
2920 | /* | 2921 | /* |
@@ -2924,8 +2925,31 @@ int t4_sge_init(struct adapter *adap) | |||
2924 | sge_control = t4_read_reg(adap, SGE_CONTROL); | 2925 | sge_control = t4_read_reg(adap, SGE_CONTROL); |
2925 | s->pktshift = PKTSHIFT_GET(sge_control); | 2926 | s->pktshift = PKTSHIFT_GET(sge_control); |
2926 | s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; | 2927 | s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; |
2927 | s->fl_align = 1 << (INGPADBOUNDARY_GET(sge_control) + | 2928 | |
2928 | X_INGPADBOUNDARY_SHIFT); | 2929 | /* T4 uses a single control field to specify both the PCIe Padding and |
2930 | * Packing Boundary. T5 introduced the ability to specify these | ||
2931 | * separately. The actual Ingress Packet Data alignment boundary | ||
2932 | * within Packed Buffer Mode is the maximum of these two | ||
2933 | * specifications. | ||
2934 | */ | ||
2935 | ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_control) + | ||
2936 | X_INGPADBOUNDARY_SHIFT); | ||
2937 | if (is_t4(adap->params.chip)) { | ||
2938 | s->fl_align = ingpadboundary; | ||
2939 | } else { | ||
2940 | /* T5 has a different interpretation of one of the PCIe Packing | ||
2941 | * Boundary values. | ||
2942 | */ | ||
2943 | sge_control2 = t4_read_reg(adap, SGE_CONTROL2_A); | ||
2944 | ingpackboundary = INGPACKBOUNDARY_G(sge_control2); | ||
2945 | if (ingpackboundary == INGPACKBOUNDARY_16B_X) | ||
2946 | ingpackboundary = 16; | ||
2947 | else | ||
2948 | ingpackboundary = 1 << (ingpackboundary + | ||
2949 | INGPACKBOUNDARY_SHIFT_X); | ||
2950 | |||
2951 | s->fl_align = max(ingpadboundary, ingpackboundary); | ||
2952 | } | ||
2929 | 2953 | ||
2930 | if (adap->flags & USING_SOFT_PARAMS) | 2954 | if (adap->flags & USING_SOFT_PARAMS) |
2931 | ret = t4_sge_init_soft(adap); | 2955 | ret = t4_sge_init_soft(adap); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index a9d9d74e4f09..163a2a14948c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -3129,12 +3129,51 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size, | |||
3129 | HOSTPAGESIZEPF6(sge_hps) | | 3129 | HOSTPAGESIZEPF6(sge_hps) | |
3130 | HOSTPAGESIZEPF7(sge_hps)); | 3130 | HOSTPAGESIZEPF7(sge_hps)); |
3131 | 3131 | ||
3132 | t4_set_reg_field(adap, SGE_CONTROL, | 3132 | if (is_t4(adap->params.chip)) { |
3133 | INGPADBOUNDARY_MASK | | 3133 | t4_set_reg_field(adap, SGE_CONTROL, |
3134 | EGRSTATUSPAGESIZE_MASK, | 3134 | INGPADBOUNDARY_MASK | |
3135 | INGPADBOUNDARY(fl_align_log - 5) | | 3135 | EGRSTATUSPAGESIZE_MASK, |
3136 | EGRSTATUSPAGESIZE(stat_len != 64)); | 3136 | INGPADBOUNDARY(fl_align_log - 5) | |
3137 | 3137 | EGRSTATUSPAGESIZE(stat_len != 64)); | |
3138 | } else { | ||
3139 | /* T5 introduced the separation of the Free List Padding and | ||
3140 | * Packing Boundaries. Thus, we can select a smaller Padding | ||
3141 | * Boundary to avoid uselessly chewing up PCIe Link and Memory | ||
3142 | * Bandwidth, and use a Packing Boundary which is large enough | ||
3143 | * to avoid false sharing between CPUs, etc. | ||
3144 | * | ||
3145 | * For the PCI Link, the smaller the Padding Boundary the | ||
3146 | * better. For the Memory Controller, a smaller Padding | ||
3147 | * Boundary is better until we cross under the Memory Line | ||
3148 | * Size (the minimum unit of transfer to/from Memory). If we | ||
3149 | * have a Padding Boundary which is smaller than the Memory | ||
3150 | * Line Size, that'll involve a Read-Modify-Write cycle on the | ||
3151 | * Memory Controller which is never good. For T5 the smallest | ||
3152 | * Padding Boundary which we can select is 32 bytes which is | ||
3153 | * larger than any known Memory Controller Line Size so we'll | ||
3154 | * use that. | ||
3155 | * | ||
3156 | * T5 has a different interpretation of the "0" value for the | ||
3157 | * Packing Boundary. This corresponds to 16 bytes instead of | ||
3158 | * the expected 32 bytes. We never have a Packing Boundary | ||
3159 | * less than 32 bytes so we can't use that special value but | ||
3160 | * on the other hand, if we wanted 32 bytes, the best we can | ||
3161 | * really do is 64 bytes. | ||
3162 | */ | ||
3163 | if (fl_align <= 32) { | ||
3164 | fl_align = 64; | ||
3165 | fl_align_log = 6; | ||
3166 | } | ||
3167 | t4_set_reg_field(adap, SGE_CONTROL, | ||
3168 | INGPADBOUNDARY_MASK | | ||
3169 | EGRSTATUSPAGESIZE_MASK, | ||
3170 | INGPADBOUNDARY(INGPCIEBOUNDARY_32B_X) | | ||
3171 | EGRSTATUSPAGESIZE(stat_len != 64)); | ||
3172 | t4_set_reg_field(adap, SGE_CONTROL2_A, | ||
3173 | INGPACKBOUNDARY_V(INGPACKBOUNDARY_M), | ||
3174 | INGPACKBOUNDARY_V(fl_align_log - | ||
3175 | INGPACKBOUNDARY_SHIFT_X)); | ||
3176 | } | ||
3138 | /* | 3177 | /* |
3139 | * Adjust various SGE Free List Host Buffer Sizes. | 3178 | * Adjust various SGE Free List Host Buffer Sizes. |
3140 | * | 3179 | * |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index a1024db5dc13..8d2de1006b08 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -95,6 +95,7 @@ | |||
95 | #define X_INGPADBOUNDARY_SHIFT 5 | 95 | #define X_INGPADBOUNDARY_SHIFT 5 |
96 | 96 | ||
97 | #define SGE_CONTROL 0x1008 | 97 | #define SGE_CONTROL 0x1008 |
98 | #define SGE_CONTROL2_A 0x1124 | ||
98 | #define DCASYSTYPE 0x00080000U | 99 | #define DCASYSTYPE 0x00080000U |
99 | #define RXPKTCPLMODE_MASK 0x00040000U | 100 | #define RXPKTCPLMODE_MASK 0x00040000U |
100 | #define RXPKTCPLMODE_SHIFT 18 | 101 | #define RXPKTCPLMODE_SHIFT 18 |
@@ -106,6 +107,7 @@ | |||
106 | #define PKTSHIFT_SHIFT 10 | 107 | #define PKTSHIFT_SHIFT 10 |
107 | #define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT) | 108 | #define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT) |
108 | #define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT) | 109 | #define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT) |
110 | #define INGPCIEBOUNDARY_32B_X 0 | ||
109 | #define INGPCIEBOUNDARY_MASK 0x00000380U | 111 | #define INGPCIEBOUNDARY_MASK 0x00000380U |
110 | #define INGPCIEBOUNDARY_SHIFT 7 | 112 | #define INGPCIEBOUNDARY_SHIFT 7 |
111 | #define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT) | 113 | #define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT) |
@@ -114,6 +116,14 @@ | |||
114 | #define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT) | 116 | #define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT) |
115 | #define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \ | 117 | #define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \ |
116 | >> INGPADBOUNDARY_SHIFT) | 118 | >> INGPADBOUNDARY_SHIFT) |
119 | #define INGPACKBOUNDARY_16B_X 0 | ||
120 | #define INGPACKBOUNDARY_SHIFT_X 5 | ||
121 | |||
122 | #define INGPACKBOUNDARY_S 16 | ||
123 | #define INGPACKBOUNDARY_M 0x7U | ||
124 | #define INGPACKBOUNDARY_V(x) ((x) << INGPACKBOUNDARY_S) | ||
125 | #define INGPACKBOUNDARY_G(x) (((x) >> INGPACKBOUNDARY_S) \ | ||
126 | & INGPACKBOUNDARY_M) | ||
117 | #define EGRPCIEBOUNDARY_MASK 0x0000000eU | 127 | #define EGRPCIEBOUNDARY_MASK 0x0000000eU |
118 | #define EGRPCIEBOUNDARY_SHIFT 1 | 128 | #define EGRPCIEBOUNDARY_SHIFT 1 |
119 | #define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT) | 129 | #define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h index 68eaa9c88c7d..3d06e77d7121 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | |||
@@ -299,6 +299,14 @@ struct sge { | |||
299 | u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */ | 299 | u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */ |
300 | u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */ | 300 | u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */ |
301 | 301 | ||
302 | /* Decoded Adapter Parameters. | ||
303 | */ | ||
304 | u32 fl_pg_order; /* large page allocation size */ | ||
305 | u32 stat_len; /* length of status page at ring end */ | ||
306 | u32 pktshift; /* padding between CPL & packet data */ | ||
307 | u32 fl_align; /* response queue message alignment */ | ||
308 | u32 fl_starve_thres; /* Free List starvation threshold */ | ||
309 | |||
302 | /* | 310 | /* |
303 | * Reverse maps from Absolute Queue IDs to associated queue pointers. | 311 | * Reverse maps from Absolute Queue IDs to associated queue pointers. |
304 | * The absolute Queue IDs are in a compact range which start at a | 312 | * The absolute Queue IDs are in a compact range which start at a |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 85036e6b42c4..fdd078d7d82c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -51,14 +51,6 @@ | |||
51 | #include "../cxgb4/t4_msg.h" | 51 | #include "../cxgb4/t4_msg.h" |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Decoded Adapter Parameters. | ||
55 | */ | ||
56 | static u32 FL_PG_ORDER; /* large page allocation size */ | ||
57 | static u32 STAT_LEN; /* length of status page at ring end */ | ||
58 | static u32 PKTSHIFT; /* padding between CPL and packet data */ | ||
59 | static u32 FL_ALIGN; /* response queue message alignment */ | ||
60 | |||
61 | /* | ||
62 | * Constants ... | 54 | * Constants ... |
63 | */ | 55 | */ |
64 | enum { | 56 | enum { |
@@ -102,12 +94,6 @@ enum { | |||
102 | MAX_TIMER_TX_RECLAIM = 100, | 94 | MAX_TIMER_TX_RECLAIM = 100, |
103 | 95 | ||
104 | /* | 96 | /* |
105 | * An FL with <= FL_STARVE_THRES buffers is starving and a periodic | ||
106 | * timer will attempt to refill it. | ||
107 | */ | ||
108 | FL_STARVE_THRES = 4, | ||
109 | |||
110 | /* | ||
111 | * Suspend an Ethernet TX queue with fewer available descriptors than | 97 | * Suspend an Ethernet TX queue with fewer available descriptors than |
112 | * this. We always want to have room for a maximum sized packet: | 98 | * this. We always want to have room for a maximum sized packet: |
113 | * inline immediate data + MAX_SKB_FRAGS. This is the same as | 99 | * inline immediate data + MAX_SKB_FRAGS. This is the same as |
@@ -264,15 +250,19 @@ static inline unsigned int fl_cap(const struct sge_fl *fl) | |||
264 | 250 | ||
265 | /** | 251 | /** |
266 | * fl_starving - return whether a Free List is starving. | 252 | * fl_starving - return whether a Free List is starving. |
253 | * @adapter: pointer to the adapter | ||
267 | * @fl: the Free List | 254 | * @fl: the Free List |
268 | * | 255 | * |
269 | * Tests specified Free List to see whether the number of buffers | 256 | * Tests specified Free List to see whether the number of buffers |
270 | * available to the hardware has falled below our "starvation" | 257 | * available to the hardware has falled below our "starvation" |
271 | * threshold. | 258 | * threshold. |
272 | */ | 259 | */ |
273 | static inline bool fl_starving(const struct sge_fl *fl) | 260 | static inline bool fl_starving(const struct adapter *adapter, |
261 | const struct sge_fl *fl) | ||
274 | { | 262 | { |
275 | return fl->avail - fl->pend_cred <= FL_STARVE_THRES; | 263 | const struct sge *s = &adapter->sge; |
264 | |||
265 | return fl->avail - fl->pend_cred <= s->fl_starve_thres; | ||
276 | } | 266 | } |
277 | 267 | ||
278 | /** | 268 | /** |
@@ -457,13 +447,16 @@ static inline void reclaim_completed_tx(struct adapter *adapter, | |||
457 | 447 | ||
458 | /** | 448 | /** |
459 | * get_buf_size - return the size of an RX Free List buffer. | 449 | * get_buf_size - return the size of an RX Free List buffer. |
450 | * @adapter: pointer to the associated adapter | ||
460 | * @sdesc: pointer to the software buffer descriptor | 451 | * @sdesc: pointer to the software buffer descriptor |
461 | */ | 452 | */ |
462 | static inline int get_buf_size(const struct rx_sw_desc *sdesc) | 453 | static inline int get_buf_size(const struct adapter *adapter, |
454 | const struct rx_sw_desc *sdesc) | ||
463 | { | 455 | { |
464 | return FL_PG_ORDER > 0 && (sdesc->dma_addr & RX_LARGE_BUF) | 456 | const struct sge *s = &adapter->sge; |
465 | ? (PAGE_SIZE << FL_PG_ORDER) | 457 | |
466 | : PAGE_SIZE; | 458 | return (s->fl_pg_order > 0 && (sdesc->dma_addr & RX_LARGE_BUF) |
459 | ? (PAGE_SIZE << s->fl_pg_order) : PAGE_SIZE); | ||
467 | } | 460 | } |
468 | 461 | ||
469 | /** | 462 | /** |
@@ -483,7 +476,8 @@ static void free_rx_bufs(struct adapter *adapter, struct sge_fl *fl, int n) | |||
483 | 476 | ||
484 | if (is_buf_mapped(sdesc)) | 477 | if (is_buf_mapped(sdesc)) |
485 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), | 478 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), |
486 | get_buf_size(sdesc), PCI_DMA_FROMDEVICE); | 479 | get_buf_size(adapter, sdesc), |
480 | PCI_DMA_FROMDEVICE); | ||
487 | put_page(sdesc->page); | 481 | put_page(sdesc->page); |
488 | sdesc->page = NULL; | 482 | sdesc->page = NULL; |
489 | if (++fl->cidx == fl->size) | 483 | if (++fl->cidx == fl->size) |
@@ -511,7 +505,8 @@ static void unmap_rx_buf(struct adapter *adapter, struct sge_fl *fl) | |||
511 | 505 | ||
512 | if (is_buf_mapped(sdesc)) | 506 | if (is_buf_mapped(sdesc)) |
513 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), | 507 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), |
514 | get_buf_size(sdesc), PCI_DMA_FROMDEVICE); | 508 | get_buf_size(adapter, sdesc), |
509 | PCI_DMA_FROMDEVICE); | ||
515 | sdesc->page = NULL; | 510 | sdesc->page = NULL; |
516 | if (++fl->cidx == fl->size) | 511 | if (++fl->cidx == fl->size) |
517 | fl->cidx = 0; | 512 | fl->cidx = 0; |
@@ -589,6 +584,7 @@ static inline void poison_buf(struct page *page, size_t sz) | |||
589 | static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | 584 | static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, |
590 | int n, gfp_t gfp) | 585 | int n, gfp_t gfp) |
591 | { | 586 | { |
587 | struct sge *s = &adapter->sge; | ||
592 | struct page *page; | 588 | struct page *page; |
593 | dma_addr_t dma_addr; | 589 | dma_addr_t dma_addr; |
594 | unsigned int cred = fl->avail; | 590 | unsigned int cred = fl->avail; |
@@ -608,12 +604,12 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | |||
608 | * If we don't support large pages, drop directly into the small page | 604 | * If we don't support large pages, drop directly into the small page |
609 | * allocation code. | 605 | * allocation code. |
610 | */ | 606 | */ |
611 | if (FL_PG_ORDER == 0) | 607 | if (s->fl_pg_order == 0) |
612 | goto alloc_small_pages; | 608 | goto alloc_small_pages; |
613 | 609 | ||
614 | while (n) { | 610 | while (n) { |
615 | page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN, | 611 | page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN, |
616 | FL_PG_ORDER); | 612 | s->fl_pg_order); |
617 | if (unlikely(!page)) { | 613 | if (unlikely(!page)) { |
618 | /* | 614 | /* |
619 | * We've failed inour attempt to allocate a "large | 615 | * We've failed inour attempt to allocate a "large |
@@ -623,10 +619,10 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | |||
623 | fl->large_alloc_failed++; | 619 | fl->large_alloc_failed++; |
624 | break; | 620 | break; |
625 | } | 621 | } |
626 | poison_buf(page, PAGE_SIZE << FL_PG_ORDER); | 622 | poison_buf(page, PAGE_SIZE << s->fl_pg_order); |
627 | 623 | ||
628 | dma_addr = dma_map_page(adapter->pdev_dev, page, 0, | 624 | dma_addr = dma_map_page(adapter->pdev_dev, page, 0, |
629 | PAGE_SIZE << FL_PG_ORDER, | 625 | PAGE_SIZE << s->fl_pg_order, |
630 | PCI_DMA_FROMDEVICE); | 626 | PCI_DMA_FROMDEVICE); |
631 | if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) { | 627 | if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) { |
632 | /* | 628 | /* |
@@ -637,7 +633,7 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | |||
637 | * because DMA mapping resources are typically | 633 | * because DMA mapping resources are typically |
638 | * critical resources once they become scarse. | 634 | * critical resources once they become scarse. |
639 | */ | 635 | */ |
640 | __free_pages(page, FL_PG_ORDER); | 636 | __free_pages(page, s->fl_pg_order); |
641 | goto out; | 637 | goto out; |
642 | } | 638 | } |
643 | dma_addr |= RX_LARGE_BUF; | 639 | dma_addr |= RX_LARGE_BUF; |
@@ -693,7 +689,7 @@ out: | |||
693 | fl->pend_cred += cred; | 689 | fl->pend_cred += cred; |
694 | ring_fl_db(adapter, fl); | 690 | ring_fl_db(adapter, fl); |
695 | 691 | ||
696 | if (unlikely(fl_starving(fl))) { | 692 | if (unlikely(fl_starving(adapter, fl))) { |
697 | smp_wmb(); | 693 | smp_wmb(); |
698 | set_bit(fl->cntxt_id, adapter->sge.starving_fl); | 694 | set_bit(fl->cntxt_id, adapter->sge.starving_fl); |
699 | } | 695 | } |
@@ -1468,6 +1464,8 @@ static void t4vf_pktgl_free(const struct pkt_gl *gl) | |||
1468 | static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, | 1464 | static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, |
1469 | const struct cpl_rx_pkt *pkt) | 1465 | const struct cpl_rx_pkt *pkt) |
1470 | { | 1466 | { |
1467 | struct adapter *adapter = rxq->rspq.adapter; | ||
1468 | struct sge *s = &adapter->sge; | ||
1471 | int ret; | 1469 | int ret; |
1472 | struct sk_buff *skb; | 1470 | struct sk_buff *skb; |
1473 | 1471 | ||
@@ -1478,8 +1476,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, | |||
1478 | return; | 1476 | return; |
1479 | } | 1477 | } |
1480 | 1478 | ||
1481 | copy_frags(skb, gl, PKTSHIFT); | 1479 | copy_frags(skb, gl, s->pktshift); |
1482 | skb->len = gl->tot_len - PKTSHIFT; | 1480 | skb->len = gl->tot_len - s->pktshift; |
1483 | skb->data_len = skb->len; | 1481 | skb->data_len = skb->len; |
1484 | skb->truesize += skb->data_len; | 1482 | skb->truesize += skb->data_len; |
1485 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1483 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1516,6 +1514,8 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp, | |||
1516 | bool csum_ok = pkt->csum_calc && !pkt->err_vec && | 1514 | bool csum_ok = pkt->csum_calc && !pkt->err_vec && |
1517 | (rspq->netdev->features & NETIF_F_RXCSUM); | 1515 | (rspq->netdev->features & NETIF_F_RXCSUM); |
1518 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); | 1516 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); |
1517 | struct adapter *adapter = rspq->adapter; | ||
1518 | struct sge *s = &adapter->sge; | ||
1519 | 1519 | ||
1520 | /* | 1520 | /* |
1521 | * If this is a good TCP packet and we have Generic Receive Offload | 1521 | * If this is a good TCP packet and we have Generic Receive Offload |
@@ -1537,7 +1537,7 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp, | |||
1537 | rxq->stats.rx_drops++; | 1537 | rxq->stats.rx_drops++; |
1538 | return 0; | 1538 | return 0; |
1539 | } | 1539 | } |
1540 | __skb_pull(skb, PKTSHIFT); | 1540 | __skb_pull(skb, s->pktshift); |
1541 | skb->protocol = eth_type_trans(skb, rspq->netdev); | 1541 | skb->protocol = eth_type_trans(skb, rspq->netdev); |
1542 | skb_record_rx_queue(skb, rspq->idx); | 1542 | skb_record_rx_queue(skb, rspq->idx); |
1543 | rxq->stats.pkts++; | 1543 | rxq->stats.pkts++; |
@@ -1648,6 +1648,8 @@ static inline void rspq_next(struct sge_rspq *rspq) | |||
1648 | static int process_responses(struct sge_rspq *rspq, int budget) | 1648 | static int process_responses(struct sge_rspq *rspq, int budget) |
1649 | { | 1649 | { |
1650 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); | 1650 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); |
1651 | struct adapter *adapter = rspq->adapter; | ||
1652 | struct sge *s = &adapter->sge; | ||
1651 | int budget_left = budget; | 1653 | int budget_left = budget; |
1652 | 1654 | ||
1653 | while (likely(budget_left)) { | 1655 | while (likely(budget_left)) { |
@@ -1697,7 +1699,7 @@ static int process_responses(struct sge_rspq *rspq, int budget) | |||
1697 | BUG_ON(frag >= MAX_SKB_FRAGS); | 1699 | BUG_ON(frag >= MAX_SKB_FRAGS); |
1698 | BUG_ON(rxq->fl.avail == 0); | 1700 | BUG_ON(rxq->fl.avail == 0); |
1699 | sdesc = &rxq->fl.sdesc[rxq->fl.cidx]; | 1701 | sdesc = &rxq->fl.sdesc[rxq->fl.cidx]; |
1700 | bufsz = get_buf_size(sdesc); | 1702 | bufsz = get_buf_size(adapter, sdesc); |
1701 | fp->page = sdesc->page; | 1703 | fp->page = sdesc->page; |
1702 | fp->offset = rspq->offset; | 1704 | fp->offset = rspq->offset; |
1703 | fp->size = min(bufsz, len); | 1705 | fp->size = min(bufsz, len); |
@@ -1726,7 +1728,7 @@ static int process_responses(struct sge_rspq *rspq, int budget) | |||
1726 | */ | 1728 | */ |
1727 | ret = rspq->handler(rspq, rspq->cur_desc, &gl); | 1729 | ret = rspq->handler(rspq, rspq->cur_desc, &gl); |
1728 | if (likely(ret == 0)) | 1730 | if (likely(ret == 0)) |
1729 | rspq->offset += ALIGN(fp->size, FL_ALIGN); | 1731 | rspq->offset += ALIGN(fp->size, s->fl_align); |
1730 | else | 1732 | else |
1731 | restore_rx_bufs(&gl, &rxq->fl, frag); | 1733 | restore_rx_bufs(&gl, &rxq->fl, frag); |
1732 | } else if (likely(rsp_type == RSP_TYPE_CPL)) { | 1734 | } else if (likely(rsp_type == RSP_TYPE_CPL)) { |
@@ -1963,7 +1965,7 @@ static void sge_rx_timer_cb(unsigned long data) | |||
1963 | * schedule napi but the FL is no longer starving. | 1965 | * schedule napi but the FL is no longer starving. |
1964 | * No biggie. | 1966 | * No biggie. |
1965 | */ | 1967 | */ |
1966 | if (fl_starving(fl)) { | 1968 | if (fl_starving(adapter, fl)) { |
1967 | struct sge_eth_rxq *rxq; | 1969 | struct sge_eth_rxq *rxq; |
1968 | 1970 | ||
1969 | rxq = container_of(fl, struct sge_eth_rxq, fl); | 1971 | rxq = container_of(fl, struct sge_eth_rxq, fl); |
@@ -2047,6 +2049,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, | |||
2047 | int intr_dest, | 2049 | int intr_dest, |
2048 | struct sge_fl *fl, rspq_handler_t hnd) | 2050 | struct sge_fl *fl, rspq_handler_t hnd) |
2049 | { | 2051 | { |
2052 | struct sge *s = &adapter->sge; | ||
2050 | struct port_info *pi = netdev_priv(dev); | 2053 | struct port_info *pi = netdev_priv(dev); |
2051 | struct fw_iq_cmd cmd, rpl; | 2054 | struct fw_iq_cmd cmd, rpl; |
2052 | int ret, iqandst, flsz = 0; | 2055 | int ret, iqandst, flsz = 0; |
@@ -2117,7 +2120,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, | |||
2117 | fl->size = roundup(fl->size, FL_PER_EQ_UNIT); | 2120 | fl->size = roundup(fl->size, FL_PER_EQ_UNIT); |
2118 | fl->desc = alloc_ring(adapter->pdev_dev, fl->size, | 2121 | fl->desc = alloc_ring(adapter->pdev_dev, fl->size, |
2119 | sizeof(__be64), sizeof(struct rx_sw_desc), | 2122 | sizeof(__be64), sizeof(struct rx_sw_desc), |
2120 | &fl->addr, &fl->sdesc, STAT_LEN); | 2123 | &fl->addr, &fl->sdesc, s->stat_len); |
2121 | if (!fl->desc) { | 2124 | if (!fl->desc) { |
2122 | ret = -ENOMEM; | 2125 | ret = -ENOMEM; |
2123 | goto err; | 2126 | goto err; |
@@ -2129,7 +2132,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, | |||
2129 | * free list ring) in Egress Queue Units. | 2132 | * free list ring) in Egress Queue Units. |
2130 | */ | 2133 | */ |
2131 | flsz = (fl->size / FL_PER_EQ_UNIT + | 2134 | flsz = (fl->size / FL_PER_EQ_UNIT + |
2132 | STAT_LEN / EQ_UNIT); | 2135 | s->stat_len / EQ_UNIT); |
2133 | 2136 | ||
2134 | /* | 2137 | /* |
2135 | * Fill in all the relevant firmware Ingress Queue Command | 2138 | * Fill in all the relevant firmware Ingress Queue Command |
@@ -2217,6 +2220,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2217 | struct net_device *dev, struct netdev_queue *devq, | 2220 | struct net_device *dev, struct netdev_queue *devq, |
2218 | unsigned int iqid) | 2221 | unsigned int iqid) |
2219 | { | 2222 | { |
2223 | struct sge *s = &adapter->sge; | ||
2220 | int ret, nentries; | 2224 | int ret, nentries; |
2221 | struct fw_eq_eth_cmd cmd, rpl; | 2225 | struct fw_eq_eth_cmd cmd, rpl; |
2222 | struct port_info *pi = netdev_priv(dev); | 2226 | struct port_info *pi = netdev_priv(dev); |
@@ -2225,7 +2229,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2225 | * Calculate the size of the hardware TX Queue (including the Status | 2229 | * Calculate the size of the hardware TX Queue (including the Status |
2226 | * Page on the end of the TX Queue) in units of TX Descriptors. | 2230 | * Page on the end of the TX Queue) in units of TX Descriptors. |
2227 | */ | 2231 | */ |
2228 | nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc); | 2232 | nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); |
2229 | 2233 | ||
2230 | /* | 2234 | /* |
2231 | * Allocate the hardware ring for the TX ring (with space for its | 2235 | * Allocate the hardware ring for the TX ring (with space for its |
@@ -2234,7 +2238,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2234 | txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size, | 2238 | txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size, |
2235 | sizeof(struct tx_desc), | 2239 | sizeof(struct tx_desc), |
2236 | sizeof(struct tx_sw_desc), | 2240 | sizeof(struct tx_sw_desc), |
2237 | &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); | 2241 | &txq->q.phys_addr, &txq->q.sdesc, s->stat_len); |
2238 | if (!txq->q.desc) | 2242 | if (!txq->q.desc) |
2239 | return -ENOMEM; | 2243 | return -ENOMEM; |
2240 | 2244 | ||
@@ -2307,8 +2311,10 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2307 | */ | 2311 | */ |
2308 | static void free_txq(struct adapter *adapter, struct sge_txq *tq) | 2312 | static void free_txq(struct adapter *adapter, struct sge_txq *tq) |
2309 | { | 2313 | { |
2314 | struct sge *s = &adapter->sge; | ||
2315 | |||
2310 | dma_free_coherent(adapter->pdev_dev, | 2316 | dma_free_coherent(adapter->pdev_dev, |
2311 | tq->size * sizeof(*tq->desc) + STAT_LEN, | 2317 | tq->size * sizeof(*tq->desc) + s->stat_len, |
2312 | tq->desc, tq->phys_addr); | 2318 | tq->desc, tq->phys_addr); |
2313 | tq->cntxt_id = 0; | 2319 | tq->cntxt_id = 0; |
2314 | tq->sdesc = NULL; | 2320 | tq->sdesc = NULL; |
@@ -2322,6 +2328,7 @@ static void free_txq(struct adapter *adapter, struct sge_txq *tq) | |||
2322 | static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, | 2328 | static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, |
2323 | struct sge_fl *fl) | 2329 | struct sge_fl *fl) |
2324 | { | 2330 | { |
2331 | struct sge *s = &adapter->sge; | ||
2325 | unsigned int flid = fl ? fl->cntxt_id : 0xffff; | 2332 | unsigned int flid = fl ? fl->cntxt_id : 0xffff; |
2326 | 2333 | ||
2327 | t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP, | 2334 | t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP, |
@@ -2337,7 +2344,7 @@ static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, | |||
2337 | if (fl) { | 2344 | if (fl) { |
2338 | free_rx_bufs(adapter, fl, fl->avail); | 2345 | free_rx_bufs(adapter, fl, fl->avail); |
2339 | dma_free_coherent(adapter->pdev_dev, | 2346 | dma_free_coherent(adapter->pdev_dev, |
2340 | fl->size * sizeof(*fl->desc) + STAT_LEN, | 2347 | fl->size * sizeof(*fl->desc) + s->stat_len, |
2341 | fl->desc, fl->addr); | 2348 | fl->desc, fl->addr); |
2342 | kfree(fl->sdesc); | 2349 | kfree(fl->sdesc); |
2343 | fl->sdesc = NULL; | 2350 | fl->sdesc = NULL; |
@@ -2423,6 +2430,7 @@ int t4vf_sge_init(struct adapter *adapter) | |||
2423 | u32 fl0 = sge_params->sge_fl_buffer_size[0]; | 2430 | u32 fl0 = sge_params->sge_fl_buffer_size[0]; |
2424 | u32 fl1 = sge_params->sge_fl_buffer_size[1]; | 2431 | u32 fl1 = sge_params->sge_fl_buffer_size[1]; |
2425 | struct sge *s = &adapter->sge; | 2432 | struct sge *s = &adapter->sge; |
2433 | unsigned int ingpadboundary, ingpackboundary; | ||
2426 | 2434 | ||
2427 | /* | 2435 | /* |
2428 | * Start by vetting the basic SGE parameters which have been set up by | 2436 | * Start by vetting the basic SGE parameters which have been set up by |
@@ -2443,12 +2451,48 @@ int t4vf_sge_init(struct adapter *adapter) | |||
2443 | * Now translate the adapter parameters into our internal forms. | 2451 | * Now translate the adapter parameters into our internal forms. |
2444 | */ | 2452 | */ |
2445 | if (fl1) | 2453 | if (fl1) |
2446 | FL_PG_ORDER = ilog2(fl1) - PAGE_SHIFT; | 2454 | s->fl_pg_order = ilog2(fl1) - PAGE_SHIFT; |
2447 | STAT_LEN = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) | 2455 | s->stat_len = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) |
2448 | ? 128 : 64); | 2456 | ? 128 : 64); |
2449 | PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control); | 2457 | s->pktshift = PKTSHIFT_GET(sge_params->sge_control); |
2450 | FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + | 2458 | |
2451 | SGE_INGPADBOUNDARY_SHIFT); | 2459 | /* T4 uses a single control field to specify both the PCIe Padding and |
2460 | * Packing Boundary. T5 introduced the ability to specify these | ||
2461 | * separately. The actual Ingress Packet Data alignment boundary | ||
2462 | * within Packed Buffer Mode is the maximum of these two | ||
2463 | * specifications. (Note that it makes no real practical sense to | ||
2464 | * have the Pading Boudary be larger than the Packing Boundary but you | ||
2465 | * could set the chip up that way and, in fact, legacy T4 code would | ||
2466 | * end doing this because it would initialize the Padding Boundary and | ||
2467 | * leave the Packing Boundary initialized to 0 (16 bytes).) | ||
2468 | */ | ||
2469 | ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + | ||
2470 | X_INGPADBOUNDARY_SHIFT); | ||
2471 | if (is_t4(adapter->params.chip)) { | ||
2472 | s->fl_align = ingpadboundary; | ||
2473 | } else { | ||
2474 | /* T5 has a different interpretation of one of the PCIe Packing | ||
2475 | * Boundary values. | ||
2476 | */ | ||
2477 | ingpackboundary = INGPACKBOUNDARY_G(sge_params->sge_control2); | ||
2478 | if (ingpackboundary == INGPACKBOUNDARY_16B_X) | ||
2479 | ingpackboundary = 16; | ||
2480 | else | ||
2481 | ingpackboundary = 1 << (ingpackboundary + | ||
2482 | INGPACKBOUNDARY_SHIFT_X); | ||
2483 | |||
2484 | s->fl_align = max(ingpadboundary, ingpackboundary); | ||
2485 | } | ||
2486 | |||
2487 | /* A FL with <= fl_starve_thres buffers is starving and a periodic | ||
2488 | * timer will attempt to refill it. This needs to be larger than the | ||
2489 | * SGE's Egress Congestion Threshold. If it isn't, then we can get | ||
2490 | * stuck waiting for new packets while the SGE is waiting for us to | ||
2491 | * give it more Free List entries. (Note that the SGE's Egress | ||
2492 | * Congestion Threshold is in units of 2 Free List pointers.) | ||
2493 | */ | ||
2494 | s->fl_starve_thres | ||
2495 | = EGRTHRESHOLD_GET(sge_params->sge_congestion_control)*2 + 1; | ||
2452 | 2496 | ||
2453 | /* | 2497 | /* |
2454 | * Set up tasklet timers. | 2498 | * Set up tasklet timers. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h index 95df61dcb4ce..4b6a6d14d86d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | |||
@@ -134,11 +134,13 @@ struct dev_params { | |||
134 | */ | 134 | */ |
135 | struct sge_params { | 135 | struct sge_params { |
136 | u32 sge_control; /* padding, boundaries, lengths, etc. */ | 136 | u32 sge_control; /* padding, boundaries, lengths, etc. */ |
137 | u32 sge_control2; /* T5: more of the same */ | ||
137 | u32 sge_host_page_size; /* RDMA page sizes */ | 138 | u32 sge_host_page_size; /* RDMA page sizes */ |
138 | u32 sge_queues_per_page; /* RDMA queues/page */ | 139 | u32 sge_queues_per_page; /* RDMA queues/page */ |
139 | u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */ | 140 | u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */ |
140 | u32 sge_fl_buffer_size[16]; /* free list buffer sizes */ | 141 | u32 sge_fl_buffer_size[16]; /* free list buffer sizes */ |
141 | u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */ | 142 | u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */ |
143 | u32 sge_congestion_control; /* congestion thresholds, etc. */ | ||
142 | u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */ | 144 | u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */ |
143 | u32 sge_timer_value_2_and_3; | 145 | u32 sge_timer_value_2_and_3; |
144 | u32 sge_timer_value_4_and_5; | 146 | u32 sge_timer_value_4_and_5; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c index e984fdc48ba2..1e896b923234 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | |||
@@ -468,12 +468,38 @@ int t4vf_get_sge_params(struct adapter *adapter) | |||
468 | sge_params->sge_timer_value_2_and_3 = vals[5]; | 468 | sge_params->sge_timer_value_2_and_3 = vals[5]; |
469 | sge_params->sge_timer_value_4_and_5 = vals[6]; | 469 | sge_params->sge_timer_value_4_and_5 = vals[6]; |
470 | 470 | ||
471 | /* T4 uses a single control field to specify both the PCIe Padding and | ||
472 | * Packing Boundary. T5 introduced the ability to specify these | ||
473 | * separately with the Padding Boundary in SGE_CONTROL and and Packing | ||
474 | * Boundary in SGE_CONTROL2. So for T5 and later we need to grab | ||
475 | * SGE_CONTROL in order to determine how ingress packet data will be | ||
476 | * laid out in Packed Buffer Mode. Unfortunately, older versions of | ||
477 | * the firmware won't let us retrieve SGE_CONTROL2 so if we get a | ||
478 | * failure grabbing it we throw an error since we can't figure out the | ||
479 | * right value. | ||
480 | */ | ||
481 | if (!is_t4(adapter->params.chip)) { | ||
482 | params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | | ||
483 | FW_PARAMS_PARAM_XYZ(SGE_CONTROL2_A)); | ||
484 | v = t4vf_query_params(adapter, 1, params, vals); | ||
485 | if (v != FW_SUCCESS) { | ||
486 | dev_err(adapter->pdev_dev, | ||
487 | "Unable to get SGE Control2; " | ||
488 | "probably old firmware.\n"); | ||
489 | return v; | ||
490 | } | ||
491 | sge_params->sge_control2 = vals[0]; | ||
492 | } | ||
493 | |||
471 | params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | | 494 | params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | |
472 | FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD)); | 495 | FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD)); |
473 | v = t4vf_query_params(adapter, 1, params, vals); | 496 | params[1] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | |
497 | FW_PARAMS_PARAM_XYZ(SGE_CONM_CTRL)); | ||
498 | v = t4vf_query_params(adapter, 2, params, vals); | ||
474 | if (v) | 499 | if (v) |
475 | return v; | 500 | return v; |
476 | sge_params->sge_ingress_rx_threshold = vals[0]; | 501 | sge_params->sge_ingress_rx_threshold = vals[0]; |
502 | sge_params->sge_congestion_control = vals[1]; | ||
477 | 503 | ||
478 | return 0; | 504 | return 0; |
479 | } | 505 | } |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 180e53fa628f..73cf1653a4a3 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -940,18 +940,8 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq) | |||
940 | struct vnic_rq_buf *buf = rq->to_use; | 940 | struct vnic_rq_buf *buf = rq->to_use; |
941 | 941 | ||
942 | if (buf->os_buf) { | 942 | if (buf->os_buf) { |
943 | buf = buf->next; | 943 | enic_queue_rq_desc(rq, buf->os_buf, os_buf_index, buf->dma_addr, |
944 | rq->to_use = buf; | 944 | buf->len); |
945 | rq->ring.desc_avail--; | ||
946 | if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) { | ||
947 | /* Adding write memory barrier prevents compiler and/or | ||
948 | * CPU reordering, thus avoiding descriptor posting | ||
949 | * before descriptor is initialized. Otherwise, hardware | ||
950 | * can read stale descriptor fields. | ||
951 | */ | ||
952 | wmb(); | ||
953 | iowrite32(buf->index, &rq->ctrl->posted_index); | ||
954 | } | ||
955 | 945 | ||
956 | return 0; | 946 | return 0; |
957 | } | 947 | } |
@@ -1037,7 +1027,10 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, | |||
1037 | enic->rq_truncated_pkts++; | 1027 | enic->rq_truncated_pkts++; |
1038 | } | 1028 | } |
1039 | 1029 | ||
1030 | pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, | ||
1031 | PCI_DMA_FROMDEVICE); | ||
1040 | dev_kfree_skb_any(skb); | 1032 | dev_kfree_skb_any(skb); |
1033 | buf->os_buf = NULL; | ||
1041 | 1034 | ||
1042 | return; | 1035 | return; |
1043 | } | 1036 | } |
@@ -1088,7 +1081,10 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, | |||
1088 | /* Buffer overflow | 1081 | /* Buffer overflow |
1089 | */ | 1082 | */ |
1090 | 1083 | ||
1084 | pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, | ||
1085 | PCI_DMA_FROMDEVICE); | ||
1091 | dev_kfree_skb_any(skb); | 1086 | dev_kfree_skb_any(skb); |
1087 | buf->os_buf = NULL; | ||
1092 | } | 1088 | } |
1093 | } | 1089 | } |
1094 | 1090 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9a18e7930b31..597c463e384d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4309,11 +4309,16 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh) | |||
4309 | return -EOPNOTSUPP; | 4309 | return -EOPNOTSUPP; |
4310 | 4310 | ||
4311 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | 4311 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); |
4312 | if (!br_spec) | ||
4313 | return -EINVAL; | ||
4312 | 4314 | ||
4313 | nla_for_each_nested(attr, br_spec, rem) { | 4315 | nla_for_each_nested(attr, br_spec, rem) { |
4314 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 4316 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
4315 | continue; | 4317 | continue; |
4316 | 4318 | ||
4319 | if (nla_len(attr) < sizeof(mode)) | ||
4320 | return -EINVAL; | ||
4321 | |||
4317 | mode = nla_get_u16(attr); | 4322 | mode = nla_get_u16(attr); |
4318 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) | 4323 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) |
4319 | return -EINVAL; | 4324 | return -EINVAL; |
@@ -4421,6 +4426,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, | |||
4421 | "Disabled VxLAN offloads for UDP port %d\n", | 4426 | "Disabled VxLAN offloads for UDP port %d\n", |
4422 | be16_to_cpu(port)); | 4427 | be16_to_cpu(port)); |
4423 | } | 4428 | } |
4429 | |||
4430 | static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
4431 | { | ||
4432 | return vxlan_gso_check(skb); | ||
4433 | } | ||
4424 | #endif | 4434 | #endif |
4425 | 4435 | ||
4426 | static const struct net_device_ops be_netdev_ops = { | 4436 | static const struct net_device_ops be_netdev_ops = { |
@@ -4450,6 +4460,7 @@ static const struct net_device_ops be_netdev_ops = { | |||
4450 | #ifdef CONFIG_BE2NET_VXLAN | 4460 | #ifdef CONFIG_BE2NET_VXLAN |
4451 | .ndo_add_vxlan_port = be_add_vxlan_port, | 4461 | .ndo_add_vxlan_port = be_add_vxlan_port, |
4452 | .ndo_del_vxlan_port = be_del_vxlan_port, | 4462 | .ndo_del_vxlan_port = be_del_vxlan_port, |
4463 | .ndo_gso_check = be_gso_check, | ||
4453 | #endif | 4464 | #endif |
4454 | }; | 4465 | }; |
4455 | 4466 | ||
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 50a851db2852..3dca494797bd 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -298,6 +298,16 @@ static void *swap_buffer(void *bufaddr, int len) | |||
298 | return bufaddr; | 298 | return bufaddr; |
299 | } | 299 | } |
300 | 300 | ||
301 | static void swap_buffer2(void *dst_buf, void *src_buf, int len) | ||
302 | { | ||
303 | int i; | ||
304 | unsigned int *src = src_buf; | ||
305 | unsigned int *dst = dst_buf; | ||
306 | |||
307 | for (i = 0; i < len; i += 4, src++, dst++) | ||
308 | *dst = swab32p(src); | ||
309 | } | ||
310 | |||
301 | static void fec_dump(struct net_device *ndev) | 311 | static void fec_dump(struct net_device *ndev) |
302 | { | 312 | { |
303 | struct fec_enet_private *fep = netdev_priv(ndev); | 313 | struct fec_enet_private *fep = netdev_priv(ndev); |
@@ -1307,7 +1317,7 @@ fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct sk_buff | |||
1307 | } | 1317 | } |
1308 | 1318 | ||
1309 | static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, | 1319 | static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, |
1310 | struct bufdesc *bdp, u32 length) | 1320 | struct bufdesc *bdp, u32 length, bool swap) |
1311 | { | 1321 | { |
1312 | struct fec_enet_private *fep = netdev_priv(ndev); | 1322 | struct fec_enet_private *fep = netdev_priv(ndev); |
1313 | struct sk_buff *new_skb; | 1323 | struct sk_buff *new_skb; |
@@ -1322,7 +1332,10 @@ static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, | |||
1322 | dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, | 1332 | dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, |
1323 | FEC_ENET_RX_FRSIZE - fep->rx_align, | 1333 | FEC_ENET_RX_FRSIZE - fep->rx_align, |
1324 | DMA_FROM_DEVICE); | 1334 | DMA_FROM_DEVICE); |
1325 | memcpy(new_skb->data, (*skb)->data, length); | 1335 | if (!swap) |
1336 | memcpy(new_skb->data, (*skb)->data, length); | ||
1337 | else | ||
1338 | swap_buffer2(new_skb->data, (*skb)->data, length); | ||
1326 | *skb = new_skb; | 1339 | *skb = new_skb; |
1327 | 1340 | ||
1328 | return true; | 1341 | return true; |
@@ -1352,6 +1365,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
1352 | u16 vlan_tag; | 1365 | u16 vlan_tag; |
1353 | int index = 0; | 1366 | int index = 0; |
1354 | bool is_copybreak; | 1367 | bool is_copybreak; |
1368 | bool need_swap = id_entry->driver_data & FEC_QUIRK_SWAP_FRAME; | ||
1355 | 1369 | ||
1356 | #ifdef CONFIG_M532x | 1370 | #ifdef CONFIG_M532x |
1357 | flush_cache_all(); | 1371 | flush_cache_all(); |
@@ -1415,7 +1429,8 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
1415 | * include that when passing upstream as it messes up | 1429 | * include that when passing upstream as it messes up |
1416 | * bridging applications. | 1430 | * bridging applications. |
1417 | */ | 1431 | */ |
1418 | is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4); | 1432 | is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4, |
1433 | need_swap); | ||
1419 | if (!is_copybreak) { | 1434 | if (!is_copybreak) { |
1420 | skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE); | 1435 | skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE); |
1421 | if (unlikely(!skb_new)) { | 1436 | if (unlikely(!skb_new)) { |
@@ -1430,7 +1445,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
1430 | prefetch(skb->data - NET_IP_ALIGN); | 1445 | prefetch(skb->data - NET_IP_ALIGN); |
1431 | skb_put(skb, pkt_len - 4); | 1446 | skb_put(skb, pkt_len - 4); |
1432 | data = skb->data; | 1447 | data = skb->data; |
1433 | if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) | 1448 | if (!is_copybreak && need_swap) |
1434 | swap_buffer(data, pkt_len); | 1449 | swap_buffer(data, pkt_len); |
1435 | 1450 | ||
1436 | /* Extract the enhanced buffer descriptor */ | 1451 | /* Extract the enhanced buffer descriptor */ |
@@ -3343,12 +3358,11 @@ static int __maybe_unused fec_suspend(struct device *dev) | |||
3343 | netif_device_detach(ndev); | 3358 | netif_device_detach(ndev); |
3344 | netif_tx_unlock_bh(ndev); | 3359 | netif_tx_unlock_bh(ndev); |
3345 | fec_stop(ndev); | 3360 | fec_stop(ndev); |
3361 | fec_enet_clk_enable(ndev, false); | ||
3362 | pinctrl_pm_select_sleep_state(&fep->pdev->dev); | ||
3346 | } | 3363 | } |
3347 | rtnl_unlock(); | 3364 | rtnl_unlock(); |
3348 | 3365 | ||
3349 | fec_enet_clk_enable(ndev, false); | ||
3350 | pinctrl_pm_select_sleep_state(&fep->pdev->dev); | ||
3351 | |||
3352 | if (fep->reg_phy) | 3366 | if (fep->reg_phy) |
3353 | regulator_disable(fep->reg_phy); | 3367 | regulator_disable(fep->reg_phy); |
3354 | 3368 | ||
@@ -3367,13 +3381,14 @@ static int __maybe_unused fec_resume(struct device *dev) | |||
3367 | return ret; | 3381 | return ret; |
3368 | } | 3382 | } |
3369 | 3383 | ||
3370 | pinctrl_pm_select_default_state(&fep->pdev->dev); | ||
3371 | ret = fec_enet_clk_enable(ndev, true); | ||
3372 | if (ret) | ||
3373 | goto failed_clk; | ||
3374 | |||
3375 | rtnl_lock(); | 3384 | rtnl_lock(); |
3376 | if (netif_running(ndev)) { | 3385 | if (netif_running(ndev)) { |
3386 | pinctrl_pm_select_default_state(&fep->pdev->dev); | ||
3387 | ret = fec_enet_clk_enable(ndev, true); | ||
3388 | if (ret) { | ||
3389 | rtnl_unlock(); | ||
3390 | goto failed_clk; | ||
3391 | } | ||
3377 | fec_restart(ndev); | 3392 | fec_restart(ndev); |
3378 | netif_tx_lock_bh(ndev); | 3393 | netif_tx_lock_bh(ndev); |
3379 | netif_device_attach(ndev); | 3394 | netif_device_attach(ndev); |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a2d72a87cbde..487cd9c4ac0d 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -1012,7 +1012,8 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) | |||
1012 | /* igb_get_stats64() might access the rings on this vector, | 1012 | /* igb_get_stats64() might access the rings on this vector, |
1013 | * we must wait a grace period before freeing it. | 1013 | * we must wait a grace period before freeing it. |
1014 | */ | 1014 | */ |
1015 | kfree_rcu(q_vector, rcu); | 1015 | if (q_vector) |
1016 | kfree_rcu(q_vector, rcu); | ||
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | /** | 1019 | /** |
@@ -1792,8 +1793,10 @@ void igb_down(struct igb_adapter *adapter) | |||
1792 | adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; | 1793 | adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; |
1793 | 1794 | ||
1794 | for (i = 0; i < adapter->num_q_vectors; i++) { | 1795 | for (i = 0; i < adapter->num_q_vectors; i++) { |
1795 | napi_synchronize(&(adapter->q_vector[i]->napi)); | 1796 | if (adapter->q_vector[i]) { |
1796 | napi_disable(&(adapter->q_vector[i]->napi)); | 1797 | napi_synchronize(&adapter->q_vector[i]->napi); |
1798 | napi_disable(&adapter->q_vector[i]->napi); | ||
1799 | } | ||
1797 | } | 1800 | } |
1798 | 1801 | ||
1799 | 1802 | ||
@@ -3717,7 +3720,8 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter) | |||
3717 | int i; | 3720 | int i; |
3718 | 3721 | ||
3719 | for (i = 0; i < adapter->num_tx_queues; i++) | 3722 | for (i = 0; i < adapter->num_tx_queues; i++) |
3720 | igb_free_tx_resources(adapter->tx_ring[i]); | 3723 | if (adapter->tx_ring[i]) |
3724 | igb_free_tx_resources(adapter->tx_ring[i]); | ||
3721 | } | 3725 | } |
3722 | 3726 | ||
3723 | void igb_unmap_and_free_tx_resource(struct igb_ring *ring, | 3727 | void igb_unmap_and_free_tx_resource(struct igb_ring *ring, |
@@ -3782,7 +3786,8 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter) | |||
3782 | int i; | 3786 | int i; |
3783 | 3787 | ||
3784 | for (i = 0; i < adapter->num_tx_queues; i++) | 3788 | for (i = 0; i < adapter->num_tx_queues; i++) |
3785 | igb_clean_tx_ring(adapter->tx_ring[i]); | 3789 | if (adapter->tx_ring[i]) |
3790 | igb_clean_tx_ring(adapter->tx_ring[i]); | ||
3786 | } | 3791 | } |
3787 | 3792 | ||
3788 | /** | 3793 | /** |
@@ -3819,7 +3824,8 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter) | |||
3819 | int i; | 3824 | int i; |
3820 | 3825 | ||
3821 | for (i = 0; i < adapter->num_rx_queues; i++) | 3826 | for (i = 0; i < adapter->num_rx_queues; i++) |
3822 | igb_free_rx_resources(adapter->rx_ring[i]); | 3827 | if (adapter->rx_ring[i]) |
3828 | igb_free_rx_resources(adapter->rx_ring[i]); | ||
3823 | } | 3829 | } |
3824 | 3830 | ||
3825 | /** | 3831 | /** |
@@ -3874,7 +3880,8 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter) | |||
3874 | int i; | 3880 | int i; |
3875 | 3881 | ||
3876 | for (i = 0; i < adapter->num_rx_queues; i++) | 3882 | for (i = 0; i < adapter->num_rx_queues; i++) |
3877 | igb_clean_rx_ring(adapter->rx_ring[i]); | 3883 | if (adapter->rx_ring[i]) |
3884 | igb_clean_rx_ring(adapter->rx_ring[i]); | ||
3878 | } | 3885 | } |
3879 | 3886 | ||
3880 | /** | 3887 | /** |
@@ -7404,6 +7411,8 @@ static int igb_resume(struct device *dev) | |||
7404 | pci_restore_state(pdev); | 7411 | pci_restore_state(pdev); |
7405 | pci_save_state(pdev); | 7412 | pci_save_state(pdev); |
7406 | 7413 | ||
7414 | if (!pci_device_is_present(pdev)) | ||
7415 | return -ENODEV; | ||
7407 | err = pci_enable_device_mem(pdev); | 7416 | err = pci_enable_device_mem(pdev); |
7408 | if (err) { | 7417 | if (err) { |
7409 | dev_err(&pdev->dev, | 7418 | dev_err(&pdev->dev, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index d2df4e3d1032..cc51554c9e99 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3936,8 +3936,8 @@ void ixgbe_set_rx_mode(struct net_device *netdev) | |||
3936 | * if SR-IOV and VMDQ are disabled - otherwise ensure | 3936 | * if SR-IOV and VMDQ are disabled - otherwise ensure |
3937 | * that hardware VLAN filters remain enabled. | 3937 | * that hardware VLAN filters remain enabled. |
3938 | */ | 3938 | */ |
3939 | if (!(adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | | 3939 | if (adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | |
3940 | IXGBE_FLAG_SRIOV_ENABLED))) | 3940 | IXGBE_FLAG_SRIOV_ENABLED)) |
3941 | vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); | 3941 | vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); |
3942 | } else { | 3942 | } else { |
3943 | if (netdev->flags & IFF_ALLMULTI) { | 3943 | if (netdev->flags & IFF_ALLMULTI) { |
@@ -7669,6 +7669,8 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7669 | return -EOPNOTSUPP; | 7669 | return -EOPNOTSUPP; |
7670 | 7670 | ||
7671 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | 7671 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); |
7672 | if (!br_spec) | ||
7673 | return -EINVAL; | ||
7672 | 7674 | ||
7673 | nla_for_each_nested(attr, br_spec, rem) { | 7675 | nla_for_each_nested(attr, br_spec, rem) { |
7674 | __u16 mode; | 7676 | __u16 mode; |
@@ -7677,6 +7679,9 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7677 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 7679 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
7678 | continue; | 7680 | continue; |
7679 | 7681 | ||
7682 | if (nla_len(attr) < sizeof(mode)) | ||
7683 | return -EINVAL; | ||
7684 | |||
7680 | mode = nla_get_u16(attr); | 7685 | mode = nla_get_u16(attr); |
7681 | if (mode == BRIDGE_MODE_VEPA) { | 7686 | if (mode == BRIDGE_MODE_VEPA) { |
7682 | reg = 0; | 7687 | reg = 0; |
@@ -7979,6 +7984,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7979 | int i, err, pci_using_dac, expected_gts; | 7984 | int i, err, pci_using_dac, expected_gts; |
7980 | unsigned int indices = MAX_TX_QUEUES; | 7985 | unsigned int indices = MAX_TX_QUEUES; |
7981 | u8 part_str[IXGBE_PBANUM_LENGTH]; | 7986 | u8 part_str[IXGBE_PBANUM_LENGTH]; |
7987 | bool disable_dev = false; | ||
7982 | #ifdef IXGBE_FCOE | 7988 | #ifdef IXGBE_FCOE |
7983 | u16 device_caps; | 7989 | u16 device_caps; |
7984 | #endif | 7990 | #endif |
@@ -8369,13 +8375,14 @@ err_sw_init: | |||
8369 | iounmap(adapter->io_addr); | 8375 | iounmap(adapter->io_addr); |
8370 | kfree(adapter->mac_table); | 8376 | kfree(adapter->mac_table); |
8371 | err_ioremap: | 8377 | err_ioremap: |
8378 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); | ||
8372 | free_netdev(netdev); | 8379 | free_netdev(netdev); |
8373 | err_alloc_etherdev: | 8380 | err_alloc_etherdev: |
8374 | pci_release_selected_regions(pdev, | 8381 | pci_release_selected_regions(pdev, |
8375 | pci_select_bars(pdev, IORESOURCE_MEM)); | 8382 | pci_select_bars(pdev, IORESOURCE_MEM)); |
8376 | err_pci_reg: | 8383 | err_pci_reg: |
8377 | err_dma: | 8384 | err_dma: |
8378 | if (!adapter || !test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) | 8385 | if (!adapter || disable_dev) |
8379 | pci_disable_device(pdev); | 8386 | pci_disable_device(pdev); |
8380 | return err; | 8387 | return err; |
8381 | } | 8388 | } |
@@ -8393,6 +8400,7 @@ static void ixgbe_remove(struct pci_dev *pdev) | |||
8393 | { | 8400 | { |
8394 | struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); | 8401 | struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); |
8395 | struct net_device *netdev = adapter->netdev; | 8402 | struct net_device *netdev = adapter->netdev; |
8403 | bool disable_dev; | ||
8396 | 8404 | ||
8397 | ixgbe_dbg_adapter_exit(adapter); | 8405 | ixgbe_dbg_adapter_exit(adapter); |
8398 | 8406 | ||
@@ -8442,11 +8450,12 @@ static void ixgbe_remove(struct pci_dev *pdev) | |||
8442 | e_dev_info("complete\n"); | 8450 | e_dev_info("complete\n"); |
8443 | 8451 | ||
8444 | kfree(adapter->mac_table); | 8452 | kfree(adapter->mac_table); |
8453 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); | ||
8445 | free_netdev(netdev); | 8454 | free_netdev(netdev); |
8446 | 8455 | ||
8447 | pci_disable_pcie_error_reporting(pdev); | 8456 | pci_disable_pcie_error_reporting(pdev); |
8448 | 8457 | ||
8449 | if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) | 8458 | if (disable_dev) |
8450 | pci_disable_device(pdev); | 8459 | pci_disable_device(pdev); |
8451 | } | 8460 | } |
8452 | 8461 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index d47b19f27c35..28b81ae09b5a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | |||
@@ -635,7 +635,6 @@ s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, ixgbe_link_speed *speed, | |||
635 | **/ | 635 | **/ |
636 | s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) | 636 | s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) |
637 | { | 637 | { |
638 | s32 status; | ||
639 | u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; | 638 | u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; |
640 | bool autoneg = false; | 639 | bool autoneg = false; |
641 | ixgbe_link_speed speed; | 640 | ixgbe_link_speed speed; |
@@ -700,8 +699,7 @@ s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) | |||
700 | 699 | ||
701 | hw->phy.ops.write_reg(hw, MDIO_CTRL1, | 700 | hw->phy.ops.write_reg(hw, MDIO_CTRL1, |
702 | MDIO_MMD_AN, autoneg_reg); | 701 | MDIO_MMD_AN, autoneg_reg); |
703 | 702 | return 0; | |
704 | return status; | ||
705 | } | 703 | } |
706 | 704 | ||
707 | /** | 705 | /** |
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index b151a949f352..d44560d1d268 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -1047,7 +1047,6 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
1047 | int tx_index; | 1047 | int tx_index; |
1048 | struct tx_desc *desc; | 1048 | struct tx_desc *desc; |
1049 | u32 cmd_sts; | 1049 | u32 cmd_sts; |
1050 | struct sk_buff *skb; | ||
1051 | 1050 | ||
1052 | tx_index = txq->tx_used_desc; | 1051 | tx_index = txq->tx_used_desc; |
1053 | desc = &txq->tx_desc_area[tx_index]; | 1052 | desc = &txq->tx_desc_area[tx_index]; |
@@ -1066,19 +1065,22 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
1066 | reclaimed++; | 1065 | reclaimed++; |
1067 | txq->tx_desc_count--; | 1066 | txq->tx_desc_count--; |
1068 | 1067 | ||
1069 | skb = NULL; | 1068 | if (!IS_TSO_HEADER(txq, desc->buf_ptr)) |
1070 | if (cmd_sts & TX_LAST_DESC) | 1069 | dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, |
1071 | skb = __skb_dequeue(&txq->tx_skb); | 1070 | desc->byte_cnt, DMA_TO_DEVICE); |
1071 | |||
1072 | if (cmd_sts & TX_ENABLE_INTERRUPT) { | ||
1073 | struct sk_buff *skb = __skb_dequeue(&txq->tx_skb); | ||
1074 | |||
1075 | if (!WARN_ON(!skb)) | ||
1076 | dev_kfree_skb(skb); | ||
1077 | } | ||
1072 | 1078 | ||
1073 | if (cmd_sts & ERROR_SUMMARY) { | 1079 | if (cmd_sts & ERROR_SUMMARY) { |
1074 | netdev_info(mp->dev, "tx error\n"); | 1080 | netdev_info(mp->dev, "tx error\n"); |
1075 | mp->dev->stats.tx_errors++; | 1081 | mp->dev->stats.tx_errors++; |
1076 | } | 1082 | } |
1077 | 1083 | ||
1078 | if (!IS_TSO_HEADER(txq, desc->buf_ptr)) | ||
1079 | dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, | ||
1080 | desc->byte_cnt, DMA_TO_DEVICE); | ||
1081 | dev_kfree_skb(skb); | ||
1082 | } | 1084 | } |
1083 | 1085 | ||
1084 | __netif_tx_unlock_bh(nq); | 1086 | __netif_tx_unlock_bh(nq); |
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index ece83f101526..fdf3e382e464 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c | |||
@@ -1692,6 +1692,7 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai, | |||
1692 | { | 1692 | { |
1693 | struct mvpp2_prs_entry *pe; | 1693 | struct mvpp2_prs_entry *pe; |
1694 | int tid_aux, tid; | 1694 | int tid_aux, tid; |
1695 | int ret = 0; | ||
1695 | 1696 | ||
1696 | pe = mvpp2_prs_vlan_find(priv, tpid, ai); | 1697 | pe = mvpp2_prs_vlan_find(priv, tpid, ai); |
1697 | 1698 | ||
@@ -1723,8 +1724,10 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai, | |||
1723 | break; | 1724 | break; |
1724 | } | 1725 | } |
1725 | 1726 | ||
1726 | if (tid <= tid_aux) | 1727 | if (tid <= tid_aux) { |
1727 | return -EINVAL; | 1728 | ret = -EINVAL; |
1729 | goto error; | ||
1730 | } | ||
1728 | 1731 | ||
1729 | memset(pe, 0 , sizeof(struct mvpp2_prs_entry)); | 1732 | memset(pe, 0 , sizeof(struct mvpp2_prs_entry)); |
1730 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); | 1733 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); |
@@ -1756,9 +1759,10 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai, | |||
1756 | 1759 | ||
1757 | mvpp2_prs_hw_write(priv, pe); | 1760 | mvpp2_prs_hw_write(priv, pe); |
1758 | 1761 | ||
1762 | error: | ||
1759 | kfree(pe); | 1763 | kfree(pe); |
1760 | 1764 | ||
1761 | return 0; | 1765 | return ret; |
1762 | } | 1766 | } |
1763 | 1767 | ||
1764 | /* Get first free double vlan ai number */ | 1768 | /* Get first free double vlan ai number */ |
@@ -1821,7 +1825,7 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1821 | unsigned int port_map) | 1825 | unsigned int port_map) |
1822 | { | 1826 | { |
1823 | struct mvpp2_prs_entry *pe; | 1827 | struct mvpp2_prs_entry *pe; |
1824 | int tid_aux, tid, ai; | 1828 | int tid_aux, tid, ai, ret = 0; |
1825 | 1829 | ||
1826 | pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2); | 1830 | pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2); |
1827 | 1831 | ||
@@ -1838,8 +1842,10 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1838 | 1842 | ||
1839 | /* Set ai value for new double vlan entry */ | 1843 | /* Set ai value for new double vlan entry */ |
1840 | ai = mvpp2_prs_double_vlan_ai_free_get(priv); | 1844 | ai = mvpp2_prs_double_vlan_ai_free_get(priv); |
1841 | if (ai < 0) | 1845 | if (ai < 0) { |
1842 | return ai; | 1846 | ret = ai; |
1847 | goto error; | ||
1848 | } | ||
1843 | 1849 | ||
1844 | /* Get first single/triple vlan tid */ | 1850 | /* Get first single/triple vlan tid */ |
1845 | for (tid_aux = MVPP2_PE_FIRST_FREE_TID; | 1851 | for (tid_aux = MVPP2_PE_FIRST_FREE_TID; |
@@ -1859,8 +1865,10 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1859 | break; | 1865 | break; |
1860 | } | 1866 | } |
1861 | 1867 | ||
1862 | if (tid >= tid_aux) | 1868 | if (tid >= tid_aux) { |
1863 | return -ERANGE; | 1869 | ret = -ERANGE; |
1870 | goto error; | ||
1871 | } | ||
1864 | 1872 | ||
1865 | memset(pe, 0, sizeof(struct mvpp2_prs_entry)); | 1873 | memset(pe, 0, sizeof(struct mvpp2_prs_entry)); |
1866 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); | 1874 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); |
@@ -1887,8 +1895,9 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1887 | mvpp2_prs_tcam_port_map_set(pe, port_map); | 1895 | mvpp2_prs_tcam_port_map_set(pe, port_map); |
1888 | mvpp2_prs_hw_write(priv, pe); | 1896 | mvpp2_prs_hw_write(priv, pe); |
1889 | 1897 | ||
1898 | error: | ||
1890 | kfree(pe); | 1899 | kfree(pe); |
1891 | return 0; | 1900 | return ret; |
1892 | } | 1901 | } |
1893 | 1902 | ||
1894 | /* IPv4 header parsing for fragmentation and L4 offset */ | 1903 | /* IPv4 header parsing for fragmentation and L4 offset */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f3032fec8fce..4d69e382b4e5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | 1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); |
1694 | 1694 | ||
1695 | #ifdef CONFIG_MLX4_EN_VXLAN | 1695 | #ifdef CONFIG_MLX4_EN_VXLAN |
1696 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) | 1696 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
1697 | vxlan_get_rx_port(dev); | 1697 | vxlan_get_rx_port(dev); |
1698 | #endif | 1698 | #endif |
1699 | priv->port_up = true; | 1699 | priv->port_up = true; |
@@ -2281,8 +2281,16 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work) | |||
2281 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, | 2281 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, |
2282 | VXLAN_STEER_BY_OUTER_MAC, 1); | 2282 | VXLAN_STEER_BY_OUTER_MAC, 1); |
2283 | out: | 2283 | out: |
2284 | if (ret) | 2284 | if (ret) { |
2285 | en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); | 2285 | en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); |
2286 | return; | ||
2287 | } | ||
2288 | |||
2289 | /* set offloads */ | ||
2290 | priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2291 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; | ||
2292 | priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2293 | priv->dev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2286 | } | 2294 | } |
2287 | 2295 | ||
2288 | static void mlx4_en_del_vxlan_offloads(struct work_struct *work) | 2296 | static void mlx4_en_del_vxlan_offloads(struct work_struct *work) |
@@ -2290,6 +2298,11 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work) | |||
2290 | int ret; | 2298 | int ret; |
2291 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, | 2299 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, |
2292 | vxlan_del_task); | 2300 | vxlan_del_task); |
2301 | /* unset offloads */ | ||
2302 | priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2303 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL); | ||
2304 | priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL; | ||
2305 | priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL; | ||
2293 | 2306 | ||
2294 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, | 2307 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, |
2295 | VXLAN_STEER_BY_OUTER_MAC, 0); | 2308 | VXLAN_STEER_BY_OUTER_MAC, 0); |
@@ -2342,6 +2355,11 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, | |||
2342 | 2355 | ||
2343 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); | 2356 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); |
2344 | } | 2357 | } |
2358 | |||
2359 | static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
2360 | { | ||
2361 | return vxlan_gso_check(skb); | ||
2362 | } | ||
2345 | #endif | 2363 | #endif |
2346 | 2364 | ||
2347 | static const struct net_device_ops mlx4_netdev_ops = { | 2365 | static const struct net_device_ops mlx4_netdev_ops = { |
@@ -2373,6 +2391,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2373 | #ifdef CONFIG_MLX4_EN_VXLAN | 2391 | #ifdef CONFIG_MLX4_EN_VXLAN |
2374 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | 2392 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, |
2375 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | 2393 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, |
2394 | .ndo_gso_check = mlx4_en_gso_check, | ||
2376 | #endif | 2395 | #endif |
2377 | }; | 2396 | }; |
2378 | 2397 | ||
@@ -2403,6 +2422,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = { | |||
2403 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2422 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
2404 | #endif | 2423 | #endif |
2405 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, | 2424 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, |
2425 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2426 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | ||
2427 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | ||
2428 | .ndo_gso_check = mlx4_en_gso_check, | ||
2429 | #endif | ||
2406 | }; | 2430 | }; |
2407 | 2431 | ||
2408 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | 2432 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, |
@@ -2568,13 +2592,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2568 | if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) | 2592 | if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) |
2569 | dev->priv_flags |= IFF_UNICAST_FLT; | 2593 | dev->priv_flags |= IFF_UNICAST_FLT; |
2570 | 2594 | ||
2571 | if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | ||
2572 | dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2573 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; | ||
2574 | dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2575 | dev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2576 | } | ||
2577 | |||
2578 | mdev->pndev[port] = dev; | 2595 | mdev->pndev[port] = dev; |
2579 | 2596 | ||
2580 | netif_carrier_off(dev); | 2597 | netif_carrier_off(dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 5d2498dcf536..cd5cf6d957c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -1546,7 +1546,7 @@ static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, | |||
1546 | 1546 | ||
1547 | switch (op) { | 1547 | switch (op) { |
1548 | case RES_OP_RESERVE: | 1548 | case RES_OP_RESERVE: |
1549 | count = get_param_l(&in_param); | 1549 | count = get_param_l(&in_param) & 0xffffff; |
1550 | align = get_param_h(&in_param); | 1550 | align = get_param_h(&in_param); |
1551 | err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); | 1551 | err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); |
1552 | if (err) | 1552 | if (err) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index a278238a2db6..ad2c96a02a53 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
@@ -374,15 +374,14 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, | |||
374 | snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", | 374 | snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", |
375 | name, pci_name(dev->pdev)); | 375 | name, pci_name(dev->pdev)); |
376 | eq->eqn = out.eq_number; | 376 | eq->eqn = out.eq_number; |
377 | eq->irqn = vecidx; | ||
378 | eq->dev = dev; | ||
379 | eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; | ||
377 | err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, | 380 | err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, |
378 | eq->name, eq); | 381 | eq->name, eq); |
379 | if (err) | 382 | if (err) |
380 | goto err_eq; | 383 | goto err_eq; |
381 | 384 | ||
382 | eq->irqn = vecidx; | ||
383 | eq->dev = dev; | ||
384 | eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; | ||
385 | |||
386 | err = mlx5_debug_eq_add(dev, eq); | 385 | err = mlx5_debug_eq_add(dev, eq); |
387 | if (err) | 386 | if (err) |
388 | goto err_irq; | 387 | goto err_irq; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 3d8e8e489b2d..71b10b210792 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -864,14 +864,14 @@ static int init_one(struct pci_dev *pdev, | |||
864 | dev->profile = &profile[prof_sel]; | 864 | dev->profile = &profile[prof_sel]; |
865 | dev->event = mlx5_core_event; | 865 | dev->event = mlx5_core_event; |
866 | 866 | ||
867 | INIT_LIST_HEAD(&priv->ctx_list); | ||
868 | spin_lock_init(&priv->ctx_lock); | ||
867 | err = mlx5_dev_init(dev, pdev); | 869 | err = mlx5_dev_init(dev, pdev); |
868 | if (err) { | 870 | if (err) { |
869 | dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err); | 871 | dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err); |
870 | goto out; | 872 | goto out; |
871 | } | 873 | } |
872 | 874 | ||
873 | INIT_LIST_HEAD(&priv->ctx_list); | ||
874 | spin_lock_init(&priv->ctx_lock); | ||
875 | err = mlx5_register_device(dev); | 875 | err = mlx5_register_device(dev); |
876 | if (err) { | 876 | if (err) { |
877 | dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); | 877 | dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 0b2a1ccd276d..613037584d08 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -2762,7 +2762,8 @@ netxen_fw_poll_work(struct work_struct *work) | |||
2762 | if (test_bit(__NX_RESETTING, &adapter->state)) | 2762 | if (test_bit(__NX_RESETTING, &adapter->state)) |
2763 | goto reschedule; | 2763 | goto reschedule; |
2764 | 2764 | ||
2765 | if (test_bit(__NX_DEV_UP, &adapter->state)) { | 2765 | if (test_bit(__NX_DEV_UP, &adapter->state) && |
2766 | !(adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)) { | ||
2766 | if (!adapter->has_link_events) { | 2767 | if (!adapter->has_link_events) { |
2767 | 2768 | ||
2768 | netxen_nic_handle_phy_intr(adapter); | 2769 | netxen_nic_handle_phy_intr(adapter); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index f5e29f7bdae3..a913b3ad2f89 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev, | |||
503 | 503 | ||
504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | 504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; |
505 | } | 505 | } |
506 | |||
507 | static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
508 | { | ||
509 | return vxlan_gso_check(skb); | ||
510 | } | ||
506 | #endif | 511 | #endif |
507 | 512 | ||
508 | static const struct net_device_ops qlcnic_netdev_ops = { | 513 | static const struct net_device_ops qlcnic_netdev_ops = { |
@@ -526,6 +531,7 @@ static const struct net_device_ops qlcnic_netdev_ops = { | |||
526 | #ifdef CONFIG_QLCNIC_VXLAN | 531 | #ifdef CONFIG_QLCNIC_VXLAN |
527 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, | 532 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, |
528 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, | 533 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, |
534 | .ndo_gso_check = qlcnic_gso_check, | ||
529 | #endif | 535 | #endif |
530 | #ifdef CONFIG_NET_POLL_CONTROLLER | 536 | #ifdef CONFIG_NET_POLL_CONTROLLER |
531 | .ndo_poll_controller = qlcnic_poll_controller, | 537 | .ndo_poll_controller = qlcnic_poll_controller, |
diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig index f3a47147937d..9a49f42ac2ba 100644 --- a/drivers/net/ethernet/qualcomm/Kconfig +++ b/drivers/net/ethernet/qualcomm/Kconfig | |||
@@ -5,7 +5,6 @@ | |||
5 | config NET_VENDOR_QUALCOMM | 5 | config NET_VENDOR_QUALCOMM |
6 | bool "Qualcomm devices" | 6 | bool "Qualcomm devices" |
7 | default y | 7 | default y |
8 | depends on SPI_MASTER && OF_GPIO | ||
9 | ---help--- | 8 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y | 9 | If you have a network (Ethernet) card belonging to this class, say Y |
11 | and read the Ethernet-HOWTO, available from | 10 | and read the Ethernet-HOWTO, available from |
@@ -20,7 +19,7 @@ if NET_VENDOR_QUALCOMM | |||
20 | 19 | ||
21 | config QCA7000 | 20 | config QCA7000 |
22 | tristate "Qualcomm Atheros QCA7000 support" | 21 | tristate "Qualcomm Atheros QCA7000 support" |
23 | depends on SPI_MASTER && OF_GPIO | 22 | depends on SPI_MASTER && OF |
24 | ---help--- | 23 | ---help--- |
25 | This SPI protocol driver supports the Qualcomm Atheros QCA7000. | 24 | This SPI protocol driver supports the Qualcomm Atheros QCA7000. |
26 | 25 | ||
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 002d4cdc319f..a77f05ce8325 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -180,7 +180,8 @@ static int efx_ef10_probe(struct efx_nic *efx) | |||
180 | EFX_MAX_CHANNELS, | 180 | EFX_MAX_CHANNELS, |
181 | resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / | 181 | resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / |
182 | (EFX_VI_PAGE_SIZE * EFX_TXQ_TYPES)); | 182 | (EFX_VI_PAGE_SIZE * EFX_TXQ_TYPES)); |
183 | BUG_ON(efx->max_channels == 0); | 183 | if (WARN_ON(efx->max_channels == 0)) |
184 | return -EIO; | ||
184 | 185 | ||
185 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); | 186 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); |
186 | if (!nic_data) | 187 | if (!nic_data) |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 2c62208077fe..6cc3cf6f17c8 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -2243,9 +2243,10 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2243 | const struct of_device_id *match = NULL; | 2243 | const struct of_device_id *match = NULL; |
2244 | struct smc_local *lp; | 2244 | struct smc_local *lp; |
2245 | struct net_device *ndev; | 2245 | struct net_device *ndev; |
2246 | struct resource *res, *ires; | 2246 | struct resource *res; |
2247 | unsigned int __iomem *addr; | 2247 | unsigned int __iomem *addr; |
2248 | unsigned long irq_flags = SMC_IRQ_FLAGS; | 2248 | unsigned long irq_flags = SMC_IRQ_FLAGS; |
2249 | unsigned long irq_resflags; | ||
2249 | int ret; | 2250 | int ret; |
2250 | 2251 | ||
2251 | ndev = alloc_etherdev(sizeof(struct smc_local)); | 2252 | ndev = alloc_etherdev(sizeof(struct smc_local)); |
@@ -2337,16 +2338,19 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2337 | goto out_free_netdev; | 2338 | goto out_free_netdev; |
2338 | } | 2339 | } |
2339 | 2340 | ||
2340 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 2341 | ndev->irq = platform_get_irq(pdev, 0); |
2341 | if (!ires) { | 2342 | if (ndev->irq <= 0) { |
2342 | ret = -ENODEV; | 2343 | ret = -ENODEV; |
2343 | goto out_release_io; | 2344 | goto out_release_io; |
2344 | } | 2345 | } |
2345 | 2346 | /* | |
2346 | ndev->irq = ires->start; | 2347 | * If this platform does not specify any special irqflags, or if |
2347 | 2348 | * the resource supplies a trigger, override the irqflags with | |
2348 | if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) | 2349 | * the trigger flags from the resource. |
2349 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; | 2350 | */ |
2351 | irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); | ||
2352 | if (irq_flags == -1 || irq_resflags & IRQF_TRIGGER_MASK) | ||
2353 | irq_flags = irq_resflags & IRQF_TRIGGER_MASK; | ||
2350 | 2354 | ||
2351 | ret = smc_request_attrib(pdev, ndev); | 2355 | ret = smc_request_attrib(pdev, ndev); |
2352 | if (ret) | 2356 | if (ret) |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index affb29da353e..77ed74561e5f 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1342,6 +1342,42 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata) | |||
1342 | spin_unlock(&pdata->mac_lock); | 1342 | spin_unlock(&pdata->mac_lock); |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata) | ||
1346 | { | ||
1347 | int rc = 0; | ||
1348 | |||
1349 | if (!pdata->phy_dev) | ||
1350 | return rc; | ||
1351 | |||
1352 | /* If the internal PHY is in General Power-Down mode, all, except the | ||
1353 | * management interface, is powered-down and stays in that condition as | ||
1354 | * long as Phy register bit 0.11 is HIGH. | ||
1355 | * | ||
1356 | * In that case, clear the bit 0.11, so the PHY powers up and we can | ||
1357 | * access to the phy registers. | ||
1358 | */ | ||
1359 | rc = phy_read(pdata->phy_dev, MII_BMCR); | ||
1360 | if (rc < 0) { | ||
1361 | SMSC_WARN(pdata, drv, "Failed reading PHY control reg"); | ||
1362 | return rc; | ||
1363 | } | ||
1364 | |||
1365 | /* If the PHY general power-down bit is not set is not necessary to | ||
1366 | * disable the general power down-mode. | ||
1367 | */ | ||
1368 | if (rc & BMCR_PDOWN) { | ||
1369 | rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN); | ||
1370 | if (rc < 0) { | ||
1371 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | ||
1372 | return rc; | ||
1373 | } | ||
1374 | |||
1375 | usleep_range(1000, 1500); | ||
1376 | } | ||
1377 | |||
1378 | return 0; | ||
1379 | } | ||
1380 | |||
1345 | static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | 1381 | static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) |
1346 | { | 1382 | { |
1347 | int rc = 0; | 1383 | int rc = 0; |
@@ -1356,12 +1392,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | |||
1356 | return rc; | 1392 | return rc; |
1357 | } | 1393 | } |
1358 | 1394 | ||
1359 | /* | 1395 | /* Only disable if energy detect mode is already enabled */ |
1360 | * If energy is detected the PHY is already awake so is not necessary | 1396 | if (rc & MII_LAN83C185_EDPWRDOWN) { |
1361 | * to disable the energy detect power-down mode. | ||
1362 | */ | ||
1363 | if ((rc & MII_LAN83C185_EDPWRDOWN) && | ||
1364 | !(rc & MII_LAN83C185_ENERGYON)) { | ||
1365 | /* Disable energy detect mode for this SMSC Transceivers */ | 1397 | /* Disable energy detect mode for this SMSC Transceivers */ |
1366 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, | 1398 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, |
1367 | rc & (~MII_LAN83C185_EDPWRDOWN)); | 1399 | rc & (~MII_LAN83C185_EDPWRDOWN)); |
@@ -1370,8 +1402,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | |||
1370 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | 1402 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); |
1371 | return rc; | 1403 | return rc; |
1372 | } | 1404 | } |
1373 | 1405 | /* Allow PHY to wakeup */ | |
1374 | mdelay(1); | 1406 | mdelay(2); |
1375 | } | 1407 | } |
1376 | 1408 | ||
1377 | return 0; | 1409 | return 0; |
@@ -1393,7 +1425,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata) | |||
1393 | 1425 | ||
1394 | /* Only enable if energy detect mode is already disabled */ | 1426 | /* Only enable if energy detect mode is already disabled */ |
1395 | if (!(rc & MII_LAN83C185_EDPWRDOWN)) { | 1427 | if (!(rc & MII_LAN83C185_EDPWRDOWN)) { |
1396 | mdelay(100); | ||
1397 | /* Enable energy detect mode for this SMSC Transceivers */ | 1428 | /* Enable energy detect mode for this SMSC Transceivers */ |
1398 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, | 1429 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, |
1399 | rc | MII_LAN83C185_EDPWRDOWN); | 1430 | rc | MII_LAN83C185_EDPWRDOWN); |
@@ -1402,8 +1433,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata) | |||
1402 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | 1433 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); |
1403 | return rc; | 1434 | return rc; |
1404 | } | 1435 | } |
1405 | |||
1406 | mdelay(1); | ||
1407 | } | 1436 | } |
1408 | return 0; | 1437 | return 0; |
1409 | } | 1438 | } |
@@ -1415,6 +1444,16 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata) | |||
1415 | int ret; | 1444 | int ret; |
1416 | 1445 | ||
1417 | /* | 1446 | /* |
1447 | * Make sure to power-up the PHY chip before doing a reset, otherwise | ||
1448 | * the reset fails. | ||
1449 | */ | ||
1450 | ret = smsc911x_phy_general_power_up(pdata); | ||
1451 | if (ret) { | ||
1452 | SMSC_WARN(pdata, drv, "Failed to power-up the PHY chip"); | ||
1453 | return ret; | ||
1454 | } | ||
1455 | |||
1456 | /* | ||
1418 | * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that | 1457 | * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that |
1419 | * are initialized in a Energy Detect Power-Down mode that prevents | 1458 | * are initialized in a Energy Detect Power-Down mode that prevents |
1420 | * the MAC chip to be software reseted. So we have to wakeup the PHY | 1459 | * the MAC chip to be software reseted. So we have to wakeup the PHY |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6f77a46c7e2c..18c46bb0f3bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -276,6 +276,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) | |||
276 | bool stmmac_eee_init(struct stmmac_priv *priv) | 276 | bool stmmac_eee_init(struct stmmac_priv *priv) |
277 | { | 277 | { |
278 | char *phy_bus_name = priv->plat->phy_bus_name; | 278 | char *phy_bus_name = priv->plat->phy_bus_name; |
279 | unsigned long flags; | ||
279 | bool ret = false; | 280 | bool ret = false; |
280 | 281 | ||
281 | /* Using PCS we cannot dial with the phy registers at this stage | 282 | /* Using PCS we cannot dial with the phy registers at this stage |
@@ -300,6 +301,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
300 | * changed). | 301 | * changed). |
301 | * In that case the driver disable own timers. | 302 | * In that case the driver disable own timers. |
302 | */ | 303 | */ |
304 | spin_lock_irqsave(&priv->lock, flags); | ||
303 | if (priv->eee_active) { | 305 | if (priv->eee_active) { |
304 | pr_debug("stmmac: disable EEE\n"); | 306 | pr_debug("stmmac: disable EEE\n"); |
305 | del_timer_sync(&priv->eee_ctrl_timer); | 307 | del_timer_sync(&priv->eee_ctrl_timer); |
@@ -307,9 +309,11 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
307 | tx_lpi_timer); | 309 | tx_lpi_timer); |
308 | } | 310 | } |
309 | priv->eee_active = 0; | 311 | priv->eee_active = 0; |
312 | spin_unlock_irqrestore(&priv->lock, flags); | ||
310 | goto out; | 313 | goto out; |
311 | } | 314 | } |
312 | /* Activate the EEE and start timers */ | 315 | /* Activate the EEE and start timers */ |
316 | spin_lock_irqsave(&priv->lock, flags); | ||
313 | if (!priv->eee_active) { | 317 | if (!priv->eee_active) { |
314 | priv->eee_active = 1; | 318 | priv->eee_active = 1; |
315 | init_timer(&priv->eee_ctrl_timer); | 319 | init_timer(&priv->eee_ctrl_timer); |
@@ -325,9 +329,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
325 | /* Set HW EEE according to the speed */ | 329 | /* Set HW EEE according to the speed */ |
326 | priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); | 330 | priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); |
327 | 331 | ||
328 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); | ||
329 | |||
330 | ret = true; | 332 | ret = true; |
333 | spin_unlock_irqrestore(&priv->lock, flags); | ||
334 | |||
335 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); | ||
331 | } | 336 | } |
332 | out: | 337 | out: |
333 | return ret; | 338 | return ret; |
@@ -760,12 +765,12 @@ static void stmmac_adjust_link(struct net_device *dev) | |||
760 | if (new_state && netif_msg_link(priv)) | 765 | if (new_state && netif_msg_link(priv)) |
761 | phy_print_status(phydev); | 766 | phy_print_status(phydev); |
762 | 767 | ||
768 | spin_unlock_irqrestore(&priv->lock, flags); | ||
769 | |||
763 | /* At this stage, it could be needed to setup the EEE or adjust some | 770 | /* At this stage, it could be needed to setup the EEE or adjust some |
764 | * MAC related HW registers. | 771 | * MAC related HW registers. |
765 | */ | 772 | */ |
766 | priv->eee_enabled = stmmac_eee_init(priv); | 773 | priv->eee_enabled = stmmac_eee_init(priv); |
767 | |||
768 | spin_unlock_irqrestore(&priv->lock, flags); | ||
769 | } | 774 | } |
770 | 775 | ||
771 | /** | 776 | /** |
@@ -959,12 +964,12 @@ static void stmmac_clear_descriptors(struct stmmac_priv *priv) | |||
959 | } | 964 | } |
960 | 965 | ||
961 | static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | 966 | static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, |
962 | int i) | 967 | int i, gfp_t flags) |
963 | { | 968 | { |
964 | struct sk_buff *skb; | 969 | struct sk_buff *skb; |
965 | 970 | ||
966 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, | 971 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, |
967 | GFP_KERNEL); | 972 | flags); |
968 | if (!skb) { | 973 | if (!skb) { |
969 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); | 974 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); |
970 | return -ENOMEM; | 975 | return -ENOMEM; |
@@ -1006,7 +1011,7 @@ static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i) | |||
1006 | * and allocates the socket buffers. It suppors the chained and ring | 1011 | * and allocates the socket buffers. It suppors the chained and ring |
1007 | * modes. | 1012 | * modes. |
1008 | */ | 1013 | */ |
1009 | static int init_dma_desc_rings(struct net_device *dev) | 1014 | static int init_dma_desc_rings(struct net_device *dev, gfp_t flags) |
1010 | { | 1015 | { |
1011 | int i; | 1016 | int i; |
1012 | struct stmmac_priv *priv = netdev_priv(dev); | 1017 | struct stmmac_priv *priv = netdev_priv(dev); |
@@ -1041,7 +1046,7 @@ static int init_dma_desc_rings(struct net_device *dev) | |||
1041 | else | 1046 | else |
1042 | p = priv->dma_rx + i; | 1047 | p = priv->dma_rx + i; |
1043 | 1048 | ||
1044 | ret = stmmac_init_rx_buffers(priv, p, i); | 1049 | ret = stmmac_init_rx_buffers(priv, p, i, flags); |
1045 | if (ret) | 1050 | if (ret) |
1046 | goto err_init_rx_buffers; | 1051 | goto err_init_rx_buffers; |
1047 | 1052 | ||
@@ -1647,11 +1652,6 @@ static int stmmac_hw_setup(struct net_device *dev) | |||
1647 | struct stmmac_priv *priv = netdev_priv(dev); | 1652 | struct stmmac_priv *priv = netdev_priv(dev); |
1648 | int ret; | 1653 | int ret; |
1649 | 1654 | ||
1650 | ret = init_dma_desc_rings(dev); | ||
1651 | if (ret < 0) { | ||
1652 | pr_err("%s: DMA descriptors initialization failed\n", __func__); | ||
1653 | return ret; | ||
1654 | } | ||
1655 | /* DMA initialization and SW reset */ | 1655 | /* DMA initialization and SW reset */ |
1656 | ret = stmmac_init_dma_engine(priv); | 1656 | ret = stmmac_init_dma_engine(priv); |
1657 | if (ret < 0) { | 1657 | if (ret < 0) { |
@@ -1705,10 +1705,6 @@ static int stmmac_hw_setup(struct net_device *dev) | |||
1705 | } | 1705 | } |
1706 | priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; | 1706 | priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; |
1707 | 1707 | ||
1708 | priv->eee_enabled = stmmac_eee_init(priv); | ||
1709 | |||
1710 | stmmac_init_tx_coalesce(priv); | ||
1711 | |||
1712 | if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { | 1708 | if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { |
1713 | priv->rx_riwt = MAX_DMA_RIWT; | 1709 | priv->rx_riwt = MAX_DMA_RIWT; |
1714 | priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT); | 1710 | priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT); |
@@ -1761,12 +1757,20 @@ static int stmmac_open(struct net_device *dev) | |||
1761 | goto dma_desc_error; | 1757 | goto dma_desc_error; |
1762 | } | 1758 | } |
1763 | 1759 | ||
1760 | ret = init_dma_desc_rings(dev, GFP_KERNEL); | ||
1761 | if (ret < 0) { | ||
1762 | pr_err("%s: DMA descriptors initialization failed\n", __func__); | ||
1763 | goto init_error; | ||
1764 | } | ||
1765 | |||
1764 | ret = stmmac_hw_setup(dev); | 1766 | ret = stmmac_hw_setup(dev); |
1765 | if (ret < 0) { | 1767 | if (ret < 0) { |
1766 | pr_err("%s: Hw setup failed\n", __func__); | 1768 | pr_err("%s: Hw setup failed\n", __func__); |
1767 | goto init_error; | 1769 | goto init_error; |
1768 | } | 1770 | } |
1769 | 1771 | ||
1772 | stmmac_init_tx_coalesce(priv); | ||
1773 | |||
1770 | if (priv->phydev) | 1774 | if (priv->phydev) |
1771 | phy_start(priv->phydev); | 1775 | phy_start(priv->phydev); |
1772 | 1776 | ||
@@ -1894,7 +1898,10 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1894 | unsigned int nopaged_len = skb_headlen(skb); | 1898 | unsigned int nopaged_len = skb_headlen(skb); |
1895 | unsigned int enh_desc = priv->plat->enh_desc; | 1899 | unsigned int enh_desc = priv->plat->enh_desc; |
1896 | 1900 | ||
1901 | spin_lock(&priv->tx_lock); | ||
1902 | |||
1897 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { | 1903 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { |
1904 | spin_unlock(&priv->tx_lock); | ||
1898 | if (!netif_queue_stopped(dev)) { | 1905 | if (!netif_queue_stopped(dev)) { |
1899 | netif_stop_queue(dev); | 1906 | netif_stop_queue(dev); |
1900 | /* This is a hard error, log it. */ | 1907 | /* This is a hard error, log it. */ |
@@ -1903,8 +1910,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1903 | return NETDEV_TX_BUSY; | 1910 | return NETDEV_TX_BUSY; |
1904 | } | 1911 | } |
1905 | 1912 | ||
1906 | spin_lock(&priv->tx_lock); | ||
1907 | |||
1908 | if (priv->tx_path_in_lpi_mode) | 1913 | if (priv->tx_path_in_lpi_mode) |
1909 | stmmac_disable_eee_mode(priv); | 1914 | stmmac_disable_eee_mode(priv); |
1910 | 1915 | ||
@@ -2025,6 +2030,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2025 | return NETDEV_TX_OK; | 2030 | return NETDEV_TX_OK; |
2026 | 2031 | ||
2027 | dma_map_err: | 2032 | dma_map_err: |
2033 | spin_unlock(&priv->tx_lock); | ||
2028 | dev_err(priv->device, "Tx dma map failed\n"); | 2034 | dev_err(priv->device, "Tx dma map failed\n"); |
2029 | dev_kfree_skb(skb); | 2035 | dev_kfree_skb(skb); |
2030 | priv->dev->stats.tx_dropped++; | 2036 | priv->dev->stats.tx_dropped++; |
@@ -2281,9 +2287,7 @@ static void stmmac_set_rx_mode(struct net_device *dev) | |||
2281 | { | 2287 | { |
2282 | struct stmmac_priv *priv = netdev_priv(dev); | 2288 | struct stmmac_priv *priv = netdev_priv(dev); |
2283 | 2289 | ||
2284 | spin_lock(&priv->lock); | ||
2285 | priv->hw->mac->set_filter(priv->hw, dev); | 2290 | priv->hw->mac->set_filter(priv->hw, dev); |
2286 | spin_unlock(&priv->lock); | ||
2287 | } | 2291 | } |
2288 | 2292 | ||
2289 | /** | 2293 | /** |
@@ -2950,7 +2954,7 @@ int stmmac_suspend(struct net_device *ndev) | |||
2950 | stmmac_set_mac(priv->ioaddr, false); | 2954 | stmmac_set_mac(priv->ioaddr, false); |
2951 | pinctrl_pm_select_sleep_state(priv->device); | 2955 | pinctrl_pm_select_sleep_state(priv->device); |
2952 | /* Disable clock in case of PWM is off */ | 2956 | /* Disable clock in case of PWM is off */ |
2953 | clk_disable_unprepare(priv->stmmac_clk); | 2957 | clk_disable(priv->stmmac_clk); |
2954 | } | 2958 | } |
2955 | spin_unlock_irqrestore(&priv->lock, flags); | 2959 | spin_unlock_irqrestore(&priv->lock, flags); |
2956 | 2960 | ||
@@ -2982,7 +2986,7 @@ int stmmac_resume(struct net_device *ndev) | |||
2982 | } else { | 2986 | } else { |
2983 | pinctrl_pm_select_default_state(priv->device); | 2987 | pinctrl_pm_select_default_state(priv->device); |
2984 | /* enable the clk prevously disabled */ | 2988 | /* enable the clk prevously disabled */ |
2985 | clk_prepare_enable(priv->stmmac_clk); | 2989 | clk_enable(priv->stmmac_clk); |
2986 | /* reset the phy so that it's ready */ | 2990 | /* reset the phy so that it's ready */ |
2987 | if (priv->mii) | 2991 | if (priv->mii) |
2988 | stmmac_mdio_reset(priv->mii); | 2992 | stmmac_mdio_reset(priv->mii); |
@@ -2990,7 +2994,9 @@ int stmmac_resume(struct net_device *ndev) | |||
2990 | 2994 | ||
2991 | netif_device_attach(ndev); | 2995 | netif_device_attach(ndev); |
2992 | 2996 | ||
2997 | init_dma_desc_rings(ndev, GFP_ATOMIC); | ||
2993 | stmmac_hw_setup(ndev); | 2998 | stmmac_hw_setup(ndev); |
2999 | stmmac_init_tx_coalesce(priv); | ||
2994 | 3000 | ||
2995 | napi_enable(&priv->napi); | 3001 | napi_enable(&priv->napi); |
2996 | 3002 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index db56fa7ce8f9..5b0da3986216 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -177,12 +177,6 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, | |||
177 | */ | 177 | */ |
178 | plat->maxmtu = JUMBO_LEN; | 178 | plat->maxmtu = JUMBO_LEN; |
179 | 179 | ||
180 | /* Set default value for multicast hash bins */ | ||
181 | plat->multicast_filter_bins = HASH_TABLE_SIZE; | ||
182 | |||
183 | /* Set default value for unicast filter entries */ | ||
184 | plat->unicast_filter_entries = 1; | ||
185 | |||
186 | /* | 180 | /* |
187 | * Currently only the properties needed on SPEAr600 | 181 | * Currently only the properties needed on SPEAr600 |
188 | * are provided. All other properties should be added | 182 | * are provided. All other properties should be added |
@@ -270,6 +264,13 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
270 | return PTR_ERR(addr); | 264 | return PTR_ERR(addr); |
271 | 265 | ||
272 | plat_dat = dev_get_platdata(&pdev->dev); | 266 | plat_dat = dev_get_platdata(&pdev->dev); |
267 | |||
268 | /* Set default value for multicast hash bins */ | ||
269 | plat_dat->multicast_filter_bins = HASH_TABLE_SIZE; | ||
270 | |||
271 | /* Set default value for unicast filter entries */ | ||
272 | plat_dat->unicast_filter_entries = 1; | ||
273 | |||
273 | if (pdev->dev.of_node) { | 274 | if (pdev->dev.of_node) { |
274 | if (!plat_dat) | 275 | if (!plat_dat) |
275 | plat_dat = devm_kzalloc(&pdev->dev, | 276 | plat_dat = devm_kzalloc(&pdev->dev, |
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 72c8525d5457..9c014803b03b 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
@@ -1262,6 +1262,7 @@ static void happy_meal_init_rings(struct happy_meal *hp) | |||
1262 | HMD(("init rxring, ")); | 1262 | HMD(("init rxring, ")); |
1263 | for (i = 0; i < RX_RING_SIZE; i++) { | 1263 | for (i = 0; i < RX_RING_SIZE; i++) { |
1264 | struct sk_buff *skb; | 1264 | struct sk_buff *skb; |
1265 | u32 mapping; | ||
1265 | 1266 | ||
1266 | skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); | 1267 | skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); |
1267 | if (!skb) { | 1268 | if (!skb) { |
@@ -1272,10 +1273,16 @@ static void happy_meal_init_rings(struct happy_meal *hp) | |||
1272 | 1273 | ||
1273 | /* Because we reserve afterwards. */ | 1274 | /* Because we reserve afterwards. */ |
1274 | skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); | 1275 | skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); |
1276 | mapping = dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, | ||
1277 | DMA_FROM_DEVICE); | ||
1278 | if (dma_mapping_error(hp->dma_dev, mapping)) { | ||
1279 | dev_kfree_skb_any(skb); | ||
1280 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], 0, 0); | ||
1281 | continue; | ||
1282 | } | ||
1275 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], | 1283 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], |
1276 | (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), | 1284 | (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), |
1277 | dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, | 1285 | mapping); |
1278 | DMA_FROM_DEVICE)); | ||
1279 | skb_reserve(skb, RX_OFFSET); | 1286 | skb_reserve(skb, RX_OFFSET); |
1280 | } | 1287 | } |
1281 | 1288 | ||
@@ -2020,6 +2027,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) | |||
2020 | skb = hp->rx_skbs[elem]; | 2027 | skb = hp->rx_skbs[elem]; |
2021 | if (len > RX_COPY_THRESHOLD) { | 2028 | if (len > RX_COPY_THRESHOLD) { |
2022 | struct sk_buff *new_skb; | 2029 | struct sk_buff *new_skb; |
2030 | u32 mapping; | ||
2023 | 2031 | ||
2024 | /* Now refill the entry, if we can. */ | 2032 | /* Now refill the entry, if we can. */ |
2025 | new_skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); | 2033 | new_skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); |
@@ -2027,13 +2035,21 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) | |||
2027 | drops++; | 2035 | drops++; |
2028 | goto drop_it; | 2036 | goto drop_it; |
2029 | } | 2037 | } |
2038 | skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); | ||
2039 | mapping = dma_map_single(hp->dma_dev, new_skb->data, | ||
2040 | RX_BUF_ALLOC_SIZE, | ||
2041 | DMA_FROM_DEVICE); | ||
2042 | if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) { | ||
2043 | dev_kfree_skb_any(new_skb); | ||
2044 | drops++; | ||
2045 | goto drop_it; | ||
2046 | } | ||
2047 | |||
2030 | dma_unmap_single(hp->dma_dev, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROM_DEVICE); | 2048 | dma_unmap_single(hp->dma_dev, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROM_DEVICE); |
2031 | hp->rx_skbs[elem] = new_skb; | 2049 | hp->rx_skbs[elem] = new_skb; |
2032 | skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); | ||
2033 | hme_write_rxd(hp, this, | 2050 | hme_write_rxd(hp, this, |
2034 | (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), | 2051 | (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), |
2035 | dma_map_single(hp->dma_dev, new_skb->data, RX_BUF_ALLOC_SIZE, | 2052 | mapping); |
2036 | DMA_FROM_DEVICE)); | ||
2037 | skb_reserve(new_skb, RX_OFFSET); | 2053 | skb_reserve(new_skb, RX_OFFSET); |
2038 | 2054 | ||
2039 | /* Trim the original skb for the netif. */ | 2055 | /* Trim the original skb for the netif. */ |
@@ -2248,6 +2264,25 @@ static void happy_meal_tx_timeout(struct net_device *dev) | |||
2248 | netif_wake_queue(dev); | 2264 | netif_wake_queue(dev); |
2249 | } | 2265 | } |
2250 | 2266 | ||
2267 | static void unmap_partial_tx_skb(struct happy_meal *hp, u32 first_mapping, | ||
2268 | u32 first_len, u32 first_entry, u32 entry) | ||
2269 | { | ||
2270 | struct happy_meal_txd *txbase = &hp->happy_block->happy_meal_txd[0]; | ||
2271 | |||
2272 | dma_unmap_single(hp->dma_dev, first_mapping, first_len, DMA_TO_DEVICE); | ||
2273 | |||
2274 | first_entry = NEXT_TX(first_entry); | ||
2275 | while (first_entry != entry) { | ||
2276 | struct happy_meal_txd *this = &txbase[first_entry]; | ||
2277 | u32 addr, len; | ||
2278 | |||
2279 | addr = hme_read_desc32(hp, &this->tx_addr); | ||
2280 | len = hme_read_desc32(hp, &this->tx_flags); | ||
2281 | len &= TXFLAG_SIZE; | ||
2282 | dma_unmap_page(hp->dma_dev, addr, len, DMA_TO_DEVICE); | ||
2283 | } | ||
2284 | } | ||
2285 | |||
2251 | static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | 2286 | static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, |
2252 | struct net_device *dev) | 2287 | struct net_device *dev) |
2253 | { | 2288 | { |
@@ -2284,6 +2319,8 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2284 | 2319 | ||
2285 | len = skb->len; | 2320 | len = skb->len; |
2286 | mapping = dma_map_single(hp->dma_dev, skb->data, len, DMA_TO_DEVICE); | 2321 | mapping = dma_map_single(hp->dma_dev, skb->data, len, DMA_TO_DEVICE); |
2322 | if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) | ||
2323 | goto out_dma_error; | ||
2287 | tx_flags |= (TXFLAG_SOP | TXFLAG_EOP); | 2324 | tx_flags |= (TXFLAG_SOP | TXFLAG_EOP); |
2288 | hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], | 2325 | hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], |
2289 | (tx_flags | (len & TXFLAG_SIZE)), | 2326 | (tx_flags | (len & TXFLAG_SIZE)), |
@@ -2299,6 +2336,8 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2299 | first_len = skb_headlen(skb); | 2336 | first_len = skb_headlen(skb); |
2300 | first_mapping = dma_map_single(hp->dma_dev, skb->data, first_len, | 2337 | first_mapping = dma_map_single(hp->dma_dev, skb->data, first_len, |
2301 | DMA_TO_DEVICE); | 2338 | DMA_TO_DEVICE); |
2339 | if (unlikely(dma_mapping_error(hp->dma_dev, first_mapping))) | ||
2340 | goto out_dma_error; | ||
2302 | entry = NEXT_TX(entry); | 2341 | entry = NEXT_TX(entry); |
2303 | 2342 | ||
2304 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { | 2343 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { |
@@ -2308,6 +2347,11 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2308 | len = skb_frag_size(this_frag); | 2347 | len = skb_frag_size(this_frag); |
2309 | mapping = skb_frag_dma_map(hp->dma_dev, this_frag, | 2348 | mapping = skb_frag_dma_map(hp->dma_dev, this_frag, |
2310 | 0, len, DMA_TO_DEVICE); | 2349 | 0, len, DMA_TO_DEVICE); |
2350 | if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) { | ||
2351 | unmap_partial_tx_skb(hp, first_mapping, first_len, | ||
2352 | first_entry, entry); | ||
2353 | goto out_dma_error; | ||
2354 | } | ||
2311 | this_txflags = tx_flags; | 2355 | this_txflags = tx_flags; |
2312 | if (frag == skb_shinfo(skb)->nr_frags - 1) | 2356 | if (frag == skb_shinfo(skb)->nr_frags - 1) |
2313 | this_txflags |= TXFLAG_EOP; | 2357 | this_txflags |= TXFLAG_EOP; |
@@ -2333,6 +2377,14 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2333 | 2377 | ||
2334 | tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); | 2378 | tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); |
2335 | return NETDEV_TX_OK; | 2379 | return NETDEV_TX_OK; |
2380 | |||
2381 | out_dma_error: | ||
2382 | hp->tx_skbs[hp->tx_new] = NULL; | ||
2383 | spin_unlock_irq(&hp->happy_lock); | ||
2384 | |||
2385 | dev_kfree_skb_any(skb); | ||
2386 | dev->stats.tx_dropped++; | ||
2387 | return NETDEV_TX_OK; | ||
2336 | } | 2388 | } |
2337 | 2389 | ||
2338 | static struct net_device_stats *happy_meal_get_stats(struct net_device *dev) | 2390 | static struct net_device_stats *happy_meal_get_stats(struct net_device *dev) |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index d8794488f80a..c560f9aeb55d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -129,9 +129,9 @@ do { \ | |||
129 | #define CPSW_VLAN_AWARE BIT(1) | 129 | #define CPSW_VLAN_AWARE BIT(1) |
130 | #define CPSW_ALE_VLAN_AWARE 1 | 130 | #define CPSW_ALE_VLAN_AWARE 1 |
131 | 131 | ||
132 | #define CPSW_FIFO_NORMAL_MODE (0 << 15) | 132 | #define CPSW_FIFO_NORMAL_MODE (0 << 16) |
133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) | 133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16) |
134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) | 134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16) |
135 | 135 | ||
136 | #define CPSW_INTPACEEN (0x3f << 16) | 136 | #define CPSW_INTPACEEN (0x3f << 16) |
137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) | 137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) |
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 3ae83879a75f..097ebe7077ac 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c | |||
@@ -785,7 +785,6 @@ int cpsw_ale_destroy(struct cpsw_ale *ale) | |||
785 | { | 785 | { |
786 | if (!ale) | 786 | if (!ale) |
787 | return -EINVAL; | 787 | return -EINVAL; |
788 | cpsw_ale_stop(ale); | ||
789 | cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); | 788 | cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); |
790 | kfree(ale); | 789 | kfree(ale); |
791 | return 0; | 790 | return 0; |
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index ab92f67da035..4a4388b813ac 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c | |||
@@ -264,7 +264,7 @@ static int cpts_match(struct sk_buff *skb, unsigned int ptp_class, | |||
264 | 264 | ||
265 | switch (ptp_class & PTP_CLASS_PMASK) { | 265 | switch (ptp_class & PTP_CLASS_PMASK) { |
266 | case PTP_CLASS_IPV4: | 266 | case PTP_CLASS_IPV4: |
267 | offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; | 267 | offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; |
268 | break; | 268 | break; |
269 | case PTP_CLASS_IPV6: | 269 | case PTP_CLASS_IPV6: |
270 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; | 270 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; |
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c index 9ce854f43917..6cbc56ad9ff4 100644 --- a/drivers/net/ieee802154/fakehard.c +++ b/drivers/net/ieee802154/fakehard.c | |||
@@ -377,17 +377,20 @@ static int ieee802154fake_probe(struct platform_device *pdev) | |||
377 | 377 | ||
378 | err = wpan_phy_register(phy); | 378 | err = wpan_phy_register(phy); |
379 | if (err) | 379 | if (err) |
380 | goto out; | 380 | goto err_phy_reg; |
381 | 381 | ||
382 | err = register_netdev(dev); | 382 | err = register_netdev(dev); |
383 | if (err < 0) | 383 | if (err) |
384 | goto out; | 384 | goto err_netdev_reg; |
385 | 385 | ||
386 | dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); | 386 | dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); |
387 | return 0; | 387 | return 0; |
388 | 388 | ||
389 | out: | 389 | err_netdev_reg: |
390 | unregister_netdev(dev); | 390 | wpan_phy_unregister(phy); |
391 | err_phy_reg: | ||
392 | free_netdev(dev); | ||
393 | wpan_phy_free(phy); | ||
391 | return err; | 394 | return err; |
392 | } | 395 | } |
393 | 396 | ||
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 6f226de655a4..880cc090dc44 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -629,6 +629,8 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, | |||
629 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 629 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
630 | vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; | 630 | vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; |
631 | vnet_hdr->csum_start = skb_checksum_start_offset(skb); | 631 | vnet_hdr->csum_start = skb_checksum_start_offset(skb); |
632 | if (vlan_tx_tag_present(skb)) | ||
633 | vnet_hdr->csum_start += VLAN_HLEN; | ||
632 | vnet_hdr->csum_offset = skb->csum_offset; | 634 | vnet_hdr->csum_offset = skb->csum_offset; |
633 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { | 635 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { |
634 | vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID; | 636 | vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID; |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 2954052706e8..e22e602beef3 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -791,7 +791,7 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts) | |||
791 | 791 | ||
792 | switch (type & PTP_CLASS_PMASK) { | 792 | switch (type & PTP_CLASS_PMASK) { |
793 | case PTP_CLASS_IPV4: | 793 | case PTP_CLASS_IPV4: |
794 | offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; | 794 | offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; |
795 | break; | 795 | break; |
796 | case PTP_CLASS_IPV6: | 796 | case PTP_CLASS_IPV6: |
797 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; | 797 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; |
@@ -934,7 +934,7 @@ static int is_sync(struct sk_buff *skb, int type) | |||
934 | 934 | ||
935 | switch (type & PTP_CLASS_PMASK) { | 935 | switch (type & PTP_CLASS_PMASK) { |
936 | case PTP_CLASS_IPV4: | 936 | case PTP_CLASS_IPV4: |
937 | offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; | 937 | offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; |
938 | break; | 938 | break; |
939 | case PTP_CLASS_IPV6: | 939 | case PTP_CLASS_IPV6: |
940 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; | 940 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1dfffdc9dfc3..767cd110f496 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -352,6 +352,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) | |||
352 | { | 352 | { |
353 | struct mii_ioctl_data *mii_data = if_mii(ifr); | 353 | struct mii_ioctl_data *mii_data = if_mii(ifr); |
354 | u16 val = mii_data->val_in; | 354 | u16 val = mii_data->val_in; |
355 | bool change_autoneg = false; | ||
355 | 356 | ||
356 | switch (cmd) { | 357 | switch (cmd) { |
357 | case SIOCGMIIPHY: | 358 | case SIOCGMIIPHY: |
@@ -367,22 +368,29 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) | |||
367 | if (mii_data->phy_id == phydev->addr) { | 368 | if (mii_data->phy_id == phydev->addr) { |
368 | switch (mii_data->reg_num) { | 369 | switch (mii_data->reg_num) { |
369 | case MII_BMCR: | 370 | case MII_BMCR: |
370 | if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) | 371 | if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) { |
372 | if (phydev->autoneg == AUTONEG_ENABLE) | ||
373 | change_autoneg = true; | ||
371 | phydev->autoneg = AUTONEG_DISABLE; | 374 | phydev->autoneg = AUTONEG_DISABLE; |
372 | else | 375 | if (val & BMCR_FULLDPLX) |
376 | phydev->duplex = DUPLEX_FULL; | ||
377 | else | ||
378 | phydev->duplex = DUPLEX_HALF; | ||
379 | if (val & BMCR_SPEED1000) | ||
380 | phydev->speed = SPEED_1000; | ||
381 | else if (val & BMCR_SPEED100) | ||
382 | phydev->speed = SPEED_100; | ||
383 | else phydev->speed = SPEED_10; | ||
384 | } | ||
385 | else { | ||
386 | if (phydev->autoneg == AUTONEG_DISABLE) | ||
387 | change_autoneg = true; | ||
373 | phydev->autoneg = AUTONEG_ENABLE; | 388 | phydev->autoneg = AUTONEG_ENABLE; |
374 | if (!phydev->autoneg && (val & BMCR_FULLDPLX)) | 389 | } |
375 | phydev->duplex = DUPLEX_FULL; | ||
376 | else | ||
377 | phydev->duplex = DUPLEX_HALF; | ||
378 | if (!phydev->autoneg && (val & BMCR_SPEED1000)) | ||
379 | phydev->speed = SPEED_1000; | ||
380 | else if (!phydev->autoneg && | ||
381 | (val & BMCR_SPEED100)) | ||
382 | phydev->speed = SPEED_100; | ||
383 | break; | 390 | break; |
384 | case MII_ADVERTISE: | 391 | case MII_ADVERTISE: |
385 | phydev->advertising = val; | 392 | phydev->advertising = mii_adv_to_ethtool_adv_t(val); |
393 | change_autoneg = true; | ||
386 | break; | 394 | break; |
387 | default: | 395 | default: |
388 | /* do nothing */ | 396 | /* do nothing */ |
@@ -396,6 +404,10 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) | |||
396 | if (mii_data->reg_num == MII_BMCR && | 404 | if (mii_data->reg_num == MII_BMCR && |
397 | val & BMCR_RESET) | 405 | val & BMCR_RESET) |
398 | return phy_init_hw(phydev); | 406 | return phy_init_hw(phydev); |
407 | |||
408 | if (change_autoneg) | ||
409 | return phy_start_aneg(phydev); | ||
410 | |||
399 | return 0; | 411 | return 0; |
400 | 412 | ||
401 | case SIOCSHWTSTAMP: | 413 | case SIOCSHWTSTAMP: |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 68c3a3f4e0ab..794a47329368 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
@@ -755,23 +755,23 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
755 | 755 | ||
756 | err = get_filter(argp, &code); | 756 | err = get_filter(argp, &code); |
757 | if (err >= 0) { | 757 | if (err >= 0) { |
758 | struct bpf_prog *pass_filter = NULL; | ||
758 | struct sock_fprog_kern fprog = { | 759 | struct sock_fprog_kern fprog = { |
759 | .len = err, | 760 | .len = err, |
760 | .filter = code, | 761 | .filter = code, |
761 | }; | 762 | }; |
762 | 763 | ||
763 | ppp_lock(ppp); | 764 | err = 0; |
764 | if (ppp->pass_filter) { | 765 | if (fprog.filter) |
765 | bpf_prog_destroy(ppp->pass_filter); | 766 | err = bpf_prog_create(&pass_filter, &fprog); |
766 | ppp->pass_filter = NULL; | 767 | if (!err) { |
768 | ppp_lock(ppp); | ||
769 | if (ppp->pass_filter) | ||
770 | bpf_prog_destroy(ppp->pass_filter); | ||
771 | ppp->pass_filter = pass_filter; | ||
772 | ppp_unlock(ppp); | ||
767 | } | 773 | } |
768 | if (fprog.filter != NULL) | ||
769 | err = bpf_prog_create(&ppp->pass_filter, | ||
770 | &fprog); | ||
771 | else | ||
772 | err = 0; | ||
773 | kfree(code); | 774 | kfree(code); |
774 | ppp_unlock(ppp); | ||
775 | } | 775 | } |
776 | break; | 776 | break; |
777 | } | 777 | } |
@@ -781,23 +781,23 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
781 | 781 | ||
782 | err = get_filter(argp, &code); | 782 | err = get_filter(argp, &code); |
783 | if (err >= 0) { | 783 | if (err >= 0) { |
784 | struct bpf_prog *active_filter = NULL; | ||
784 | struct sock_fprog_kern fprog = { | 785 | struct sock_fprog_kern fprog = { |
785 | .len = err, | 786 | .len = err, |
786 | .filter = code, | 787 | .filter = code, |
787 | }; | 788 | }; |
788 | 789 | ||
789 | ppp_lock(ppp); | 790 | err = 0; |
790 | if (ppp->active_filter) { | 791 | if (fprog.filter) |
791 | bpf_prog_destroy(ppp->active_filter); | 792 | err = bpf_prog_create(&active_filter, &fprog); |
792 | ppp->active_filter = NULL; | 793 | if (!err) { |
794 | ppp_lock(ppp); | ||
795 | if (ppp->active_filter) | ||
796 | bpf_prog_destroy(ppp->active_filter); | ||
797 | ppp->active_filter = active_filter; | ||
798 | ppp_unlock(ppp); | ||
793 | } | 799 | } |
794 | if (fprog.filter != NULL) | ||
795 | err = bpf_prog_create(&ppp->active_filter, | ||
796 | &fprog); | ||
797 | else | ||
798 | err = 0; | ||
799 | kfree(code); | 800 | kfree(code); |
800 | ppp_unlock(ppp); | ||
801 | } | 801 | } |
802 | break; | 802 | break; |
803 | } | 803 | } |
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 1aff970be33e..1dc628ffce2b 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
@@ -506,7 +506,9 @@ static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, | |||
506 | int len = sizeof(struct sockaddr_pppox); | 506 | int len = sizeof(struct sockaddr_pppox); |
507 | struct sockaddr_pppox sp; | 507 | struct sockaddr_pppox sp; |
508 | 508 | ||
509 | sp.sa_family = AF_PPPOX; | 509 | memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); |
510 | |||
511 | sp.sa_family = AF_PPPOX; | ||
510 | sp.sa_protocol = PX_PROTO_PPTP; | 512 | sp.sa_protocol = PX_PROTO_PPTP; |
511 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; | 513 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; |
512 | 514 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 7302398f0b1f..9dd3746994a4 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1235,12 +1235,20 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1235 | struct tun_pi pi = { 0, skb->protocol }; | 1235 | struct tun_pi pi = { 0, skb->protocol }; |
1236 | ssize_t total = 0; | 1236 | ssize_t total = 0; |
1237 | int vlan_offset = 0, copied; | 1237 | int vlan_offset = 0, copied; |
1238 | int vlan_hlen = 0; | ||
1239 | int vnet_hdr_sz = 0; | ||
1240 | |||
1241 | if (vlan_tx_tag_present(skb)) | ||
1242 | vlan_hlen = VLAN_HLEN; | ||
1243 | |||
1244 | if (tun->flags & TUN_VNET_HDR) | ||
1245 | vnet_hdr_sz = tun->vnet_hdr_sz; | ||
1238 | 1246 | ||
1239 | if (!(tun->flags & TUN_NO_PI)) { | 1247 | if (!(tun->flags & TUN_NO_PI)) { |
1240 | if ((len -= sizeof(pi)) < 0) | 1248 | if ((len -= sizeof(pi)) < 0) |
1241 | return -EINVAL; | 1249 | return -EINVAL; |
1242 | 1250 | ||
1243 | if (len < skb->len) { | 1251 | if (len < skb->len + vlan_hlen + vnet_hdr_sz) { |
1244 | /* Packet will be striped */ | 1252 | /* Packet will be striped */ |
1245 | pi.flags |= TUN_PKT_STRIP; | 1253 | pi.flags |= TUN_PKT_STRIP; |
1246 | } | 1254 | } |
@@ -1250,9 +1258,9 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1250 | total += sizeof(pi); | 1258 | total += sizeof(pi); |
1251 | } | 1259 | } |
1252 | 1260 | ||
1253 | if (tun->flags & TUN_VNET_HDR) { | 1261 | if (vnet_hdr_sz) { |
1254 | struct virtio_net_hdr gso = { 0 }; /* no info leak */ | 1262 | struct virtio_net_hdr gso = { 0 }; /* no info leak */ |
1255 | if ((len -= tun->vnet_hdr_sz) < 0) | 1263 | if ((len -= vnet_hdr_sz) < 0) |
1256 | return -EINVAL; | 1264 | return -EINVAL; |
1257 | 1265 | ||
1258 | if (skb_is_gso(skb)) { | 1266 | if (skb_is_gso(skb)) { |
@@ -1284,7 +1292,8 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1284 | 1292 | ||
1285 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1293 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1286 | gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; | 1294 | gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; |
1287 | gso.csum_start = skb_checksum_start_offset(skb); | 1295 | gso.csum_start = skb_checksum_start_offset(skb) + |
1296 | vlan_hlen; | ||
1288 | gso.csum_offset = skb->csum_offset; | 1297 | gso.csum_offset = skb->csum_offset; |
1289 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { | 1298 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { |
1290 | gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; | 1299 | gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; |
@@ -1293,14 +1302,13 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1293 | if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, | 1302 | if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, |
1294 | sizeof(gso)))) | 1303 | sizeof(gso)))) |
1295 | return -EFAULT; | 1304 | return -EFAULT; |
1296 | total += tun->vnet_hdr_sz; | 1305 | total += vnet_hdr_sz; |
1297 | } | 1306 | } |
1298 | 1307 | ||
1299 | copied = total; | 1308 | copied = total; |
1300 | total += skb->len; | 1309 | len = min_t(int, skb->len + vlan_hlen, len); |
1301 | if (!vlan_tx_tag_present(skb)) { | 1310 | total += skb->len + vlan_hlen; |
1302 | len = min_t(int, skb->len, len); | 1311 | if (vlan_hlen) { |
1303 | } else { | ||
1304 | int copy, ret; | 1312 | int copy, ret; |
1305 | struct { | 1313 | struct { |
1306 | __be16 h_vlan_proto; | 1314 | __be16 h_vlan_proto; |
@@ -1311,8 +1319,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1311 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); | 1319 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); |
1312 | 1320 | ||
1313 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); | 1321 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); |
1314 | len = min_t(int, skb->len + VLAN_HLEN, len); | ||
1315 | total += VLAN_HLEN; | ||
1316 | 1322 | ||
1317 | copy = min_t(int, vlan_offset, len); | 1323 | copy = min_t(int, vlan_offset, len); |
1318 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); | 1324 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 2c05f6cdb12f..816d511e34d3 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -465,19 +465,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
465 | return ret; | 465 | return ret; |
466 | } | 466 | } |
467 | 467 | ||
468 | ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL); | 468 | ax88772_reset(dev); |
469 | if (ret < 0) | ||
470 | return ret; | ||
471 | |||
472 | msleep(150); | ||
473 | |||
474 | ret = asix_sw_reset(dev, AX_SWRESET_CLEAR); | ||
475 | if (ret < 0) | ||
476 | return ret; | ||
477 | |||
478 | msleep(150); | ||
479 | |||
480 | ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE); | ||
481 | 469 | ||
482 | /* Read PHYID register *AFTER* the PHY was reset properly */ | 470 | /* Read PHYID register *AFTER* the PHY was reset properly */ |
483 | phyid = asix_get_phyid(dev); | 471 | phyid = asix_get_phyid(dev); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 22756db53dca..b8a82b86f909 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -780,6 +780,7 @@ static const struct usb_device_id products[] = { | |||
780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ | 781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ | 782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
783 | {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ | ||
783 | 784 | ||
784 | /* 4. Gobi 1000 devices */ | 785 | /* 4. Gobi 1000 devices */ |
785 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 786 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ec2a8b41ed41..b0bc8ead47de 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1673,6 +1673,40 @@ static const struct attribute_group virtio_net_mrg_rx_group = { | |||
1673 | }; | 1673 | }; |
1674 | #endif | 1674 | #endif |
1675 | 1675 | ||
1676 | static bool virtnet_fail_on_feature(struct virtio_device *vdev, | ||
1677 | unsigned int fbit, | ||
1678 | const char *fname, const char *dname) | ||
1679 | { | ||
1680 | if (!virtio_has_feature(vdev, fbit)) | ||
1681 | return false; | ||
1682 | |||
1683 | dev_err(&vdev->dev, "device advertises feature %s but not %s", | ||
1684 | fname, dname); | ||
1685 | |||
1686 | return true; | ||
1687 | } | ||
1688 | |||
1689 | #define VIRTNET_FAIL_ON(vdev, fbit, dbit) \ | ||
1690 | virtnet_fail_on_feature(vdev, fbit, #fbit, dbit) | ||
1691 | |||
1692 | static bool virtnet_validate_features(struct virtio_device *vdev) | ||
1693 | { | ||
1694 | if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) && | ||
1695 | (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX, | ||
1696 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1697 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN, | ||
1698 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1699 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE, | ||
1700 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1701 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") || | ||
1702 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR, | ||
1703 | "VIRTIO_NET_F_CTRL_VQ"))) { | ||
1704 | return false; | ||
1705 | } | ||
1706 | |||
1707 | return true; | ||
1708 | } | ||
1709 | |||
1676 | static int virtnet_probe(struct virtio_device *vdev) | 1710 | static int virtnet_probe(struct virtio_device *vdev) |
1677 | { | 1711 | { |
1678 | int i, err; | 1712 | int i, err; |
@@ -1680,6 +1714,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1680 | struct virtnet_info *vi; | 1714 | struct virtnet_info *vi; |
1681 | u16 max_queue_pairs; | 1715 | u16 max_queue_pairs; |
1682 | 1716 | ||
1717 | if (!virtnet_validate_features(vdev)) | ||
1718 | return -EINVAL; | ||
1719 | |||
1683 | /* Find if host supports multiqueue virtio_net device */ | 1720 | /* Find if host supports multiqueue virtio_net device */ |
1684 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, | 1721 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, |
1685 | struct virtio_net_config, | 1722 | struct virtio_net_config, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index ca309820d39e..be4649a49c5e 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -67,12 +67,6 @@ | |||
67 | 67 | ||
68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ | 68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ |
69 | 69 | ||
70 | /* VXLAN protocol header */ | ||
71 | struct vxlanhdr { | ||
72 | __be32 vx_flags; | ||
73 | __be32 vx_vni; | ||
74 | }; | ||
75 | |||
76 | /* UDP port for VXLAN traffic. | 70 | /* UDP port for VXLAN traffic. |
77 | * The IANA assigned port is 4789, but the Linux default is 8472 | 71 | * The IANA assigned port is 4789, but the Linux default is 8472 |
78 | * for compatibility with early adopters. | 72 | * for compatibility with early adopters. |
@@ -275,13 +269,15 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb) | |||
275 | return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); | 269 | return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); |
276 | } | 270 | } |
277 | 271 | ||
278 | /* Find VXLAN socket based on network namespace and UDP port */ | 272 | /* Find VXLAN socket based on network namespace, address family and UDP port */ |
279 | static struct vxlan_sock *vxlan_find_sock(struct net *net, __be16 port) | 273 | static struct vxlan_sock *vxlan_find_sock(struct net *net, |
274 | sa_family_t family, __be16 port) | ||
280 | { | 275 | { |
281 | struct vxlan_sock *vs; | 276 | struct vxlan_sock *vs; |
282 | 277 | ||
283 | hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { | 278 | hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { |
284 | if (inet_sk(vs->sock->sk)->inet_sport == port) | 279 | if (inet_sk(vs->sock->sk)->inet_sport == port && |
280 | inet_sk(vs->sock->sk)->sk.sk_family == family) | ||
285 | return vs; | 281 | return vs; |
286 | } | 282 | } |
287 | return NULL; | 283 | return NULL; |
@@ -300,11 +296,12 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs, u32 id) | |||
300 | } | 296 | } |
301 | 297 | ||
302 | /* Look up VNI in a per net namespace table */ | 298 | /* Look up VNI in a per net namespace table */ |
303 | static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, __be16 port) | 299 | static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, |
300 | sa_family_t family, __be16 port) | ||
304 | { | 301 | { |
305 | struct vxlan_sock *vs; | 302 | struct vxlan_sock *vs; |
306 | 303 | ||
307 | vs = vxlan_find_sock(net, port); | 304 | vs = vxlan_find_sock(net, family, port); |
308 | if (!vs) | 305 | if (!vs) |
309 | return NULL; | 306 | return NULL; |
310 | 307 | ||
@@ -621,6 +618,8 @@ static int vxlan_gro_complete(struct sk_buff *skb, int nhoff) | |||
621 | int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); | 618 | int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); |
622 | int err = -ENOSYS; | 619 | int err = -ENOSYS; |
623 | 620 | ||
621 | udp_tunnel_gro_complete(skb, nhoff); | ||
622 | |||
624 | eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); | 623 | eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); |
625 | type = eh->h_proto; | 624 | type = eh->h_proto; |
626 | 625 | ||
@@ -1771,7 +1770,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1771 | struct vxlan_dev *dst_vxlan; | 1770 | struct vxlan_dev *dst_vxlan; |
1772 | 1771 | ||
1773 | ip_rt_put(rt); | 1772 | ip_rt_put(rt); |
1774 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); | 1773 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, |
1774 | dst->sa.sa_family, dst_port); | ||
1775 | if (!dst_vxlan) | 1775 | if (!dst_vxlan) |
1776 | goto tx_error; | 1776 | goto tx_error; |
1777 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); | 1777 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); |
@@ -1825,7 +1825,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1825 | struct vxlan_dev *dst_vxlan; | 1825 | struct vxlan_dev *dst_vxlan; |
1826 | 1826 | ||
1827 | dst_release(ndst); | 1827 | dst_release(ndst); |
1828 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); | 1828 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, |
1829 | dst->sa.sa_family, dst_port); | ||
1829 | if (!dst_vxlan) | 1830 | if (!dst_vxlan) |
1830 | goto tx_error; | 1831 | goto tx_error; |
1831 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); | 1832 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); |
@@ -1985,13 +1986,15 @@ static int vxlan_init(struct net_device *dev) | |||
1985 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1986 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1986 | struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); | 1987 | struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); |
1987 | struct vxlan_sock *vs; | 1988 | struct vxlan_sock *vs; |
1989 | bool ipv6 = vxlan->flags & VXLAN_F_IPV6; | ||
1988 | 1990 | ||
1989 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); | 1991 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
1990 | if (!dev->tstats) | 1992 | if (!dev->tstats) |
1991 | return -ENOMEM; | 1993 | return -ENOMEM; |
1992 | 1994 | ||
1993 | spin_lock(&vn->sock_lock); | 1995 | spin_lock(&vn->sock_lock); |
1994 | vs = vxlan_find_sock(vxlan->net, vxlan->dst_port); | 1996 | vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET, |
1997 | vxlan->dst_port); | ||
1995 | if (vs) { | 1998 | if (vs) { |
1996 | /* If we have a socket with same port already, reuse it */ | 1999 | /* If we have a socket with same port already, reuse it */ |
1997 | atomic_inc(&vs->refcnt); | 2000 | atomic_inc(&vs->refcnt); |
@@ -2303,9 +2306,9 @@ static struct socket *vxlan_create_sock(struct net *net, bool ipv6, | |||
2303 | if (ipv6) { | 2306 | if (ipv6) { |
2304 | udp_conf.family = AF_INET6; | 2307 | udp_conf.family = AF_INET6; |
2305 | udp_conf.use_udp6_tx_checksums = | 2308 | udp_conf.use_udp6_tx_checksums = |
2306 | !!(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); | 2309 | !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); |
2307 | udp_conf.use_udp6_rx_checksums = | 2310 | udp_conf.use_udp6_rx_checksums = |
2308 | !!(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); | 2311 | !(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); |
2309 | } else { | 2312 | } else { |
2310 | udp_conf.family = AF_INET; | 2313 | udp_conf.family = AF_INET; |
2311 | udp_conf.local_ip.s_addr = INADDR_ANY; | 2314 | udp_conf.local_ip.s_addr = INADDR_ANY; |
@@ -2382,6 +2385,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, | |||
2382 | { | 2385 | { |
2383 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 2386 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
2384 | struct vxlan_sock *vs; | 2387 | struct vxlan_sock *vs; |
2388 | bool ipv6 = flags & VXLAN_F_IPV6; | ||
2385 | 2389 | ||
2386 | vs = vxlan_socket_create(net, port, rcv, data, flags); | 2390 | vs = vxlan_socket_create(net, port, rcv, data, flags); |
2387 | if (!IS_ERR(vs)) | 2391 | if (!IS_ERR(vs)) |
@@ -2391,7 +2395,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, | |||
2391 | return vs; | 2395 | return vs; |
2392 | 2396 | ||
2393 | spin_lock(&vn->sock_lock); | 2397 | spin_lock(&vn->sock_lock); |
2394 | vs = vxlan_find_sock(net, port); | 2398 | vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port); |
2395 | if (vs) { | 2399 | if (vs) { |
2396 | if (vs->rcv == rcv) | 2400 | if (vs->rcv == rcv) |
2397 | atomic_inc(&vs->refcnt); | 2401 | atomic_inc(&vs->refcnt); |
@@ -2550,7 +2554,8 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, | |||
2550 | nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) | 2554 | nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) |
2551 | vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; | 2555 | vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; |
2552 | 2556 | ||
2553 | if (vxlan_find_vni(net, vni, vxlan->dst_port)) { | 2557 | if (vxlan_find_vni(net, vni, use_ipv6 ? AF_INET6 : AF_INET, |
2558 | vxlan->dst_port)) { | ||
2554 | pr_info("duplicate VNI %u\n", vni); | 2559 | pr_info("duplicate VNI %u\n", vni); |
2555 | return -EEXIST; | 2560 | return -EEXIST; |
2556 | } | 2561 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 697c4ae90af0..1e8ea5e4d4ca 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -664,6 +664,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah) | |||
664 | ah->enabled_cals |= TX_CL_CAL; | 664 | ah->enabled_cals |= TX_CL_CAL; |
665 | else | 665 | else |
666 | ah->enabled_cals &= ~TX_CL_CAL; | 666 | ah->enabled_cals &= ~TX_CL_CAL; |
667 | |||
668 | if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { | ||
669 | if (ah->is_clk_25mhz) { | ||
670 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
671 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
672 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
673 | } else { | ||
674 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
675 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
676 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
677 | } | ||
678 | udelay(100); | ||
679 | } | ||
667 | } | 680 | } |
668 | 681 | ||
669 | static void ar9003_hw_prog_ini(struct ath_hw *ah, | 682 | static void ar9003_hw_prog_ini(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 8be4b1453394..2ad605760e21 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -861,19 +861,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah, | |||
861 | udelay(RTC_PLL_SETTLE_DELAY); | 861 | udelay(RTC_PLL_SETTLE_DELAY); |
862 | 862 | ||
863 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); | 863 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); |
864 | |||
865 | if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { | ||
866 | if (ah->is_clk_25mhz) { | ||
867 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
868 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
869 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
870 | } else { | ||
871 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
872 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
873 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
874 | } | ||
875 | udelay(100); | ||
876 | } | ||
877 | } | 864 | } |
878 | 865 | ||
879 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, | 866 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 30c66dfcd7a0..4f18a6be0c7d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -974,9 +974,8 @@ void ath9k_calculate_iter_data(struct ath_softc *sc, | |||
974 | struct ath_vif *avp; | 974 | struct ath_vif *avp; |
975 | 975 | ||
976 | /* | 976 | /* |
977 | * Pick the MAC address of the first interface as the new hardware | 977 | * The hardware will use primary station addr together with the |
978 | * MAC address. The hardware will use it together with the BSSID mask | 978 | * BSSID mask when matching addresses. |
979 | * when matching addresses. | ||
980 | */ | 979 | */ |
981 | memset(iter_data, 0, sizeof(*iter_data)); | 980 | memset(iter_data, 0, sizeof(*iter_data)); |
982 | memset(&iter_data->mask, 0xff, ETH_ALEN); | 981 | memset(&iter_data->mask, 0xff, ETH_ALEN); |
@@ -1205,6 +1204,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1205 | list_add_tail(&avp->list, &avp->chanctx->vifs); | 1204 | list_add_tail(&avp->list, &avp->chanctx->vifs); |
1206 | } | 1205 | } |
1207 | 1206 | ||
1207 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
1208 | |||
1208 | ath9k_assign_hw_queues(hw, vif); | 1209 | ath9k_assign_hw_queues(hw, vif); |
1209 | 1210 | ||
1210 | an->sc = sc; | 1211 | an->sc = sc; |
@@ -1274,6 +1275,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1274 | 1275 | ||
1275 | ath_tx_node_cleanup(sc, &avp->mcast_node); | 1276 | ath_tx_node_cleanup(sc, &avp->mcast_node); |
1276 | 1277 | ||
1278 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
1279 | |||
1277 | mutex_unlock(&sc->mutex); | 1280 | mutex_unlock(&sc->mutex); |
1278 | } | 1281 | } |
1279 | 1282 | ||
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index 1dfc682a8055..ee27b06074e1 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -300,9 +300,7 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value) | |||
300 | 300 | ||
301 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) | 301 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) |
302 | { | 302 | { |
303 | assert_mac_suspended(dev); | 303 | b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg)); |
304 | dev->phy.ops->phy_write(dev, destreg, | ||
305 | dev->phy.ops->phy_read(dev, srcreg)); | ||
306 | } | 304 | } |
307 | 305 | ||
308 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) | 306 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/of.c b/drivers/net/wireless/brcm80211/brcmfmac/of.c index f05f5270fec1..927bffd5be64 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c | |||
@@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev) | |||
40 | return; | 40 | return; |
41 | 41 | ||
42 | irq = irq_of_parse_and_map(np, 0); | 42 | irq = irq_of_parse_and_map(np, 0); |
43 | if (irq < 0) { | 43 | if (!irq) { |
44 | brcmf_err("interrupt could not be mapped: err=%d\n", irq); | 44 | brcmf_err("interrupt could not be mapped\n"); |
45 | devm_kfree(dev, sdiodev->pdata); | 45 | devm_kfree(dev, sdiodev->pdata); |
46 | return; | 46 | return; |
47 | } | 47 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c index 8c0632ec9f7a..16fef3382019 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/unaligned/access_ok.h> | ||
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/bcma/bcma.h> | 23 | #include <linux/bcma/bcma.h> |
25 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <asm/unaligned.h> | ||
26 | 26 | ||
27 | #include <soc.h> | 27 | #include <soc.h> |
28 | #include <chipcommon.h> | 28 | #include <chipcommon.h> |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index dc135915470d..875d1142c8b0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -669,10 +669,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, | |||
669 | goto finalize; | 669 | goto finalize; |
670 | } | 670 | } |
671 | 671 | ||
672 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) | 672 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) { |
673 | usb_kill_urb(devinfo->ctl_urb); | ||
673 | ret = -ETIMEDOUT; | 674 | ret = -ETIMEDOUT; |
674 | else | 675 | } else { |
675 | memcpy(buffer, tmpbuf, buflen); | 676 | memcpy(buffer, tmpbuf, buflen); |
677 | } | ||
676 | 678 | ||
677 | finalize: | 679 | finalize: |
678 | kfree(tmpbuf); | 680 | kfree(tmpbuf); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 28fa25b509db..39b45c038a93 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -299,6 +299,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
299 | primary_offset = ch->center_freq1 - ch->chan->center_freq; | 299 | primary_offset = ch->center_freq1 - ch->chan->center_freq; |
300 | switch (ch->width) { | 300 | switch (ch->width) { |
301 | case NL80211_CHAN_WIDTH_20: | 301 | case NL80211_CHAN_WIDTH_20: |
302 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
302 | ch_inf.bw = BRCMU_CHAN_BW_20; | 303 | ch_inf.bw = BRCMU_CHAN_BW_20; |
303 | WARN_ON(primary_offset != 0); | 304 | WARN_ON(primary_offset != 0); |
304 | break; | 305 | break; |
@@ -323,6 +324,10 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
323 | ch_inf.sb = BRCMU_CHAN_SB_LU; | 324 | ch_inf.sb = BRCMU_CHAN_SB_LU; |
324 | } | 325 | } |
325 | break; | 326 | break; |
327 | case NL80211_CHAN_WIDTH_80P80: | ||
328 | case NL80211_CHAN_WIDTH_160: | ||
329 | case NL80211_CHAN_WIDTH_5: | ||
330 | case NL80211_CHAN_WIDTH_10: | ||
326 | default: | 331 | default: |
327 | WARN_ON_ONCE(1); | 332 | WARN_ON_ONCE(1); |
328 | } | 333 | } |
@@ -333,6 +338,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
333 | case IEEE80211_BAND_5GHZ: | 338 | case IEEE80211_BAND_5GHZ: |
334 | ch_inf.band = BRCMU_CHAN_BAND_5G; | 339 | ch_inf.band = BRCMU_CHAN_BAND_5G; |
335 | break; | 340 | break; |
341 | case IEEE80211_BAND_60GHZ: | ||
336 | default: | 342 | default: |
337 | WARN_ON_ONCE(1); | 343 | WARN_ON_ONCE(1); |
338 | } | 344 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index 4f6e66892acc..b894a84e8393 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -155,6 +155,7 @@ enum iwl_ucode_tlv_api { | |||
155 | * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests | 155 | * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests |
156 | * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), | 156 | * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), |
157 | * which also implies support for the scheduler configuration command | 157 | * which also implies support for the scheduler configuration command |
158 | * @IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command | ||
158 | */ | 159 | */ |
159 | enum iwl_ucode_tlv_capa { | 160 | enum iwl_ucode_tlv_capa { |
160 | IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), | 161 | IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), |
@@ -163,6 +164,7 @@ enum iwl_ucode_tlv_capa { | |||
163 | IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), | 164 | IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), |
164 | IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), | 165 | IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), |
165 | IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), | 166 | IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), |
167 | IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = BIT(18), | ||
166 | }; | 168 | }; |
167 | 169 | ||
168 | /* The default calibrate table size if not specified by firmware file */ | 170 | /* The default calibrate table size if not specified by firmware file */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index e0d9f19650b0..eb03943f8463 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
@@ -284,7 +284,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
284 | 284 | ||
285 | lockdep_assert_held(&mvm->mutex); | 285 | lockdep_assert_held(&mvm->mutex); |
286 | 286 | ||
287 | if (WARN_ON_ONCE(mvm->init_ucode_complete)) | 287 | if (WARN_ON_ONCE(mvm->init_ucode_complete || mvm->calibrating)) |
288 | return 0; | 288 | return 0; |
289 | 289 | ||
290 | iwl_init_notification_wait(&mvm->notif_wait, | 290 | iwl_init_notification_wait(&mvm->notif_wait, |
@@ -334,6 +334,8 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
334 | goto out; | 334 | goto out; |
335 | } | 335 | } |
336 | 336 | ||
337 | mvm->calibrating = true; | ||
338 | |||
337 | /* Send TX valid antennas before triggering calibrations */ | 339 | /* Send TX valid antennas before triggering calibrations */ |
338 | ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant); | 340 | ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant); |
339 | if (ret) | 341 | if (ret) |
@@ -358,11 +360,17 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
358 | MVM_UCODE_CALIB_TIMEOUT); | 360 | MVM_UCODE_CALIB_TIMEOUT); |
359 | if (!ret) | 361 | if (!ret) |
360 | mvm->init_ucode_complete = true; | 362 | mvm->init_ucode_complete = true; |
363 | |||
364 | if (ret && iwl_mvm_is_radio_killed(mvm)) { | ||
365 | IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); | ||
366 | ret = 1; | ||
367 | } | ||
361 | goto out; | 368 | goto out; |
362 | 369 | ||
363 | error: | 370 | error: |
364 | iwl_remove_notification(&mvm->notif_wait, &calib_wait); | 371 | iwl_remove_notification(&mvm->notif_wait, &calib_wait); |
365 | out: | 372 | out: |
373 | mvm->calibrating = false; | ||
366 | if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { | 374 | if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { |
367 | /* we want to debug INIT and we have no NVM - fake */ | 375 | /* we want to debug INIT and we have no NVM - fake */ |
368 | mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + | 376 | mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 585fe5b7100f..b6d2683da3a9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -788,6 +788,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | |||
788 | 788 | ||
789 | mvm->scan_status = IWL_MVM_SCAN_NONE; | 789 | mvm->scan_status = IWL_MVM_SCAN_NONE; |
790 | mvm->ps_disabled = false; | 790 | mvm->ps_disabled = false; |
791 | mvm->calibrating = false; | ||
791 | 792 | ||
792 | /* just in case one was running */ | 793 | /* just in case one was running */ |
793 | ieee80211_remain_on_channel_expired(mvm->hw); | 794 | ieee80211_remain_on_channel_expired(mvm->hw); |
@@ -2447,9 +2448,15 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw, | |||
2447 | 2448 | ||
2448 | switch (vif->type) { | 2449 | switch (vif->type) { |
2449 | case NL80211_IFTYPE_STATION: | 2450 | case NL80211_IFTYPE_STATION: |
2450 | /* Use aux roc framework (HS20) */ | 2451 | if (mvm->fw->ucode_capa.capa[0] & |
2451 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | 2452 | IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT) { |
2452 | vif, duration); | 2453 | /* Use aux roc framework (HS20) */ |
2454 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | ||
2455 | vif, duration); | ||
2456 | goto out_unlock; | ||
2457 | } | ||
2458 | IWL_ERR(mvm, "hotspot not supported\n"); | ||
2459 | ret = -EINVAL; | ||
2453 | goto out_unlock; | 2460 | goto out_unlock; |
2454 | case NL80211_IFTYPE_P2P_DEVICE: | 2461 | case NL80211_IFTYPE_P2P_DEVICE: |
2455 | /* handle below */ | 2462 | /* handle below */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index b153ced7015b..845429c88cf4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -548,6 +548,7 @@ struct iwl_mvm { | |||
548 | enum iwl_ucode_type cur_ucode; | 548 | enum iwl_ucode_type cur_ucode; |
549 | bool ucode_loaded; | 549 | bool ucode_loaded; |
550 | bool init_ucode_complete; | 550 | bool init_ucode_complete; |
551 | bool calibrating; | ||
551 | u32 error_event_table; | 552 | u32 error_event_table; |
552 | u32 log_event_table; | 553 | u32 log_event_table; |
553 | u32 umac_error_event_table; | 554 | u32 umac_error_event_table; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 48cb25a93591..5b719ee8e789 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -424,6 +424,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
424 | } | 424 | } |
425 | mvm->sf_state = SF_UNINIT; | 425 | mvm->sf_state = SF_UNINIT; |
426 | mvm->low_latency_agg_frame_limit = 6; | 426 | mvm->low_latency_agg_frame_limit = 6; |
427 | mvm->cur_ucode = IWL_UCODE_INIT; | ||
427 | 428 | ||
428 | mutex_init(&mvm->mutex); | 429 | mutex_init(&mvm->mutex); |
429 | mutex_init(&mvm->d0i3_suspend_mutex); | 430 | mutex_init(&mvm->d0i3_suspend_mutex); |
@@ -752,6 +753,7 @@ void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state) | |||
752 | static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | 753 | static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) |
753 | { | 754 | { |
754 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | 755 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); |
756 | bool calibrating = ACCESS_ONCE(mvm->calibrating); | ||
755 | 757 | ||
756 | if (state) | 758 | if (state) |
757 | set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); | 759 | set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); |
@@ -760,7 +762,15 @@ static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | |||
760 | 762 | ||
761 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); | 763 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); |
762 | 764 | ||
763 | return state && mvm->cur_ucode != IWL_UCODE_INIT; | 765 | /* iwl_run_init_mvm_ucode is waiting for results, abort it */ |
766 | if (calibrating) | ||
767 | iwl_abort_notification_waits(&mvm->notif_wait); | ||
768 | |||
769 | /* | ||
770 | * Stop the device if we run OPERATIONAL firmware or if we are in the | ||
771 | * middle of the calibrations. | ||
772 | */ | ||
773 | return state && (mvm->cur_ucode != IWL_UCODE_INIT || calibrating); | ||
764 | } | 774 | } |
765 | 775 | ||
766 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) | 776 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index b280d5d87127..7554f7053830 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -602,16 +602,6 @@ static int iwl_mvm_cancel_regular_scan(struct iwl_mvm *mvm) | |||
602 | SCAN_COMPLETE_NOTIFICATION }; | 602 | SCAN_COMPLETE_NOTIFICATION }; |
603 | int ret; | 603 | int ret; |
604 | 604 | ||
605 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | ||
606 | return 0; | ||
607 | |||
608 | if (iwl_mvm_is_radio_killed(mvm)) { | ||
609 | ieee80211_scan_completed(mvm->hw, true); | ||
610 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | ||
611 | mvm->scan_status = IWL_MVM_SCAN_NONE; | ||
612 | return 0; | ||
613 | } | ||
614 | |||
615 | iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, | 605 | iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, |
616 | scan_abort_notif, | 606 | scan_abort_notif, |
617 | ARRAY_SIZE(scan_abort_notif), | 607 | ARRAY_SIZE(scan_abort_notif), |
@@ -1400,6 +1390,16 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm, | |||
1400 | 1390 | ||
1401 | int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) | 1391 | int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) |
1402 | { | 1392 | { |
1393 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | ||
1394 | return 0; | ||
1395 | |||
1396 | if (iwl_mvm_is_radio_killed(mvm)) { | ||
1397 | ieee80211_scan_completed(mvm->hw, true); | ||
1398 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | ||
1399 | mvm->scan_status = IWL_MVM_SCAN_NONE; | ||
1400 | return 0; | ||
1401 | } | ||
1402 | |||
1403 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) | 1403 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) |
1404 | return iwl_mvm_scan_offload_stop(mvm, true); | 1404 | return iwl_mvm_scan_offload_stop(mvm, true); |
1405 | return iwl_mvm_cancel_regular_scan(mvm); | 1405 | return iwl_mvm_cancel_regular_scan(mvm); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 3781b029e54a..dd2f3f8baa9d 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -915,7 +915,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
915 | * restart. So don't process again if the device is | 915 | * restart. So don't process again if the device is |
916 | * already dead. | 916 | * already dead. |
917 | */ | 917 | */ |
918 | if (test_bit(STATUS_DEVICE_ENABLED, &trans->status)) { | 918 | if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { |
919 | IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); | ||
919 | iwl_pcie_tx_stop(trans); | 920 | iwl_pcie_tx_stop(trans); |
920 | iwl_pcie_rx_stop(trans); | 921 | iwl_pcie_rx_stop(trans); |
921 | 922 | ||
@@ -945,7 +946,6 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
945 | /* clear all status bits */ | 946 | /* clear all status bits */ |
946 | clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); | 947 | clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); |
947 | clear_bit(STATUS_INT_ENABLED, &trans->status); | 948 | clear_bit(STATUS_INT_ENABLED, &trans->status); |
948 | clear_bit(STATUS_DEVICE_ENABLED, &trans->status); | ||
949 | clear_bit(STATUS_TPOWER_PMI, &trans->status); | 949 | clear_bit(STATUS_TPOWER_PMI, &trans->status); |
950 | clear_bit(STATUS_RFKILL, &trans->status); | 950 | clear_bit(STATUS_RFKILL, &trans->status); |
951 | 951 | ||
@@ -1894,8 +1894,7 @@ static u32 iwl_trans_pcie_dump_prph(struct iwl_trans *trans, | |||
1894 | int reg; | 1894 | int reg; |
1895 | __le32 *val; | 1895 | __le32 *val; |
1896 | 1896 | ||
1897 | prph_len += sizeof(*data) + sizeof(*prph) + | 1897 | prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk; |
1898 | num_bytes_in_chunk; | ||
1899 | 1898 | ||
1900 | (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); | 1899 | (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); |
1901 | (*data)->len = cpu_to_le32(sizeof(*prph) + | 1900 | (*data)->len = cpu_to_le32(sizeof(*prph) + |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index babbdc1ce741..c9ad4cf1adfb 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1987,7 +1987,7 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, | |||
1987 | if (err != 0) { | 1987 | if (err != 0) { |
1988 | printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", | 1988 | printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", |
1989 | err); | 1989 | err); |
1990 | goto failed_hw; | 1990 | goto failed_bind; |
1991 | } | 1991 | } |
1992 | 1992 | ||
1993 | skb_queue_head_init(&data->pending); | 1993 | skb_queue_head_init(&data->pending); |
@@ -2183,6 +2183,8 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, | |||
2183 | return idx; | 2183 | return idx; |
2184 | 2184 | ||
2185 | failed_hw: | 2185 | failed_hw: |
2186 | device_release_driver(data->dev); | ||
2187 | failed_bind: | ||
2186 | device_unregister(data->dev); | 2188 | device_unregister(data->dev); |
2187 | failed_drvdata: | 2189 | failed_drvdata: |
2188 | ieee80211_free_hw(hw); | 2190 | ieee80211_free_hw(hw); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 8e68f87ab13c..66ff36447b94 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -158,55 +158,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb) | |||
158 | skb_trim(skb, frame_length); | 158 | skb_trim(skb, frame_length); |
159 | } | 159 | } |
160 | 160 | ||
161 | void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) | 161 | /* |
162 | * H/W needs L2 padding between the header and the paylod if header size | ||
163 | * is not 4 bytes aligned. | ||
164 | */ | ||
165 | void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len) | ||
162 | { | 166 | { |
163 | unsigned int payload_length = skb->len - header_length; | 167 | unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; |
164 | unsigned int header_align = ALIGN_SIZE(skb, 0); | ||
165 | unsigned int payload_align = ALIGN_SIZE(skb, header_length); | ||
166 | unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; | ||
167 | 168 | ||
168 | /* | 169 | if (!l2pad) |
169 | * Adjust the header alignment if the payload needs to be moved more | ||
170 | * than the header. | ||
171 | */ | ||
172 | if (payload_align > header_align) | ||
173 | header_align += 4; | ||
174 | |||
175 | /* There is nothing to do if no alignment is needed */ | ||
176 | if (!header_align) | ||
177 | return; | 170 | return; |
178 | 171 | ||
179 | /* Reserve the amount of space needed in front of the frame */ | 172 | skb_push(skb, l2pad); |
180 | skb_push(skb, header_align); | 173 | memmove(skb->data, skb->data + l2pad, hdr_len); |
181 | |||
182 | /* | ||
183 | * Move the header. | ||
184 | */ | ||
185 | memmove(skb->data, skb->data + header_align, header_length); | ||
186 | |||
187 | /* Move the payload, if present and if required */ | ||
188 | if (payload_length && payload_align) | ||
189 | memmove(skb->data + header_length + l2pad, | ||
190 | skb->data + header_length + l2pad + payload_align, | ||
191 | payload_length); | ||
192 | |||
193 | /* Trim the skb to the correct size */ | ||
194 | skb_trim(skb, header_length + l2pad + payload_length); | ||
195 | } | 174 | } |
196 | 175 | ||
197 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) | 176 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len) |
198 | { | 177 | { |
199 | /* | 178 | unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; |
200 | * L2 padding is only present if the skb contains more than just the | ||
201 | * IEEE 802.11 header. | ||
202 | */ | ||
203 | unsigned int l2pad = (skb->len > header_length) ? | ||
204 | L2PAD_SIZE(header_length) : 0; | ||
205 | 179 | ||
206 | if (!l2pad) | 180 | if (!l2pad) |
207 | return; | 181 | return; |
208 | 182 | ||
209 | memmove(skb->data + l2pad, skb->data, header_length); | 183 | memmove(skb->data + l2pad, skb->data, hdr_len); |
210 | skb_pull(skb, l2pad); | 184 | skb_pull(skb, l2pad); |
211 | } | 185 | } |
212 | 186 | ||
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 25daa8715219..846a2e6e34d8 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -842,7 +842,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
842 | break; | 842 | break; |
843 | } | 843 | } |
844 | /* handle command packet here */ | 844 | /* handle command packet here */ |
845 | if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { | 845 | if (rtlpriv->cfg->ops->rx_command_packet && |
846 | rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { | ||
846 | dev_kfree_skb_any(skb); | 847 | dev_kfree_skb_any(skb); |
847 | goto end; | 848 | goto end; |
848 | } | 849 | } |
@@ -1127,9 +1128,14 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
1127 | 1128 | ||
1128 | __skb_queue_tail(&ring->queue, pskb); | 1129 | __skb_queue_tail(&ring->queue, pskb); |
1129 | 1130 | ||
1130 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, | 1131 | if (rtlpriv->use_new_trx_flow) { |
1131 | &temp_one); | 1132 | temp_one = 4; |
1132 | 1133 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pbuffer_desc, true, | |
1134 | HW_DESC_OWN, (u8 *)&temp_one); | ||
1135 | } else { | ||
1136 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, | ||
1137 | &temp_one); | ||
1138 | } | ||
1133 | return; | 1139 | return; |
1134 | } | 1140 | } |
1135 | 1141 | ||
@@ -1370,9 +1376,9 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, | |||
1370 | ring->desc = NULL; | 1376 | ring->desc = NULL; |
1371 | if (rtlpriv->use_new_trx_flow) { | 1377 | if (rtlpriv->use_new_trx_flow) { |
1372 | pci_free_consistent(rtlpci->pdev, | 1378 | pci_free_consistent(rtlpci->pdev, |
1373 | sizeof(*ring->desc) * ring->entries, | 1379 | sizeof(*ring->buffer_desc) * ring->entries, |
1374 | ring->buffer_desc, ring->buffer_desc_dma); | 1380 | ring->buffer_desc, ring->buffer_desc_dma); |
1375 | ring->desc = NULL; | 1381 | ring->buffer_desc = NULL; |
1376 | } | 1382 | } |
1377 | } | 1383 | } |
1378 | 1384 | ||
@@ -1543,7 +1549,6 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) | |||
1543 | true, | 1549 | true, |
1544 | HW_DESC_TXBUFF_ADDR), | 1550 | HW_DESC_TXBUFF_ADDR), |
1545 | skb->len, PCI_DMA_TODEVICE); | 1551 | skb->len, PCI_DMA_TODEVICE); |
1546 | ring->idx = (ring->idx + 1) % ring->entries; | ||
1547 | kfree_skb(skb); | 1552 | kfree_skb(skb); |
1548 | ring->idx = (ring->idx + 1) % ring->entries; | 1553 | ring->idx = (ring->idx + 1) % ring->entries; |
1549 | } | 1554 | } |
@@ -2244,6 +2249,16 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
2244 | /*like read eeprom and so on */ | 2249 | /*like read eeprom and so on */ |
2245 | rtlpriv->cfg->ops->read_eeprom_info(hw); | 2250 | rtlpriv->cfg->ops->read_eeprom_info(hw); |
2246 | 2251 | ||
2252 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
2253 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
2254 | err = -ENODEV; | ||
2255 | goto fail3; | ||
2256 | } | ||
2257 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
2258 | |||
2259 | /*aspm */ | ||
2260 | rtl_pci_init_aspm(hw); | ||
2261 | |||
2247 | /* Init mac80211 sw */ | 2262 | /* Init mac80211 sw */ |
2248 | err = rtl_init_core(hw); | 2263 | err = rtl_init_core(hw); |
2249 | if (err) { | 2264 | if (err) { |
@@ -2259,16 +2274,6 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
2259 | goto fail3; | 2274 | goto fail3; |
2260 | } | 2275 | } |
2261 | 2276 | ||
2262 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
2263 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
2264 | err = -ENODEV; | ||
2265 | goto fail3; | ||
2266 | } | ||
2267 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
2268 | |||
2269 | /*aspm */ | ||
2270 | rtl_pci_init_aspm(hw); | ||
2271 | |||
2272 | err = ieee80211_register_hw(hw); | 2277 | err = ieee80211_register_hw(hw); |
2273 | if (err) { | 2278 | if (err) { |
2274 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 2279 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c index 00e067044c08..5761d5b49e39 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c | |||
@@ -1201,6 +1201,9 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw, | |||
1201 | 1201 | ||
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | if (type != NL80211_IFTYPE_AP && | ||
1205 | rtlpriv->mac80211.link_state < MAC80211_LINKED) | ||
1206 | bt_msr = rtl_read_byte(rtlpriv, MSR) & ~MSR_LINK_MASK; | ||
1204 | rtl_write_byte(rtlpriv, (MSR), bt_msr); | 1207 | rtl_write_byte(rtlpriv, (MSR), bt_msr); |
1205 | 1208 | ||
1206 | temp = rtl_read_dword(rtlpriv, TCR); | 1209 | temp = rtl_read_dword(rtlpriv, TCR); |
@@ -1262,6 +1265,7 @@ void rtl92se_enable_interrupt(struct ieee80211_hw *hw) | |||
1262 | rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); | 1265 | rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); |
1263 | /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ | 1266 | /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ |
1264 | rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); | 1267 | rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); |
1268 | rtlpci->irq_enabled = true; | ||
1265 | } | 1269 | } |
1266 | 1270 | ||
1267 | void rtl92se_disable_interrupt(struct ieee80211_hw *hw) | 1271 | void rtl92se_disable_interrupt(struct ieee80211_hw *hw) |
@@ -1276,8 +1280,7 @@ void rtl92se_disable_interrupt(struct ieee80211_hw *hw) | |||
1276 | rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 1280 | rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
1277 | rtl_write_dword(rtlpriv, INTA_MASK, 0); | 1281 | rtl_write_dword(rtlpriv, INTA_MASK, 0); |
1278 | rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); | 1282 | rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); |
1279 | 1283 | rtlpci->irq_enabled = false; | |
1280 | synchronize_irq(rtlpci->pdev->irq); | ||
1281 | } | 1284 | } |
1282 | 1285 | ||
1283 | static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) | 1286 | static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index 77c5b5f35244..4b4612fe2fdb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
@@ -399,6 +399,8 @@ static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | |||
399 | case 2: | 399 | case 2: |
400 | currentcmd = &postcommoncmd[*step]; | 400 | currentcmd = &postcommoncmd[*step]; |
401 | break; | 401 | break; |
402 | default: | ||
403 | return true; | ||
402 | } | 404 | } |
403 | 405 | ||
404 | if (currentcmd->cmdid == CMDID_END) { | 406 | if (currentcmd->cmdid == CMDID_END) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index aadba29c167a..fb003868bdef 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
@@ -236,6 +236,19 @@ static void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw) | |||
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, | ||
240 | u16 index) | ||
241 | { | ||
242 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
243 | struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; | ||
244 | u8 *entry = (u8 *)(&ring->desc[ring->idx]); | ||
245 | u8 own = (u8)rtl92se_get_desc(entry, true, HW_DESC_OWN); | ||
246 | |||
247 | if (own) | ||
248 | return false; | ||
249 | return true; | ||
250 | } | ||
251 | |||
239 | static struct rtl_hal_ops rtl8192se_hal_ops = { | 252 | static struct rtl_hal_ops rtl8192se_hal_ops = { |
240 | .init_sw_vars = rtl92s_init_sw_vars, | 253 | .init_sw_vars = rtl92s_init_sw_vars, |
241 | .deinit_sw_vars = rtl92s_deinit_sw_vars, | 254 | .deinit_sw_vars = rtl92s_deinit_sw_vars, |
@@ -269,6 +282,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = { | |||
269 | .led_control = rtl92se_led_control, | 282 | .led_control = rtl92se_led_control, |
270 | .set_desc = rtl92se_set_desc, | 283 | .set_desc = rtl92se_set_desc, |
271 | .get_desc = rtl92se_get_desc, | 284 | .get_desc = rtl92se_get_desc, |
285 | .is_tx_desc_closed = rtl92se_is_tx_desc_closed, | ||
272 | .tx_polling = rtl92se_tx_polling, | 286 | .tx_polling = rtl92se_tx_polling, |
273 | .enable_hw_sec = rtl92se_enable_hw_security_config, | 287 | .enable_hw_sec = rtl92se_enable_hw_security_config, |
274 | .set_key = rtl92se_set_key, | 288 | .set_key = rtl92se_set_key, |
@@ -306,6 +320,8 @@ static struct rtl_hal_cfg rtl92se_hal_cfg = { | |||
306 | .maps[MAC_RCR_ACRC32] = RCR_ACRC32, | 320 | .maps[MAC_RCR_ACRC32] = RCR_ACRC32, |
307 | .maps[MAC_RCR_ACF] = RCR_ACF, | 321 | .maps[MAC_RCR_ACF] = RCR_ACF, |
308 | .maps[MAC_RCR_AAP] = RCR_AAP, | 322 | .maps[MAC_RCR_AAP] = RCR_AAP, |
323 | .maps[MAC_HIMR] = INTA_MASK, | ||
324 | .maps[MAC_HIMRE] = INTA_MASK + 4, | ||
309 | 325 | ||
310 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, | 326 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, |
311 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, | 327 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c index 310d3163dc5b..8ec8200002c7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | |||
@@ -3672,8 +3672,9 @@ static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw, | |||
3672 | mac->opmode == NL80211_IFTYPE_ADHOC) | 3672 | mac->opmode == NL80211_IFTYPE_ADHOC) |
3673 | macid = sta->aid + 1; | 3673 | macid = sta->aid + 1; |
3674 | if (wirelessmode == WIRELESS_MODE_N_5G || | 3674 | if (wirelessmode == WIRELESS_MODE_N_5G || |
3675 | wirelessmode == WIRELESS_MODE_AC_5G) | 3675 | wirelessmode == WIRELESS_MODE_AC_5G || |
3676 | ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ]; | 3676 | wirelessmode == WIRELESS_MODE_A) |
3677 | ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ] << 4; | ||
3677 | else | 3678 | else |
3678 | ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; | 3679 | ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; |
3679 | 3680 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 4e56a27f9689..fab0d4b42f58 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -39,7 +39,7 @@ struct backend_info { | |||
39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | 39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); |
40 | static void connect(struct backend_info *be); | 40 | static void connect(struct backend_info *be); |
41 | static int read_xenbus_vif_flags(struct backend_info *be); | 41 | static int read_xenbus_vif_flags(struct backend_info *be); |
42 | static void backend_create_xenvif(struct backend_info *be); | 42 | static int backend_create_xenvif(struct backend_info *be); |
43 | static void unregister_hotplug_status_watch(struct backend_info *be); | 43 | static void unregister_hotplug_status_watch(struct backend_info *be); |
44 | static void set_backend_state(struct backend_info *be, | 44 | static void set_backend_state(struct backend_info *be, |
45 | enum xenbus_state state); | 45 | enum xenbus_state state); |
@@ -352,7 +352,9 @@ static int netback_probe(struct xenbus_device *dev, | |||
352 | be->state = XenbusStateInitWait; | 352 | be->state = XenbusStateInitWait; |
353 | 353 | ||
354 | /* This kicks hotplug scripts, so do it immediately. */ | 354 | /* This kicks hotplug scripts, so do it immediately. */ |
355 | backend_create_xenvif(be); | 355 | err = backend_create_xenvif(be); |
356 | if (err) | ||
357 | goto fail; | ||
356 | 358 | ||
357 | return 0; | 359 | return 0; |
358 | 360 | ||
@@ -397,19 +399,19 @@ static int netback_uevent(struct xenbus_device *xdev, | |||
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | ||
400 | static void backend_create_xenvif(struct backend_info *be) | 402 | static int backend_create_xenvif(struct backend_info *be) |
401 | { | 403 | { |
402 | int err; | 404 | int err; |
403 | long handle; | 405 | long handle; |
404 | struct xenbus_device *dev = be->dev; | 406 | struct xenbus_device *dev = be->dev; |
405 | 407 | ||
406 | if (be->vif != NULL) | 408 | if (be->vif != NULL) |
407 | return; | 409 | return 0; |
408 | 410 | ||
409 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); | 411 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); |
410 | if (err != 1) { | 412 | if (err != 1) { |
411 | xenbus_dev_fatal(dev, err, "reading handle"); | 413 | xenbus_dev_fatal(dev, err, "reading handle"); |
412 | return; | 414 | return (err < 0) ? err : -EINVAL; |
413 | } | 415 | } |
414 | 416 | ||
415 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); | 417 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); |
@@ -417,10 +419,11 @@ static void backend_create_xenvif(struct backend_info *be) | |||
417 | err = PTR_ERR(be->vif); | 419 | err = PTR_ERR(be->vif); |
418 | be->vif = NULL; | 420 | be->vif = NULL; |
419 | xenbus_dev_fatal(dev, err, "creating interface"); | 421 | xenbus_dev_fatal(dev, err, "creating interface"); |
420 | return; | 422 | return err; |
421 | } | 423 | } |
422 | 424 | ||
423 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); | 425 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); |
426 | return 0; | ||
424 | } | 427 | } |
425 | 428 | ||
426 | static void backend_disconnect(struct backend_info *be) | 429 | static void backend_disconnect(struct backend_info *be) |
diff --git a/drivers/of/address.c b/drivers/of/address.c index afdb78299f61..06af494184d6 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -450,6 +450,21 @@ static struct of_bus *of_match_bus(struct device_node *np) | |||
450 | return NULL; | 450 | return NULL; |
451 | } | 451 | } |
452 | 452 | ||
453 | static int of_empty_ranges_quirk(void) | ||
454 | { | ||
455 | if (IS_ENABLED(CONFIG_PPC)) { | ||
456 | /* To save cycles, we cache the result */ | ||
457 | static int quirk_state = -1; | ||
458 | |||
459 | if (quirk_state < 0) | ||
460 | quirk_state = | ||
461 | of_machine_is_compatible("Power Macintosh") || | ||
462 | of_machine_is_compatible("MacRISC"); | ||
463 | return quirk_state; | ||
464 | } | ||
465 | return false; | ||
466 | } | ||
467 | |||
453 | static int of_translate_one(struct device_node *parent, struct of_bus *bus, | 468 | static int of_translate_one(struct device_node *parent, struct of_bus *bus, |
454 | struct of_bus *pbus, __be32 *addr, | 469 | struct of_bus *pbus, __be32 *addr, |
455 | int na, int ns, int pna, const char *rprop) | 470 | int na, int ns, int pna, const char *rprop) |
@@ -475,12 +490,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
475 | * This code is only enabled on powerpc. --gcl | 490 | * This code is only enabled on powerpc. --gcl |
476 | */ | 491 | */ |
477 | ranges = of_get_property(parent, rprop, &rlen); | 492 | ranges = of_get_property(parent, rprop, &rlen); |
478 | #if !defined(CONFIG_PPC) | 493 | if (ranges == NULL && !of_empty_ranges_quirk()) { |
479 | if (ranges == NULL) { | ||
480 | pr_err("OF: no ranges; cannot translate\n"); | 494 | pr_err("OF: no ranges; cannot translate\n"); |
481 | return 1; | 495 | return 1; |
482 | } | 496 | } |
483 | #endif /* !defined(CONFIG_PPC) */ | ||
484 | if (ranges == NULL || rlen == 0) { | 497 | if (ranges == NULL || rlen == 0) { |
485 | offset = of_read_number(addr, na); | 498 | offset = of_read_number(addr, na); |
486 | memset(addr, 0, pna * 4); | 499 | memset(addr, 0, pna * 4); |
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index f297891d8529..d4994177dec2 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -247,7 +247,7 @@ void of_node_release(struct kobject *kobj) | |||
247 | * @allocflags: Allocation flags (typically pass GFP_KERNEL) | 247 | * @allocflags: Allocation flags (typically pass GFP_KERNEL) |
248 | * | 248 | * |
249 | * Copy a property by dynamically allocating the memory of both the | 249 | * Copy a property by dynamically allocating the memory of both the |
250 | * property stucture and the property name & contents. The property's | 250 | * property structure and the property name & contents. The property's |
251 | * flags have the OF_DYNAMIC bit set so that we can differentiate between | 251 | * flags have the OF_DYNAMIC bit set so that we can differentiate between |
252 | * dynamically allocated properties and not. | 252 | * dynamically allocated properties and not. |
253 | * Returns the newly allocated property or NULL on out of memory error. | 253 | * Returns the newly allocated property or NULL on out of memory error. |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d1ffca8b34ea..30e97bcc4f88 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -773,7 +773,7 @@ int __init early_init_dt_scan_chosen_serial(void) | |||
773 | if (offset < 0) | 773 | if (offset < 0) |
774 | return -ENODEV; | 774 | return -ENODEV; |
775 | 775 | ||
776 | while (match->compatible) { | 776 | while (match->compatible[0]) { |
777 | unsigned long addr; | 777 | unsigned long addr; |
778 | if (fdt_node_check_compatible(fdt, offset, match->compatible)) { | 778 | if (fdt_node_check_compatible(fdt, offset, match->compatible)) { |
779 | match++; | 779 | match++; |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 11b873c54a77..e2d79afa9dc6 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -896,10 +896,14 @@ static void selftest_data_remove(void) | |||
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | 898 | ||
899 | while (last_node_index >= 0) { | 899 | while (last_node_index-- > 0) { |
900 | if (nodes[last_node_index]) { | 900 | if (nodes[last_node_index]) { |
901 | np = of_find_node_by_path(nodes[last_node_index]->full_name); | 901 | np = of_find_node_by_path(nodes[last_node_index]->full_name); |
902 | if (strcmp(np->full_name, "/aliases") != 0) { | 902 | if (np == nodes[last_node_index]) { |
903 | if (of_aliases == np) { | ||
904 | of_node_put(of_aliases); | ||
905 | of_aliases = NULL; | ||
906 | } | ||
903 | detach_node_and_children(np); | 907 | detach_node_and_children(np); |
904 | } else { | 908 | } else { |
905 | for_each_property_of_node(np, prop) { | 909 | for_each_property_of_node(np, prop) { |
@@ -908,7 +912,6 @@ static void selftest_data_remove(void) | |||
908 | } | 912 | } |
909 | } | 913 | } |
910 | } | 914 | } |
911 | last_node_index--; | ||
912 | } | 915 | } |
913 | } | 916 | } |
914 | 917 | ||
@@ -921,6 +924,8 @@ static int __init of_selftest(void) | |||
921 | res = selftest_data_add(); | 924 | res = selftest_data_add(); |
922 | if (res) | 925 | if (res) |
923 | return res; | 926 | return res; |
927 | if (!of_aliases) | ||
928 | of_aliases = of_find_node_by_path("/aliases"); | ||
924 | 929 | ||
925 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); | 930 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); |
926 | if (!np) { | 931 | if (!np) { |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index d292d7cb3417..49dd766852ba 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -444,7 +444,7 @@ static inline int pcie_cap_version(const struct pci_dev *dev) | |||
444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; | 444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; |
445 | } | 445 | } |
446 | 446 | ||
447 | static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | 447 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) |
448 | { | 448 | { |
449 | int type = pci_pcie_type(dev); | 449 | int type = pci_pcie_type(dev); |
450 | 450 | ||
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 9ecabfa8c634..2988fe136c1e 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c | |||
@@ -631,10 +631,15 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev) | |||
631 | if (ret) | 631 | if (ret) |
632 | return ret; | 632 | return ret; |
633 | 633 | ||
634 | bus = pci_scan_root_bus(&pdev->dev, 0, &xgene_pcie_ops, port, &res); | 634 | bus = pci_create_root_bus(&pdev->dev, 0, |
635 | &xgene_pcie_ops, port, &res); | ||
635 | if (!bus) | 636 | if (!bus) |
636 | return -ENOMEM; | 637 | return -ENOMEM; |
637 | 638 | ||
639 | pci_scan_child_bus(bus); | ||
640 | pci_assign_unassigned_bus_resources(bus); | ||
641 | pci_bus_add_devices(bus); | ||
642 | |||
638 | platform_set_drvdata(pdev, port); | 643 | platform_set_drvdata(pdev, port); |
639 | return 0; | 644 | return 0; |
640 | } | 645 | } |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 9fab30af0e75..084587d7cd13 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -590,6 +590,20 @@ static struct msi_desc *msi_setup_entry(struct pci_dev *dev) | |||
590 | return entry; | 590 | return entry; |
591 | } | 591 | } |
592 | 592 | ||
593 | static int msi_verify_entries(struct pci_dev *dev) | ||
594 | { | ||
595 | struct msi_desc *entry; | ||
596 | |||
597 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
598 | if (!dev->no_64bit_msi || !entry->msg.address_hi) | ||
599 | continue; | ||
600 | dev_err(&dev->dev, "Device has broken 64-bit MSI but arch" | ||
601 | " tried to assign one above 4G\n"); | ||
602 | return -EIO; | ||
603 | } | ||
604 | return 0; | ||
605 | } | ||
606 | |||
593 | /** | 607 | /** |
594 | * msi_capability_init - configure device's MSI capability structure | 608 | * msi_capability_init - configure device's MSI capability structure |
595 | * @dev: pointer to the pci_dev data structure of MSI device function | 609 | * @dev: pointer to the pci_dev data structure of MSI device function |
@@ -627,6 +641,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
627 | return ret; | 641 | return ret; |
628 | } | 642 | } |
629 | 643 | ||
644 | ret = msi_verify_entries(dev); | ||
645 | if (ret) { | ||
646 | msi_mask_irq(entry, mask, ~mask); | ||
647 | free_msi_irqs(dev); | ||
648 | return ret; | ||
649 | } | ||
650 | |||
630 | ret = populate_msi_sysfs(dev); | 651 | ret = populate_msi_sysfs(dev); |
631 | if (ret) { | 652 | if (ret) { |
632 | msi_mask_irq(entry, mask, ~mask); | 653 | msi_mask_irq(entry, mask, ~mask); |
@@ -739,6 +760,11 @@ static int msix_capability_init(struct pci_dev *dev, | |||
739 | if (ret) | 760 | if (ret) |
740 | goto out_avail; | 761 | goto out_avail; |
741 | 762 | ||
763 | /* Check if all MSI entries honor device restrictions */ | ||
764 | ret = msi_verify_entries(dev); | ||
765 | if (ret) | ||
766 | goto out_free; | ||
767 | |||
742 | /* | 768 | /* |
743 | * Some devices require MSI-X to be enabled before we can touch the | 769 | * Some devices require MSI-X to be enabled before we can touch the |
744 | * MSI-X registers. We need to mask all the vectors to prevent | 770 | * MSI-X registers. We need to mask all the vectors to prevent |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 0601890db22d..4a3902d8e6fe 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | extern const unsigned char pcie_link_speed[]; | 7 | extern const unsigned char pcie_link_speed[]; |
8 | 8 | ||
9 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); | ||
10 | |||
9 | /* Functions internal to the PCI core code */ | 11 | /* Functions internal to the PCI core code */ |
10 | 12 | ||
11 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); | 13 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5ed99309c758..c8ca98c2b480 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -407,15 +407,16 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
407 | { | 407 | { |
408 | struct pci_dev *dev = child->self; | 408 | struct pci_dev *dev = child->self; |
409 | u16 mem_base_lo, mem_limit_lo; | 409 | u16 mem_base_lo, mem_limit_lo; |
410 | unsigned long base, limit; | 410 | u64 base64, limit64; |
411 | dma_addr_t base, limit; | ||
411 | struct pci_bus_region region; | 412 | struct pci_bus_region region; |
412 | struct resource *res; | 413 | struct resource *res; |
413 | 414 | ||
414 | res = child->resource[2]; | 415 | res = child->resource[2]; |
415 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); | 416 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); |
416 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); | 417 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); |
417 | base = ((unsigned long) mem_base_lo & PCI_PREF_RANGE_MASK) << 16; | 418 | base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; |
418 | limit = ((unsigned long) mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; | 419 | limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; |
419 | 420 | ||
420 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { | 421 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { |
421 | u32 mem_base_hi, mem_limit_hi; | 422 | u32 mem_base_hi, mem_limit_hi; |
@@ -429,17 +430,20 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
429 | * this, just assume they are not being used. | 430 | * this, just assume they are not being used. |
430 | */ | 431 | */ |
431 | if (mem_base_hi <= mem_limit_hi) { | 432 | if (mem_base_hi <= mem_limit_hi) { |
432 | #if BITS_PER_LONG == 64 | 433 | base64 |= (u64) mem_base_hi << 32; |
433 | base |= ((unsigned long) mem_base_hi) << 32; | 434 | limit64 |= (u64) mem_limit_hi << 32; |
434 | limit |= ((unsigned long) mem_limit_hi) << 32; | ||
435 | #else | ||
436 | if (mem_base_hi || mem_limit_hi) { | ||
437 | dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n"); | ||
438 | return; | ||
439 | } | ||
440 | #endif | ||
441 | } | 435 | } |
442 | } | 436 | } |
437 | |||
438 | base = (dma_addr_t) base64; | ||
439 | limit = (dma_addr_t) limit64; | ||
440 | |||
441 | if (base != base64) { | ||
442 | dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", | ||
443 | (unsigned long long) base64); | ||
444 | return; | ||
445 | } | ||
446 | |||
443 | if (base <= limit) { | 447 | if (base <= limit) { |
444 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | | 448 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | |
445 | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 449 | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
@@ -1323,7 +1327,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) | |||
1323 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); | 1327 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); |
1324 | 1328 | ||
1325 | /* Initialize Link Control Register */ | 1329 | /* Initialize Link Control Register */ |
1326 | if (dev->subordinate) | 1330 | if (pcie_cap_has_lnkctl(dev)) |
1327 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, | 1331 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, |
1328 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); | 1332 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); |
1329 | 1333 | ||
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 4dcfb7116a04..a2eabe6ff9ad 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -202,6 +202,7 @@ config TC1100_WMI | |||
202 | config HP_ACCEL | 202 | config HP_ACCEL |
203 | tristate "HP laptop accelerometer" | 203 | tristate "HP laptop accelerometer" |
204 | depends on INPUT && ACPI | 204 | depends on INPUT && ACPI |
205 | depends on SERIO_I8042 | ||
205 | select SENSORS_LIS3LV02D | 206 | select SENSORS_LIS3LV02D |
206 | select NEW_LEDS | 207 | select NEW_LEDS |
207 | select LEDS_CLASS | 208 | select LEDS_CLASS |
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c index 13e14ec1d3d7..6bec745b6b92 100644 --- a/drivers/platform/x86/hp_accel.c +++ b/drivers/platform/x86/hp_accel.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/leds.h> | 37 | #include <linux/leds.h> |
38 | #include <linux/atomic.h> | 38 | #include <linux/atomic.h> |
39 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
40 | #include <linux/i8042.h> | ||
41 | #include <linux/serio.h> | ||
40 | #include "../../misc/lis3lv02d/lis3lv02d.h" | 42 | #include "../../misc/lis3lv02d/lis3lv02d.h" |
41 | 43 | ||
42 | #define DRIVER_NAME "hp_accel" | 44 | #define DRIVER_NAME "hp_accel" |
@@ -73,6 +75,13 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev, | |||
73 | 75 | ||
74 | /* HP-specific accelerometer driver ------------------------------------ */ | 76 | /* HP-specific accelerometer driver ------------------------------------ */ |
75 | 77 | ||
78 | /* e0 25, e0 26, e0 27, e0 28 are scan codes that the accelerometer with acpi id | ||
79 | * HPQ6000 sends through the keyboard bus */ | ||
80 | #define ACCEL_1 0x25 | ||
81 | #define ACCEL_2 0x26 | ||
82 | #define ACCEL_3 0x27 | ||
83 | #define ACCEL_4 0x28 | ||
84 | |||
76 | /* For automatic insertion of the module */ | 85 | /* For automatic insertion of the module */ |
77 | static const struct acpi_device_id lis3lv02d_device_ids[] = { | 86 | static const struct acpi_device_id lis3lv02d_device_ids[] = { |
78 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ | 87 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ |
@@ -294,6 +303,35 @@ static void lis3lv02d_enum_resources(struct acpi_device *device) | |||
294 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); | 303 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); |
295 | } | 304 | } |
296 | 305 | ||
306 | static bool hp_accel_i8042_filter(unsigned char data, unsigned char str, | ||
307 | struct serio *port) | ||
308 | { | ||
309 | static bool extended; | ||
310 | |||
311 | if (str & I8042_STR_AUXDATA) | ||
312 | return false; | ||
313 | |||
314 | if (data == 0xe0) { | ||
315 | extended = true; | ||
316 | return true; | ||
317 | } else if (unlikely(extended)) { | ||
318 | extended = false; | ||
319 | |||
320 | switch (data) { | ||
321 | case ACCEL_1: | ||
322 | case ACCEL_2: | ||
323 | case ACCEL_3: | ||
324 | case ACCEL_4: | ||
325 | return true; | ||
326 | default: | ||
327 | serio_interrupt(port, 0xe0, 0); | ||
328 | return false; | ||
329 | } | ||
330 | } | ||
331 | |||
332 | return false; | ||
333 | } | ||
334 | |||
297 | static int lis3lv02d_add(struct acpi_device *device) | 335 | static int lis3lv02d_add(struct acpi_device *device) |
298 | { | 336 | { |
299 | int ret; | 337 | int ret; |
@@ -326,6 +364,11 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
326 | if (ret) | 364 | if (ret) |
327 | return ret; | 365 | return ret; |
328 | 366 | ||
367 | /* filter to remove HPQ6000 accelerometer data | ||
368 | * from keyboard bus stream */ | ||
369 | if (strstr(dev_name(&device->dev), "HPQ6000")) | ||
370 | i8042_install_filter(hp_accel_i8042_filter); | ||
371 | |||
329 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); | 372 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); |
330 | ret = led_classdev_register(NULL, &hpled_led.led_classdev); | 373 | ret = led_classdev_register(NULL, &hpled_led.led_classdev); |
331 | if (ret) { | 374 | if (ret) { |
@@ -343,6 +386,7 @@ static int lis3lv02d_remove(struct acpi_device *device) | |||
343 | if (!device) | 386 | if (!device) |
344 | return -EINVAL; | 387 | return -EINVAL; |
345 | 388 | ||
389 | i8042_remove_filter(hp_accel_i8042_filter); | ||
346 | lis3lv02d_joystick_disable(&lis3_dev); | 390 | lis3lv02d_joystick_disable(&lis3_dev); |
347 | lis3lv02d_poweroff(&lis3_dev); | 391 | lis3lv02d_poweroff(&lis3_dev); |
348 | 392 | ||
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 217da4b2ca86..99a78d365ceb 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/time64.h> | ||
28 | #include <linux/of.h> | 29 | #include <linux/of.h> |
29 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
30 | #include <linux/mfd/core.h> | 31 | #include <linux/mfd/core.h> |
@@ -108,7 +109,7 @@ enum ab8500_fg_calibration_state { | |||
108 | struct ab8500_fg_avg_cap { | 109 | struct ab8500_fg_avg_cap { |
109 | int avg; | 110 | int avg; |
110 | int samples[NBR_AVG_SAMPLES]; | 111 | int samples[NBR_AVG_SAMPLES]; |
111 | __kernel_time_t time_stamps[NBR_AVG_SAMPLES]; | 112 | time64_t time_stamps[NBR_AVG_SAMPLES]; |
112 | int pos; | 113 | int pos; |
113 | int nbr_samples; | 114 | int nbr_samples; |
114 | int sum; | 115 | int sum; |
@@ -386,15 +387,15 @@ static int ab8500_fg_is_low_curr(struct ab8500_fg *di, int curr) | |||
386 | */ | 387 | */ |
387 | static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) | 388 | static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) |
388 | { | 389 | { |
389 | struct timespec ts; | 390 | struct timespec64 ts64; |
390 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; | 391 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; |
391 | 392 | ||
392 | getnstimeofday(&ts); | 393 | getnstimeofday64(&ts64); |
393 | 394 | ||
394 | do { | 395 | do { |
395 | avg->sum += sample - avg->samples[avg->pos]; | 396 | avg->sum += sample - avg->samples[avg->pos]; |
396 | avg->samples[avg->pos] = sample; | 397 | avg->samples[avg->pos] = sample; |
397 | avg->time_stamps[avg->pos] = ts.tv_sec; | 398 | avg->time_stamps[avg->pos] = ts64.tv_sec; |
398 | avg->pos++; | 399 | avg->pos++; |
399 | 400 | ||
400 | if (avg->pos == NBR_AVG_SAMPLES) | 401 | if (avg->pos == NBR_AVG_SAMPLES) |
@@ -407,7 +408,7 @@ static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) | |||
407 | * Check the time stamp for each sample. If too old, | 408 | * Check the time stamp for each sample. If too old, |
408 | * replace with latest sample | 409 | * replace with latest sample |
409 | */ | 410 | */ |
410 | } while (ts.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); | 411 | } while (ts64.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); |
411 | 412 | ||
412 | avg->avg = avg->sum / avg->nbr_samples; | 413 | avg->avg = avg->sum / avg->nbr_samples; |
413 | 414 | ||
@@ -446,14 +447,14 @@ static void ab8500_fg_clear_cap_samples(struct ab8500_fg *di) | |||
446 | static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample) | 447 | static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample) |
447 | { | 448 | { |
448 | int i; | 449 | int i; |
449 | struct timespec ts; | 450 | struct timespec64 ts64; |
450 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; | 451 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; |
451 | 452 | ||
452 | getnstimeofday(&ts); | 453 | getnstimeofday64(&ts64); |
453 | 454 | ||
454 | for (i = 0; i < NBR_AVG_SAMPLES; i++) { | 455 | for (i = 0; i < NBR_AVG_SAMPLES; i++) { |
455 | avg->samples[i] = sample; | 456 | avg->samples[i] = sample; |
456 | avg->time_stamps[i] = ts.tv_sec; | 457 | avg->time_stamps[i] = ts64.tv_sec; |
457 | } | 458 | } |
458 | 459 | ||
459 | avg->pos = 0; | 460 | avg->pos = 0; |
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index e384844a1ae1..1f49986fc605 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c | |||
@@ -1579,8 +1579,15 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1579 | if (np) { | 1579 | if (np) { |
1580 | bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); | 1580 | bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); |
1581 | 1581 | ||
1582 | if (!bq->notify_psy) | 1582 | if (IS_ERR(bq->notify_psy)) { |
1583 | return -EPROBE_DEFER; | 1583 | dev_info(&client->dev, |
1584 | "no 'ti,usb-charger-detection' property (err=%ld)\n", | ||
1585 | PTR_ERR(bq->notify_psy)); | ||
1586 | bq->notify_psy = NULL; | ||
1587 | } else if (!bq->notify_psy) { | ||
1588 | ret = -EPROBE_DEFER; | ||
1589 | goto error_2; | ||
1590 | } | ||
1584 | } | 1591 | } |
1585 | else if (pdata->notify_device) | 1592 | else if (pdata->notify_device) |
1586 | bq->notify_psy = power_supply_get_by_name(pdata->notify_device); | 1593 | bq->notify_psy = power_supply_get_by_name(pdata->notify_device); |
@@ -1602,27 +1609,27 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1602 | ret = of_property_read_u32(np, "ti,current-limit", | 1609 | ret = of_property_read_u32(np, "ti,current-limit", |
1603 | &bq->init_data.current_limit); | 1610 | &bq->init_data.current_limit); |
1604 | if (ret) | 1611 | if (ret) |
1605 | return ret; | 1612 | goto error_2; |
1606 | ret = of_property_read_u32(np, "ti,weak-battery-voltage", | 1613 | ret = of_property_read_u32(np, "ti,weak-battery-voltage", |
1607 | &bq->init_data.weak_battery_voltage); | 1614 | &bq->init_data.weak_battery_voltage); |
1608 | if (ret) | 1615 | if (ret) |
1609 | return ret; | 1616 | goto error_2; |
1610 | ret = of_property_read_u32(np, "ti,battery-regulation-voltage", | 1617 | ret = of_property_read_u32(np, "ti,battery-regulation-voltage", |
1611 | &bq->init_data.battery_regulation_voltage); | 1618 | &bq->init_data.battery_regulation_voltage); |
1612 | if (ret) | 1619 | if (ret) |
1613 | return ret; | 1620 | goto error_2; |
1614 | ret = of_property_read_u32(np, "ti,charge-current", | 1621 | ret = of_property_read_u32(np, "ti,charge-current", |
1615 | &bq->init_data.charge_current); | 1622 | &bq->init_data.charge_current); |
1616 | if (ret) | 1623 | if (ret) |
1617 | return ret; | 1624 | goto error_2; |
1618 | ret = of_property_read_u32(np, "ti,termination-current", | 1625 | ret = of_property_read_u32(np, "ti,termination-current", |
1619 | &bq->init_data.termination_current); | 1626 | &bq->init_data.termination_current); |
1620 | if (ret) | 1627 | if (ret) |
1621 | return ret; | 1628 | goto error_2; |
1622 | ret = of_property_read_u32(np, "ti,resistor-sense", | 1629 | ret = of_property_read_u32(np, "ti,resistor-sense", |
1623 | &bq->init_data.resistor_sense); | 1630 | &bq->init_data.resistor_sense); |
1624 | if (ret) | 1631 | if (ret) |
1625 | return ret; | 1632 | goto error_2; |
1626 | } else { | 1633 | } else { |
1627 | memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); | 1634 | memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); |
1628 | } | 1635 | } |
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 7098a1ce2d3c..ef8094a61f1e 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c | |||
@@ -97,6 +97,7 @@ static struct charger_global_desc *g_desc; /* init with setup_charger_manager */ | |||
97 | static bool is_batt_present(struct charger_manager *cm) | 97 | static bool is_batt_present(struct charger_manager *cm) |
98 | { | 98 | { |
99 | union power_supply_propval val; | 99 | union power_supply_propval val; |
100 | struct power_supply *psy; | ||
100 | bool present = false; | 101 | bool present = false; |
101 | int i, ret; | 102 | int i, ret; |
102 | 103 | ||
@@ -107,16 +108,27 @@ static bool is_batt_present(struct charger_manager *cm) | |||
107 | case CM_NO_BATTERY: | 108 | case CM_NO_BATTERY: |
108 | break; | 109 | break; |
109 | case CM_FUEL_GAUGE: | 110 | case CM_FUEL_GAUGE: |
110 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 111 | psy = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
112 | if (!psy) | ||
113 | break; | ||
114 | |||
115 | ret = psy->get_property(psy, | ||
111 | POWER_SUPPLY_PROP_PRESENT, &val); | 116 | POWER_SUPPLY_PROP_PRESENT, &val); |
112 | if (ret == 0 && val.intval) | 117 | if (ret == 0 && val.intval) |
113 | present = true; | 118 | present = true; |
114 | break; | 119 | break; |
115 | case CM_CHARGER_STAT: | 120 | case CM_CHARGER_STAT: |
116 | for (i = 0; cm->charger_stat[i]; i++) { | 121 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
117 | ret = cm->charger_stat[i]->get_property( | 122 | psy = power_supply_get_by_name( |
118 | cm->charger_stat[i], | 123 | cm->desc->psy_charger_stat[i]); |
119 | POWER_SUPPLY_PROP_PRESENT, &val); | 124 | if (!psy) { |
125 | dev_err(cm->dev, "Cannot find power supply \"%s\"\n", | ||
126 | cm->desc->psy_charger_stat[i]); | ||
127 | continue; | ||
128 | } | ||
129 | |||
130 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, | ||
131 | &val); | ||
120 | if (ret == 0 && val.intval) { | 132 | if (ret == 0 && val.intval) { |
121 | present = true; | 133 | present = true; |
122 | break; | 134 | break; |
@@ -139,14 +151,20 @@ static bool is_batt_present(struct charger_manager *cm) | |||
139 | static bool is_ext_pwr_online(struct charger_manager *cm) | 151 | static bool is_ext_pwr_online(struct charger_manager *cm) |
140 | { | 152 | { |
141 | union power_supply_propval val; | 153 | union power_supply_propval val; |
154 | struct power_supply *psy; | ||
142 | bool online = false; | 155 | bool online = false; |
143 | int i, ret; | 156 | int i, ret; |
144 | 157 | ||
145 | /* If at least one of them has one, it's yes. */ | 158 | /* If at least one of them has one, it's yes. */ |
146 | for (i = 0; cm->charger_stat[i]; i++) { | 159 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
147 | ret = cm->charger_stat[i]->get_property( | 160 | psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); |
148 | cm->charger_stat[i], | 161 | if (!psy) { |
149 | POWER_SUPPLY_PROP_ONLINE, &val); | 162 | dev_err(cm->dev, "Cannot find power supply \"%s\"\n", |
163 | cm->desc->psy_charger_stat[i]); | ||
164 | continue; | ||
165 | } | ||
166 | |||
167 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); | ||
150 | if (ret == 0 && val.intval) { | 168 | if (ret == 0 && val.intval) { |
151 | online = true; | 169 | online = true; |
152 | break; | 170 | break; |
@@ -167,12 +185,14 @@ static bool is_ext_pwr_online(struct charger_manager *cm) | |||
167 | static int get_batt_uV(struct charger_manager *cm, int *uV) | 185 | static int get_batt_uV(struct charger_manager *cm, int *uV) |
168 | { | 186 | { |
169 | union power_supply_propval val; | 187 | union power_supply_propval val; |
188 | struct power_supply *fuel_gauge; | ||
170 | int ret; | 189 | int ret; |
171 | 190 | ||
172 | if (!cm->fuel_gauge) | 191 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
192 | if (!fuel_gauge) | ||
173 | return -ENODEV; | 193 | return -ENODEV; |
174 | 194 | ||
175 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 195 | ret = fuel_gauge->get_property(fuel_gauge, |
176 | POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); | 196 | POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); |
177 | if (ret) | 197 | if (ret) |
178 | return ret; | 198 | return ret; |
@@ -189,6 +209,7 @@ static bool is_charging(struct charger_manager *cm) | |||
189 | { | 209 | { |
190 | int i, ret; | 210 | int i, ret; |
191 | bool charging = false; | 211 | bool charging = false; |
212 | struct power_supply *psy; | ||
192 | union power_supply_propval val; | 213 | union power_supply_propval val; |
193 | 214 | ||
194 | /* If there is no battery, it cannot be charged */ | 215 | /* If there is no battery, it cannot be charged */ |
@@ -196,17 +217,22 @@ static bool is_charging(struct charger_manager *cm) | |||
196 | return false; | 217 | return false; |
197 | 218 | ||
198 | /* If at least one of the charger is charging, return yes */ | 219 | /* If at least one of the charger is charging, return yes */ |
199 | for (i = 0; cm->charger_stat[i]; i++) { | 220 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
200 | /* 1. The charger sholuld not be DISABLED */ | 221 | /* 1. The charger sholuld not be DISABLED */ |
201 | if (cm->emergency_stop) | 222 | if (cm->emergency_stop) |
202 | continue; | 223 | continue; |
203 | if (!cm->charger_enabled) | 224 | if (!cm->charger_enabled) |
204 | continue; | 225 | continue; |
205 | 226 | ||
227 | psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); | ||
228 | if (!psy) { | ||
229 | dev_err(cm->dev, "Cannot find power supply \"%s\"\n", | ||
230 | cm->desc->psy_charger_stat[i]); | ||
231 | continue; | ||
232 | } | ||
233 | |||
206 | /* 2. The charger should be online (ext-power) */ | 234 | /* 2. The charger should be online (ext-power) */ |
207 | ret = cm->charger_stat[i]->get_property( | 235 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); |
208 | cm->charger_stat[i], | ||
209 | POWER_SUPPLY_PROP_ONLINE, &val); | ||
210 | if (ret) { | 236 | if (ret) { |
211 | dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", | 237 | dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", |
212 | cm->desc->psy_charger_stat[i]); | 238 | cm->desc->psy_charger_stat[i]); |
@@ -219,9 +245,7 @@ static bool is_charging(struct charger_manager *cm) | |||
219 | * 3. The charger should not be FULL, DISCHARGING, | 245 | * 3. The charger should not be FULL, DISCHARGING, |
220 | * or NOT_CHARGING. | 246 | * or NOT_CHARGING. |
221 | */ | 247 | */ |
222 | ret = cm->charger_stat[i]->get_property( | 248 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_STATUS, &val); |
223 | cm->charger_stat[i], | ||
224 | POWER_SUPPLY_PROP_STATUS, &val); | ||
225 | if (ret) { | 249 | if (ret) { |
226 | dev_warn(cm->dev, "Cannot read STATUS value from %s\n", | 250 | dev_warn(cm->dev, "Cannot read STATUS value from %s\n", |
227 | cm->desc->psy_charger_stat[i]); | 251 | cm->desc->psy_charger_stat[i]); |
@@ -248,6 +272,7 @@ static bool is_full_charged(struct charger_manager *cm) | |||
248 | { | 272 | { |
249 | struct charger_desc *desc = cm->desc; | 273 | struct charger_desc *desc = cm->desc; |
250 | union power_supply_propval val; | 274 | union power_supply_propval val; |
275 | struct power_supply *fuel_gauge; | ||
251 | int ret = 0; | 276 | int ret = 0; |
252 | int uV; | 277 | int uV; |
253 | 278 | ||
@@ -255,11 +280,15 @@ static bool is_full_charged(struct charger_manager *cm) | |||
255 | if (!is_batt_present(cm)) | 280 | if (!is_batt_present(cm)) |
256 | return false; | 281 | return false; |
257 | 282 | ||
258 | if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) { | 283 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
284 | if (!fuel_gauge) | ||
285 | return false; | ||
286 | |||
287 | if (desc->fullbatt_full_capacity > 0) { | ||
259 | val.intval = 0; | 288 | val.intval = 0; |
260 | 289 | ||
261 | /* Not full if capacity of fuel gauge isn't full */ | 290 | /* Not full if capacity of fuel gauge isn't full */ |
262 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 291 | ret = fuel_gauge->get_property(fuel_gauge, |
263 | POWER_SUPPLY_PROP_CHARGE_FULL, &val); | 292 | POWER_SUPPLY_PROP_CHARGE_FULL, &val); |
264 | if (!ret && val.intval > desc->fullbatt_full_capacity) | 293 | if (!ret && val.intval > desc->fullbatt_full_capacity) |
265 | return true; | 294 | return true; |
@@ -273,10 +302,10 @@ static bool is_full_charged(struct charger_manager *cm) | |||
273 | } | 302 | } |
274 | 303 | ||
275 | /* Full, if the capacity is more than fullbatt_soc */ | 304 | /* Full, if the capacity is more than fullbatt_soc */ |
276 | if (cm->fuel_gauge && desc->fullbatt_soc > 0) { | 305 | if (desc->fullbatt_soc > 0) { |
277 | val.intval = 0; | 306 | val.intval = 0; |
278 | 307 | ||
279 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 308 | ret = fuel_gauge->get_property(fuel_gauge, |
280 | POWER_SUPPLY_PROP_CAPACITY, &val); | 309 | POWER_SUPPLY_PROP_CAPACITY, &val); |
281 | if (!ret && val.intval >= desc->fullbatt_soc) | 310 | if (!ret && val.intval >= desc->fullbatt_soc) |
282 | return true; | 311 | return true; |
@@ -551,6 +580,20 @@ static int check_charging_duration(struct charger_manager *cm) | |||
551 | return ret; | 580 | return ret; |
552 | } | 581 | } |
553 | 582 | ||
583 | static int cm_get_battery_temperature_by_psy(struct charger_manager *cm, | ||
584 | int *temp) | ||
585 | { | ||
586 | struct power_supply *fuel_gauge; | ||
587 | |||
588 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); | ||
589 | if (!fuel_gauge) | ||
590 | return -ENODEV; | ||
591 | |||
592 | return fuel_gauge->get_property(fuel_gauge, | ||
593 | POWER_SUPPLY_PROP_TEMP, | ||
594 | (union power_supply_propval *)temp); | ||
595 | } | ||
596 | |||
554 | static int cm_get_battery_temperature(struct charger_manager *cm, | 597 | static int cm_get_battery_temperature(struct charger_manager *cm, |
555 | int *temp) | 598 | int *temp) |
556 | { | 599 | { |
@@ -560,15 +603,18 @@ static int cm_get_battery_temperature(struct charger_manager *cm, | |||
560 | return -ENODEV; | 603 | return -ENODEV; |
561 | 604 | ||
562 | #ifdef CONFIG_THERMAL | 605 | #ifdef CONFIG_THERMAL |
563 | ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); | 606 | if (cm->tzd_batt) { |
564 | if (!ret) | 607 | ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); |
565 | /* Calibrate temperature unit */ | 608 | if (!ret) |
566 | *temp /= 100; | 609 | /* Calibrate temperature unit */ |
567 | #else | 610 | *temp /= 100; |
568 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 611 | } else |
569 | POWER_SUPPLY_PROP_TEMP, | ||
570 | (union power_supply_propval *)temp); | ||
571 | #endif | 612 | #endif |
613 | { | ||
614 | /* if-else continued from CONFIG_THERMAL */ | ||
615 | ret = cm_get_battery_temperature_by_psy(cm, temp); | ||
616 | } | ||
617 | |||
572 | return ret; | 618 | return ret; |
573 | } | 619 | } |
574 | 620 | ||
@@ -827,6 +873,7 @@ static int charger_get_property(struct power_supply *psy, | |||
827 | struct charger_manager *cm = container_of(psy, | 873 | struct charger_manager *cm = container_of(psy, |
828 | struct charger_manager, charger_psy); | 874 | struct charger_manager, charger_psy); |
829 | struct charger_desc *desc = cm->desc; | 875 | struct charger_desc *desc = cm->desc; |
876 | struct power_supply *fuel_gauge; | ||
830 | int ret = 0; | 877 | int ret = 0; |
831 | int uV; | 878 | int uV; |
832 | 879 | ||
@@ -857,14 +904,20 @@ static int charger_get_property(struct power_supply *psy, | |||
857 | ret = get_batt_uV(cm, &val->intval); | 904 | ret = get_batt_uV(cm, &val->intval); |
858 | break; | 905 | break; |
859 | case POWER_SUPPLY_PROP_CURRENT_NOW: | 906 | case POWER_SUPPLY_PROP_CURRENT_NOW: |
860 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 907 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
908 | if (!fuel_gauge) { | ||
909 | ret = -ENODEV; | ||
910 | break; | ||
911 | } | ||
912 | ret = fuel_gauge->get_property(fuel_gauge, | ||
861 | POWER_SUPPLY_PROP_CURRENT_NOW, val); | 913 | POWER_SUPPLY_PROP_CURRENT_NOW, val); |
862 | break; | 914 | break; |
863 | case POWER_SUPPLY_PROP_TEMP: | 915 | case POWER_SUPPLY_PROP_TEMP: |
864 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: | 916 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: |
865 | return cm_get_battery_temperature(cm, &val->intval); | 917 | return cm_get_battery_temperature(cm, &val->intval); |
866 | case POWER_SUPPLY_PROP_CAPACITY: | 918 | case POWER_SUPPLY_PROP_CAPACITY: |
867 | if (!cm->fuel_gauge) { | 919 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
920 | if (!fuel_gauge) { | ||
868 | ret = -ENODEV; | 921 | ret = -ENODEV; |
869 | break; | 922 | break; |
870 | } | 923 | } |
@@ -875,7 +928,7 @@ static int charger_get_property(struct power_supply *psy, | |||
875 | break; | 928 | break; |
876 | } | 929 | } |
877 | 930 | ||
878 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 931 | ret = fuel_gauge->get_property(fuel_gauge, |
879 | POWER_SUPPLY_PROP_CAPACITY, val); | 932 | POWER_SUPPLY_PROP_CAPACITY, val); |
880 | if (ret) | 933 | if (ret) |
881 | break; | 934 | break; |
@@ -924,7 +977,14 @@ static int charger_get_property(struct power_supply *psy, | |||
924 | break; | 977 | break; |
925 | case POWER_SUPPLY_PROP_CHARGE_NOW: | 978 | case POWER_SUPPLY_PROP_CHARGE_NOW: |
926 | if (is_charging(cm)) { | 979 | if (is_charging(cm)) { |
927 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 980 | fuel_gauge = power_supply_get_by_name( |
981 | cm->desc->psy_fuel_gauge); | ||
982 | if (!fuel_gauge) { | ||
983 | ret = -ENODEV; | ||
984 | break; | ||
985 | } | ||
986 | |||
987 | ret = fuel_gauge->get_property(fuel_gauge, | ||
928 | POWER_SUPPLY_PROP_CHARGE_NOW, | 988 | POWER_SUPPLY_PROP_CHARGE_NOW, |
929 | val); | 989 | val); |
930 | if (ret) { | 990 | if (ret) { |
@@ -970,6 +1030,7 @@ static struct power_supply psy_default = { | |||
970 | .properties = default_charger_props, | 1030 | .properties = default_charger_props, |
971 | .num_properties = ARRAY_SIZE(default_charger_props), | 1031 | .num_properties = ARRAY_SIZE(default_charger_props), |
972 | .get_property = charger_get_property, | 1032 | .get_property = charger_get_property, |
1033 | .no_thermal = true, | ||
973 | }; | 1034 | }; |
974 | 1035 | ||
975 | /** | 1036 | /** |
@@ -1485,14 +1546,15 @@ err: | |||
1485 | return ret; | 1546 | return ret; |
1486 | } | 1547 | } |
1487 | 1548 | ||
1488 | static int cm_init_thermal_data(struct charger_manager *cm) | 1549 | static int cm_init_thermal_data(struct charger_manager *cm, |
1550 | struct power_supply *fuel_gauge) | ||
1489 | { | 1551 | { |
1490 | struct charger_desc *desc = cm->desc; | 1552 | struct charger_desc *desc = cm->desc; |
1491 | union power_supply_propval val; | 1553 | union power_supply_propval val; |
1492 | int ret; | 1554 | int ret; |
1493 | 1555 | ||
1494 | /* Verify whether fuel gauge provides battery temperature */ | 1556 | /* Verify whether fuel gauge provides battery temperature */ |
1495 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 1557 | ret = fuel_gauge->get_property(fuel_gauge, |
1496 | POWER_SUPPLY_PROP_TEMP, &val); | 1558 | POWER_SUPPLY_PROP_TEMP, &val); |
1497 | 1559 | ||
1498 | if (!ret) { | 1560 | if (!ret) { |
@@ -1502,8 +1564,6 @@ static int cm_init_thermal_data(struct charger_manager *cm) | |||
1502 | cm->desc->measure_battery_temp = true; | 1564 | cm->desc->measure_battery_temp = true; |
1503 | } | 1565 | } |
1504 | #ifdef CONFIG_THERMAL | 1566 | #ifdef CONFIG_THERMAL |
1505 | cm->tzd_batt = cm->fuel_gauge->tzd; | ||
1506 | |||
1507 | if (ret && desc->thermal_zone) { | 1567 | if (ret && desc->thermal_zone) { |
1508 | cm->tzd_batt = | 1568 | cm->tzd_batt = |
1509 | thermal_zone_get_zone_by_name(desc->thermal_zone); | 1569 | thermal_zone_get_zone_by_name(desc->thermal_zone); |
@@ -1666,6 +1726,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1666 | int ret = 0, i = 0; | 1726 | int ret = 0, i = 0; |
1667 | int j = 0; | 1727 | int j = 0; |
1668 | union power_supply_propval val; | 1728 | union power_supply_propval val; |
1729 | struct power_supply *fuel_gauge; | ||
1669 | 1730 | ||
1670 | if (g_desc && !rtc_dev && g_desc->rtc_name) { | 1731 | if (g_desc && !rtc_dev && g_desc->rtc_name) { |
1671 | rtc_dev = rtc_class_open(g_desc->rtc_name); | 1732 | rtc_dev = rtc_class_open(g_desc->rtc_name); |
@@ -1729,23 +1790,20 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1729 | while (desc->psy_charger_stat[i]) | 1790 | while (desc->psy_charger_stat[i]) |
1730 | i++; | 1791 | i++; |
1731 | 1792 | ||
1732 | cm->charger_stat = devm_kzalloc(&pdev->dev, | 1793 | /* Check if charger's supplies are present at probe */ |
1733 | sizeof(struct power_supply *) * i, GFP_KERNEL); | ||
1734 | if (!cm->charger_stat) | ||
1735 | return -ENOMEM; | ||
1736 | |||
1737 | for (i = 0; desc->psy_charger_stat[i]; i++) { | 1794 | for (i = 0; desc->psy_charger_stat[i]; i++) { |
1738 | cm->charger_stat[i] = power_supply_get_by_name( | 1795 | struct power_supply *psy; |
1739 | desc->psy_charger_stat[i]); | 1796 | |
1740 | if (!cm->charger_stat[i]) { | 1797 | psy = power_supply_get_by_name(desc->psy_charger_stat[i]); |
1798 | if (!psy) { | ||
1741 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", | 1799 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", |
1742 | desc->psy_charger_stat[i]); | 1800 | desc->psy_charger_stat[i]); |
1743 | return -ENODEV; | 1801 | return -ENODEV; |
1744 | } | 1802 | } |
1745 | } | 1803 | } |
1746 | 1804 | ||
1747 | cm->fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); | 1805 | fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); |
1748 | if (!cm->fuel_gauge) { | 1806 | if (!fuel_gauge) { |
1749 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", | 1807 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", |
1750 | desc->psy_fuel_gauge); | 1808 | desc->psy_fuel_gauge); |
1751 | return -ENODEV; | 1809 | return -ENODEV; |
@@ -1788,13 +1846,13 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1788 | cm->charger_psy.num_properties = psy_default.num_properties; | 1846 | cm->charger_psy.num_properties = psy_default.num_properties; |
1789 | 1847 | ||
1790 | /* Find which optional psy-properties are available */ | 1848 | /* Find which optional psy-properties are available */ |
1791 | if (!cm->fuel_gauge->get_property(cm->fuel_gauge, | 1849 | if (!fuel_gauge->get_property(fuel_gauge, |
1792 | POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { | 1850 | POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { |
1793 | cm->charger_psy.properties[cm->charger_psy.num_properties] = | 1851 | cm->charger_psy.properties[cm->charger_psy.num_properties] = |
1794 | POWER_SUPPLY_PROP_CHARGE_NOW; | 1852 | POWER_SUPPLY_PROP_CHARGE_NOW; |
1795 | cm->charger_psy.num_properties++; | 1853 | cm->charger_psy.num_properties++; |
1796 | } | 1854 | } |
1797 | if (!cm->fuel_gauge->get_property(cm->fuel_gauge, | 1855 | if (!fuel_gauge->get_property(fuel_gauge, |
1798 | POWER_SUPPLY_PROP_CURRENT_NOW, | 1856 | POWER_SUPPLY_PROP_CURRENT_NOW, |
1799 | &val)) { | 1857 | &val)) { |
1800 | cm->charger_psy.properties[cm->charger_psy.num_properties] = | 1858 | cm->charger_psy.properties[cm->charger_psy.num_properties] = |
@@ -1802,7 +1860,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1802 | cm->charger_psy.num_properties++; | 1860 | cm->charger_psy.num_properties++; |
1803 | } | 1861 | } |
1804 | 1862 | ||
1805 | ret = cm_init_thermal_data(cm); | 1863 | ret = cm_init_thermal_data(cm, fuel_gauge); |
1806 | if (ret) { | 1864 | if (ret) { |
1807 | dev_err(&pdev->dev, "Failed to initialize thermal data\n"); | 1865 | dev_err(&pdev->dev, "Failed to initialize thermal data\n"); |
1808 | cm->desc->measure_battery_temp = false; | 1866 | cm->desc->measure_battery_temp = false; |
@@ -2066,8 +2124,8 @@ static bool find_power_supply(struct charger_manager *cm, | |||
2066 | int i; | 2124 | int i; |
2067 | bool found = false; | 2125 | bool found = false; |
2068 | 2126 | ||
2069 | for (i = 0; cm->charger_stat[i]; i++) { | 2127 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
2070 | if (psy == cm->charger_stat[i]) { | 2128 | if (!strcmp(psy->name, cm->desc->psy_charger_stat[i])) { |
2071 | found = true; | 2129 | found = true; |
2072 | break; | 2130 | break; |
2073 | } | 2131 | } |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 6cb7fe5c022d..694e8cddd5c1 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -417,6 +417,9 @@ static int psy_register_thermal(struct power_supply *psy) | |||
417 | { | 417 | { |
418 | int i; | 418 | int i; |
419 | 419 | ||
420 | if (psy->no_thermal) | ||
421 | return 0; | ||
422 | |||
420 | /* Register battery zone device psy reports temperature */ | 423 | /* Register battery zone device psy reports temperature */ |
421 | for (i = 0; i < psy->num_properties; i++) { | 424 | for (i = 0; i < psy->num_properties; i++) { |
422 | if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { | 425 | if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { |
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c index 6cbe6ef3c889..bda52f18e967 100644 --- a/drivers/s390/kvm/virtio_ccw.c +++ b/drivers/s390/kvm/virtio_ccw.c | |||
@@ -888,7 +888,6 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev, | |||
888 | struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev); | 888 | struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev); |
889 | int i; | 889 | int i; |
890 | struct virtqueue *vq; | 890 | struct virtqueue *vq; |
891 | struct virtio_driver *drv; | ||
892 | 891 | ||
893 | if (!vcdev) | 892 | if (!vcdev) |
894 | return; | 893 | return; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_els.c b/drivers/scsi/bnx2fc/bnx2fc_els.c index ca75c7ca2559..ef355c13ccc4 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_els.c +++ b/drivers/scsi/bnx2fc/bnx2fc_els.c | |||
@@ -480,9 +480,7 @@ void bnx2fc_rec_compl(struct bnx2fc_els_cb_arg *cb_arg) | |||
480 | bnx2fc_initiate_cleanup(orig_io_req); | 480 | bnx2fc_initiate_cleanup(orig_io_req); |
481 | /* Post a new IO req with the same sc_cmd */ | 481 | /* Post a new IO req with the same sc_cmd */ |
482 | BNX2FC_IO_DBG(rec_req, "Post IO request again\n"); | 482 | BNX2FC_IO_DBG(rec_req, "Post IO request again\n"); |
483 | spin_unlock_bh(&tgt->tgt_lock); | ||
484 | rc = bnx2fc_post_io_req(tgt, new_io_req); | 483 | rc = bnx2fc_post_io_req(tgt, new_io_req); |
485 | spin_lock_bh(&tgt->tgt_lock); | ||
486 | if (!rc) | 484 | if (!rc) |
487 | goto free_frame; | 485 | goto free_frame; |
488 | BNX2FC_IO_DBG(rec_req, "REC: io post err\n"); | 486 | BNX2FC_IO_DBG(rec_req, "REC: io post err\n"); |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 79e5c94107a9..72533c58c1f3 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -412,6 +412,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
412 | struct fc_frame_header *fh; | 412 | struct fc_frame_header *fh; |
413 | struct fcoe_rcv_info *fr; | 413 | struct fcoe_rcv_info *fr; |
414 | struct fcoe_percpu_s *bg; | 414 | struct fcoe_percpu_s *bg; |
415 | struct sk_buff *tmp_skb; | ||
415 | unsigned short oxid; | 416 | unsigned short oxid; |
416 | 417 | ||
417 | interface = container_of(ptype, struct bnx2fc_interface, | 418 | interface = container_of(ptype, struct bnx2fc_interface, |
@@ -424,6 +425,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
424 | goto err; | 425 | goto err; |
425 | } | 426 | } |
426 | 427 | ||
428 | tmp_skb = skb_share_check(skb, GFP_ATOMIC); | ||
429 | if (!tmp_skb) | ||
430 | goto err; | ||
431 | |||
432 | skb = tmp_skb; | ||
433 | |||
427 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { | 434 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { |
428 | printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); | 435 | printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); |
429 | goto err; | 436 | goto err; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 0679782d9d15..5b99844ef6bf 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -1894,18 +1894,24 @@ int bnx2fc_queuecommand(struct Scsi_Host *host, | |||
1894 | goto exit_qcmd; | 1894 | goto exit_qcmd; |
1895 | } | 1895 | } |
1896 | } | 1896 | } |
1897 | |||
1898 | spin_lock_bh(&tgt->tgt_lock); | ||
1899 | |||
1897 | io_req = bnx2fc_cmd_alloc(tgt); | 1900 | io_req = bnx2fc_cmd_alloc(tgt); |
1898 | if (!io_req) { | 1901 | if (!io_req) { |
1899 | rc = SCSI_MLQUEUE_HOST_BUSY; | 1902 | rc = SCSI_MLQUEUE_HOST_BUSY; |
1900 | goto exit_qcmd; | 1903 | goto exit_qcmd_tgtlock; |
1901 | } | 1904 | } |
1902 | io_req->sc_cmd = sc_cmd; | 1905 | io_req->sc_cmd = sc_cmd; |
1903 | 1906 | ||
1904 | if (bnx2fc_post_io_req(tgt, io_req)) { | 1907 | if (bnx2fc_post_io_req(tgt, io_req)) { |
1905 | printk(KERN_ERR PFX "Unable to post io_req\n"); | 1908 | printk(KERN_ERR PFX "Unable to post io_req\n"); |
1906 | rc = SCSI_MLQUEUE_HOST_BUSY; | 1909 | rc = SCSI_MLQUEUE_HOST_BUSY; |
1907 | goto exit_qcmd; | 1910 | goto exit_qcmd_tgtlock; |
1908 | } | 1911 | } |
1912 | |||
1913 | exit_qcmd_tgtlock: | ||
1914 | spin_unlock_bh(&tgt->tgt_lock); | ||
1909 | exit_qcmd: | 1915 | exit_qcmd: |
1910 | return rc; | 1916 | return rc; |
1911 | } | 1917 | } |
@@ -2020,6 +2026,8 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2020 | int task_idx, index; | 2026 | int task_idx, index; |
2021 | u16 xid; | 2027 | u16 xid; |
2022 | 2028 | ||
2029 | /* bnx2fc_post_io_req() is called with the tgt_lock held */ | ||
2030 | |||
2023 | /* Initialize rest of io_req fields */ | 2031 | /* Initialize rest of io_req fields */ |
2024 | io_req->cmd_type = BNX2FC_SCSI_CMD; | 2032 | io_req->cmd_type = BNX2FC_SCSI_CMD; |
2025 | io_req->port = port; | 2033 | io_req->port = port; |
@@ -2047,9 +2055,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2047 | /* Build buffer descriptor list for firmware from sg list */ | 2055 | /* Build buffer descriptor list for firmware from sg list */ |
2048 | if (bnx2fc_build_bd_list_from_sg(io_req)) { | 2056 | if (bnx2fc_build_bd_list_from_sg(io_req)) { |
2049 | printk(KERN_ERR PFX "BD list creation failed\n"); | 2057 | printk(KERN_ERR PFX "BD list creation failed\n"); |
2050 | spin_lock_bh(&tgt->tgt_lock); | ||
2051 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 2058 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
2052 | spin_unlock_bh(&tgt->tgt_lock); | ||
2053 | return -EAGAIN; | 2059 | return -EAGAIN; |
2054 | } | 2060 | } |
2055 | 2061 | ||
@@ -2061,19 +2067,15 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2061 | task = &(task_page[index]); | 2067 | task = &(task_page[index]); |
2062 | bnx2fc_init_task(io_req, task); | 2068 | bnx2fc_init_task(io_req, task); |
2063 | 2069 | ||
2064 | spin_lock_bh(&tgt->tgt_lock); | ||
2065 | |||
2066 | if (tgt->flush_in_prog) { | 2070 | if (tgt->flush_in_prog) { |
2067 | printk(KERN_ERR PFX "Flush in progress..Host Busy\n"); | 2071 | printk(KERN_ERR PFX "Flush in progress..Host Busy\n"); |
2068 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 2072 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
2069 | spin_unlock_bh(&tgt->tgt_lock); | ||
2070 | return -EAGAIN; | 2073 | return -EAGAIN; |
2071 | } | 2074 | } |
2072 | 2075 | ||
2073 | if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) { | 2076 | if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) { |
2074 | printk(KERN_ERR PFX "Session not ready...post_io\n"); | 2077 | printk(KERN_ERR PFX "Session not ready...post_io\n"); |
2075 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 2078 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
2076 | spin_unlock_bh(&tgt->tgt_lock); | ||
2077 | return -EAGAIN; | 2079 | return -EAGAIN; |
2078 | } | 2080 | } |
2079 | 2081 | ||
@@ -2091,6 +2093,5 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2091 | 2093 | ||
2092 | /* Ring doorbell */ | 2094 | /* Ring doorbell */ |
2093 | bnx2fc_ring_doorbell(tgt); | 2095 | bnx2fc_ring_doorbell(tgt); |
2094 | spin_unlock_bh(&tgt->tgt_lock); | ||
2095 | return 0; | 2096 | return 0; |
2096 | } | 2097 | } |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 3e0a0d315f72..15081257cfc8 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -828,6 +828,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
828 | if (status == CPL_ERR_RTX_NEG_ADVICE) | 828 | if (status == CPL_ERR_RTX_NEG_ADVICE) |
829 | goto rel_skb; | 829 | goto rel_skb; |
830 | 830 | ||
831 | module_put(THIS_MODULE); | ||
832 | |||
831 | if (status && status != CPL_ERR_TCAM_FULL && | 833 | if (status && status != CPL_ERR_TCAM_FULL && |
832 | status != CPL_ERR_CONN_EXIST && | 834 | status != CPL_ERR_CONN_EXIST && |
833 | status != CPL_ERR_ARP_MISS) | 835 | status != CPL_ERR_ARP_MISS) |
@@ -936,20 +938,23 @@ static void do_abort_req_rss(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
936 | cxgbi_sock_get(csk); | 938 | cxgbi_sock_get(csk); |
937 | spin_lock_bh(&csk->lock); | 939 | spin_lock_bh(&csk->lock); |
938 | 940 | ||
939 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) { | 941 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); |
940 | cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); | 942 | |
941 | cxgbi_sock_set_state(csk, CTP_ABORTING); | 943 | if (!cxgbi_sock_flag(csk, CTPF_TX_DATA_SENT)) { |
942 | goto done; | 944 | send_tx_flowc_wr(csk); |
945 | cxgbi_sock_set_flag(csk, CTPF_TX_DATA_SENT); | ||
943 | } | 946 | } |
944 | 947 | ||
945 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); | 948 | cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); |
949 | cxgbi_sock_set_state(csk, CTP_ABORTING); | ||
950 | |||
946 | send_abort_rpl(csk, rst_status); | 951 | send_abort_rpl(csk, rst_status); |
947 | 952 | ||
948 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { | 953 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { |
949 | csk->err = abort_status_to_errno(csk, req->status, &rst_status); | 954 | csk->err = abort_status_to_errno(csk, req->status, &rst_status); |
950 | cxgbi_sock_closed(csk); | 955 | cxgbi_sock_closed(csk); |
951 | } | 956 | } |
952 | done: | 957 | |
953 | spin_unlock_bh(&csk->lock); | 958 | spin_unlock_bh(&csk->lock); |
954 | cxgbi_sock_put(csk); | 959 | cxgbi_sock_put(csk); |
955 | rel_skb: | 960 | rel_skb: |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 674d498b46ab..7da59c38a69e 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -816,7 +816,7 @@ static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk) | |||
816 | read_lock_bh(&csk->callback_lock); | 816 | read_lock_bh(&csk->callback_lock); |
817 | if (csk->user_data) | 817 | if (csk->user_data) |
818 | iscsi_conn_failure(csk->user_data, | 818 | iscsi_conn_failure(csk->user_data, |
819 | ISCSI_ERR_CONN_FAILED); | 819 | ISCSI_ERR_TCP_CONN_CLOSE); |
820 | read_unlock_bh(&csk->callback_lock); | 820 | read_unlock_bh(&csk->callback_lock); |
821 | } | 821 | } |
822 | } | 822 | } |
@@ -905,18 +905,16 @@ void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk) | |||
905 | { | 905 | { |
906 | cxgbi_sock_get(csk); | 906 | cxgbi_sock_get(csk); |
907 | spin_lock_bh(&csk->lock); | 907 | spin_lock_bh(&csk->lock); |
908 | |||
909 | cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); | ||
908 | if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { | 910 | if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { |
909 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_RCVD)) | 911 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); |
910 | cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); | 912 | if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) |
911 | else { | 913 | pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", |
912 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_RCVD); | 914 | csk, csk->state, csk->flags, csk->tid); |
913 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); | 915 | cxgbi_sock_closed(csk); |
914 | if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) | ||
915 | pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", | ||
916 | csk, csk->state, csk->flags, csk->tid); | ||
917 | cxgbi_sock_closed(csk); | ||
918 | } | ||
919 | } | 916 | } |
917 | |||
920 | spin_unlock_bh(&csk->lock); | 918 | spin_unlock_bh(&csk->lock); |
921 | cxgbi_sock_put(csk); | 919 | cxgbi_sock_put(csk); |
922 | } | 920 | } |
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index e99507ed0e3c..fd78bdc53528 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c | |||
@@ -474,6 +474,13 @@ static int alua_check_sense(struct scsi_device *sdev, | |||
474 | * LUN Not Ready -- Offline | 474 | * LUN Not Ready -- Offline |
475 | */ | 475 | */ |
476 | return SUCCESS; | 476 | return SUCCESS; |
477 | if (sdev->allow_restart && | ||
478 | sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x02) | ||
479 | /* | ||
480 | * if the device is not started, we need to wake | ||
481 | * the error handler to start the motor | ||
482 | */ | ||
483 | return FAILED; | ||
477 | break; | 484 | break; |
478 | case UNIT_ATTENTION: | 485 | case UNIT_ATTENTION: |
479 | if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) | 486 | if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f6a69a3b1b3f..5640ad1c8214 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -4453,7 +4453,7 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
4453 | instance->msixentry[i].entry = i; | 4453 | instance->msixentry[i].entry = i; |
4454 | i = pci_enable_msix_range(instance->pdev, instance->msixentry, | 4454 | i = pci_enable_msix_range(instance->pdev, instance->msixentry, |
4455 | 1, instance->msix_vectors); | 4455 | 1, instance->msix_vectors); |
4456 | if (i) | 4456 | if (i > 0) |
4457 | instance->msix_vectors = i; | 4457 | instance->msix_vectors = i; |
4458 | else | 4458 | else |
4459 | instance->msix_vectors = 0; | 4459 | instance->msix_vectors = 0; |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 49014a143c6a..c1d04d4d3c6c 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -202,6 +202,7 @@ static struct { | |||
202 | {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, | 202 | {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, |
203 | {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, | 203 | {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, |
204 | {"INSITE", "I325VM", NULL, BLIST_KEY}, | 204 | {"INSITE", "I325VM", NULL, BLIST_KEY}, |
205 | {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, | ||
205 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, | 206 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, |
206 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, | 207 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, |
207 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 208 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 9a6f8468225f..bc5ff6ff9c79 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -459,14 +459,6 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
459 | if (! scsi_command_normalize_sense(scmd, &sshdr)) | 459 | if (! scsi_command_normalize_sense(scmd, &sshdr)) |
460 | return FAILED; /* no valid sense data */ | 460 | return FAILED; /* no valid sense data */ |
461 | 461 | ||
462 | if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) | ||
463 | /* | ||
464 | * nasty: for mid-layer issued TURs, we need to return the | ||
465 | * actual sense data without any recovery attempt. For eh | ||
466 | * issued ones, we need to try to recover and interpret | ||
467 | */ | ||
468 | return SUCCESS; | ||
469 | |||
470 | scsi_report_sense(sdev, &sshdr); | 462 | scsi_report_sense(sdev, &sshdr); |
471 | 463 | ||
472 | if (scsi_sense_is_deferred(&sshdr)) | 464 | if (scsi_sense_is_deferred(&sshdr)) |
@@ -482,6 +474,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
482 | /* handler does not care. Drop down to default handling */ | 474 | /* handler does not care. Drop down to default handling */ |
483 | } | 475 | } |
484 | 476 | ||
477 | if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) | ||
478 | /* | ||
479 | * nasty: for mid-layer issued TURs, we need to return the | ||
480 | * actual sense data without any recovery attempt. For eh | ||
481 | * issued ones, we need to try to recover and interpret | ||
482 | */ | ||
483 | return SUCCESS; | ||
484 | |||
485 | /* | 485 | /* |
486 | * Previous logic looked for FILEMARK, EOM or ILI which are | 486 | * Previous logic looked for FILEMARK, EOM or ILI which are |
487 | * mainly associated with tapes and returned SUCCESS. | 487 | * mainly associated with tapes and returned SUCCESS. |
@@ -2001,8 +2001,10 @@ static void scsi_restart_operations(struct Scsi_Host *shost) | |||
2001 | * is no point trying to lock the door of an off-line device. | 2001 | * is no point trying to lock the door of an off-line device. |
2002 | */ | 2002 | */ |
2003 | shost_for_each_device(sdev, shost) { | 2003 | shost_for_each_device(sdev, shost) { |
2004 | if (scsi_device_online(sdev) && sdev->locked) | 2004 | if (scsi_device_online(sdev) && sdev->was_reset && sdev->locked) { |
2005 | scsi_eh_lock_door(sdev); | 2005 | scsi_eh_lock_door(sdev); |
2006 | sdev->was_reset = 0; | ||
2007 | } | ||
2006 | } | 2008 | } |
2007 | 2009 | ||
2008 | /* | 2010 | /* |
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 8adf067ff019..1c3467b82566 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c | |||
@@ -102,7 +102,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
102 | clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), | 102 | clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), |
103 | GFP_KERNEL); | 103 | GFP_KERNEL); |
104 | if (!clkfreq) { | 104 | if (!clkfreq) { |
105 | dev_err(dev, "%s: no memory\n", "freq-table-hz"); | ||
106 | ret = -ENOMEM; | 105 | ret = -ENOMEM; |
107 | goto out; | 106 | goto out; |
108 | } | 107 | } |
@@ -112,19 +111,19 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
112 | if (ret && (ret != -EINVAL)) { | 111 | if (ret && (ret != -EINVAL)) { |
113 | dev_err(dev, "%s: error reading array %d\n", | 112 | dev_err(dev, "%s: error reading array %d\n", |
114 | "freq-table-hz", ret); | 113 | "freq-table-hz", ret); |
115 | goto free_clkfreq; | 114 | return ret; |
116 | } | 115 | } |
117 | 116 | ||
118 | for (i = 0; i < sz; i += 2) { | 117 | for (i = 0; i < sz; i += 2) { |
119 | ret = of_property_read_string_index(np, | 118 | ret = of_property_read_string_index(np, |
120 | "clock-names", i/2, (const char **)&name); | 119 | "clock-names", i/2, (const char **)&name); |
121 | if (ret) | 120 | if (ret) |
122 | goto free_clkfreq; | 121 | goto out; |
123 | 122 | ||
124 | clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); | 123 | clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); |
125 | if (!clki) { | 124 | if (!clki) { |
126 | ret = -ENOMEM; | 125 | ret = -ENOMEM; |
127 | goto free_clkfreq; | 126 | goto out; |
128 | } | 127 | } |
129 | 128 | ||
130 | clki->min_freq = clkfreq[i]; | 129 | clki->min_freq = clkfreq[i]; |
@@ -134,8 +133,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
134 | clki->min_freq, clki->max_freq, clki->name); | 133 | clki->min_freq, clki->max_freq, clki->name); |
135 | list_add_tail(&clki->list, &hba->clk_list_head); | 134 | list_add_tail(&clki->list, &hba->clk_list_head); |
136 | } | 135 | } |
137 | free_clkfreq: | ||
138 | kfree(clkfreq); | ||
139 | out: | 136 | out: |
140 | return ret; | 137 | return ret; |
141 | } | 138 | } |
@@ -162,10 +159,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, | |||
162 | } | 159 | } |
163 | 160 | ||
164 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); | 161 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); |
165 | if (!vreg) { | 162 | if (!vreg) |
166 | dev_err(dev, "No memory for %s regulator\n", name); | 163 | return -ENOMEM; |
167 | goto out; | ||
168 | } | ||
169 | 164 | ||
170 | vreg->name = kstrdup(name, GFP_KERNEL); | 165 | vreg->name = kstrdup(name, GFP_KERNEL); |
171 | 166 | ||
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 497c38a4a866..605ca60e8a10 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -744,6 +744,8 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) | |||
744 | if (!ufshcd_is_clkgating_allowed(hba)) | 744 | if (!ufshcd_is_clkgating_allowed(hba)) |
745 | return; | 745 | return; |
746 | device_remove_file(hba->dev, &hba->clk_gating.delay_attr); | 746 | device_remove_file(hba->dev, &hba->clk_gating.delay_attr); |
747 | cancel_work_sync(&hba->clk_gating.ungate_work); | ||
748 | cancel_delayed_work_sync(&hba->clk_gating.gate_work); | ||
747 | } | 749 | } |
748 | 750 | ||
749 | /* Must be called with host lock acquired */ | 751 | /* Must be called with host lock acquired */ |
@@ -2246,6 +2248,22 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) | |||
2246 | return ret; | 2248 | return ret; |
2247 | } | 2249 | } |
2248 | 2250 | ||
2251 | /** | ||
2252 | * ufshcd_init_pwr_info - setting the POR (power on reset) | ||
2253 | * values in hba power info | ||
2254 | * @hba: per-adapter instance | ||
2255 | */ | ||
2256 | static void ufshcd_init_pwr_info(struct ufs_hba *hba) | ||
2257 | { | ||
2258 | hba->pwr_info.gear_rx = UFS_PWM_G1; | ||
2259 | hba->pwr_info.gear_tx = UFS_PWM_G1; | ||
2260 | hba->pwr_info.lane_rx = 1; | ||
2261 | hba->pwr_info.lane_tx = 1; | ||
2262 | hba->pwr_info.pwr_rx = SLOWAUTO_MODE; | ||
2263 | hba->pwr_info.pwr_tx = SLOWAUTO_MODE; | ||
2264 | hba->pwr_info.hs_rate = 0; | ||
2265 | } | ||
2266 | |||
2249 | /** | 2267 | /** |
2250 | * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device | 2268 | * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device |
2251 | * @hba: per-adapter instance | 2269 | * @hba: per-adapter instance |
@@ -2844,8 +2862,13 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev) | |||
2844 | hba = shost_priv(sdev->host); | 2862 | hba = shost_priv(sdev->host); |
2845 | scsi_deactivate_tcq(sdev, hba->nutrs); | 2863 | scsi_deactivate_tcq(sdev, hba->nutrs); |
2846 | /* Drop the reference as it won't be needed anymore */ | 2864 | /* Drop the reference as it won't be needed anymore */ |
2847 | if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) | 2865 | if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) { |
2866 | unsigned long flags; | ||
2867 | |||
2868 | spin_lock_irqsave(hba->host->host_lock, flags); | ||
2848 | hba->sdev_ufs_device = NULL; | 2869 | hba->sdev_ufs_device = NULL; |
2870 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
2871 | } | ||
2849 | } | 2872 | } |
2850 | 2873 | ||
2851 | /** | 2874 | /** |
@@ -4062,6 +4085,8 @@ static void ufshcd_init_icc_levels(struct ufs_hba *hba) | |||
4062 | static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) | 4085 | static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) |
4063 | { | 4086 | { |
4064 | int ret = 0; | 4087 | int ret = 0; |
4088 | struct scsi_device *sdev_rpmb; | ||
4089 | struct scsi_device *sdev_boot; | ||
4065 | 4090 | ||
4066 | hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, | 4091 | hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, |
4067 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); | 4092 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); |
@@ -4070,26 +4095,27 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) | |||
4070 | hba->sdev_ufs_device = NULL; | 4095 | hba->sdev_ufs_device = NULL; |
4071 | goto out; | 4096 | goto out; |
4072 | } | 4097 | } |
4098 | scsi_device_put(hba->sdev_ufs_device); | ||
4073 | 4099 | ||
4074 | hba->sdev_boot = __scsi_add_device(hba->host, 0, 0, | 4100 | sdev_boot = __scsi_add_device(hba->host, 0, 0, |
4075 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); | 4101 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); |
4076 | if (IS_ERR(hba->sdev_boot)) { | 4102 | if (IS_ERR(sdev_boot)) { |
4077 | ret = PTR_ERR(hba->sdev_boot); | 4103 | ret = PTR_ERR(sdev_boot); |
4078 | hba->sdev_boot = NULL; | ||
4079 | goto remove_sdev_ufs_device; | 4104 | goto remove_sdev_ufs_device; |
4080 | } | 4105 | } |
4106 | scsi_device_put(sdev_boot); | ||
4081 | 4107 | ||
4082 | hba->sdev_rpmb = __scsi_add_device(hba->host, 0, 0, | 4108 | sdev_rpmb = __scsi_add_device(hba->host, 0, 0, |
4083 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); | 4109 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); |
4084 | if (IS_ERR(hba->sdev_rpmb)) { | 4110 | if (IS_ERR(sdev_rpmb)) { |
4085 | ret = PTR_ERR(hba->sdev_rpmb); | 4111 | ret = PTR_ERR(sdev_rpmb); |
4086 | hba->sdev_rpmb = NULL; | ||
4087 | goto remove_sdev_boot; | 4112 | goto remove_sdev_boot; |
4088 | } | 4113 | } |
4114 | scsi_device_put(sdev_rpmb); | ||
4089 | goto out; | 4115 | goto out; |
4090 | 4116 | ||
4091 | remove_sdev_boot: | 4117 | remove_sdev_boot: |
4092 | scsi_remove_device(hba->sdev_boot); | 4118 | scsi_remove_device(sdev_boot); |
4093 | remove_sdev_ufs_device: | 4119 | remove_sdev_ufs_device: |
4094 | scsi_remove_device(hba->sdev_ufs_device); | 4120 | scsi_remove_device(hba->sdev_ufs_device); |
4095 | out: | 4121 | out: |
@@ -4097,30 +4123,6 @@ out: | |||
4097 | } | 4123 | } |
4098 | 4124 | ||
4099 | /** | 4125 | /** |
4100 | * ufshcd_scsi_remove_wlus - Removes the W-LUs which were added by | ||
4101 | * ufshcd_scsi_add_wlus() | ||
4102 | * @hba: per-adapter instance | ||
4103 | * | ||
4104 | */ | ||
4105 | static void ufshcd_scsi_remove_wlus(struct ufs_hba *hba) | ||
4106 | { | ||
4107 | if (hba->sdev_ufs_device) { | ||
4108 | scsi_remove_device(hba->sdev_ufs_device); | ||
4109 | hba->sdev_ufs_device = NULL; | ||
4110 | } | ||
4111 | |||
4112 | if (hba->sdev_boot) { | ||
4113 | scsi_remove_device(hba->sdev_boot); | ||
4114 | hba->sdev_boot = NULL; | ||
4115 | } | ||
4116 | |||
4117 | if (hba->sdev_rpmb) { | ||
4118 | scsi_remove_device(hba->sdev_rpmb); | ||
4119 | hba->sdev_rpmb = NULL; | ||
4120 | } | ||
4121 | } | ||
4122 | |||
4123 | /** | ||
4124 | * ufshcd_probe_hba - probe hba to detect device and initialize | 4126 | * ufshcd_probe_hba - probe hba to detect device and initialize |
4125 | * @hba: per-adapter instance | 4127 | * @hba: per-adapter instance |
4126 | * | 4128 | * |
@@ -4134,6 +4136,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) | |||
4134 | if (ret) | 4136 | if (ret) |
4135 | goto out; | 4137 | goto out; |
4136 | 4138 | ||
4139 | ufshcd_init_pwr_info(hba); | ||
4140 | |||
4137 | /* UniPro link is active now */ | 4141 | /* UniPro link is active now */ |
4138 | ufshcd_set_link_active(hba); | 4142 | ufshcd_set_link_active(hba); |
4139 | 4143 | ||
@@ -4264,12 +4268,18 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, | |||
4264 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, | 4268 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, |
4265 | struct ufs_vreg *vreg) | 4269 | struct ufs_vreg *vreg) |
4266 | { | 4270 | { |
4271 | if (!vreg) | ||
4272 | return 0; | ||
4273 | |||
4267 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); | 4274 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); |
4268 | } | 4275 | } |
4269 | 4276 | ||
4270 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, | 4277 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, |
4271 | struct ufs_vreg *vreg) | 4278 | struct ufs_vreg *vreg) |
4272 | { | 4279 | { |
4280 | if (!vreg) | ||
4281 | return 0; | ||
4282 | |||
4273 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); | 4283 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); |
4274 | } | 4284 | } |
4275 | 4285 | ||
@@ -4471,7 +4481,7 @@ out: | |||
4471 | if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) | 4481 | if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) |
4472 | clk_disable_unprepare(clki->clk); | 4482 | clk_disable_unprepare(clki->clk); |
4473 | } | 4483 | } |
4474 | } else if (!ret && on) { | 4484 | } else if (on) { |
4475 | spin_lock_irqsave(hba->host->host_lock, flags); | 4485 | spin_lock_irqsave(hba->host->host_lock, flags); |
4476 | hba->clk_gating.state = CLKS_ON; | 4486 | hba->clk_gating.state = CLKS_ON; |
4477 | spin_unlock_irqrestore(hba->host->host_lock, flags); | 4487 | spin_unlock_irqrestore(hba->host->host_lock, flags); |
@@ -4675,11 +4685,25 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | |||
4675 | { | 4685 | { |
4676 | unsigned char cmd[6] = { START_STOP }; | 4686 | unsigned char cmd[6] = { START_STOP }; |
4677 | struct scsi_sense_hdr sshdr; | 4687 | struct scsi_sense_hdr sshdr; |
4678 | struct scsi_device *sdp = hba->sdev_ufs_device; | 4688 | struct scsi_device *sdp; |
4689 | unsigned long flags; | ||
4679 | int ret; | 4690 | int ret; |
4680 | 4691 | ||
4681 | if (!sdp || !scsi_device_online(sdp)) | 4692 | spin_lock_irqsave(hba->host->host_lock, flags); |
4682 | return -ENODEV; | 4693 | sdp = hba->sdev_ufs_device; |
4694 | if (sdp) { | ||
4695 | ret = scsi_device_get(sdp); | ||
4696 | if (!ret && !scsi_device_online(sdp)) { | ||
4697 | ret = -ENODEV; | ||
4698 | scsi_device_put(sdp); | ||
4699 | } | ||
4700 | } else { | ||
4701 | ret = -ENODEV; | ||
4702 | } | ||
4703 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
4704 | |||
4705 | if (ret) | ||
4706 | return ret; | ||
4683 | 4707 | ||
4684 | /* | 4708 | /* |
4685 | * If scsi commands fail, the scsi mid-layer schedules scsi error- | 4709 | * If scsi commands fail, the scsi mid-layer schedules scsi error- |
@@ -4718,6 +4742,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | |||
4718 | if (!ret) | 4742 | if (!ret) |
4719 | hba->curr_dev_pwr_mode = pwr_mode; | 4743 | hba->curr_dev_pwr_mode = pwr_mode; |
4720 | out: | 4744 | out: |
4745 | scsi_device_put(sdp); | ||
4721 | hba->host->eh_noresume = 0; | 4746 | hba->host->eh_noresume = 0; |
4722 | return ret; | 4747 | return ret; |
4723 | } | 4748 | } |
@@ -5087,7 +5112,7 @@ int ufshcd_system_suspend(struct ufs_hba *hba) | |||
5087 | int ret = 0; | 5112 | int ret = 0; |
5088 | 5113 | ||
5089 | if (!hba || !hba->is_powered) | 5114 | if (!hba || !hba->is_powered) |
5090 | goto out; | 5115 | return 0; |
5091 | 5116 | ||
5092 | if (pm_runtime_suspended(hba->dev)) { | 5117 | if (pm_runtime_suspended(hba->dev)) { |
5093 | if (hba->rpm_lvl == hba->spm_lvl) | 5118 | if (hba->rpm_lvl == hba->spm_lvl) |
@@ -5231,7 +5256,6 @@ EXPORT_SYMBOL(ufshcd_shutdown); | |||
5231 | void ufshcd_remove(struct ufs_hba *hba) | 5256 | void ufshcd_remove(struct ufs_hba *hba) |
5232 | { | 5257 | { |
5233 | scsi_remove_host(hba->host); | 5258 | scsi_remove_host(hba->host); |
5234 | ufshcd_scsi_remove_wlus(hba); | ||
5235 | /* disable interrupts */ | 5259 | /* disable interrupts */ |
5236 | ufshcd_disable_intr(hba, hba->intr_mask); | 5260 | ufshcd_disable_intr(hba, hba->intr_mask); |
5237 | ufshcd_hba_stop(hba); | 5261 | ufshcd_hba_stop(hba); |
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 58ecdff5065c..4a574aa45855 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
@@ -392,8 +392,6 @@ struct ufs_hba { | |||
392 | * "UFS device" W-LU. | 392 | * "UFS device" W-LU. |
393 | */ | 393 | */ |
394 | struct scsi_device *sdev_ufs_device; | 394 | struct scsi_device *sdev_ufs_device; |
395 | struct scsi_device *sdev_rpmb; | ||
396 | struct scsi_device *sdev_boot; | ||
397 | 395 | ||
398 | enum ufs_dev_pwr_mode curr_dev_pwr_mode; | 396 | enum ufs_dev_pwr_mode curr_dev_pwr_mode; |
399 | enum uic_link_state uic_link_state; | 397 | enum uic_link_state uic_link_state; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 72e12bad14b9..d0d5542efc06 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -376,9 +376,6 @@ static void pump_transfers(unsigned long data) | |||
376 | chip = dws->cur_chip; | 376 | chip = dws->cur_chip; |
377 | spi = message->spi; | 377 | spi = message->spi; |
378 | 378 | ||
379 | if (unlikely(!chip->clk_div)) | ||
380 | chip->clk_div = dws->max_freq / chip->speed_hz; | ||
381 | |||
382 | if (message->state == ERROR_STATE) { | 379 | if (message->state == ERROR_STATE) { |
383 | message->status = -EIO; | 380 | message->status = -EIO; |
384 | goto early_exit; | 381 | goto early_exit; |
@@ -419,7 +416,7 @@ static void pump_transfers(unsigned long data) | |||
419 | if (transfer->speed_hz) { | 416 | if (transfer->speed_hz) { |
420 | speed = chip->speed_hz; | 417 | speed = chip->speed_hz; |
421 | 418 | ||
422 | if (transfer->speed_hz != speed) { | 419 | if ((transfer->speed_hz != speed) || (!chip->clk_div)) { |
423 | speed = transfer->speed_hz; | 420 | speed = transfer->speed_hz; |
424 | 421 | ||
425 | /* clk_div doesn't support odd number */ | 422 | /* clk_div doesn't support odd number */ |
@@ -581,7 +578,6 @@ static int dw_spi_setup(struct spi_device *spi) | |||
581 | dev_err(&spi->dev, "No max speed HZ parameter\n"); | 578 | dev_err(&spi->dev, "No max speed HZ parameter\n"); |
582 | return -EINVAL; | 579 | return -EINVAL; |
583 | } | 580 | } |
584 | chip->speed_hz = spi->max_speed_hz; | ||
585 | 581 | ||
586 | chip->tmode = 0; /* Tx & Rx */ | 582 | chip->tmode = 0; /* Tx & Rx */ |
587 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ | 583 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 39e2c0a55a28..f63de781c729 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -562,9 +562,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
562 | 562 | ||
563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); | 563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); |
564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | | 564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
565 | sspi->word_width; | 565 | (sspi->word_width >> 1); |
566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | | 566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
567 | sspi->word_width; | 567 | (sspi->word_width >> 1); |
568 | 568 | ||
569 | if (!(spi->mode & SPI_CS_HIGH)) | 569 | if (!(spi->mode & SPI_CS_HIGH)) |
570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; | 570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ebcb33df2eb2..50f20f243981 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -615,13 +615,13 @@ static int spi_map_buf(struct spi_master *master, struct device *dev, | |||
615 | sg_free_table(sgt); | 615 | sg_free_table(sgt); |
616 | return -ENOMEM; | 616 | return -ENOMEM; |
617 | } | 617 | } |
618 | sg_buf = page_address(vm_page) + | 618 | sg_set_page(&sgt->sgl[i], vm_page, |
619 | ((size_t)buf & ~PAGE_MASK); | 619 | min, offset_in_page(buf)); |
620 | } else { | 620 | } else { |
621 | sg_buf = buf; | 621 | sg_buf = buf; |
622 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
622 | } | 623 | } |
623 | 624 | ||
624 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
625 | 625 | ||
626 | buf += min; | 626 | buf += min; |
627 | len -= min; | 627 | len -= min; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9935e66935af..eddef9cd2e16 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c | |||
@@ -275,11 +275,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, | |||
275 | if (check_fwstate(pmlmepriv, _FW_LINKED) == true) | 275 | if (check_fwstate(pmlmepriv, _FW_LINKED) == true) |
276 | rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); | 276 | rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); |
277 | 277 | ||
278 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 278 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
279 | if (ph2c == NULL) | 279 | if (ph2c == NULL) |
280 | return _FAIL; | 280 | return _FAIL; |
281 | 281 | ||
282 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); | 282 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); |
283 | if (psurveyPara == NULL) { | 283 | if (psurveyPara == NULL) { |
284 | kfree(ph2c); | 284 | kfree(ph2c); |
285 | return _FAIL; | 285 | return _FAIL; |
@@ -405,7 +405,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) | |||
405 | else | 405 | else |
406 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); | 406 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); |
407 | 407 | ||
408 | pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 408 | pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
409 | if (pcmd == NULL) { | 409 | if (pcmd == NULL) { |
410 | res = _FAIL; | 410 | res = _FAIL; |
411 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); | 411 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); |
@@ -755,13 +755,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) | |||
755 | u8 res = _SUCCESS; | 755 | u8 res = _SUCCESS; |
756 | 756 | ||
757 | 757 | ||
758 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 758 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
759 | if (ph2c == NULL) { | 759 | if (ph2c == NULL) { |
760 | res = _FAIL; | 760 | res = _FAIL; |
761 | goto exit; | 761 | goto exit; |
762 | } | 762 | } |
763 | 763 | ||
764 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 764 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
765 | if (pdrvextra_cmd_parm == NULL) { | 765 | if (pdrvextra_cmd_parm == NULL) { |
766 | kfree(ph2c); | 766 | kfree(ph2c); |
767 | res = _FAIL; | 767 | res = _FAIL; |
@@ -967,13 +967,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) | |||
967 | u8 res = _SUCCESS; | 967 | u8 res = _SUCCESS; |
968 | 968 | ||
969 | if (enqueue) { | 969 | if (enqueue) { |
970 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 970 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
971 | if (ph2c == NULL) { | 971 | if (ph2c == NULL) { |
972 | res = _FAIL; | 972 | res = _FAIL; |
973 | goto exit; | 973 | goto exit; |
974 | } | 974 | } |
975 | 975 | ||
976 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 976 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
977 | if (pdrvextra_cmd_parm == NULL) { | 977 | if (pdrvextra_cmd_parm == NULL) { |
978 | kfree(ph2c); | 978 | kfree(ph2c); |
979 | res = _FAIL; | 979 | res = _FAIL; |
@@ -1010,13 +1010,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) | |||
1010 | 1010 | ||
1011 | u8 res = _SUCCESS; | 1011 | u8 res = _SUCCESS; |
1012 | 1012 | ||
1013 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 1013 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
1014 | if (ph2c == NULL) { | 1014 | if (ph2c == NULL) { |
1015 | res = _FAIL; | 1015 | res = _FAIL; |
1016 | goto exit; | 1016 | goto exit; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 1019 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
1020 | if (pdrvextra_cmd_parm == NULL) { | 1020 | if (pdrvextra_cmd_parm == NULL) { |
1021 | kfree(ph2c); | 1021 | kfree(ph2c); |
1022 | res = _FAIL; | 1022 | res = _FAIL; |
@@ -1088,13 +1088,13 @@ u8 rtw_ps_cmd(struct adapter *padapter) | |||
1088 | 1088 | ||
1089 | u8 res = _SUCCESS; | 1089 | u8 res = _SUCCESS; |
1090 | 1090 | ||
1091 | ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 1091 | ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
1092 | if (ppscmd == NULL) { | 1092 | if (ppscmd == NULL) { |
1093 | res = _FAIL; | 1093 | res = _FAIL; |
1094 | goto exit; | 1094 | goto exit; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 1097 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
1098 | if (pdrvextra_cmd_parm == NULL) { | 1098 | if (pdrvextra_cmd_parm == NULL) { |
1099 | kfree(ppscmd); | 1099 | kfree(ppscmd); |
1100 | res = _FAIL; | 1100 | res = _FAIL; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 5ba5099ec20d..70b1bc3e0e63 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | |||
@@ -4241,12 +4241,12 @@ void report_survey_event(struct adapter *padapter, | |||
4241 | pcmdpriv = &padapter->cmdpriv; | 4241 | pcmdpriv = &padapter->cmdpriv; |
4242 | 4242 | ||
4243 | 4243 | ||
4244 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4244 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4245 | if (pcmd_obj == NULL) | 4245 | if (pcmd_obj == NULL) |
4246 | return; | 4246 | return; |
4247 | 4247 | ||
4248 | cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); | 4248 | cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); |
4249 | pevtcmd = kzalloc(cmdsz, GFP_KERNEL); | 4249 | pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); |
4250 | if (pevtcmd == NULL) { | 4250 | if (pevtcmd == NULL) { |
4251 | kfree(pcmd_obj); | 4251 | kfree(pcmd_obj); |
4252 | return; | 4252 | return; |
@@ -4339,12 +4339,12 @@ void report_join_res(struct adapter *padapter, int res) | |||
4339 | struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); | 4339 | struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); |
4340 | struct cmd_priv *pcmdpriv = &padapter->cmdpriv; | 4340 | struct cmd_priv *pcmdpriv = &padapter->cmdpriv; |
4341 | 4341 | ||
4342 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4342 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4343 | if (pcmd_obj == NULL) | 4343 | if (pcmd_obj == NULL) |
4344 | return; | 4344 | return; |
4345 | 4345 | ||
4346 | cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); | 4346 | cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); |
4347 | pevtcmd = kzalloc(cmdsz, GFP_KERNEL); | 4347 | pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); |
4348 | if (pevtcmd == NULL) { | 4348 | if (pevtcmd == NULL) { |
4349 | kfree(pcmd_obj); | 4349 | kfree(pcmd_obj); |
4350 | return; | 4350 | return; |
@@ -4854,11 +4854,11 @@ void survey_timer_hdl(void *function_context) | |||
4854 | pmlmeext->scan_abort = false;/* reset */ | 4854 | pmlmeext->scan_abort = false;/* reset */ |
4855 | } | 4855 | } |
4856 | 4856 | ||
4857 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4857 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4858 | if (ph2c == NULL) | 4858 | if (ph2c == NULL) |
4859 | goto exit_survey_timer_hdl; | 4859 | goto exit_survey_timer_hdl; |
4860 | 4860 | ||
4861 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); | 4861 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); |
4862 | if (psurveyPara == NULL) { | 4862 | if (psurveyPara == NULL) { |
4863 | kfree(ph2c); | 4863 | kfree(ph2c); |
4864 | goto exit_survey_timer_hdl; | 4864 | goto exit_survey_timer_hdl; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 33ccbbbd8ed6..d300369977fa 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c | |||
@@ -935,7 +935,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) | |||
935 | return true; | 935 | return true; |
936 | } | 936 | } |
937 | 937 | ||
938 | bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL); | 938 | bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); |
939 | 939 | ||
940 | subtype = GetFrameSubType(pframe) >> 4; | 940 | subtype = GetFrameSubType(pframe) >> 4; |
941 | 941 | ||
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 407a318b09db..2f87150a21b7 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -47,6 +47,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | 49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
50 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ | ||
50 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ | 51 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
51 | {} /* Terminating entry */ | 52 | {} /* Terminating entry */ |
52 | }; | 53 | }; |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index b19e4329ba00..73e58d22e325 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3491,7 +3491,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, | |||
3491 | len = sprintf(buf, "TargetAddress=" | 3491 | len = sprintf(buf, "TargetAddress=" |
3492 | "%s:%hu,%hu", | 3492 | "%s:%hu,%hu", |
3493 | inaddr_any ? conn->local_ip : np->np_ip, | 3493 | inaddr_any ? conn->local_ip : np->np_ip, |
3494 | inaddr_any ? conn->local_port : np->np_port, | 3494 | np->np_port, |
3495 | tpg->tpgt); | 3495 | tpg->tpgt); |
3496 | len += 1; | 3496 | len += 1; |
3497 | 3497 | ||
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 8c60a1a1ae8d..9f93b8234095 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -2738,7 +2738,8 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2738 | struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; | 2738 | struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; |
2739 | struct t10_reservation *pr_tmpl = &dev->t10_pr; | 2739 | struct t10_reservation *pr_tmpl = &dev->t10_pr; |
2740 | u32 pr_res_mapped_lun = 0; | 2740 | u32 pr_res_mapped_lun = 0; |
2741 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; | 2741 | int all_reg = 0, calling_it_nexus = 0; |
2742 | bool sa_res_key_unmatched = sa_res_key != 0; | ||
2742 | int prh_type = 0, prh_scope = 0; | 2743 | int prh_type = 0, prh_scope = 0; |
2743 | 2744 | ||
2744 | if (!se_sess) | 2745 | if (!se_sess) |
@@ -2813,6 +2814,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2813 | if (!all_reg) { | 2814 | if (!all_reg) { |
2814 | if (pr_reg->pr_res_key != sa_res_key) | 2815 | if (pr_reg->pr_res_key != sa_res_key) |
2815 | continue; | 2816 | continue; |
2817 | sa_res_key_unmatched = false; | ||
2816 | 2818 | ||
2817 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; | 2819 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; |
2818 | pr_reg_nacl = pr_reg->pr_reg_nacl; | 2820 | pr_reg_nacl = pr_reg->pr_reg_nacl; |
@@ -2820,7 +2822,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2820 | __core_scsi3_free_registration(dev, pr_reg, | 2822 | __core_scsi3_free_registration(dev, pr_reg, |
2821 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : | 2823 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : |
2822 | NULL, calling_it_nexus); | 2824 | NULL, calling_it_nexus); |
2823 | released_regs++; | ||
2824 | } else { | 2825 | } else { |
2825 | /* | 2826 | /* |
2826 | * Case for any existing all registrants type | 2827 | * Case for any existing all registrants type |
@@ -2838,6 +2839,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2838 | if ((sa_res_key) && | 2839 | if ((sa_res_key) && |
2839 | (pr_reg->pr_res_key != sa_res_key)) | 2840 | (pr_reg->pr_res_key != sa_res_key)) |
2840 | continue; | 2841 | continue; |
2842 | sa_res_key_unmatched = false; | ||
2841 | 2843 | ||
2842 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; | 2844 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; |
2843 | if (calling_it_nexus) | 2845 | if (calling_it_nexus) |
@@ -2848,7 +2850,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2848 | __core_scsi3_free_registration(dev, pr_reg, | 2850 | __core_scsi3_free_registration(dev, pr_reg, |
2849 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : | 2851 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : |
2850 | NULL, 0); | 2852 | NULL, 0); |
2851 | released_regs++; | ||
2852 | } | 2853 | } |
2853 | if (!calling_it_nexus) | 2854 | if (!calling_it_nexus) |
2854 | core_scsi3_ua_allocate(pr_reg_nacl, | 2855 | core_scsi3_ua_allocate(pr_reg_nacl, |
@@ -2863,7 +2864,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2863 | * registered reservation key, then the device server shall | 2864 | * registered reservation key, then the device server shall |
2864 | * complete the command with RESERVATION CONFLICT status. | 2865 | * complete the command with RESERVATION CONFLICT status. |
2865 | */ | 2866 | */ |
2866 | if (!released_regs) { | 2867 | if (sa_res_key_unmatched) { |
2867 | spin_unlock(&dev->dev_reservation_lock); | 2868 | spin_unlock(&dev->dev_reservation_lock); |
2868 | core_scsi3_put_pr_reg(pr_reg_n); | 2869 | core_scsi3_put_pr_reg(pr_reg_n); |
2869 | return TCM_RESERVATION_CONFLICT; | 2870 | return TCM_RESERVATION_CONFLICT; |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 9ea0d5f03f7a..be877bf6f730 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2292,7 +2292,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2292 | * and let it call back once the write buffers are ready. | 2292 | * and let it call back once the write buffers are ready. |
2293 | */ | 2293 | */ |
2294 | target_add_to_state_list(cmd); | 2294 | target_add_to_state_list(cmd); |
2295 | if (cmd->data_direction != DMA_TO_DEVICE) { | 2295 | if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) { |
2296 | target_execute_cmd(cmd); | 2296 | target_execute_cmd(cmd); |
2297 | return 0; | 2297 | return 0; |
2298 | } | 2298 | } |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 1ab0018271c5..ad09e51ffae4 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -50,15 +50,14 @@ struct cpufreq_cooling_device { | |||
50 | unsigned int cpufreq_state; | 50 | unsigned int cpufreq_state; |
51 | unsigned int cpufreq_val; | 51 | unsigned int cpufreq_val; |
52 | struct cpumask allowed_cpus; | 52 | struct cpumask allowed_cpus; |
53 | struct list_head node; | ||
53 | }; | 54 | }; |
54 | static DEFINE_IDR(cpufreq_idr); | 55 | static DEFINE_IDR(cpufreq_idr); |
55 | static DEFINE_MUTEX(cooling_cpufreq_lock); | 56 | static DEFINE_MUTEX(cooling_cpufreq_lock); |
56 | 57 | ||
57 | static unsigned int cpufreq_dev_count; | 58 | static unsigned int cpufreq_dev_count; |
58 | 59 | ||
59 | /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ | 60 | static LIST_HEAD(cpufreq_dev_list); |
60 | #define NOTIFY_INVALID NULL | ||
61 | static struct cpufreq_cooling_device *notify_device; | ||
62 | 61 | ||
63 | /** | 62 | /** |
64 | * get_idr - function to get a unique id. | 63 | * get_idr - function to get a unique id. |
@@ -287,15 +286,12 @@ static int cpufreq_apply_cooling(struct cpufreq_cooling_device *cpufreq_device, | |||
287 | 286 | ||
288 | cpufreq_device->cpufreq_state = cooling_state; | 287 | cpufreq_device->cpufreq_state = cooling_state; |
289 | cpufreq_device->cpufreq_val = clip_freq; | 288 | cpufreq_device->cpufreq_val = clip_freq; |
290 | notify_device = cpufreq_device; | ||
291 | 289 | ||
292 | for_each_cpu(cpuid, mask) { | 290 | for_each_cpu(cpuid, mask) { |
293 | if (is_cpufreq_valid(cpuid)) | 291 | if (is_cpufreq_valid(cpuid)) |
294 | cpufreq_update_policy(cpuid); | 292 | cpufreq_update_policy(cpuid); |
295 | } | 293 | } |
296 | 294 | ||
297 | notify_device = NOTIFY_INVALID; | ||
298 | |||
299 | return 0; | 295 | return 0; |
300 | } | 296 | } |
301 | 297 | ||
@@ -316,21 +312,28 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, | |||
316 | { | 312 | { |
317 | struct cpufreq_policy *policy = data; | 313 | struct cpufreq_policy *policy = data; |
318 | unsigned long max_freq = 0; | 314 | unsigned long max_freq = 0; |
315 | struct cpufreq_cooling_device *cpufreq_dev; | ||
319 | 316 | ||
320 | if (event != CPUFREQ_ADJUST || notify_device == NOTIFY_INVALID) | 317 | if (event != CPUFREQ_ADJUST) |
321 | return 0; | 318 | return 0; |
322 | 319 | ||
323 | if (cpumask_test_cpu(policy->cpu, ¬ify_device->allowed_cpus)) | 320 | mutex_lock(&cooling_cpufreq_lock); |
324 | max_freq = notify_device->cpufreq_val; | 321 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { |
325 | else | 322 | if (!cpumask_test_cpu(policy->cpu, |
326 | return 0; | 323 | &cpufreq_dev->allowed_cpus)) |
324 | continue; | ||
325 | |||
326 | if (!cpufreq_dev->cpufreq_val) | ||
327 | cpufreq_dev->cpufreq_val = get_cpu_frequency( | ||
328 | cpumask_any(&cpufreq_dev->allowed_cpus), | ||
329 | cpufreq_dev->cpufreq_state); | ||
327 | 330 | ||
328 | /* Never exceed user_policy.max */ | 331 | max_freq = cpufreq_dev->cpufreq_val; |
329 | if (max_freq > policy->user_policy.max) | ||
330 | max_freq = policy->user_policy.max; | ||
331 | 332 | ||
332 | if (policy->max != max_freq) | 333 | if (policy->max != max_freq) |
333 | cpufreq_verify_within_limits(policy, 0, max_freq); | 334 | cpufreq_verify_within_limits(policy, 0, max_freq); |
335 | } | ||
336 | mutex_unlock(&cooling_cpufreq_lock); | ||
334 | 337 | ||
335 | return 0; | 338 | return 0; |
336 | } | 339 | } |
@@ -486,6 +489,7 @@ __cpufreq_cooling_register(struct device_node *np, | |||
486 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, | 489 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, |
487 | CPUFREQ_POLICY_NOTIFIER); | 490 | CPUFREQ_POLICY_NOTIFIER); |
488 | cpufreq_dev_count++; | 491 | cpufreq_dev_count++; |
492 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); | ||
489 | 493 | ||
490 | mutex_unlock(&cooling_cpufreq_lock); | 494 | mutex_unlock(&cooling_cpufreq_lock); |
491 | 495 | ||
@@ -549,6 +553,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) | |||
549 | 553 | ||
550 | cpufreq_dev = cdev->devdata; | 554 | cpufreq_dev = cdev->devdata; |
551 | mutex_lock(&cooling_cpufreq_lock); | 555 | mutex_lock(&cooling_cpufreq_lock); |
556 | list_del(&cpufreq_dev->node); | ||
552 | cpufreq_dev_count--; | 557 | cpufreq_dev_count--; |
553 | 558 | ||
554 | /* Unregister the notifier for the last cpufreq cooling device */ | 559 | /* Unregister the notifier for the last cpufreq cooling device */ |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 461bf3d033a0..5a1f1070b702 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -459,6 +459,10 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
459 | int measure_freq; | 459 | int measure_freq; |
460 | int ret; | 460 | int ret; |
461 | 461 | ||
462 | if (!cpufreq_get_current_driver()) { | ||
463 | dev_dbg(&pdev->dev, "no cpufreq driver!"); | ||
464 | return -EPROBE_DEFER; | ||
465 | } | ||
462 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | 466 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
463 | if (!data) | 467 | if (!data) |
464 | return -ENOMEM; | 468 | return -ENOMEM; |
@@ -521,6 +525,30 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
521 | return ret; | 525 | return ret; |
522 | } | 526 | } |
523 | 527 | ||
528 | data->thermal_clk = devm_clk_get(&pdev->dev, NULL); | ||
529 | if (IS_ERR(data->thermal_clk)) { | ||
530 | ret = PTR_ERR(data->thermal_clk); | ||
531 | if (ret != -EPROBE_DEFER) | ||
532 | dev_err(&pdev->dev, | ||
533 | "failed to get thermal clk: %d\n", ret); | ||
534 | cpufreq_cooling_unregister(data->cdev); | ||
535 | return ret; | ||
536 | } | ||
537 | |||
538 | /* | ||
539 | * Thermal sensor needs clk on to get correct value, normally | ||
540 | * we should enable its clk before taking measurement and disable | ||
541 | * clk after measurement is done, but if alarm function is enabled, | ||
542 | * hardware will auto measure the temperature periodically, so we | ||
543 | * need to keep the clk always on for alarm function. | ||
544 | */ | ||
545 | ret = clk_prepare_enable(data->thermal_clk); | ||
546 | if (ret) { | ||
547 | dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret); | ||
548 | cpufreq_cooling_unregister(data->cdev); | ||
549 | return ret; | ||
550 | } | ||
551 | |||
524 | data->tz = thermal_zone_device_register("imx_thermal_zone", | 552 | data->tz = thermal_zone_device_register("imx_thermal_zone", |
525 | IMX_TRIP_NUM, | 553 | IMX_TRIP_NUM, |
526 | BIT(IMX_TRIP_PASSIVE), data, | 554 | BIT(IMX_TRIP_PASSIVE), data, |
@@ -531,26 +559,11 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
531 | ret = PTR_ERR(data->tz); | 559 | ret = PTR_ERR(data->tz); |
532 | dev_err(&pdev->dev, | 560 | dev_err(&pdev->dev, |
533 | "failed to register thermal zone device %d\n", ret); | 561 | "failed to register thermal zone device %d\n", ret); |
562 | clk_disable_unprepare(data->thermal_clk); | ||
534 | cpufreq_cooling_unregister(data->cdev); | 563 | cpufreq_cooling_unregister(data->cdev); |
535 | return ret; | 564 | return ret; |
536 | } | 565 | } |
537 | 566 | ||
538 | data->thermal_clk = devm_clk_get(&pdev->dev, NULL); | ||
539 | if (IS_ERR(data->thermal_clk)) { | ||
540 | dev_warn(&pdev->dev, "failed to get thermal clk!\n"); | ||
541 | } else { | ||
542 | /* | ||
543 | * Thermal sensor needs clk on to get correct value, normally | ||
544 | * we should enable its clk before taking measurement and disable | ||
545 | * clk after measurement is done, but if alarm function is enabled, | ||
546 | * hardware will auto measure the temperature periodically, so we | ||
547 | * need to keep the clk always on for alarm function. | ||
548 | */ | ||
549 | ret = clk_prepare_enable(data->thermal_clk); | ||
550 | if (ret) | ||
551 | dev_warn(&pdev->dev, "failed to enable thermal clk: %d\n", ret); | ||
552 | } | ||
553 | |||
554 | /* Enable measurements at ~ 10 Hz */ | 567 | /* Enable measurements at ~ 10 Hz */ |
555 | regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ); | 568 | regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ); |
556 | measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */ | 569 | measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */ |
diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c index d20dba986f0f..6e9fb62eb817 100644 --- a/drivers/thermal/int340x_thermal/int3403_thermal.c +++ b/drivers/thermal/int340x_thermal/int3403_thermal.c | |||
@@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone, | |||
92 | if (ACPI_FAILURE(status)) | 92 | if (ACPI_FAILURE(status)) |
93 | return -EIO; | 93 | return -EIO; |
94 | 94 | ||
95 | *temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET); | 95 | /* |
96 | * Thermal hysteresis represents a temperature difference. | ||
97 | * Kelvin and Celsius have same degree size. So the | ||
98 | * conversion here between tenths of degree Kelvin unit | ||
99 | * and Milli-Celsius unit is just to multiply 100. | ||
100 | */ | ||
101 | *temp = hyst * 100; | ||
96 | 102 | ||
97 | return 0; | 103 | return 0; |
98 | } | 104 | } |
diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c index 3f5ad25ddca8..b6be572704a4 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.c +++ b/drivers/thermal/samsung/exynos_thermal_common.c | |||
@@ -417,13 +417,10 @@ void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) | |||
417 | 417 | ||
418 | th_zone = sensor_conf->pzone_data; | 418 | th_zone = sensor_conf->pzone_data; |
419 | 419 | ||
420 | if (th_zone->therm_dev) | 420 | thermal_zone_device_unregister(th_zone->therm_dev); |
421 | thermal_zone_device_unregister(th_zone->therm_dev); | ||
422 | 421 | ||
423 | for (i = 0; i < th_zone->cool_dev_size; i++) { | 422 | for (i = 0; i < th_zone->cool_dev_size; ++i) |
424 | if (th_zone->cool_dev[i]) | 423 | cpufreq_cooling_unregister(th_zone->cool_dev[i]); |
425 | cpufreq_cooling_unregister(th_zone->cool_dev[i]); | ||
426 | } | ||
427 | 424 | ||
428 | dev_info(sensor_conf->dev, | 425 | dev_info(sensor_conf->dev, |
429 | "Exynos: Kernel Thermal management unregistered\n"); | 426 | "Exynos: Kernel Thermal management unregistered\n"); |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 2683d2897e90..1724f6cdaef8 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c | |||
@@ -264,7 +264,6 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = { | |||
264 | static const struct exynos_tmu_registers exynos5260_tmu_registers = { | 264 | static const struct exynos_tmu_registers exynos5260_tmu_registers = { |
265 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 265 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
266 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 266 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
267 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1, | ||
268 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 267 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
269 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | 268 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, |
270 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | 269 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index 65e2ea6a9579..63de598c9c2c 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h | |||
@@ -75,7 +75,6 @@ | |||
75 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 | 75 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 |
76 | 76 | ||
77 | /* Exynos5260 specific */ | 77 | /* Exynos5260 specific */ |
78 | #define EXYNOS_TMU_REG_CONTROL1 0x24 | ||
79 | #define EXYNOS5260_TMU_REG_INTEN 0xC0 | 78 | #define EXYNOS5260_TMU_REG_INTEN 0xC0 |
80 | #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 | 79 | #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 |
81 | #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 | 80 | #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 |
diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 90163b384660..d1ec5804c0bb 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c | |||
@@ -275,6 +275,7 @@ int st_thermal_unregister(struct platform_device *pdev) | |||
275 | } | 275 | } |
276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); | 276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); |
277 | 277 | ||
278 | #ifdef CONFIG_PM_SLEEP | ||
278 | static int st_thermal_suspend(struct device *dev) | 279 | static int st_thermal_suspend(struct device *dev) |
279 | { | 280 | { |
280 | struct platform_device *pdev = to_platform_device(dev); | 281 | struct platform_device *pdev = to_platform_device(dev); |
@@ -305,6 +306,8 @@ static int st_thermal_resume(struct device *dev) | |||
305 | 306 | ||
306 | return 0; | 307 | return 0; |
307 | } | 308 | } |
309 | #endif | ||
310 | |||
308 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); | 311 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); |
309 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); | 312 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); |
310 | 313 | ||
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 56982da4a9e9..bf355050eab6 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -240,32 +240,6 @@ static int of_platform_serial_remove(struct platform_device *ofdev) | |||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | #ifdef CONFIG_PM_SLEEP | ||
244 | static int of_serial_suspend(struct device *dev) | ||
245 | { | ||
246 | struct of_serial_info *info = dev_get_drvdata(dev); | ||
247 | |||
248 | serial8250_suspend_port(info->line); | ||
249 | if (info->clk) | ||
250 | clk_disable_unprepare(info->clk); | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int of_serial_resume(struct device *dev) | ||
256 | { | ||
257 | struct of_serial_info *info = dev_get_drvdata(dev); | ||
258 | |||
259 | if (info->clk) | ||
260 | clk_prepare_enable(info->clk); | ||
261 | |||
262 | serial8250_resume_port(info->line); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | #endif | ||
267 | static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume); | ||
268 | |||
269 | /* | 243 | /* |
270 | * A few common types, add more as needed. | 244 | * A few common types, add more as needed. |
271 | */ | 245 | */ |
@@ -297,7 +271,6 @@ static struct platform_driver of_platform_serial_driver = { | |||
297 | .name = "of_serial", | 271 | .name = "of_serial", |
298 | .owner = THIS_MODULE, | 272 | .owner = THIS_MODULE, |
299 | .of_match_table = of_platform_serial_table, | 273 | .of_match_table = of_platform_serial_table, |
300 | .pm = &of_serial_pm_ops, | ||
301 | }, | 274 | }, |
302 | .probe = of_platform_serial_probe, | 275 | .probe = of_platform_serial_probe, |
303 | .remove = of_platform_serial_remove, | 276 | .remove = of_platform_serial_remove, |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 39b4081b632d..96fafed92b76 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
44 | /* Creative SB Audigy 2 NX */ | 44 | /* Creative SB Audigy 2 NX */ |
45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, | 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
46 | 46 | ||
47 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ | ||
48 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
49 | |||
47 | /* Microsoft LifeCam-VX700 v2.0 */ | 50 | /* Microsoft LifeCam-VX700 v2.0 */ |
48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 52 | ||
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 711b23019d54..df38e7ef4976 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -791,6 +791,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
791 | 791 | ||
792 | trb = dwc->ep0_trb; | 792 | trb = dwc->ep0_trb; |
793 | 793 | ||
794 | r = next_request(&ep0->request_list); | ||
795 | if (!r) | ||
796 | return; | ||
797 | |||
794 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); | 798 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); |
795 | if (status == DWC3_TRBSTS_SETUP_PENDING) { | 799 | if (status == DWC3_TRBSTS_SETUP_PENDING) { |
796 | dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); | 800 | dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); |
@@ -801,10 +805,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
801 | return; | 805 | return; |
802 | } | 806 | } |
803 | 807 | ||
804 | r = next_request(&ep0->request_list); | ||
805 | if (!r) | ||
806 | return; | ||
807 | |||
808 | ur = &r->request; | 808 | ur = &r->request; |
809 | 809 | ||
810 | length = trb->size & DWC3_TRB_SIZE_MASK; | 810 | length = trb->size & DWC3_TRB_SIZE_MASK; |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 696160d48ae8..388cfd83b6b6 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/device.h> | ||
26 | #include <asm/unaligned.h> | 25 | #include <asm/unaligned.h> |
27 | 26 | ||
28 | #include "xhci.h" | 27 | #include "xhci.h" |
@@ -1149,9 +1148,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1149 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1148 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
1150 | * is enabled, so also enable remote wake here. | 1149 | * is enabled, so also enable remote wake here. |
1151 | */ | 1150 | */ |
1152 | if (hcd->self.root_hub->do_remote_wakeup | 1151 | if (hcd->self.root_hub->do_remote_wakeup) { |
1153 | && device_may_wakeup(hcd->self.controller)) { | ||
1154 | |||
1155 | if (t1 & PORT_CONNECT) { | 1152 | if (t1 & PORT_CONNECT) { |
1156 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1153 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
1157 | t2 &= ~PORT_WKCONN_E; | 1154 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 9a69b1f1b300..142b601f9563 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -281,7 +281,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
281 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | 281 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) |
282 | pdev->no_d3cold = true; | 282 | pdev->no_d3cold = true; |
283 | 283 | ||
284 | return xhci_suspend(xhci); | 284 | return xhci_suspend(xhci, do_wakeup); |
285 | } | 285 | } |
286 | 286 | ||
287 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | 287 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0cd674b..646300cbe5f7 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -204,7 +204,15 @@ static int xhci_plat_suspend(struct device *dev) | |||
204 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 204 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
205 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 205 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
206 | 206 | ||
207 | return xhci_suspend(xhci); | 207 | /* |
208 | * xhci_suspend() needs `do_wakeup` to know whether host is allowed | ||
209 | * to do wakeup during suspend. Since xhci_plat_suspend is currently | ||
210 | * only designed for system suspend, device_may_wakeup() is enough | ||
211 | * to dertermine whether host is allowed to do wakeup. Need to | ||
212 | * reconsider this when xhci_plat_suspend enlarges its scope, e.g., | ||
213 | * also applies to runtime suspend. | ||
214 | */ | ||
215 | return xhci_suspend(xhci, device_may_wakeup(dev)); | ||
208 | } | 216 | } |
209 | 217 | ||
210 | static int xhci_plat_resume(struct device *dev) | 218 | static int xhci_plat_resume(struct device *dev) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bc6fcbc16f61..06433aec81d7 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1067,9 +1067,8 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, | |||
1067 | false); | 1067 | false); |
1068 | xhci_ring_cmd_db(xhci); | 1068 | xhci_ring_cmd_db(xhci); |
1069 | } else { | 1069 | } else { |
1070 | /* Clear our internal halted state and restart the ring(s) */ | 1070 | /* Clear our internal halted state */ |
1071 | xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; | 1071 | xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; |
1072 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); | ||
1073 | } | 1072 | } |
1074 | } | 1073 | } |
1075 | 1074 | ||
@@ -1823,22 +1822,13 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1823 | ep->stopped_td = td; | 1822 | ep->stopped_td = td; |
1824 | return 0; | 1823 | return 0; |
1825 | } else { | 1824 | } else { |
1826 | if (trb_comp_code == COMP_STALL) { | 1825 | if (trb_comp_code == COMP_STALL || |
1827 | /* The transfer is completed from the driver's | 1826 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
1828 | * perspective, but we need to issue a set dequeue | 1827 | trb_comp_code)) { |
1829 | * command for this stalled endpoint to move the dequeue | 1828 | /* Issue a reset endpoint command to clear the host side |
1830 | * pointer past the TD. We can't do that here because | 1829 | * halt, followed by a set dequeue command to move the |
1831 | * the halt condition must be cleared first. Let the | 1830 | * dequeue pointer past the TD. |
1832 | * USB class driver clear the stall later. | 1831 | * The class driver clears the device side halt later. |
1833 | */ | ||
1834 | ep->stopped_td = td; | ||
1835 | ep->stopped_stream = ep_ring->stream_id; | ||
1836 | } else if (xhci_requires_manual_halt_cleanup(xhci, | ||
1837 | ep_ctx, trb_comp_code)) { | ||
1838 | /* Other types of errors halt the endpoint, but the | ||
1839 | * class driver doesn't call usb_reset_endpoint() unless | ||
1840 | * the error is -EPIPE. Clear the halted status in the | ||
1841 | * xHCI hardware manually. | ||
1842 | */ | 1832 | */ |
1843 | xhci_cleanup_halted_endpoint(xhci, | 1833 | xhci_cleanup_halted_endpoint(xhci, |
1844 | slot_id, ep_index, ep_ring->stream_id, | 1834 | slot_id, ep_index, ep_ring->stream_id, |
@@ -1958,9 +1948,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1958 | else | 1948 | else |
1959 | td->urb->actual_length = 0; | 1949 | td->urb->actual_length = 0; |
1960 | 1950 | ||
1961 | xhci_cleanup_halted_endpoint(xhci, | 1951 | return finish_td(xhci, td, event_trb, event, ep, status, false); |
1962 | slot_id, ep_index, 0, td, event_trb); | ||
1963 | return finish_td(xhci, td, event_trb, event, ep, status, true); | ||
1964 | } | 1952 | } |
1965 | /* | 1953 | /* |
1966 | * Did we transfer any data, despite the errors that might have | 1954 | * Did we transfer any data, despite the errors that might have |
@@ -2519,17 +2507,8 @@ cleanup: | |||
2519 | if (ret) { | 2507 | if (ret) { |
2520 | urb = td->urb; | 2508 | urb = td->urb; |
2521 | urb_priv = urb->hcpriv; | 2509 | urb_priv = urb->hcpriv; |
2522 | /* Leave the TD around for the reset endpoint function | 2510 | |
2523 | * to use(but only if it's not a control endpoint, | 2511 | xhci_urb_free_priv(xhci, urb_priv); |
2524 | * since we already queued the Set TR dequeue pointer | ||
2525 | * command for stalled control endpoints). | ||
2526 | */ | ||
2527 | if (usb_endpoint_xfer_control(&urb->ep->desc) || | ||
2528 | (trb_comp_code != COMP_STALL && | ||
2529 | trb_comp_code != COMP_BABBLE)) | ||
2530 | xhci_urb_free_priv(xhci, urb_priv); | ||
2531 | else | ||
2532 | kfree(urb_priv); | ||
2533 | 2512 | ||
2534 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | 2513 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); |
2535 | if ((urb->actual_length != urb->transfer_buffer_length && | 2514 | if ((urb->actual_length != urb->transfer_buffer_length && |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2a5d45b4cb15..033b46c470bd 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #define DRIVER_AUTHOR "Sarah Sharp" | 35 | #define DRIVER_AUTHOR "Sarah Sharp" |
36 | #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" | 36 | #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" |
37 | 37 | ||
38 | #define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) | ||
39 | |||
38 | /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ | 40 | /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ |
39 | static int link_quirk; | 41 | static int link_quirk; |
40 | module_param(link_quirk, int, S_IRUGO | S_IWUSR); | 42 | module_param(link_quirk, int, S_IRUGO | S_IWUSR); |
@@ -851,13 +853,47 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) | |||
851 | xhci_set_cmd_ring_deq(xhci); | 853 | xhci_set_cmd_ring_deq(xhci); |
852 | } | 854 | } |
853 | 855 | ||
856 | static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) | ||
857 | { | ||
858 | int port_index; | ||
859 | __le32 __iomem **port_array; | ||
860 | unsigned long flags; | ||
861 | u32 t1, t2; | ||
862 | |||
863 | spin_lock_irqsave(&xhci->lock, flags); | ||
864 | |||
865 | /* disble usb3 ports Wake bits*/ | ||
866 | port_index = xhci->num_usb3_ports; | ||
867 | port_array = xhci->usb3_ports; | ||
868 | while (port_index--) { | ||
869 | t1 = readl(port_array[port_index]); | ||
870 | t1 = xhci_port_state_to_neutral(t1); | ||
871 | t2 = t1 & ~PORT_WAKE_BITS; | ||
872 | if (t1 != t2) | ||
873 | writel(t2, port_array[port_index]); | ||
874 | } | ||
875 | |||
876 | /* disble usb2 ports Wake bits*/ | ||
877 | port_index = xhci->num_usb2_ports; | ||
878 | port_array = xhci->usb2_ports; | ||
879 | while (port_index--) { | ||
880 | t1 = readl(port_array[port_index]); | ||
881 | t1 = xhci_port_state_to_neutral(t1); | ||
882 | t2 = t1 & ~PORT_WAKE_BITS; | ||
883 | if (t1 != t2) | ||
884 | writel(t2, port_array[port_index]); | ||
885 | } | ||
886 | |||
887 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
888 | } | ||
889 | |||
854 | /* | 890 | /* |
855 | * Stop HC (not bus-specific) | 891 | * Stop HC (not bus-specific) |
856 | * | 892 | * |
857 | * This is called when the machine transition into S3/S4 mode. | 893 | * This is called when the machine transition into S3/S4 mode. |
858 | * | 894 | * |
859 | */ | 895 | */ |
860 | int xhci_suspend(struct xhci_hcd *xhci) | 896 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) |
861 | { | 897 | { |
862 | int rc = 0; | 898 | int rc = 0; |
863 | unsigned int delay = XHCI_MAX_HALT_USEC; | 899 | unsigned int delay = XHCI_MAX_HALT_USEC; |
@@ -868,6 +904,10 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
868 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) | 904 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) |
869 | return -EINVAL; | 905 | return -EINVAL; |
870 | 906 | ||
907 | /* Clear root port wake on bits if wakeup not allowed. */ | ||
908 | if (!do_wakeup) | ||
909 | xhci_disable_port_wake_on_bits(xhci); | ||
910 | |||
871 | /* Don't poll the roothubs on bus suspend. */ | 911 | /* Don't poll the roothubs on bus suspend. */ |
872 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); | 912 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
873 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); | 913 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
@@ -2912,68 +2952,33 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | |||
2912 | } | 2952 | } |
2913 | } | 2953 | } |
2914 | 2954 | ||
2915 | /* Deal with stalled endpoints. The core should have sent the control message | 2955 | /* Called when clearing halted device. The core should have sent the control |
2916 | * to clear the halt condition. However, we need to make the xHCI hardware | 2956 | * message to clear the device halt condition. The host side of the halt should |
2917 | * reset its sequence number, since a device will expect a sequence number of | 2957 | * already be cleared with a reset endpoint command issued when the STALL tx |
2918 | * zero after the halt condition is cleared. | 2958 | * event was received. |
2959 | * | ||
2919 | * Context: in_interrupt | 2960 | * Context: in_interrupt |
2920 | */ | 2961 | */ |
2962 | |||
2921 | void xhci_endpoint_reset(struct usb_hcd *hcd, | 2963 | void xhci_endpoint_reset(struct usb_hcd *hcd, |
2922 | struct usb_host_endpoint *ep) | 2964 | struct usb_host_endpoint *ep) |
2923 | { | 2965 | { |
2924 | struct xhci_hcd *xhci; | 2966 | struct xhci_hcd *xhci; |
2925 | struct usb_device *udev; | ||
2926 | unsigned int ep_index; | ||
2927 | unsigned long flags; | ||
2928 | int ret; | ||
2929 | struct xhci_virt_ep *virt_ep; | ||
2930 | struct xhci_command *command; | ||
2931 | 2967 | ||
2932 | xhci = hcd_to_xhci(hcd); | 2968 | xhci = hcd_to_xhci(hcd); |
2933 | udev = (struct usb_device *) ep->hcpriv; | ||
2934 | /* Called with a root hub endpoint (or an endpoint that wasn't added | ||
2935 | * with xhci_add_endpoint() | ||
2936 | */ | ||
2937 | if (!ep->hcpriv) | ||
2938 | return; | ||
2939 | ep_index = xhci_get_endpoint_index(&ep->desc); | ||
2940 | virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index]; | ||
2941 | if (!virt_ep->stopped_td) { | ||
2942 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2943 | "Endpoint 0x%x not halted, refusing to reset.", | ||
2944 | ep->desc.bEndpointAddress); | ||
2945 | return; | ||
2946 | } | ||
2947 | if (usb_endpoint_xfer_control(&ep->desc)) { | ||
2948 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2949 | "Control endpoint stall already handled."); | ||
2950 | return; | ||
2951 | } | ||
2952 | 2969 | ||
2953 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); | ||
2954 | if (!command) | ||
2955 | return; | ||
2956 | |||
2957 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2958 | "Queueing reset endpoint command"); | ||
2959 | spin_lock_irqsave(&xhci->lock, flags); | ||
2960 | ret = xhci_queue_reset_ep(xhci, command, udev->slot_id, ep_index); | ||
2961 | /* | 2970 | /* |
2962 | * Can't change the ring dequeue pointer until it's transitioned to the | 2971 | * We might need to implement the config ep cmd in xhci 4.8.1 note: |
2963 | * stopped state, which is only upon a successful reset endpoint | 2972 | * The Reset Endpoint Command may only be issued to endpoints in the |
2964 | * command. Better hope that last command worked! | 2973 | * Halted state. If software wishes reset the Data Toggle or Sequence |
2974 | * Number of an endpoint that isn't in the Halted state, then software | ||
2975 | * may issue a Configure Endpoint Command with the Drop and Add bits set | ||
2976 | * for the target endpoint. that is in the Stopped state. | ||
2965 | */ | 2977 | */ |
2966 | if (!ret) { | ||
2967 | xhci_cleanup_stalled_ring(xhci, udev, ep_index); | ||
2968 | kfree(virt_ep->stopped_td); | ||
2969 | xhci_ring_cmd_db(xhci); | ||
2970 | } | ||
2971 | virt_ep->stopped_td = NULL; | ||
2972 | virt_ep->stopped_stream = 0; | ||
2973 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
2974 | 2978 | ||
2975 | if (ret) | 2979 | /* For now just print debug to follow the situation */ |
2976 | xhci_warn(xhci, "FIXME allocate a new ring segment\n"); | 2980 | xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", |
2981 | ep->desc.bEndpointAddress); | ||
2977 | } | 2982 | } |
2978 | 2983 | ||
2979 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, | 2984 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index df76d642e719..d745715a1e2f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1746,7 +1746,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); | |||
1746 | void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); | 1746 | void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); |
1747 | 1747 | ||
1748 | #ifdef CONFIG_PM | 1748 | #ifdef CONFIG_PM |
1749 | int xhci_suspend(struct xhci_hcd *xhci); | 1749 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup); |
1750 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); | 1750 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); |
1751 | #else | 1751 | #else |
1752 | #define xhci_suspend NULL | 1752 | #define xhci_suspend NULL |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index cfd009dc4018..6c4eb3cf5efd 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = { | |||
120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ | 120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ |
121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ | 121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ |
122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ | 122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ |
123 | { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ | ||
123 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ | 124 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
124 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 125 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
125 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 126 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0dad8ce5a609..1ebb351b9e9a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -470,6 +470,39 @@ static const struct usb_device_id id_table_combined[] = { | |||
470 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, | 470 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, |
471 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, | 471 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, |
472 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, | 472 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, |
473 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) }, | ||
474 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) }, | ||
475 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) }, | ||
476 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) }, | ||
477 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) }, | ||
478 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) }, | ||
479 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) }, | ||
480 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) }, | ||
481 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) }, | ||
482 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) }, | ||
483 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) }, | ||
484 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) }, | ||
485 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) }, | ||
486 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) }, | ||
487 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) }, | ||
488 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) }, | ||
489 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) }, | ||
490 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) }, | ||
491 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) }, | ||
492 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) }, | ||
493 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) }, | ||
494 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) }, | ||
495 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) }, | ||
496 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) }, | ||
497 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) }, | ||
498 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) }, | ||
499 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) }, | ||
500 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) }, | ||
501 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) }, | ||
502 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) }, | ||
503 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) }, | ||
504 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) }, | ||
505 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) }, | ||
473 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 506 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
474 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 507 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
475 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | 508 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 6786b705ccf6..e52409c9be99 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -926,8 +926,8 @@ | |||
926 | #define BAYER_CONTOUR_CABLE_PID 0x6001 | 926 | #define BAYER_CONTOUR_CABLE_PID 0x6001 |
927 | 927 | ||
928 | /* | 928 | /* |
929 | * The following are the values for the Matrix Orbital FTDI Range | 929 | * Matrix Orbital Intelligent USB displays. |
930 | * Anything in this range will use an FT232RL. | 930 | * http://www.matrixorbital.com |
931 | */ | 931 | */ |
932 | #define MTXORB_VID 0x1B3D | 932 | #define MTXORB_VID 0x1B3D |
933 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 | 933 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 |
@@ -1186,8 +1186,39 @@ | |||
1186 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD | 1186 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD |
1187 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE | 1187 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE |
1188 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF | 1188 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF |
1189 | 1189 | #define MTXORB_FTDI_RANGE_4701_PID 0x4701 | |
1190 | 1190 | #define MTXORB_FTDI_RANGE_9300_PID 0x9300 | |
1191 | #define MTXORB_FTDI_RANGE_9301_PID 0x9301 | ||
1192 | #define MTXORB_FTDI_RANGE_9302_PID 0x9302 | ||
1193 | #define MTXORB_FTDI_RANGE_9303_PID 0x9303 | ||
1194 | #define MTXORB_FTDI_RANGE_9304_PID 0x9304 | ||
1195 | #define MTXORB_FTDI_RANGE_9305_PID 0x9305 | ||
1196 | #define MTXORB_FTDI_RANGE_9306_PID 0x9306 | ||
1197 | #define MTXORB_FTDI_RANGE_9307_PID 0x9307 | ||
1198 | #define MTXORB_FTDI_RANGE_9308_PID 0x9308 | ||
1199 | #define MTXORB_FTDI_RANGE_9309_PID 0x9309 | ||
1200 | #define MTXORB_FTDI_RANGE_930A_PID 0x930A | ||
1201 | #define MTXORB_FTDI_RANGE_930B_PID 0x930B | ||
1202 | #define MTXORB_FTDI_RANGE_930C_PID 0x930C | ||
1203 | #define MTXORB_FTDI_RANGE_930D_PID 0x930D | ||
1204 | #define MTXORB_FTDI_RANGE_930E_PID 0x930E | ||
1205 | #define MTXORB_FTDI_RANGE_930F_PID 0x930F | ||
1206 | #define MTXORB_FTDI_RANGE_9310_PID 0x9310 | ||
1207 | #define MTXORB_FTDI_RANGE_9311_PID 0x9311 | ||
1208 | #define MTXORB_FTDI_RANGE_9312_PID 0x9312 | ||
1209 | #define MTXORB_FTDI_RANGE_9313_PID 0x9313 | ||
1210 | #define MTXORB_FTDI_RANGE_9314_PID 0x9314 | ||
1211 | #define MTXORB_FTDI_RANGE_9315_PID 0x9315 | ||
1212 | #define MTXORB_FTDI_RANGE_9316_PID 0x9316 | ||
1213 | #define MTXORB_FTDI_RANGE_9317_PID 0x9317 | ||
1214 | #define MTXORB_FTDI_RANGE_9318_PID 0x9318 | ||
1215 | #define MTXORB_FTDI_RANGE_9319_PID 0x9319 | ||
1216 | #define MTXORB_FTDI_RANGE_931A_PID 0x931A | ||
1217 | #define MTXORB_FTDI_RANGE_931B_PID 0x931B | ||
1218 | #define MTXORB_FTDI_RANGE_931C_PID 0x931C | ||
1219 | #define MTXORB_FTDI_RANGE_931D_PID 0x931D | ||
1220 | #define MTXORB_FTDI_RANGE_931E_PID 0x931E | ||
1221 | #define MTXORB_FTDI_RANGE_931F_PID 0x931F | ||
1191 | 1222 | ||
1192 | /* | 1223 | /* |
1193 | * The Mobility Lab (TML) | 1224 | * The Mobility Lab (TML) |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 93cb7cebda62..077c714f1285 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -311,24 +311,30 @@ static void usa26_indat_callback(struct urb *urb) | |||
311 | if ((data[0] & 0x80) == 0) { | 311 | if ((data[0] & 0x80) == 0) { |
312 | /* no errors on individual bytes, only | 312 | /* no errors on individual bytes, only |
313 | possible overrun err */ | 313 | possible overrun err */ |
314 | if (data[0] & RXERROR_OVERRUN) | 314 | if (data[0] & RXERROR_OVERRUN) { |
315 | err = TTY_OVERRUN; | 315 | tty_insert_flip_char(&port->port, 0, |
316 | else | 316 | TTY_OVERRUN); |
317 | err = 0; | 317 | } |
318 | for (i = 1; i < urb->actual_length ; ++i) | 318 | for (i = 1; i < urb->actual_length ; ++i) |
319 | tty_insert_flip_char(&port->port, data[i], err); | 319 | tty_insert_flip_char(&port->port, data[i], |
320 | TTY_NORMAL); | ||
320 | } else { | 321 | } else { |
321 | /* some bytes had errors, every byte has status */ | 322 | /* some bytes had errors, every byte has status */ |
322 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); | 323 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); |
323 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 324 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
324 | int stat = data[i], flag = 0; | 325 | int stat = data[i]; |
325 | if (stat & RXERROR_OVERRUN) | 326 | int flag = TTY_NORMAL; |
326 | flag |= TTY_OVERRUN; | 327 | |
327 | if (stat & RXERROR_FRAMING) | 328 | if (stat & RXERROR_OVERRUN) { |
328 | flag |= TTY_FRAME; | 329 | tty_insert_flip_char(&port->port, 0, |
329 | if (stat & RXERROR_PARITY) | 330 | TTY_OVERRUN); |
330 | flag |= TTY_PARITY; | 331 | } |
331 | /* XXX should handle break (0x10) */ | 332 | /* XXX should handle break (0x10) */ |
333 | if (stat & RXERROR_PARITY) | ||
334 | flag = TTY_PARITY; | ||
335 | else if (stat & RXERROR_FRAMING) | ||
336 | flag = TTY_FRAME; | ||
337 | |||
332 | tty_insert_flip_char(&port->port, data[i+1], | 338 | tty_insert_flip_char(&port->port, data[i+1], |
333 | flag); | 339 | flag); |
334 | } | 340 | } |
@@ -649,14 +655,19 @@ static void usa49_indat_callback(struct urb *urb) | |||
649 | } else { | 655 | } else { |
650 | /* some bytes had errors, every byte has status */ | 656 | /* some bytes had errors, every byte has status */ |
651 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 657 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
652 | int stat = data[i], flag = 0; | 658 | int stat = data[i]; |
653 | if (stat & RXERROR_OVERRUN) | 659 | int flag = TTY_NORMAL; |
654 | flag |= TTY_OVERRUN; | 660 | |
655 | if (stat & RXERROR_FRAMING) | 661 | if (stat & RXERROR_OVERRUN) { |
656 | flag |= TTY_FRAME; | 662 | tty_insert_flip_char(&port->port, 0, |
657 | if (stat & RXERROR_PARITY) | 663 | TTY_OVERRUN); |
658 | flag |= TTY_PARITY; | 664 | } |
659 | /* XXX should handle break (0x10) */ | 665 | /* XXX should handle break (0x10) */ |
666 | if (stat & RXERROR_PARITY) | ||
667 | flag = TTY_PARITY; | ||
668 | else if (stat & RXERROR_FRAMING) | ||
669 | flag = TTY_FRAME; | ||
670 | |||
660 | tty_insert_flip_char(&port->port, data[i+1], | 671 | tty_insert_flip_char(&port->port, data[i+1], |
661 | flag); | 672 | flag); |
662 | } | 673 | } |
@@ -713,15 +724,19 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
713 | */ | 724 | */ |
714 | for (x = 0; x + 1 < len && | 725 | for (x = 0; x + 1 < len && |
715 | i + 1 < urb->actual_length; x += 2) { | 726 | i + 1 < urb->actual_length; x += 2) { |
716 | int stat = data[i], flag = 0; | 727 | int stat = data[i]; |
728 | int flag = TTY_NORMAL; | ||
717 | 729 | ||
718 | if (stat & RXERROR_OVERRUN) | 730 | if (stat & RXERROR_OVERRUN) { |
719 | flag |= TTY_OVERRUN; | 731 | tty_insert_flip_char(&port->port, 0, |
720 | if (stat & RXERROR_FRAMING) | 732 | TTY_OVERRUN); |
721 | flag |= TTY_FRAME; | 733 | } |
722 | if (stat & RXERROR_PARITY) | ||
723 | flag |= TTY_PARITY; | ||
724 | /* XXX should handle break (0x10) */ | 734 | /* XXX should handle break (0x10) */ |
735 | if (stat & RXERROR_PARITY) | ||
736 | flag = TTY_PARITY; | ||
737 | else if (stat & RXERROR_FRAMING) | ||
738 | flag = TTY_FRAME; | ||
739 | |||
725 | tty_insert_flip_char(&port->port, data[i+1], | 740 | tty_insert_flip_char(&port->port, data[i+1], |
726 | flag); | 741 | flag); |
727 | i += 2; | 742 | i += 2; |
@@ -773,25 +788,31 @@ static void usa90_indat_callback(struct urb *urb) | |||
773 | if ((data[0] & 0x80) == 0) { | 788 | if ((data[0] & 0x80) == 0) { |
774 | /* no errors on individual bytes, only | 789 | /* no errors on individual bytes, only |
775 | possible overrun err*/ | 790 | possible overrun err*/ |
776 | if (data[0] & RXERROR_OVERRUN) | 791 | if (data[0] & RXERROR_OVERRUN) { |
777 | err = TTY_OVERRUN; | 792 | tty_insert_flip_char(&port->port, 0, |
778 | else | 793 | TTY_OVERRUN); |
779 | err = 0; | 794 | } |
780 | for (i = 1; i < urb->actual_length ; ++i) | 795 | for (i = 1; i < urb->actual_length ; ++i) |
781 | tty_insert_flip_char(&port->port, | 796 | tty_insert_flip_char(&port->port, |
782 | data[i], err); | 797 | data[i], TTY_NORMAL); |
783 | } else { | 798 | } else { |
784 | /* some bytes had errors, every byte has status */ | 799 | /* some bytes had errors, every byte has status */ |
785 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); | 800 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); |
786 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 801 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
787 | int stat = data[i], flag = 0; | 802 | int stat = data[i]; |
788 | if (stat & RXERROR_OVERRUN) | 803 | int flag = TTY_NORMAL; |
789 | flag |= TTY_OVERRUN; | 804 | |
790 | if (stat & RXERROR_FRAMING) | 805 | if (stat & RXERROR_OVERRUN) { |
791 | flag |= TTY_FRAME; | 806 | tty_insert_flip_char( |
792 | if (stat & RXERROR_PARITY) | 807 | &port->port, 0, |
793 | flag |= TTY_PARITY; | 808 | TTY_OVERRUN); |
809 | } | ||
794 | /* XXX should handle break (0x10) */ | 810 | /* XXX should handle break (0x10) */ |
811 | if (stat & RXERROR_PARITY) | ||
812 | flag = TTY_PARITY; | ||
813 | else if (stat & RXERROR_FRAMING) | ||
814 | flag = TTY_FRAME; | ||
815 | |||
795 | tty_insert_flip_char(&port->port, | 816 | tty_insert_flip_char(&port->port, |
796 | data[i+1], flag); | 817 | data[i+1], flag); |
797 | } | 818 | } |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index a7fe664b6b7d..70a098de429f 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -490,10 +490,9 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, | |||
490 | if (*tty_flag == TTY_NORMAL) | 490 | if (*tty_flag == TTY_NORMAL) |
491 | *tty_flag = TTY_FRAME; | 491 | *tty_flag = TTY_FRAME; |
492 | } | 492 | } |
493 | if (lsr & UART_LSR_OE){ | 493 | if (lsr & UART_LSR_OE) { |
494 | port->icount.overrun++; | 494 | port->icount.overrun++; |
495 | if (*tty_flag == TTY_NORMAL) | 495 | tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
496 | *tty_flag = TTY_OVERRUN; | ||
497 | } | 496 | } |
498 | } | 497 | } |
499 | 498 | ||
@@ -511,12 +510,8 @@ static void ssu100_process_read_urb(struct urb *urb) | |||
511 | if ((len >= 4) && | 510 | if ((len >= 4) && |
512 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && | 511 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && |
513 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { | 512 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { |
514 | if (packet[2] == 0x00) { | 513 | if (packet[2] == 0x00) |
515 | ssu100_update_lsr(port, packet[3], &flag); | 514 | ssu100_update_lsr(port, packet[3], &flag); |
516 | if (flag == TTY_OVERRUN) | ||
517 | tty_insert_flip_char(&port->port, 0, | ||
518 | TTY_OVERRUN); | ||
519 | } | ||
520 | if (packet[2] == 0x01) | 515 | if (packet[2] == 0x01) |
521 | ssu100_update_msr(port, packet[3]); | 516 | ssu100_update_msr(port, packet[3]); |
522 | 517 | ||
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 2fefaf923e4a..18a283d6de1c 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -103,3 +103,10 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | |||
103 | "VL711", | 103 | "VL711", |
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
105 | US_FL_NO_ATA_1X), | 105 | US_FL_NO_ATA_1X), |
106 | |||
107 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
108 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, | ||
109 | "Hitachi", | ||
110 | "External HDD", | ||
111 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
112 | US_FL_IGNORE_UAS), | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 69906cacd04f..a17f11850669 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1312,6 +1312,7 @@ static int | |||
1312 | vhost_scsi_set_endpoint(struct vhost_scsi *vs, | 1312 | vhost_scsi_set_endpoint(struct vhost_scsi *vs, |
1313 | struct vhost_scsi_target *t) | 1313 | struct vhost_scsi_target *t) |
1314 | { | 1314 | { |
1315 | struct se_portal_group *se_tpg; | ||
1315 | struct tcm_vhost_tport *tv_tport; | 1316 | struct tcm_vhost_tport *tv_tport; |
1316 | struct tcm_vhost_tpg *tpg; | 1317 | struct tcm_vhost_tpg *tpg; |
1317 | struct tcm_vhost_tpg **vs_tpg; | 1318 | struct tcm_vhost_tpg **vs_tpg; |
@@ -1359,6 +1360,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1359 | ret = -EEXIST; | 1360 | ret = -EEXIST; |
1360 | goto out; | 1361 | goto out; |
1361 | } | 1362 | } |
1363 | /* | ||
1364 | * In order to ensure individual vhost-scsi configfs | ||
1365 | * groups cannot be removed while in use by vhost ioctl, | ||
1366 | * go ahead and take an explicit se_tpg->tpg_group.cg_item | ||
1367 | * dependency now. | ||
1368 | */ | ||
1369 | se_tpg = &tpg->se_tpg; | ||
1370 | ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
1371 | &se_tpg->tpg_group.cg_item); | ||
1372 | if (ret) { | ||
1373 | pr_warn("configfs_depend_item() failed: %d\n", ret); | ||
1374 | kfree(vs_tpg); | ||
1375 | mutex_unlock(&tpg->tv_tpg_mutex); | ||
1376 | goto out; | ||
1377 | } | ||
1362 | tpg->tv_tpg_vhost_count++; | 1378 | tpg->tv_tpg_vhost_count++; |
1363 | tpg->vhost_scsi = vs; | 1379 | tpg->vhost_scsi = vs; |
1364 | vs_tpg[tpg->tport_tpgt] = tpg; | 1380 | vs_tpg[tpg->tport_tpgt] = tpg; |
@@ -1401,6 +1417,7 @@ static int | |||
1401 | vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | 1417 | vhost_scsi_clear_endpoint(struct vhost_scsi *vs, |
1402 | struct vhost_scsi_target *t) | 1418 | struct vhost_scsi_target *t) |
1403 | { | 1419 | { |
1420 | struct se_portal_group *se_tpg; | ||
1404 | struct tcm_vhost_tport *tv_tport; | 1421 | struct tcm_vhost_tport *tv_tport; |
1405 | struct tcm_vhost_tpg *tpg; | 1422 | struct tcm_vhost_tpg *tpg; |
1406 | struct vhost_virtqueue *vq; | 1423 | struct vhost_virtqueue *vq; |
@@ -1449,6 +1466,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | |||
1449 | vs->vs_tpg[target] = NULL; | 1466 | vs->vs_tpg[target] = NULL; |
1450 | match = true; | 1467 | match = true; |
1451 | mutex_unlock(&tpg->tv_tpg_mutex); | 1468 | mutex_unlock(&tpg->tv_tpg_mutex); |
1469 | /* | ||
1470 | * Release se_tpg->tpg_group.cg_item configfs dependency now | ||
1471 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. | ||
1472 | */ | ||
1473 | se_tpg = &tpg->se_tpg; | ||
1474 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
1475 | &se_tpg->tpg_group.cg_item); | ||
1452 | } | 1476 | } |
1453 | if (match) { | 1477 | if (match) { |
1454 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1478 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |