diff options
author | David S. Miller <davem@davemloft.net> | 2015-01-27 19:59:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-27 19:59:56 -0500 |
commit | 95f873f2fff96c592c5d863e2a39825bd8bf0500 (patch) | |
tree | 0d2dd664964ba2c701aefea5b4d1e85b481045e1 /drivers | |
parent | 8ea65f4a2dfaaf494ef42a16cbf2fea39b07450f (diff) | |
parent | 59343cd7c4809cf7598789e1cd14563780ae4239 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
arch/arm/boot/dts/imx6sx-sdb.dts
net/sched/cls_bpf.c
Two simple sets of overlapping changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
209 files changed, 2618 insertions, 2197 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 5277a0ee5704..b1def411c0b8 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -512,7 +512,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
512 | dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); | 512 | dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); |
513 | if (gsi >= 0) { | 513 | if (gsi >= 0) { |
514 | acpi_unregister_gsi(gsi); | 514 | acpi_unregister_gsi(gsi); |
515 | dev->irq = 0; | ||
516 | dev->irq_managed = 0; | 515 | dev->irq_managed = 0; |
517 | } | 516 | } |
518 | } | 517 | } |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index a3a13605a9c4..5f601553b9b0 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -835,6 +835,7 @@ config PATA_AT32 | |||
835 | config PATA_AT91 | 835 | config PATA_AT91 |
836 | tristate "PATA support for AT91SAM9260" | 836 | tristate "PATA support for AT91SAM9260" |
837 | depends on ARM && SOC_AT91SAM9 | 837 | depends on ARM && SOC_AT91SAM9 |
838 | depends on !ARCH_MULTIPLATFORM | ||
838 | help | 839 | help |
839 | This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. | 840 | This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. |
840 | 841 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 49f1e6890587..33bb06e006c9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -325,7 +325,6 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
325 | { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */ | 325 | { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */ |
326 | { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */ | 326 | { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */ |
327 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ | 327 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ |
328 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ | ||
329 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ | 328 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ |
330 | { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ | 329 | { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ |
331 | { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ | 330 | { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index feeb8f1e2fe8..cbcd20810355 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -125,10 +125,11 @@ static int xgene_ahci_restart_engine(struct ata_port *ap) | |||
125 | * xgene_ahci_qc_issue - Issue commands to the device | 125 | * xgene_ahci_qc_issue - Issue commands to the device |
126 | * @qc: Command to issue | 126 | * @qc: Command to issue |
127 | * | 127 | * |
128 | * Due to Hardware errata for IDENTIFY DEVICE command, the controller cannot | 128 | * Due to Hardware errata for IDENTIFY DEVICE command and PACKET |
129 | * clear the BSY bit after receiving the PIO setup FIS. This results in the dma | 129 | * command of ATAPI protocol set, the controller cannot clear the BSY bit |
130 | * state machine goes into the CMFatalErrorUpdate state and locks up. By | 130 | * after receiving the PIO setup FIS. This results in the DMA state machine |
131 | * restarting the dma engine, it removes the controller out of lock up state. | 131 | * going into the CMFatalErrorUpdate state and locks up. By restarting the |
132 | * DMA engine, it removes the controller out of lock up state. | ||
132 | */ | 133 | */ |
133 | static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | 134 | static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) |
134 | { | 135 | { |
@@ -137,7 +138,8 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | |||
137 | struct xgene_ahci_context *ctx = hpriv->plat_data; | 138 | struct xgene_ahci_context *ctx = hpriv->plat_data; |
138 | int rc = 0; | 139 | int rc = 0; |
139 | 140 | ||
140 | if (unlikely(ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA)) | 141 | if (unlikely((ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA) || |
142 | (ctx->last_cmd[ap->port_no] == ATA_CMD_PACKET))) | ||
141 | xgene_ahci_restart_engine(ap); | 143 | xgene_ahci_restart_engine(ap); |
142 | 144 | ||
143 | rc = ahci_qc_issue(qc); | 145 | rc = ahci_qc_issue(qc); |
@@ -188,7 +190,7 @@ static unsigned int xgene_ahci_read_id(struct ata_device *dev, | |||
188 | * | 190 | * |
189 | * Clear reserved bit 8 (DEVSLP bit) as we don't support DEVSLP | 191 | * Clear reserved bit 8 (DEVSLP bit) as we don't support DEVSLP |
190 | */ | 192 | */ |
191 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); | 193 | id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); |
192 | 194 | ||
193 | return 0; | 195 | return 0; |
194 | } | 196 | } |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 97683e45ab04..61a9c07e0dff 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -2003,7 +2003,7 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) | |||
2003 | 2003 | ||
2004 | devslp = readl(port_mmio + PORT_DEVSLP); | 2004 | devslp = readl(port_mmio + PORT_DEVSLP); |
2005 | if (!(devslp & PORT_DEVSLP_DSP)) { | 2005 | if (!(devslp & PORT_DEVSLP_DSP)) { |
2006 | dev_err(ap->host->dev, "port does not support device sleep\n"); | 2006 | dev_info(ap->host->dev, "port does not support device sleep\n"); |
2007 | return; | 2007 | return; |
2008 | } | 2008 | } |
2009 | 2009 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 5c84fb5c3372..d1a05f9bb91f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4233,10 +4233,33 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4233 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, | 4233 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
4234 | 4234 | ||
4235 | /* devices that don't properly handle queued TRIM commands */ | 4235 | /* devices that don't properly handle queued TRIM commands */ |
4236 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4236 | { "Micron_M[56]*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
4237 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4237 | ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
4238 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4238 | { "Crucial_CT*SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4239 | { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4239 | |
4240 | /* | ||
4241 | * As defined, the DRAT (Deterministic Read After Trim) and RZAT | ||
4242 | * (Return Zero After Trim) flags in the ATA Command Set are | ||
4243 | * unreliable in the sense that they only define what happens if | ||
4244 | * the device successfully executed the DSM TRIM command. TRIM | ||
4245 | * is only advisory, however, and the device is free to silently | ||
4246 | * ignore all or parts of the request. | ||
4247 | * | ||
4248 | * Whitelist drives that are known to reliably return zeroes | ||
4249 | * after TRIM. | ||
4250 | */ | ||
4251 | |||
4252 | /* | ||
4253 | * The intel 510 drive has buggy DRAT/RZAT. Explicitly exclude | ||
4254 | * that model before whitelisting all other intel SSDs. | ||
4255 | */ | ||
4256 | { "INTEL*SSDSC2MH*", NULL, 0, }, | ||
4257 | |||
4258 | { "INTEL*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
4259 | { "SSD*INTEL*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
4260 | { "Samsung*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
4261 | { "SAMSUNG*SSD*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
4262 | { "ST[1248][0248]0[FH]*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM, }, | ||
4240 | 4263 | ||
4241 | /* | 4264 | /* |
4242 | * Some WD SATA-I drives spin up and down erratically when the link | 4265 | * Some WD SATA-I drives spin up and down erratically when the link |
@@ -4748,7 +4771,10 @@ static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | |||
4748 | return NULL; | 4771 | return NULL; |
4749 | 4772 | ||
4750 | for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { | 4773 | for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { |
4751 | tag = tag < max_queue ? tag : 0; | 4774 | if (ap->flags & ATA_FLAG_LOWTAG) |
4775 | tag = i; | ||
4776 | else | ||
4777 | tag = tag < max_queue ? tag : 0; | ||
4752 | 4778 | ||
4753 | /* the last tag is reserved for internal command. */ | 4779 | /* the last tag is reserved for internal command. */ |
4754 | if (tag == ATA_TAG_INTERNAL) | 4780 | if (tag == ATA_TAG_INTERNAL) |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 3dbec8954c86..8d00c2638bed 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2389,6 +2389,7 @@ const char *ata_get_cmd_descript(u8 command) | |||
2389 | 2389 | ||
2390 | return NULL; | 2390 | return NULL; |
2391 | } | 2391 | } |
2392 | EXPORT_SYMBOL_GPL(ata_get_cmd_descript); | ||
2392 | 2393 | ||
2393 | /** | 2394 | /** |
2394 | * ata_eh_link_report - report error handling to user | 2395 | * ata_eh_link_report - report error handling to user |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index e364e86e84d7..6abd17a85b13 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2532,13 +2532,15 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) | |||
2532 | rbuf[15] = lowest_aligned; | 2532 | rbuf[15] = lowest_aligned; |
2533 | 2533 | ||
2534 | if (ata_id_has_trim(args->id)) { | 2534 | if (ata_id_has_trim(args->id)) { |
2535 | rbuf[14] |= 0x80; /* TPE */ | 2535 | rbuf[14] |= 0x80; /* LBPME */ |
2536 | 2536 | ||
2537 | if (ata_id_has_zero_after_trim(args->id)) | 2537 | if (ata_id_has_zero_after_trim(args->id) && |
2538 | rbuf[14] |= 0x40; /* TPRZ */ | 2538 | dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) { |
2539 | ata_dev_info(dev, "Enabling discard_zeroes_data\n"); | ||
2540 | rbuf[14] |= 0x40; /* LBPRZ */ | ||
2541 | } | ||
2539 | } | 2542 | } |
2540 | } | 2543 | } |
2541 | |||
2542 | return 0; | 2544 | return 0; |
2543 | } | 2545 | } |
2544 | 2546 | ||
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index db90aa35cb71..2e86e3b85266 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1333,7 +1333,19 @@ void ata_sff_flush_pio_task(struct ata_port *ap) | |||
1333 | DPRINTK("ENTER\n"); | 1333 | DPRINTK("ENTER\n"); |
1334 | 1334 | ||
1335 | cancel_delayed_work_sync(&ap->sff_pio_task); | 1335 | cancel_delayed_work_sync(&ap->sff_pio_task); |
1336 | |||
1337 | /* | ||
1338 | * We wanna reset the HSM state to IDLE. If we do so without | ||
1339 | * grabbing the port lock, critical sections protected by it which | ||
1340 | * expect the HSM state to stay stable may get surprised. For | ||
1341 | * example, we may set IDLE in between the time | ||
1342 | * __ata_sff_port_intr() checks for HSM_ST_IDLE and before it calls | ||
1343 | * ata_sff_hsm_move() causing ata_sff_hsm_move() to BUG(). | ||
1344 | */ | ||
1345 | spin_lock_irq(ap->lock); | ||
1336 | ap->hsm_task_state = HSM_ST_IDLE; | 1346 | ap->hsm_task_state = HSM_ST_IDLE; |
1347 | spin_unlock_irq(ap->lock); | ||
1348 | |||
1337 | ap->sff_pio_task_link = NULL; | 1349 | ap->sff_pio_task_link = NULL; |
1338 | 1350 | ||
1339 | if (ata_msg_ctl(ap)) | 1351 | if (ata_msg_ctl(ap)) |
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index c7ddef89e7b0..8e8248179d20 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c | |||
@@ -797,7 +797,7 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq) | |||
797 | if (err) { | 797 | if (err) { |
798 | dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns" | 798 | dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns" |
799 | " %d\n", __func__, err); | 799 | " %d\n", __func__, err); |
800 | goto error_out; | 800 | return err; |
801 | } | 801 | } |
802 | 802 | ||
803 | /* Enabe DMA */ | 803 | /* Enabe DMA */ |
@@ -808,11 +808,6 @@ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq) | |||
808 | sata_dma_regs); | 808 | sata_dma_regs); |
809 | 809 | ||
810 | return 0; | 810 | return 0; |
811 | |||
812 | error_out: | ||
813 | dma_dwc_exit(hsdev); | ||
814 | |||
815 | return err; | ||
816 | } | 811 | } |
817 | 812 | ||
818 | static int sata_dwc_scr_read(struct ata_link *link, unsigned int scr, u32 *val) | 813 | static int sata_dwc_scr_read(struct ata_link *link, unsigned int scr, u32 *val) |
@@ -1662,7 +1657,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) | |||
1662 | char *ver = (char *)&versionr; | 1657 | char *ver = (char *)&versionr; |
1663 | u8 *base = NULL; | 1658 | u8 *base = NULL; |
1664 | int err = 0; | 1659 | int err = 0; |
1665 | int irq, rc; | 1660 | int irq; |
1666 | struct ata_host *host; | 1661 | struct ata_host *host; |
1667 | struct ata_port_info pi = sata_dwc_port_info[0]; | 1662 | struct ata_port_info pi = sata_dwc_port_info[0]; |
1668 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 1663 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
@@ -1725,7 +1720,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) | |||
1725 | if (irq == NO_IRQ) { | 1720 | if (irq == NO_IRQ) { |
1726 | dev_err(&ofdev->dev, "no SATA DMA irq\n"); | 1721 | dev_err(&ofdev->dev, "no SATA DMA irq\n"); |
1727 | err = -ENODEV; | 1722 | err = -ENODEV; |
1728 | goto error_out; | 1723 | goto error_iomap; |
1729 | } | 1724 | } |
1730 | 1725 | ||
1731 | /* Get physical SATA DMA register base address */ | 1726 | /* Get physical SATA DMA register base address */ |
@@ -1734,14 +1729,16 @@ static int sata_dwc_probe(struct platform_device *ofdev) | |||
1734 | dev_err(&ofdev->dev, "ioremap failed for AHBDMA register" | 1729 | dev_err(&ofdev->dev, "ioremap failed for AHBDMA register" |
1735 | " address\n"); | 1730 | " address\n"); |
1736 | err = -ENODEV; | 1731 | err = -ENODEV; |
1737 | goto error_out; | 1732 | goto error_iomap; |
1738 | } | 1733 | } |
1739 | 1734 | ||
1740 | /* Save dev for later use in dev_xxx() routines */ | 1735 | /* Save dev for later use in dev_xxx() routines */ |
1741 | host_pvt.dwc_dev = &ofdev->dev; | 1736 | host_pvt.dwc_dev = &ofdev->dev; |
1742 | 1737 | ||
1743 | /* Initialize AHB DMAC */ | 1738 | /* Initialize AHB DMAC */ |
1744 | dma_dwc_init(hsdev, irq); | 1739 | err = dma_dwc_init(hsdev, irq); |
1740 | if (err) | ||
1741 | goto error_dma_iomap; | ||
1745 | 1742 | ||
1746 | /* Enable SATA Interrupts */ | 1743 | /* Enable SATA Interrupts */ |
1747 | sata_dwc_enable_interrupts(hsdev); | 1744 | sata_dwc_enable_interrupts(hsdev); |
@@ -1759,9 +1756,8 @@ static int sata_dwc_probe(struct platform_device *ofdev) | |||
1759 | * device discovery process, invoking our port_start() handler & | 1756 | * device discovery process, invoking our port_start() handler & |
1760 | * error_handler() to execute a dummy Softreset EH session | 1757 | * error_handler() to execute a dummy Softreset EH session |
1761 | */ | 1758 | */ |
1762 | rc = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); | 1759 | err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); |
1763 | 1760 | if (err) | |
1764 | if (rc != 0) | ||
1765 | dev_err(&ofdev->dev, "failed to activate host"); | 1761 | dev_err(&ofdev->dev, "failed to activate host"); |
1766 | 1762 | ||
1767 | dev_set_drvdata(&ofdev->dev, host); | 1763 | dev_set_drvdata(&ofdev->dev, host); |
@@ -1770,7 +1766,8 @@ static int sata_dwc_probe(struct platform_device *ofdev) | |||
1770 | error_out: | 1766 | error_out: |
1771 | /* Free SATA DMA resources */ | 1767 | /* Free SATA DMA resources */ |
1772 | dma_dwc_exit(hsdev); | 1768 | dma_dwc_exit(hsdev); |
1773 | 1769 | error_dma_iomap: | |
1770 | iounmap((void __iomem *)host_pvt.sata_dma_regs); | ||
1774 | error_iomap: | 1771 | error_iomap: |
1775 | iounmap(base); | 1772 | iounmap(base); |
1776 | error_kmalloc: | 1773 | error_kmalloc: |
@@ -1791,6 +1788,7 @@ static int sata_dwc_remove(struct platform_device *ofdev) | |||
1791 | /* Free SATA DMA resources */ | 1788 | /* Free SATA DMA resources */ |
1792 | dma_dwc_exit(hsdev); | 1789 | dma_dwc_exit(hsdev); |
1793 | 1790 | ||
1791 | iounmap((void __iomem *)host_pvt.sata_dma_regs); | ||
1794 | iounmap(hsdev->reg_base); | 1792 | iounmap(hsdev->reg_base); |
1795 | kfree(hsdev); | 1793 | kfree(hsdev); |
1796 | kfree(host); | 1794 | kfree(host); |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index d81b20ddb527..ea655949023f 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -246,7 +246,7 @@ enum { | |||
246 | /* host flags */ | 246 | /* host flags */ |
247 | SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | | 247 | SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | |
248 | ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA | | 248 | ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA | |
249 | ATA_FLAG_AN | ATA_FLAG_PMP, | 249 | ATA_FLAG_AN | ATA_FLAG_PMP | ATA_FLAG_LOWTAG, |
250 | SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */ | 250 | SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */ |
251 | 251 | ||
252 | IRQ_STAT_4PORTS = 0xf, | 252 | IRQ_STAT_4PORTS = 0xf, |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index cb529e9a82dd..d826bf3e62c8 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -106,7 +106,7 @@ struct nvme_queue { | |||
106 | dma_addr_t cq_dma_addr; | 106 | dma_addr_t cq_dma_addr; |
107 | u32 __iomem *q_db; | 107 | u32 __iomem *q_db; |
108 | u16 q_depth; | 108 | u16 q_depth; |
109 | u16 cq_vector; | 109 | s16 cq_vector; |
110 | u16 sq_head; | 110 | u16 sq_head; |
111 | u16 sq_tail; | 111 | u16 sq_tail; |
112 | u16 cq_head; | 112 | u16 cq_head; |
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c index 860da40b78ef..0ce5e2d65a06 100644 --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c | |||
@@ -1312,6 +1312,9 @@ static int cci_probe(void) | |||
1312 | if (!np) | 1312 | if (!np) |
1313 | return -ENODEV; | 1313 | return -ENODEV; |
1314 | 1314 | ||
1315 | if (!of_device_is_available(np)) | ||
1316 | return -ENODEV; | ||
1317 | |||
1315 | cci_config = of_match_node(arm_cci_matches, np)->data; | 1318 | cci_config = of_match_node(arm_cci_matches, np)->data; |
1316 | if (!cci_config) | 1319 | if (!cci_config) |
1317 | return -ENODEV; | 1320 | return -ENODEV; |
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c index eb7682dc123b..81bf297f1034 100644 --- a/drivers/bus/mvebu-mbus.c +++ b/drivers/bus/mvebu-mbus.c | |||
@@ -210,12 +210,25 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus, | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /* Checks whether the given window number is available */ | 212 | /* Checks whether the given window number is available */ |
213 | |||
214 | /* On Armada XP, 375 and 38x the MBus window 13 has the remap | ||
215 | * capability, like windows 0 to 7. However, the mvebu-mbus driver | ||
216 | * isn't currently taking into account this special case, which means | ||
217 | * that when window 13 is actually used, the remap registers are left | ||
218 | * to 0, making the device using this MBus window unavailable. The | ||
219 | * quick fix for stable is to not use window 13. A follow up patch | ||
220 | * will correctly handle this window. | ||
221 | */ | ||
213 | static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, | 222 | static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, |
214 | const int win) | 223 | const int win) |
215 | { | 224 | { |
216 | void __iomem *addr = mbus->mbuswins_base + | 225 | void __iomem *addr = mbus->mbuswins_base + |
217 | mbus->soc->win_cfg_offset(win); | 226 | mbus->soc->win_cfg_offset(win); |
218 | u32 ctrl = readl(addr + WIN_CTRL_OFF); | 227 | u32 ctrl = readl(addr + WIN_CTRL_OFF); |
228 | |||
229 | if (win == 13) | ||
230 | return false; | ||
231 | |||
219 | return !(ctrl & WIN_CTRL_ENABLE); | 232 | return !(ctrl & WIN_CTRL_ENABLE); |
220 | } | 233 | } |
221 | 234 | ||
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index 32f7c1b36204..2f13bd5246b5 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c | |||
@@ -70,6 +70,7 @@ struct clk_sam9x5_slow { | |||
70 | 70 | ||
71 | #define to_clk_sam9x5_slow(hw) container_of(hw, struct clk_sam9x5_slow, hw) | 71 | #define to_clk_sam9x5_slow(hw) container_of(hw, struct clk_sam9x5_slow, hw) |
72 | 72 | ||
73 | static struct clk *slow_clk; | ||
73 | 74 | ||
74 | static int clk_slow_osc_prepare(struct clk_hw *hw) | 75 | static int clk_slow_osc_prepare(struct clk_hw *hw) |
75 | { | 76 | { |
@@ -357,6 +358,8 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr, | |||
357 | clk = clk_register(NULL, &slowck->hw); | 358 | clk = clk_register(NULL, &slowck->hw); |
358 | if (IS_ERR(clk)) | 359 | if (IS_ERR(clk)) |
359 | kfree(slowck); | 360 | kfree(slowck); |
361 | else | ||
362 | slow_clk = clk; | ||
360 | 363 | ||
361 | return clk; | 364 | return clk; |
362 | } | 365 | } |
@@ -433,6 +436,8 @@ at91_clk_register_sam9260_slow(struct at91_pmc *pmc, | |||
433 | clk = clk_register(NULL, &slowck->hw); | 436 | clk = clk_register(NULL, &slowck->hw); |
434 | if (IS_ERR(clk)) | 437 | if (IS_ERR(clk)) |
435 | kfree(slowck); | 438 | kfree(slowck); |
439 | else | ||
440 | slow_clk = clk; | ||
436 | 441 | ||
437 | return clk; | 442 | return clk; |
438 | } | 443 | } |
@@ -465,3 +470,25 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np, | |||
465 | 470 | ||
466 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | 471 | of_clk_add_provider(np, of_clk_src_simple_get, clk); |
467 | } | 472 | } |
473 | |||
474 | /* | ||
475 | * FIXME: All slow clk users are not properly claiming it (get + prepare + | ||
476 | * enable) before using it. | ||
477 | * If all users properly claiming this clock decide that they don't need it | ||
478 | * anymore (or are removed), it is disabled while faulty users are still | ||
479 | * requiring it, and the system hangs. | ||
480 | * Prevent this clock from being disabled until all users are properly | ||
481 | * requesting it. | ||
482 | * Once this is done we should remove this function and the slow_clk variable. | ||
483 | */ | ||
484 | static int __init of_at91_clk_slow_retain(void) | ||
485 | { | ||
486 | if (!slow_clk) | ||
487 | return 0; | ||
488 | |||
489 | __clk_get(slow_clk); | ||
490 | clk_prepare_enable(slow_clk); | ||
491 | |||
492 | return 0; | ||
493 | } | ||
494 | arch_initcall(of_at91_clk_slow_retain); | ||
diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index 21784e4eb3f0..440ef81ab15c 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c | |||
@@ -285,7 +285,6 @@ static const struct berlin2_gate_data bg2q_gates[] __initconst = { | |||
285 | { "pbridge", "perif", 15, CLK_IGNORE_UNUSED }, | 285 | { "pbridge", "perif", 15, CLK_IGNORE_UNUSED }, |
286 | { "sdio", "perif", 16, CLK_IGNORE_UNUSED }, | 286 | { "sdio", "perif", 16, CLK_IGNORE_UNUSED }, |
287 | { "nfc", "perif", 18 }, | 287 | { "nfc", "perif", 18 }, |
288 | { "smemc", "perif", 19 }, | ||
289 | { "pcie", "perif", 22 }, | 288 | { "pcie", "perif", 22 }, |
290 | }; | 289 | }; |
291 | 290 | ||
diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c index b6e6c85507a5..0a47d6f49cd6 100644 --- a/drivers/clk/clk-ppc-corenet.c +++ b/drivers/clk/clk-ppc-corenet.c | |||
@@ -291,7 +291,7 @@ static const struct of_device_id ppc_clk_ids[] __initconst = { | |||
291 | {} | 291 | {} |
292 | }; | 292 | }; |
293 | 293 | ||
294 | static struct platform_driver ppc_corenet_clk_driver __initdata = { | 294 | static struct platform_driver ppc_corenet_clk_driver = { |
295 | .driver = { | 295 | .driver = { |
296 | .name = "ppc_corenet_clock", | 296 | .name = "ppc_corenet_clock", |
297 | .of_match_table = ppc_clk_ids, | 297 | .of_match_table = ppc_clk_ids, |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f4963b7d4e17..d48ac71c6c8b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1366,7 +1366,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) | |||
1366 | new_rate = clk->ops->determine_rate(clk->hw, rate, | 1366 | new_rate = clk->ops->determine_rate(clk->hw, rate, |
1367 | &best_parent_rate, | 1367 | &best_parent_rate, |
1368 | &parent_hw); | 1368 | &parent_hw); |
1369 | parent = parent_hw->clk; | 1369 | parent = parent_hw ? parent_hw->clk : NULL; |
1370 | } else if (clk->ops->round_rate) { | 1370 | } else if (clk->ops->round_rate) { |
1371 | new_rate = clk->ops->round_rate(clk->hw, rate, | 1371 | new_rate = clk->ops->round_rate(clk->hw, rate, |
1372 | &best_parent_rate); | 1372 | &best_parent_rate); |
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 75c8c45ef728..8539c4fd34cc 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c | |||
@@ -124,10 +124,11 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk, | |||
124 | { | 124 | { |
125 | const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; | 125 | const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; |
126 | unsigned long alt_prate, alt_div; | 126 | unsigned long alt_prate, alt_div; |
127 | unsigned long flags; | ||
127 | 128 | ||
128 | alt_prate = clk_get_rate(cpuclk->alt_parent); | 129 | alt_prate = clk_get_rate(cpuclk->alt_parent); |
129 | 130 | ||
130 | spin_lock(cpuclk->lock); | 131 | spin_lock_irqsave(cpuclk->lock, flags); |
131 | 132 | ||
132 | /* | 133 | /* |
133 | * If the old parent clock speed is less than the clock speed | 134 | * If the old parent clock speed is less than the clock speed |
@@ -164,7 +165,7 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk, | |||
164 | cpuclk->reg_base + reg_data->core_reg); | 165 | cpuclk->reg_base + reg_data->core_reg); |
165 | } | 166 | } |
166 | 167 | ||
167 | spin_unlock(cpuclk->lock); | 168 | spin_unlock_irqrestore(cpuclk->lock, flags); |
168 | return 0; | 169 | return 0; |
169 | } | 170 | } |
170 | 171 | ||
@@ -173,6 +174,7 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk, | |||
173 | { | 174 | { |
174 | const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; | 175 | const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; |
175 | const struct rockchip_cpuclk_rate_table *rate; | 176 | const struct rockchip_cpuclk_rate_table *rate; |
177 | unsigned long flags; | ||
176 | 178 | ||
177 | rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate); | 179 | rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate); |
178 | if (!rate) { | 180 | if (!rate) { |
@@ -181,7 +183,7 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk, | |||
181 | return -EINVAL; | 183 | return -EINVAL; |
182 | } | 184 | } |
183 | 185 | ||
184 | spin_lock(cpuclk->lock); | 186 | spin_lock_irqsave(cpuclk->lock, flags); |
185 | 187 | ||
186 | if (ndata->old_rate < ndata->new_rate) | 188 | if (ndata->old_rate < ndata->new_rate) |
187 | rockchip_cpuclk_set_dividers(cpuclk, rate); | 189 | rockchip_cpuclk_set_dividers(cpuclk, rate); |
@@ -201,7 +203,7 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk, | |||
201 | if (ndata->old_rate > ndata->new_rate) | 203 | if (ndata->old_rate > ndata->new_rate) |
202 | rockchip_cpuclk_set_dividers(cpuclk, rate); | 204 | rockchip_cpuclk_set_dividers(cpuclk, rate); |
203 | 205 | ||
204 | spin_unlock(cpuclk->lock); | 206 | spin_unlock_irqrestore(cpuclk->lock, flags); |
205 | return 0; | 207 | return 0; |
206 | } | 208 | } |
207 | 209 | ||
diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c index c54078960847..7eb684c50d42 100644 --- a/drivers/clk/rockchip/clk-rk3188.c +++ b/drivers/clk/rockchip/clk-rk3188.c | |||
@@ -210,6 +210,17 @@ PNAME(mux_sclk_hsadc_p) = { "hsadc_src", "hsadc_frac", "ext_hsadc" }; | |||
210 | PNAME(mux_mac_p) = { "gpll", "dpll" }; | 210 | PNAME(mux_mac_p) = { "gpll", "dpll" }; |
211 | PNAME(mux_sclk_macref_p) = { "mac_src", "ext_rmii" }; | 211 | PNAME(mux_sclk_macref_p) = { "mac_src", "ext_rmii" }; |
212 | 212 | ||
213 | static struct rockchip_pll_clock rk3066_pll_clks[] __initdata = { | ||
214 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK2928_PLL_CON(0), | ||
215 | RK2928_MODE_CON, 0, 5, 0, rk3188_pll_rates), | ||
216 | [dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK2928_PLL_CON(4), | ||
217 | RK2928_MODE_CON, 4, 4, 0, NULL), | ||
218 | [cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK2928_PLL_CON(8), | ||
219 | RK2928_MODE_CON, 8, 6, ROCKCHIP_PLL_SYNC_RATE, rk3188_pll_rates), | ||
220 | [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK2928_PLL_CON(12), | ||
221 | RK2928_MODE_CON, 12, 7, ROCKCHIP_PLL_SYNC_RATE, rk3188_pll_rates), | ||
222 | }; | ||
223 | |||
213 | static struct rockchip_pll_clock rk3188_pll_clks[] __initdata = { | 224 | static struct rockchip_pll_clock rk3188_pll_clks[] __initdata = { |
214 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK2928_PLL_CON(0), | 225 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK2928_PLL_CON(0), |
215 | RK2928_MODE_CON, 0, 6, 0, rk3188_pll_rates), | 226 | RK2928_MODE_CON, 0, 6, 0, rk3188_pll_rates), |
@@ -427,11 +438,11 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { | |||
427 | /* hclk_peri gates */ | 438 | /* hclk_peri gates */ |
428 | GATE(0, "hclk_peri_axi_matrix", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(4), 0, GFLAGS), | 439 | GATE(0, "hclk_peri_axi_matrix", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(4), 0, GFLAGS), |
429 | GATE(0, "hclk_peri_ahb_arbi", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(4), 6, GFLAGS), | 440 | GATE(0, "hclk_peri_ahb_arbi", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(4), 6, GFLAGS), |
430 | GATE(0, "hclk_emem_peri", "hclk_peri", 0, RK2928_CLKGATE_CON(4), 7, GFLAGS), | 441 | GATE(0, "hclk_emem_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(4), 7, GFLAGS), |
431 | GATE(HCLK_EMAC, "hclk_emac", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 0, GFLAGS), | 442 | GATE(HCLK_EMAC, "hclk_emac", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 0, GFLAGS), |
432 | GATE(HCLK_NANDC0, "hclk_nandc0", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 9, GFLAGS), | 443 | GATE(HCLK_NANDC0, "hclk_nandc0", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 9, GFLAGS), |
433 | GATE(0, "hclk_usb_peri", "hclk_peri", 0, RK2928_CLKGATE_CON(4), 5, GFLAGS), | 444 | GATE(0, "hclk_usb_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(4), 5, GFLAGS), |
434 | GATE(HCLK_OTG0, "hclk_usbotg0", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 13, GFLAGS), | 445 | GATE(HCLK_OTG0, "hclk_usbotg0", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 13, GFLAGS), |
435 | GATE(HCLK_HSADC, "hclk_hsadc", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 5, GFLAGS), | 446 | GATE(HCLK_HSADC, "hclk_hsadc", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 5, GFLAGS), |
436 | GATE(HCLK_PIDF, "hclk_pidfilter", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 6, GFLAGS), | 447 | GATE(HCLK_PIDF, "hclk_pidfilter", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 6, GFLAGS), |
437 | GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 10, GFLAGS), | 448 | GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 10, GFLAGS), |
@@ -592,7 +603,8 @@ static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = { | |||
592 | GATE(0, "hclk_cif1", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 6, GFLAGS), | 603 | GATE(0, "hclk_cif1", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 6, GFLAGS), |
593 | GATE(0, "hclk_hdmi", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS), | 604 | GATE(0, "hclk_hdmi", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS), |
594 | 605 | ||
595 | GATE(HCLK_OTG1, "hclk_usbotg1", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 14, GFLAGS), | 606 | GATE(HCLK_OTG1, "hclk_usbotg1", "hclk_peri", CLK_IGNORE_UNUSED, |
607 | RK2928_CLKGATE_CON(5), 14, GFLAGS), | ||
596 | 608 | ||
597 | GATE(0, "aclk_cif1", "aclk_vio1", 0, RK2928_CLKGATE_CON(6), 7, GFLAGS), | 609 | GATE(0, "aclk_cif1", "aclk_vio1", 0, RK2928_CLKGATE_CON(6), 7, GFLAGS), |
598 | 610 | ||
@@ -680,7 +692,8 @@ static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = { | |||
680 | GATE(0, "hclk_imem0", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS), | 692 | GATE(0, "hclk_imem0", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS), |
681 | GATE(0, "hclk_imem1", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 15, GFLAGS), | 693 | GATE(0, "hclk_imem1", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 15, GFLAGS), |
682 | 694 | ||
683 | GATE(HCLK_OTG1, "hclk_usbotg1", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 3, GFLAGS), | 695 | GATE(HCLK_OTG1, "hclk_usbotg1", "hclk_peri", CLK_IGNORE_UNUSED, |
696 | RK2928_CLKGATE_CON(7), 3, GFLAGS), | ||
684 | GATE(HCLK_HSIC, "hclk_hsic", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 4, GFLAGS), | 697 | GATE(HCLK_HSIC, "hclk_hsic", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 4, GFLAGS), |
685 | 698 | ||
686 | GATE(PCLK_TIMER3, "pclk_timer3", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 9, GFLAGS), | 699 | GATE(PCLK_TIMER3, "pclk_timer3", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 9, GFLAGS), |
@@ -735,8 +748,8 @@ static void __init rk3188_common_clk_init(struct device_node *np) | |||
735 | static void __init rk3066a_clk_init(struct device_node *np) | 748 | static void __init rk3066a_clk_init(struct device_node *np) |
736 | { | 749 | { |
737 | rk3188_common_clk_init(np); | 750 | rk3188_common_clk_init(np); |
738 | rockchip_clk_register_plls(rk3188_pll_clks, | 751 | rockchip_clk_register_plls(rk3066_pll_clks, |
739 | ARRAY_SIZE(rk3188_pll_clks), | 752 | ARRAY_SIZE(rk3066_pll_clks), |
740 | RK3066_GRF_SOC_STATUS); | 753 | RK3066_GRF_SOC_STATUS); |
741 | rockchip_clk_register_branches(rk3066a_clk_branches, | 754 | rockchip_clk_register_branches(rk3066a_clk_branches, |
742 | ARRAY_SIZE(rk3066a_clk_branches)); | 755 | ARRAY_SIZE(rk3066a_clk_branches)); |
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 40d267f5dea3..cbcddcc02475 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
@@ -145,20 +145,20 @@ struct rockchip_pll_rate_table rk3288_pll_rates[] = { | |||
145 | } | 145 | } |
146 | 146 | ||
147 | static struct rockchip_cpuclk_rate_table rk3288_cpuclk_rates[] __initdata = { | 147 | static struct rockchip_cpuclk_rate_table rk3288_cpuclk_rates[] __initdata = { |
148 | RK3288_CPUCLK_RATE(1800000000, 2, 4, 2, 4, 4), | 148 | RK3288_CPUCLK_RATE(1800000000, 1, 3, 1, 3, 3), |
149 | RK3288_CPUCLK_RATE(1704000000, 2, 4, 2, 4, 4), | 149 | RK3288_CPUCLK_RATE(1704000000, 1, 3, 1, 3, 3), |
150 | RK3288_CPUCLK_RATE(1608000000, 2, 4, 2, 4, 4), | 150 | RK3288_CPUCLK_RATE(1608000000, 1, 3, 1, 3, 3), |
151 | RK3288_CPUCLK_RATE(1512000000, 2, 4, 2, 4, 4), | 151 | RK3288_CPUCLK_RATE(1512000000, 1, 3, 1, 3, 3), |
152 | RK3288_CPUCLK_RATE(1416000000, 2, 4, 2, 4, 4), | 152 | RK3288_CPUCLK_RATE(1416000000, 1, 3, 1, 3, 3), |
153 | RK3288_CPUCLK_RATE(1200000000, 2, 4, 2, 4, 4), | 153 | RK3288_CPUCLK_RATE(1200000000, 1, 3, 1, 3, 3), |
154 | RK3288_CPUCLK_RATE(1008000000, 2, 4, 2, 4, 4), | 154 | RK3288_CPUCLK_RATE(1008000000, 1, 3, 1, 3, 3), |
155 | RK3288_CPUCLK_RATE( 816000000, 2, 4, 2, 4, 4), | 155 | RK3288_CPUCLK_RATE( 816000000, 1, 3, 1, 3, 3), |
156 | RK3288_CPUCLK_RATE( 696000000, 2, 4, 2, 4, 4), | 156 | RK3288_CPUCLK_RATE( 696000000, 1, 3, 1, 3, 3), |
157 | RK3288_CPUCLK_RATE( 600000000, 2, 4, 2, 4, 4), | 157 | RK3288_CPUCLK_RATE( 600000000, 1, 3, 1, 3, 3), |
158 | RK3288_CPUCLK_RATE( 408000000, 2, 4, 2, 4, 4), | 158 | RK3288_CPUCLK_RATE( 408000000, 1, 3, 1, 3, 3), |
159 | RK3288_CPUCLK_RATE( 312000000, 2, 4, 2, 4, 4), | 159 | RK3288_CPUCLK_RATE( 312000000, 1, 3, 1, 3, 3), |
160 | RK3288_CPUCLK_RATE( 216000000, 2, 4, 2, 4, 4), | 160 | RK3288_CPUCLK_RATE( 216000000, 1, 3, 1, 3, 3), |
161 | RK3288_CPUCLK_RATE( 126000000, 2, 4, 2, 4, 4), | 161 | RK3288_CPUCLK_RATE( 126000000, 1, 3, 1, 3, 3), |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static const struct rockchip_cpuclk_reg_data rk3288_cpuclk_data = { | 164 | static const struct rockchip_cpuclk_reg_data rk3288_cpuclk_data = { |
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index 0595dc6c453e..f1e33d08dd83 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c | |||
@@ -68,9 +68,8 @@ static void kona_timer_disable_and_clear(void __iomem *base) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static void | 70 | static void |
71 | kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw) | 71 | kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw) |
72 | { | 72 | { |
73 | void __iomem *base = IOMEM(timer_base); | ||
74 | int loop_limit = 4; | 73 | int loop_limit = 4; |
75 | 74 | ||
76 | /* | 75 | /* |
@@ -86,9 +85,9 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw) | |||
86 | */ | 85 | */ |
87 | 86 | ||
88 | while (--loop_limit) { | 87 | while (--loop_limit) { |
89 | *msw = readl(base + KONA_GPTIMER_STCHI_OFFSET); | 88 | *msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET); |
90 | *lsw = readl(base + KONA_GPTIMER_STCLO_OFFSET); | 89 | *lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET); |
91 | if (*msw == readl(base + KONA_GPTIMER_STCHI_OFFSET)) | 90 | if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET)) |
92 | break; | 91 | break; |
93 | } | 92 | } |
94 | if (!loop_limit) { | 93 | if (!loop_limit) { |
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 9403061a2acc..83564c9cfdbe 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -97,8 +97,8 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset) | |||
97 | writel_relaxed(value, reg_base + offset); | 97 | writel_relaxed(value, reg_base + offset); |
98 | 98 | ||
99 | if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) { | 99 | if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) { |
100 | stat_addr = (offset & ~EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; | 100 | stat_addr = (offset & EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; |
101 | switch (offset & EXYNOS4_MCT_L_MASK) { | 101 | switch (offset & ~EXYNOS4_MCT_L_MASK) { |
102 | case MCT_L_TCON_OFFSET: | 102 | case MCT_L_TCON_OFFSET: |
103 | mask = 1 << 3; /* L_TCON write status */ | 103 | mask = 1 << 3; /* L_TCON write status */ |
104 | break; | 104 | break; |
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 0f665b8f2461..f150ca82bfaf 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -428,7 +428,7 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, | |||
428 | ced->features = CLOCK_EVT_FEAT_PERIODIC; | 428 | ced->features = CLOCK_EVT_FEAT_PERIODIC; |
429 | ced->features |= CLOCK_EVT_FEAT_ONESHOT; | 429 | ced->features |= CLOCK_EVT_FEAT_ONESHOT; |
430 | ced->rating = 200; | 430 | ced->rating = 200; |
431 | ced->cpumask = cpumask_of(0); | 431 | ced->cpumask = cpu_possible_mask; |
432 | ced->set_next_event = sh_tmu_clock_event_next; | 432 | ced->set_next_event = sh_tmu_clock_event_next; |
433 | ced->set_mode = sh_tmu_clock_event_mode; | 433 | ced->set_mode = sh_tmu_clock_event_mode; |
434 | ced->suspend = sh_tmu_clock_event_suspend; | 434 | ced->suspend = sh_tmu_clock_event_suspend; |
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 380478562b7d..5c062548957c 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c | |||
@@ -1505,7 +1505,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) | |||
1505 | dw->regs = chip->regs; | 1505 | dw->regs = chip->regs; |
1506 | chip->dw = dw; | 1506 | chip->dw = dw; |
1507 | 1507 | ||
1508 | pm_runtime_enable(chip->dev); | ||
1509 | pm_runtime_get_sync(chip->dev); | 1508 | pm_runtime_get_sync(chip->dev); |
1510 | 1509 | ||
1511 | dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); | 1510 | dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); |
@@ -1703,7 +1702,6 @@ int dw_dma_remove(struct dw_dma_chip *chip) | |||
1703 | } | 1702 | } |
1704 | 1703 | ||
1705 | pm_runtime_put_sync_suspend(chip->dev); | 1704 | pm_runtime_put_sync_suspend(chip->dev); |
1706 | pm_runtime_disable(chip->dev); | ||
1707 | return 0; | 1705 | return 0; |
1708 | } | 1706 | } |
1709 | EXPORT_SYMBOL_GPL(dw_dma_remove); | 1707 | EXPORT_SYMBOL_GPL(dw_dma_remove); |
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index a630161473a4..32ea1aca7a0e 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/pm_runtime.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/dmaengine.h> | 20 | #include <linux/dmaengine.h> |
20 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
@@ -185,6 +186,8 @@ static int dw_probe(struct platform_device *pdev) | |||
185 | if (err) | 186 | if (err) |
186 | return err; | 187 | return err; |
187 | 188 | ||
189 | pm_runtime_enable(&pdev->dev); | ||
190 | |||
188 | err = dw_dma_probe(chip, pdata); | 191 | err = dw_dma_probe(chip, pdata); |
189 | if (err) | 192 | if (err) |
190 | goto err_dw_dma_probe; | 193 | goto err_dw_dma_probe; |
@@ -205,6 +208,7 @@ static int dw_probe(struct platform_device *pdev) | |||
205 | return 0; | 208 | return 0; |
206 | 209 | ||
207 | err_dw_dma_probe: | 210 | err_dw_dma_probe: |
211 | pm_runtime_disable(&pdev->dev); | ||
208 | clk_disable_unprepare(chip->clk); | 212 | clk_disable_unprepare(chip->clk); |
209 | return err; | 213 | return err; |
210 | } | 214 | } |
@@ -217,6 +221,7 @@ static int dw_remove(struct platform_device *pdev) | |||
217 | of_dma_controller_free(pdev->dev.of_node); | 221 | of_dma_controller_free(pdev->dev.of_node); |
218 | 222 | ||
219 | dw_dma_remove(chip); | 223 | dw_dma_remove(chip); |
224 | pm_runtime_disable(&pdev->dev); | ||
220 | clk_disable_unprepare(chip->clk); | 225 | clk_disable_unprepare(chip->clk); |
221 | 226 | ||
222 | return 0; | 227 | return 0; |
diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c index 55d4803d71b0..3d9e08f7e823 100644 --- a/drivers/gpio/gpio-crystalcove.c +++ b/drivers/gpio/gpio-crystalcove.c | |||
@@ -272,7 +272,7 @@ static irqreturn_t crystalcove_gpio_irq_handler(int irq, void *data) | |||
272 | for (gpio = 0; gpio < CRYSTALCOVE_GPIO_NUM; gpio++) { | 272 | for (gpio = 0; gpio < CRYSTALCOVE_GPIO_NUM; gpio++) { |
273 | if (pending & BIT(gpio)) { | 273 | if (pending & BIT(gpio)) { |
274 | virq = irq_find_mapping(cg->chip.irqdomain, gpio); | 274 | virq = irq_find_mapping(cg->chip.irqdomain, gpio); |
275 | generic_handle_irq(virq); | 275 | handle_nested_irq(virq); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 604dbe60bdee..08261f2b3a82 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -45,8 +45,14 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data) | |||
45 | return false; | 45 | return false; |
46 | 46 | ||
47 | ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); | 47 | ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); |
48 | if (ret < 0) | 48 | if (ret < 0) { |
49 | return false; | 49 | /* We've found the gpio chip, but the translation failed. |
50 | * Return true to stop looking and return the translation | ||
51 | * error via out_gpio | ||
52 | */ | ||
53 | gg_data->out_gpio = ERR_PTR(ret); | ||
54 | return true; | ||
55 | } | ||
50 | 56 | ||
51 | gg_data->out_gpio = gpiochip_get_desc(gc, ret); | 57 | gg_data->out_gpio = gpiochip_get_desc(gc, ret); |
52 | return true; | 58 | return true; |
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 2ac1800b58bb..f62aa115d79a 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c | |||
@@ -128,7 +128,7 @@ static ssize_t gpio_value_store(struct device *dev, | |||
128 | return status; | 128 | return status; |
129 | } | 129 | } |
130 | 130 | ||
131 | static const DEVICE_ATTR(value, 0644, | 131 | static DEVICE_ATTR(value, 0644, |
132 | gpio_value_show, gpio_value_store); | 132 | gpio_value_show, gpio_value_store); |
133 | 133 | ||
134 | static irqreturn_t gpio_sysfs_irq(int irq, void *priv) | 134 | static irqreturn_t gpio_sysfs_irq(int irq, void *priv) |
@@ -353,17 +353,46 @@ static ssize_t gpio_active_low_store(struct device *dev, | |||
353 | return status ? : size; | 353 | return status ? : size; |
354 | } | 354 | } |
355 | 355 | ||
356 | static const DEVICE_ATTR(active_low, 0644, | 356 | static DEVICE_ATTR(active_low, 0644, |
357 | gpio_active_low_show, gpio_active_low_store); | 357 | gpio_active_low_show, gpio_active_low_store); |
358 | 358 | ||
359 | static const struct attribute *gpio_attrs[] = { | 359 | static umode_t gpio_is_visible(struct kobject *kobj, struct attribute *attr, |
360 | int n) | ||
361 | { | ||
362 | struct device *dev = container_of(kobj, struct device, kobj); | ||
363 | struct gpio_desc *desc = dev_get_drvdata(dev); | ||
364 | umode_t mode = attr->mode; | ||
365 | bool show_direction = test_bit(FLAG_SYSFS_DIR, &desc->flags); | ||
366 | |||
367 | if (attr == &dev_attr_direction.attr) { | ||
368 | if (!show_direction) | ||
369 | mode = 0; | ||
370 | } else if (attr == &dev_attr_edge.attr) { | ||
371 | if (gpiod_to_irq(desc) < 0) | ||
372 | mode = 0; | ||
373 | if (!show_direction && test_bit(FLAG_IS_OUT, &desc->flags)) | ||
374 | mode = 0; | ||
375 | } | ||
376 | |||
377 | return mode; | ||
378 | } | ||
379 | |||
380 | static struct attribute *gpio_attrs[] = { | ||
381 | &dev_attr_direction.attr, | ||
382 | &dev_attr_edge.attr, | ||
360 | &dev_attr_value.attr, | 383 | &dev_attr_value.attr, |
361 | &dev_attr_active_low.attr, | 384 | &dev_attr_active_low.attr, |
362 | NULL, | 385 | NULL, |
363 | }; | 386 | }; |
364 | 387 | ||
365 | static const struct attribute_group gpio_attr_group = { | 388 | static const struct attribute_group gpio_group = { |
366 | .attrs = (struct attribute **) gpio_attrs, | 389 | .attrs = gpio_attrs, |
390 | .is_visible = gpio_is_visible, | ||
391 | }; | ||
392 | |||
393 | static const struct attribute_group *gpio_groups[] = { | ||
394 | &gpio_group, | ||
395 | NULL | ||
367 | }; | 396 | }; |
368 | 397 | ||
369 | /* | 398 | /* |
@@ -400,16 +429,13 @@ static ssize_t chip_ngpio_show(struct device *dev, | |||
400 | } | 429 | } |
401 | static DEVICE_ATTR(ngpio, 0444, chip_ngpio_show, NULL); | 430 | static DEVICE_ATTR(ngpio, 0444, chip_ngpio_show, NULL); |
402 | 431 | ||
403 | static const struct attribute *gpiochip_attrs[] = { | 432 | static struct attribute *gpiochip_attrs[] = { |
404 | &dev_attr_base.attr, | 433 | &dev_attr_base.attr, |
405 | &dev_attr_label.attr, | 434 | &dev_attr_label.attr, |
406 | &dev_attr_ngpio.attr, | 435 | &dev_attr_ngpio.attr, |
407 | NULL, | 436 | NULL, |
408 | }; | 437 | }; |
409 | 438 | ATTRIBUTE_GROUPS(gpiochip); | |
410 | static const struct attribute_group gpiochip_attr_group = { | ||
411 | .attrs = (struct attribute **) gpiochip_attrs, | ||
412 | }; | ||
413 | 439 | ||
414 | /* | 440 | /* |
415 | * /sys/class/gpio/export ... write-only | 441 | * /sys/class/gpio/export ... write-only |
@@ -556,45 +582,30 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change) | |||
556 | goto fail_unlock; | 582 | goto fail_unlock; |
557 | } | 583 | } |
558 | 584 | ||
559 | if (!desc->chip->direction_input || !desc->chip->direction_output) | 585 | if (desc->chip->direction_input && desc->chip->direction_output && |
560 | direction_may_change = false; | 586 | direction_may_change) { |
587 | set_bit(FLAG_SYSFS_DIR, &desc->flags); | ||
588 | } | ||
589 | |||
561 | spin_unlock_irqrestore(&gpio_lock, flags); | 590 | spin_unlock_irqrestore(&gpio_lock, flags); |
562 | 591 | ||
563 | offset = gpio_chip_hwgpio(desc); | 592 | offset = gpio_chip_hwgpio(desc); |
564 | if (desc->chip->names && desc->chip->names[offset]) | 593 | if (desc->chip->names && desc->chip->names[offset]) |
565 | ioname = desc->chip->names[offset]; | 594 | ioname = desc->chip->names[offset]; |
566 | 595 | ||
567 | dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), | 596 | dev = device_create_with_groups(&gpio_class, desc->chip->dev, |
568 | desc, ioname ? ioname : "gpio%u", | 597 | MKDEV(0, 0), desc, gpio_groups, |
569 | desc_to_gpio(desc)); | 598 | ioname ? ioname : "gpio%u", |
599 | desc_to_gpio(desc)); | ||
570 | if (IS_ERR(dev)) { | 600 | if (IS_ERR(dev)) { |
571 | status = PTR_ERR(dev); | 601 | status = PTR_ERR(dev); |
572 | goto fail_unlock; | 602 | goto fail_unlock; |
573 | } | 603 | } |
574 | 604 | ||
575 | status = sysfs_create_group(&dev->kobj, &gpio_attr_group); | ||
576 | if (status) | ||
577 | goto fail_unregister_device; | ||
578 | |||
579 | if (direction_may_change) { | ||
580 | status = device_create_file(dev, &dev_attr_direction); | ||
581 | if (status) | ||
582 | goto fail_unregister_device; | ||
583 | } | ||
584 | |||
585 | if (gpiod_to_irq(desc) >= 0 && (direction_may_change || | ||
586 | !test_bit(FLAG_IS_OUT, &desc->flags))) { | ||
587 | status = device_create_file(dev, &dev_attr_edge); | ||
588 | if (status) | ||
589 | goto fail_unregister_device; | ||
590 | } | ||
591 | |||
592 | set_bit(FLAG_EXPORT, &desc->flags); | 605 | set_bit(FLAG_EXPORT, &desc->flags); |
593 | mutex_unlock(&sysfs_lock); | 606 | mutex_unlock(&sysfs_lock); |
594 | return 0; | 607 | return 0; |
595 | 608 | ||
596 | fail_unregister_device: | ||
597 | device_unregister(dev); | ||
598 | fail_unlock: | 609 | fail_unlock: |
599 | mutex_unlock(&sysfs_lock); | 610 | mutex_unlock(&sysfs_lock); |
600 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); | 611 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); |
@@ -718,6 +729,7 @@ void gpiod_unexport(struct gpio_desc *desc) | |||
718 | dev = class_find_device(&gpio_class, NULL, desc, match_export); | 729 | dev = class_find_device(&gpio_class, NULL, desc, match_export); |
719 | if (dev) { | 730 | if (dev) { |
720 | gpio_setup_irq(desc, dev, 0); | 731 | gpio_setup_irq(desc, dev, 0); |
732 | clear_bit(FLAG_SYSFS_DIR, &desc->flags); | ||
721 | clear_bit(FLAG_EXPORT, &desc->flags); | 733 | clear_bit(FLAG_EXPORT, &desc->flags); |
722 | } else | 734 | } else |
723 | status = -ENODEV; | 735 | status = -ENODEV; |
@@ -750,13 +762,13 @@ int gpiochip_export(struct gpio_chip *chip) | |||
750 | 762 | ||
751 | /* use chip->base for the ID; it's already known to be unique */ | 763 | /* use chip->base for the ID; it's already known to be unique */ |
752 | mutex_lock(&sysfs_lock); | 764 | mutex_lock(&sysfs_lock); |
753 | dev = device_create(&gpio_class, chip->dev, MKDEV(0, 0), chip, | 765 | dev = device_create_with_groups(&gpio_class, chip->dev, MKDEV(0, 0), |
754 | "gpiochip%d", chip->base); | 766 | chip, gpiochip_groups, |
755 | if (!IS_ERR(dev)) { | 767 | "gpiochip%d", chip->base); |
756 | status = sysfs_create_group(&dev->kobj, | 768 | if (IS_ERR(dev)) |
757 | &gpiochip_attr_group); | ||
758 | } else | ||
759 | status = PTR_ERR(dev); | 769 | status = PTR_ERR(dev); |
770 | else | ||
771 | status = 0; | ||
760 | chip->exported = (status == 0); | 772 | chip->exported = (status == 0); |
761 | mutex_unlock(&sysfs_lock); | 773 | mutex_unlock(&sysfs_lock); |
762 | 774 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 487afe6f22fc..568aa2b6bdb0 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -248,29 +248,30 @@ int gpiochip_add(struct gpio_chip *chip) | |||
248 | base = gpiochip_find_base(chip->ngpio); | 248 | base = gpiochip_find_base(chip->ngpio); |
249 | if (base < 0) { | 249 | if (base < 0) { |
250 | status = base; | 250 | status = base; |
251 | goto unlock; | 251 | spin_unlock_irqrestore(&gpio_lock, flags); |
252 | goto err_free_descs; | ||
252 | } | 253 | } |
253 | chip->base = base; | 254 | chip->base = base; |
254 | } | 255 | } |
255 | 256 | ||
256 | status = gpiochip_add_to_list(chip); | 257 | status = gpiochip_add_to_list(chip); |
258 | if (status) { | ||
259 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
260 | goto err_free_descs; | ||
261 | } | ||
257 | 262 | ||
258 | if (status == 0) { | 263 | for (id = 0; id < chip->ngpio; id++) { |
259 | for (id = 0; id < chip->ngpio; id++) { | 264 | struct gpio_desc *desc = &descs[id]; |
260 | struct gpio_desc *desc = &descs[id]; | 265 | |
261 | desc->chip = chip; | 266 | desc->chip = chip; |
262 | 267 | ||
263 | /* REVISIT: most hardware initializes GPIOs as | 268 | /* REVISIT: most hardware initializes GPIOs as inputs (often |
264 | * inputs (often with pullups enabled) so power | 269 | * with pullups enabled) so power usage is minimized. Linux |
265 | * usage is minimized. Linux code should set the | 270 | * code should set the gpio direction first thing; but until |
266 | * gpio direction first thing; but until it does, | 271 | * it does, and in case chip->get_direction is not set, we may |
267 | * and in case chip->get_direction is not set, | 272 | * expose the wrong direction in sysfs. |
268 | * we may expose the wrong direction in sysfs. | 273 | */ |
269 | */ | 274 | desc->flags = !chip->direction_input ? (1 << FLAG_IS_OUT) : 0; |
270 | desc->flags = !chip->direction_input | ||
271 | ? (1 << FLAG_IS_OUT) | ||
272 | : 0; | ||
273 | } | ||
274 | } | 275 | } |
275 | 276 | ||
276 | chip->desc = descs; | 277 | chip->desc = descs; |
@@ -284,12 +285,9 @@ int gpiochip_add(struct gpio_chip *chip) | |||
284 | of_gpiochip_add(chip); | 285 | of_gpiochip_add(chip); |
285 | acpi_gpiochip_add(chip); | 286 | acpi_gpiochip_add(chip); |
286 | 287 | ||
287 | if (status) | ||
288 | goto fail; | ||
289 | |||
290 | status = gpiochip_export(chip); | 288 | status = gpiochip_export(chip); |
291 | if (status) | 289 | if (status) |
292 | goto fail; | 290 | goto err_remove_chip; |
293 | 291 | ||
294 | pr_debug("%s: registered GPIOs %d to %d on device: %s\n", __func__, | 292 | pr_debug("%s: registered GPIOs %d to %d on device: %s\n", __func__, |
295 | chip->base, chip->base + chip->ngpio - 1, | 293 | chip->base, chip->base + chip->ngpio - 1, |
@@ -297,11 +295,15 @@ int gpiochip_add(struct gpio_chip *chip) | |||
297 | 295 | ||
298 | return 0; | 296 | return 0; |
299 | 297 | ||
300 | unlock: | 298 | err_remove_chip: |
299 | acpi_gpiochip_remove(chip); | ||
300 | of_gpiochip_remove(chip); | ||
301 | spin_lock_irqsave(&gpio_lock, flags); | ||
302 | list_del(&chip->list); | ||
301 | spin_unlock_irqrestore(&gpio_lock, flags); | 303 | spin_unlock_irqrestore(&gpio_lock, flags); |
302 | fail: | ||
303 | kfree(descs); | ||
304 | chip->desc = NULL; | 304 | chip->desc = NULL; |
305 | err_free_descs: | ||
306 | kfree(descs); | ||
305 | 307 | ||
306 | /* failures here can mean systems won't boot... */ | 308 | /* failures here can mean systems won't boot... */ |
307 | pr_err("%s: GPIOs %d..%d (%s) failed to register\n", __func__, | 309 | pr_err("%s: GPIOs %d..%d (%s) failed to register\n", __func__, |
@@ -325,14 +327,15 @@ void gpiochip_remove(struct gpio_chip *chip) | |||
325 | unsigned long flags; | 327 | unsigned long flags; |
326 | unsigned id; | 328 | unsigned id; |
327 | 329 | ||
328 | acpi_gpiochip_remove(chip); | 330 | gpiochip_unexport(chip); |
329 | |||
330 | spin_lock_irqsave(&gpio_lock, flags); | ||
331 | 331 | ||
332 | gpiochip_irqchip_remove(chip); | 332 | gpiochip_irqchip_remove(chip); |
333 | |||
334 | acpi_gpiochip_remove(chip); | ||
333 | gpiochip_remove_pin_ranges(chip); | 335 | gpiochip_remove_pin_ranges(chip); |
334 | of_gpiochip_remove(chip); | 336 | of_gpiochip_remove(chip); |
335 | 337 | ||
338 | spin_lock_irqsave(&gpio_lock, flags); | ||
336 | for (id = 0; id < chip->ngpio; id++) { | 339 | for (id = 0; id < chip->ngpio; id++) { |
337 | if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) | 340 | if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) |
338 | dev_crit(chip->dev, "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); | 341 | dev_crit(chip->dev, "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n"); |
@@ -342,7 +345,6 @@ void gpiochip_remove(struct gpio_chip *chip) | |||
342 | 345 | ||
343 | list_del(&chip->list); | 346 | list_del(&chip->list); |
344 | spin_unlock_irqrestore(&gpio_lock, flags); | 347 | spin_unlock_irqrestore(&gpio_lock, flags); |
345 | gpiochip_unexport(chip); | ||
346 | 348 | ||
347 | kfree(chip->desc); | 349 | kfree(chip->desc); |
348 | chip->desc = NULL; | 350 | chip->desc = NULL; |
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index e3a52113a541..550a5eafbd38 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h | |||
@@ -77,6 +77,7 @@ struct gpio_desc { | |||
77 | #define FLAG_OPEN_DRAIN 7 /* Gpio is open drain type */ | 77 | #define FLAG_OPEN_DRAIN 7 /* Gpio is open drain type */ |
78 | #define FLAG_OPEN_SOURCE 8 /* Gpio is open source type */ | 78 | #define FLAG_OPEN_SOURCE 8 /* Gpio is open source type */ |
79 | #define FLAG_USED_AS_IRQ 9 /* GPIO is connected to an IRQ */ | 79 | #define FLAG_USED_AS_IRQ 9 /* GPIO is connected to an IRQ */ |
80 | #define FLAG_SYSFS_DIR 10 /* show sysfs direction attribute */ | ||
80 | 81 | ||
81 | #define ID_SHIFT 16 /* add new flags before this one */ | 82 | #define ID_SHIFT 16 /* add new flags before this one */ |
82 | 83 | ||
diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile b/drivers/gpu/drm/amd/amdkfd/Makefile index be6246de5091..307a309110e6 100644 --- a/drivers/gpu/drm/amd/amdkfd/Makefile +++ b/drivers/gpu/drm/amd/amdkfd/Makefile | |||
@@ -8,7 +8,6 @@ amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \ | |||
8 | kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \ | 8 | kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \ |
9 | kfd_process.o kfd_queue.o kfd_mqd_manager.o \ | 9 | kfd_process.o kfd_queue.o kfd_mqd_manager.o \ |
10 | kfd_kernel_queue.o kfd_packet_manager.o \ | 10 | kfd_kernel_queue.o kfd_packet_manager.o \ |
11 | kfd_process_queue_manager.o kfd_device_queue_manager.o \ | 11 | kfd_process_queue_manager.o kfd_device_queue_manager.o |
12 | kfd_interrupt.o | ||
13 | 12 | ||
14 | obj-$(CONFIG_HSA_AMD) += amdkfd.o | 13 | obj-$(CONFIG_HSA_AMD) += amdkfd.o |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 43884ebd4303..633532a2e7ec 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c | |||
@@ -192,13 +192,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, | |||
192 | goto kfd_topology_add_device_error; | 192 | goto kfd_topology_add_device_error; |
193 | } | 193 | } |
194 | 194 | ||
195 | if (kfd_interrupt_init(kfd)) { | ||
196 | dev_err(kfd_device, | ||
197 | "Error initializing interrupts for device (%x:%x)\n", | ||
198 | kfd->pdev->vendor, kfd->pdev->device); | ||
199 | goto kfd_interrupt_error; | ||
200 | } | ||
201 | |||
202 | if (!device_iommu_pasid_init(kfd)) { | 195 | if (!device_iommu_pasid_init(kfd)) { |
203 | dev_err(kfd_device, | 196 | dev_err(kfd_device, |
204 | "Error initializing iommuv2 for device (%x:%x)\n", | 197 | "Error initializing iommuv2 for device (%x:%x)\n", |
@@ -237,8 +230,6 @@ dqm_start_error: | |||
237 | device_queue_manager_error: | 230 | device_queue_manager_error: |
238 | amd_iommu_free_device(kfd->pdev); | 231 | amd_iommu_free_device(kfd->pdev); |
239 | device_iommu_pasid_error: | 232 | device_iommu_pasid_error: |
240 | kfd_interrupt_exit(kfd); | ||
241 | kfd_interrupt_error: | ||
242 | kfd_topology_remove_device(kfd); | 233 | kfd_topology_remove_device(kfd); |
243 | kfd_topology_add_device_error: | 234 | kfd_topology_add_device_error: |
244 | kfd2kgd->fini_sa_manager(kfd->kgd); | 235 | kfd2kgd->fini_sa_manager(kfd->kgd); |
@@ -254,7 +245,6 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd) | |||
254 | if (kfd->init_complete) { | 245 | if (kfd->init_complete) { |
255 | device_queue_manager_uninit(kfd->dqm); | 246 | device_queue_manager_uninit(kfd->dqm); |
256 | amd_iommu_free_device(kfd->pdev); | 247 | amd_iommu_free_device(kfd->pdev); |
257 | kfd_interrupt_exit(kfd); | ||
258 | kfd_topology_remove_device(kfd); | 248 | kfd_topology_remove_device(kfd); |
259 | } | 249 | } |
260 | 250 | ||
@@ -296,13 +286,5 @@ int kgd2kfd_resume(struct kfd_dev *kfd) | |||
296 | /* This is called directly from KGD at ISR. */ | 286 | /* This is called directly from KGD at ISR. */ |
297 | void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) | 287 | void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) |
298 | { | 288 | { |
299 | if (kfd->init_complete) { | 289 | /* Process interrupts / schedule work as necessary */ |
300 | spin_lock(&kfd->interrupt_lock); | ||
301 | |||
302 | if (kfd->interrupts_active | ||
303 | && enqueue_ih_ring_entry(kfd, ih_ring_entry)) | ||
304 | schedule_work(&kfd->interrupt_work); | ||
305 | |||
306 | spin_unlock(&kfd->interrupt_lock); | ||
307 | } | ||
308 | } | 290 | } |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 9c8961d22360..30c8fda9622e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | |||
@@ -280,7 +280,7 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, | |||
280 | q->queue); | 280 | q->queue); |
281 | 281 | ||
282 | retval = mqd->load_mqd(mqd, q->mqd, q->pipe, | 282 | retval = mqd->load_mqd(mqd, q->mqd, q->pipe, |
283 | q->queue, q->properties.write_ptr); | 283 | q->queue, (uint32_t __user *) q->properties.write_ptr); |
284 | if (retval != 0) { | 284 | if (retval != 0) { |
285 | deallocate_hqd(dqm, q); | 285 | deallocate_hqd(dqm, q); |
286 | mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); | 286 | mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c deleted file mode 100644 index 5b999095a1f7..000000000000 --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2014 Advanced Micro Devices, Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * KFD Interrupts. | ||
25 | * | ||
26 | * AMD GPUs deliver interrupts by pushing an interrupt description onto the | ||
27 | * interrupt ring and then sending an interrupt. KGD receives the interrupt | ||
28 | * in ISR and sends us a pointer to each new entry on the interrupt ring. | ||
29 | * | ||
30 | * We generally can't process interrupt-signaled events from ISR, so we call | ||
31 | * out to each interrupt client module (currently only the scheduler) to ask if | ||
32 | * each interrupt is interesting. If they return true, then it requires further | ||
33 | * processing so we copy it to an internal interrupt ring and call each | ||
34 | * interrupt client again from a work-queue. | ||
35 | * | ||
36 | * There's no acknowledgment for the interrupts we use. The hardware simply | ||
37 | * queues a new interrupt each time without waiting. | ||
38 | * | ||
39 | * The fixed-size internal queue means that it's possible for us to lose | ||
40 | * interrupts because we have no back-pressure to the hardware. | ||
41 | */ | ||
42 | |||
43 | #include <linux/slab.h> | ||
44 | #include <linux/device.h> | ||
45 | #include "kfd_priv.h" | ||
46 | |||
47 | #define KFD_INTERRUPT_RING_SIZE 256 | ||
48 | |||
49 | static void interrupt_wq(struct work_struct *); | ||
50 | |||
51 | int kfd_interrupt_init(struct kfd_dev *kfd) | ||
52 | { | ||
53 | void *interrupt_ring = kmalloc_array(KFD_INTERRUPT_RING_SIZE, | ||
54 | kfd->device_info->ih_ring_entry_size, | ||
55 | GFP_KERNEL); | ||
56 | if (!interrupt_ring) | ||
57 | return -ENOMEM; | ||
58 | |||
59 | kfd->interrupt_ring = interrupt_ring; | ||
60 | kfd->interrupt_ring_size = | ||
61 | KFD_INTERRUPT_RING_SIZE * kfd->device_info->ih_ring_entry_size; | ||
62 | atomic_set(&kfd->interrupt_ring_wptr, 0); | ||
63 | atomic_set(&kfd->interrupt_ring_rptr, 0); | ||
64 | |||
65 | spin_lock_init(&kfd->interrupt_lock); | ||
66 | |||
67 | INIT_WORK(&kfd->interrupt_work, interrupt_wq); | ||
68 | |||
69 | kfd->interrupts_active = true; | ||
70 | |||
71 | /* | ||
72 | * After this function returns, the interrupt will be enabled. This | ||
73 | * barrier ensures that the interrupt running on a different processor | ||
74 | * sees all the above writes. | ||
75 | */ | ||
76 | smp_wmb(); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | void kfd_interrupt_exit(struct kfd_dev *kfd) | ||
82 | { | ||
83 | /* | ||
84 | * Stop the interrupt handler from writing to the ring and scheduling | ||
85 | * workqueue items. The spinlock ensures that any interrupt running | ||
86 | * after we have unlocked sees interrupts_active = false. | ||
87 | */ | ||
88 | unsigned long flags; | ||
89 | |||
90 | spin_lock_irqsave(&kfd->interrupt_lock, flags); | ||
91 | kfd->interrupts_active = false; | ||
92 | spin_unlock_irqrestore(&kfd->interrupt_lock, flags); | ||
93 | |||
94 | /* | ||
95 | * Flush_scheduled_work ensures that there are no outstanding | ||
96 | * work-queue items that will access interrupt_ring. New work items | ||
97 | * can't be created because we stopped interrupt handling above. | ||
98 | */ | ||
99 | flush_scheduled_work(); | ||
100 | |||
101 | kfree(kfd->interrupt_ring); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * This assumes that it can't be called concurrently with itself | ||
106 | * but only with dequeue_ih_ring_entry. | ||
107 | */ | ||
108 | bool enqueue_ih_ring_entry(struct kfd_dev *kfd, const void *ih_ring_entry) | ||
109 | { | ||
110 | unsigned int rptr = atomic_read(&kfd->interrupt_ring_rptr); | ||
111 | unsigned int wptr = atomic_read(&kfd->interrupt_ring_wptr); | ||
112 | |||
113 | if ((rptr - wptr) % kfd->interrupt_ring_size == | ||
114 | kfd->device_info->ih_ring_entry_size) { | ||
115 | /* This is very bad, the system is likely to hang. */ | ||
116 | dev_err_ratelimited(kfd_chardev(), | ||
117 | "Interrupt ring overflow, dropping interrupt.\n"); | ||
118 | return false; | ||
119 | } | ||
120 | |||
121 | memcpy(kfd->interrupt_ring + wptr, ih_ring_entry, | ||
122 | kfd->device_info->ih_ring_entry_size); | ||
123 | |||
124 | wptr = (wptr + kfd->device_info->ih_ring_entry_size) % | ||
125 | kfd->interrupt_ring_size; | ||
126 | smp_wmb(); /* Ensure memcpy'd data is visible before wptr update. */ | ||
127 | atomic_set(&kfd->interrupt_ring_wptr, wptr); | ||
128 | |||
129 | return true; | ||
130 | } | ||
131 | |||
132 | /* | ||
133 | * This assumes that it can't be called concurrently with itself | ||
134 | * but only with enqueue_ih_ring_entry. | ||
135 | */ | ||
136 | static bool dequeue_ih_ring_entry(struct kfd_dev *kfd, void *ih_ring_entry) | ||
137 | { | ||
138 | /* | ||
139 | * Assume that wait queues have an implicit barrier, i.e. anything that | ||
140 | * happened in the ISR before it queued work is visible. | ||
141 | */ | ||
142 | |||
143 | unsigned int wptr = atomic_read(&kfd->interrupt_ring_wptr); | ||
144 | unsigned int rptr = atomic_read(&kfd->interrupt_ring_rptr); | ||
145 | |||
146 | if (rptr == wptr) | ||
147 | return false; | ||
148 | |||
149 | memcpy(ih_ring_entry, kfd->interrupt_ring + rptr, | ||
150 | kfd->device_info->ih_ring_entry_size); | ||
151 | |||
152 | rptr = (rptr + kfd->device_info->ih_ring_entry_size) % | ||
153 | kfd->interrupt_ring_size; | ||
154 | |||
155 | /* | ||
156 | * Ensure the rptr write update is not visible until | ||
157 | * memcpy has finished reading. | ||
158 | */ | ||
159 | smp_mb(); | ||
160 | atomic_set(&kfd->interrupt_ring_rptr, rptr); | ||
161 | |||
162 | return true; | ||
163 | } | ||
164 | |||
165 | static void interrupt_wq(struct work_struct *work) | ||
166 | { | ||
167 | struct kfd_dev *dev = container_of(work, struct kfd_dev, | ||
168 | interrupt_work); | ||
169 | |||
170 | uint32_t ih_ring_entry[DIV_ROUND_UP( | ||
171 | dev->device_info->ih_ring_entry_size, | ||
172 | sizeof(uint32_t))]; | ||
173 | |||
174 | while (dequeue_ih_ring_entry(dev, ih_ring_entry)) | ||
175 | ; | ||
176 | } | ||
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index a5edb29507e3..b3dc13c83169 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h | |||
@@ -135,22 +135,10 @@ struct kfd_dev { | |||
135 | 135 | ||
136 | struct kgd2kfd_shared_resources shared_resources; | 136 | struct kgd2kfd_shared_resources shared_resources; |
137 | 137 | ||
138 | void *interrupt_ring; | ||
139 | size_t interrupt_ring_size; | ||
140 | atomic_t interrupt_ring_rptr; | ||
141 | atomic_t interrupt_ring_wptr; | ||
142 | struct work_struct interrupt_work; | ||
143 | spinlock_t interrupt_lock; | ||
144 | |||
145 | /* QCM Device instance */ | 138 | /* QCM Device instance */ |
146 | struct device_queue_manager *dqm; | 139 | struct device_queue_manager *dqm; |
147 | 140 | ||
148 | bool init_complete; | 141 | bool init_complete; |
149 | /* | ||
150 | * Interrupts of interest to KFD are copied | ||
151 | * from the HW ring into a SW ring. | ||
152 | */ | ||
153 | bool interrupts_active; | ||
154 | }; | 142 | }; |
155 | 143 | ||
156 | /* KGD2KFD callbacks */ | 144 | /* KGD2KFD callbacks */ |
@@ -531,10 +519,7 @@ struct kfd_dev *kfd_device_by_pci_dev(const struct pci_dev *pdev); | |||
531 | struct kfd_dev *kfd_topology_enum_kfd_devices(uint8_t idx); | 519 | struct kfd_dev *kfd_topology_enum_kfd_devices(uint8_t idx); |
532 | 520 | ||
533 | /* Interrupts */ | 521 | /* Interrupts */ |
534 | int kfd_interrupt_init(struct kfd_dev *dev); | ||
535 | void kfd_interrupt_exit(struct kfd_dev *dev); | ||
536 | void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry); | 522 | void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry); |
537 | bool enqueue_ih_ring_entry(struct kfd_dev *kfd, const void *ih_ring_entry); | ||
538 | 523 | ||
539 | /* Power Management */ | 524 | /* Power Management */ |
540 | void kgd2kfd_suspend(struct kfd_dev *kfd); | 525 | void kgd2kfd_suspend(struct kfd_dev *kfd); |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 52ce26d6b4fb..cf775a4449c1 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -741,7 +741,9 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) | |||
741 | int i, j, rc = 0; | 741 | int i, j, rc = 0; |
742 | int start; | 742 | int start; |
743 | 743 | ||
744 | drm_modeset_lock_all(dev); | 744 | if (__drm_modeset_lock_all(dev, !!oops_in_progress)) { |
745 | return -EBUSY; | ||
746 | } | ||
745 | if (!drm_fb_helper_is_bound(fb_helper)) { | 747 | if (!drm_fb_helper_is_bound(fb_helper)) { |
746 | drm_modeset_unlock_all(dev); | 748 | drm_modeset_unlock_all(dev); |
747 | return -EBUSY; | 749 | return -EBUSY; |
@@ -915,7 +917,9 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, | |||
915 | int ret = 0; | 917 | int ret = 0; |
916 | int i; | 918 | int i; |
917 | 919 | ||
918 | drm_modeset_lock_all(dev); | 920 | if (__drm_modeset_lock_all(dev, !!oops_in_progress)) { |
921 | return -EBUSY; | ||
922 | } | ||
919 | if (!drm_fb_helper_is_bound(fb_helper)) { | 923 | if (!drm_fb_helper_is_bound(fb_helper)) { |
920 | drm_modeset_unlock_all(dev); | 924 | drm_modeset_unlock_all(dev); |
921 | return -EBUSY; | 925 | return -EBUSY; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 121470a83d1a..1bcbe07cecfc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -645,18 +645,6 @@ static int exynos_drm_init(void) | |||
645 | if (!is_exynos) | 645 | if (!is_exynos) |
646 | return -ENODEV; | 646 | return -ENODEV; |
647 | 647 | ||
648 | /* | ||
649 | * Register device object only in case of Exynos SoC. | ||
650 | * | ||
651 | * Below codes resolves temporarily infinite loop issue incurred | ||
652 | * by Exynos drm driver when using multi-platform kernel. | ||
653 | * So these codes will be replaced with more generic way later. | ||
654 | */ | ||
655 | if (!of_machine_is_compatible("samsung,exynos3") && | ||
656 | !of_machine_is_compatible("samsung,exynos4") && | ||
657 | !of_machine_is_compatible("samsung,exynos5")) | ||
658 | return -ENODEV; | ||
659 | |||
660 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, | 648 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, |
661 | NULL, 0); | 649 | NULL, 0); |
662 | if (IS_ERR(exynos_drm_pdev)) | 650 | if (IS_ERR(exynos_drm_pdev)) |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 5765a161abdd..98051e8e855a 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -1669,7 +1669,6 @@ static void hdmi_mode_apply(struct hdmi_context *hdata) | |||
1669 | 1669 | ||
1670 | static void hdmiphy_conf_reset(struct hdmi_context *hdata) | 1670 | static void hdmiphy_conf_reset(struct hdmi_context *hdata) |
1671 | { | 1671 | { |
1672 | u8 buffer[2]; | ||
1673 | u32 reg; | 1672 | u32 reg; |
1674 | 1673 | ||
1675 | clk_disable_unprepare(hdata->res.sclk_hdmi); | 1674 | clk_disable_unprepare(hdata->res.sclk_hdmi); |
@@ -1677,11 +1676,8 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata) | |||
1677 | clk_prepare_enable(hdata->res.sclk_hdmi); | 1676 | clk_prepare_enable(hdata->res.sclk_hdmi); |
1678 | 1677 | ||
1679 | /* operation mode */ | 1678 | /* operation mode */ |
1680 | buffer[0] = 0x1f; | 1679 | hdmiphy_reg_writeb(hdata, HDMIPHY_MODE_SET_DONE, |
1681 | buffer[1] = 0x00; | 1680 | HDMI_PHY_ENABLE_MODE_SET); |
1682 | |||
1683 | if (hdata->hdmiphy_port) | ||
1684 | i2c_master_send(hdata->hdmiphy_port, buffer, 2); | ||
1685 | 1681 | ||
1686 | if (hdata->type == HDMI_TYPE13) | 1682 | if (hdata->type == HDMI_TYPE13) |
1687 | reg = HDMI_V13_PHY_RSTOUT; | 1683 | reg = HDMI_V13_PHY_RSTOUT; |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 820b76234ef4..064ed6597def 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -1026,6 +1026,7 @@ static void mixer_win_disable(struct exynos_drm_manager *mgr, int zpos) | |||
1026 | static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | 1026 | static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) |
1027 | { | 1027 | { |
1028 | struct mixer_context *mixer_ctx = mgr_to_mixer(mgr); | 1028 | struct mixer_context *mixer_ctx = mgr_to_mixer(mgr); |
1029 | int err; | ||
1029 | 1030 | ||
1030 | mutex_lock(&mixer_ctx->mixer_mutex); | 1031 | mutex_lock(&mixer_ctx->mixer_mutex); |
1031 | if (!mixer_ctx->powered) { | 1032 | if (!mixer_ctx->powered) { |
@@ -1034,7 +1035,11 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
1034 | } | 1035 | } |
1035 | mutex_unlock(&mixer_ctx->mixer_mutex); | 1036 | mutex_unlock(&mixer_ctx->mixer_mutex); |
1036 | 1037 | ||
1037 | drm_vblank_get(mgr->crtc->dev, mixer_ctx->pipe); | 1038 | err = drm_vblank_get(mgr->crtc->dev, mixer_ctx->pipe); |
1039 | if (err < 0) { | ||
1040 | DRM_DEBUG_KMS("failed to acquire vblank counter\n"); | ||
1041 | return; | ||
1042 | } | ||
1038 | 1043 | ||
1039 | atomic_set(&mixer_ctx->wait_vsync_event, 1); | 1044 | atomic_set(&mixer_ctx->wait_vsync_event, 1); |
1040 | 1045 | ||
@@ -1262,8 +1267,6 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data) | |||
1262 | return ret; | 1267 | return ret; |
1263 | } | 1268 | } |
1264 | 1269 | ||
1265 | pm_runtime_enable(dev); | ||
1266 | |||
1267 | return 0; | 1270 | return 0; |
1268 | } | 1271 | } |
1269 | 1272 | ||
@@ -1272,8 +1275,6 @@ static void mixer_unbind(struct device *dev, struct device *master, void *data) | |||
1272 | struct mixer_context *ctx = dev_get_drvdata(dev); | 1275 | struct mixer_context *ctx = dev_get_drvdata(dev); |
1273 | 1276 | ||
1274 | mixer_mgr_remove(&ctx->manager); | 1277 | mixer_mgr_remove(&ctx->manager); |
1275 | |||
1276 | pm_runtime_disable(dev); | ||
1277 | } | 1278 | } |
1278 | 1279 | ||
1279 | static const struct component_ops mixer_component_ops = { | 1280 | static const struct component_ops mixer_component_ops = { |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c11603b4cf1d..76354d3ba925 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -5155,7 +5155,7 @@ static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task) | |||
5155 | if (!mutex_is_locked(mutex)) | 5155 | if (!mutex_is_locked(mutex)) |
5156 | return false; | 5156 | return false; |
5157 | 5157 | ||
5158 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES) | 5158 | #if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES) |
5159 | return mutex->owner == task; | 5159 | return mutex->owner == task; |
5160 | #else | 5160 | #else |
5161 | /* Since UP may be pre-empted, we cannot assume that we own the lock */ | 5161 | /* Since UP may be pre-empted, we cannot assume that we own the lock */ |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index d0d3dfbe6d2a..b051a238baf9 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -292,6 +292,23 @@ void gen6_enable_rps_interrupts(struct drm_device *dev) | |||
292 | spin_unlock_irq(&dev_priv->irq_lock); | 292 | spin_unlock_irq(&dev_priv->irq_lock); |
293 | } | 293 | } |
294 | 294 | ||
295 | u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask) | ||
296 | { | ||
297 | /* | ||
298 | * SNB,IVB can while VLV,CHV may hard hang on looping batchbuffer | ||
299 | * if GEN6_PM_UP_EI_EXPIRED is masked. | ||
300 | * | ||
301 | * TODO: verify if this can be reproduced on VLV,CHV. | ||
302 | */ | ||
303 | if (INTEL_INFO(dev_priv)->gen <= 7 && !IS_HASWELL(dev_priv)) | ||
304 | mask &= ~GEN6_PM_RP_UP_EI_EXPIRED; | ||
305 | |||
306 | if (INTEL_INFO(dev_priv)->gen >= 8) | ||
307 | mask &= ~GEN8_PMINTR_REDIRECT_TO_NON_DISP; | ||
308 | |||
309 | return mask; | ||
310 | } | ||
311 | |||
295 | void gen6_disable_rps_interrupts(struct drm_device *dev) | 312 | void gen6_disable_rps_interrupts(struct drm_device *dev) |
296 | { | 313 | { |
297 | struct drm_i915_private *dev_priv = dev->dev_private; | 314 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -304,8 +321,7 @@ void gen6_disable_rps_interrupts(struct drm_device *dev) | |||
304 | 321 | ||
305 | spin_lock_irq(&dev_priv->irq_lock); | 322 | spin_lock_irq(&dev_priv->irq_lock); |
306 | 323 | ||
307 | I915_WRITE(GEN6_PMINTRMSK, INTEL_INFO(dev_priv)->gen >= 8 ? | 324 | I915_WRITE(GEN6_PMINTRMSK, gen6_sanitize_rps_pm_mask(dev_priv, ~0)); |
308 | ~GEN8_PMINTR_REDIRECT_TO_NON_DISP : ~0); | ||
309 | 325 | ||
310 | __gen6_disable_pm_irq(dev_priv, dev_priv->pm_rps_events); | 326 | __gen6_disable_pm_irq(dev_priv, dev_priv->pm_rps_events); |
311 | I915_WRITE(gen6_pm_ier(dev_priv), I915_READ(gen6_pm_ier(dev_priv)) & | 327 | I915_WRITE(gen6_pm_ier(dev_priv), I915_READ(gen6_pm_ier(dev_priv)) & |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e2af1383b179..e7a16f119a29 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -9815,7 +9815,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
9815 | if (obj->tiling_mode != work->old_fb_obj->tiling_mode) | 9815 | if (obj->tiling_mode != work->old_fb_obj->tiling_mode) |
9816 | /* vlv: DISPLAY_FLIP fails to change tiling */ | 9816 | /* vlv: DISPLAY_FLIP fails to change tiling */ |
9817 | ring = NULL; | 9817 | ring = NULL; |
9818 | } else if (IS_IVYBRIDGE(dev)) { | 9818 | } else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) { |
9819 | ring = &dev_priv->ring[BCS]; | 9819 | ring = &dev_priv->ring[BCS]; |
9820 | } else if (INTEL_INFO(dev)->gen >= 7) { | 9820 | } else if (INTEL_INFO(dev)->gen >= 7) { |
9821 | ring = obj->ring; | 9821 | ring = obj->ring; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 25fdbb16d4e0..3b40a17b8852 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -794,6 +794,7 @@ void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask); | |||
794 | void gen6_reset_rps_interrupts(struct drm_device *dev); | 794 | void gen6_reset_rps_interrupts(struct drm_device *dev); |
795 | void gen6_enable_rps_interrupts(struct drm_device *dev); | 795 | void gen6_enable_rps_interrupts(struct drm_device *dev); |
796 | void gen6_disable_rps_interrupts(struct drm_device *dev); | 796 | void gen6_disable_rps_interrupts(struct drm_device *dev); |
797 | u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask); | ||
797 | void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv); | 798 | void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv); |
798 | void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv); | 799 | void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv); |
799 | static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv) | 800 | static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 964b28e3c630..bf814a64582a 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -4363,16 +4363,7 @@ static u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val) | |||
4363 | mask |= dev_priv->pm_rps_events & (GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_UP_EI_EXPIRED); | 4363 | mask |= dev_priv->pm_rps_events & (GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_UP_EI_EXPIRED); |
4364 | mask &= dev_priv->pm_rps_events; | 4364 | mask &= dev_priv->pm_rps_events; |
4365 | 4365 | ||
4366 | /* IVB and SNB hard hangs on looping batchbuffer | 4366 | return gen6_sanitize_rps_pm_mask(dev_priv, ~mask); |
4367 | * if GEN6_PM_UP_EI_EXPIRED is masked. | ||
4368 | */ | ||
4369 | if (INTEL_INFO(dev_priv->dev)->gen <= 7 && !IS_HASWELL(dev_priv->dev)) | ||
4370 | mask |= GEN6_PM_RP_UP_EI_EXPIRED; | ||
4371 | |||
4372 | if (IS_GEN8(dev_priv->dev)) | ||
4373 | mask |= GEN8_PMINTR_REDIRECT_TO_NON_DISP; | ||
4374 | |||
4375 | return ~mask; | ||
4376 | } | 4367 | } |
4377 | 4368 | ||
4378 | /* gen6_set_rps is called to update the frequency request, but should also be | 4369 | /* gen6_set_rps is called to update the frequency request, but should also be |
@@ -4441,7 +4432,8 @@ static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) | |||
4441 | return; | 4432 | return; |
4442 | 4433 | ||
4443 | /* Mask turbo interrupt so that they will not come in between */ | 4434 | /* Mask turbo interrupt so that they will not come in between */ |
4444 | I915_WRITE(GEN6_PMINTRMSK, 0xffffffff); | 4435 | I915_WRITE(GEN6_PMINTRMSK, |
4436 | gen6_sanitize_rps_pm_mask(dev_priv, ~0)); | ||
4445 | 4437 | ||
4446 | vlv_force_gfx_clock(dev_priv, true); | 4438 | vlv_force_gfx_clock(dev_priv, true); |
4447 | 4439 | ||
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 6dcde3798b45..64fdae558d36 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -6033,6 +6033,17 @@ void cik_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | |||
6033 | radeon_ring_write(ring, 0); | 6033 | radeon_ring_write(ring, 0); |
6034 | radeon_ring_write(ring, 1 << vm_id); | 6034 | radeon_ring_write(ring, 1 << vm_id); |
6035 | 6035 | ||
6036 | /* wait for the invalidate to complete */ | ||
6037 | radeon_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); | ||
6038 | radeon_ring_write(ring, (WAIT_REG_MEM_OPERATION(0) | /* wait */ | ||
6039 | WAIT_REG_MEM_FUNCTION(0) | /* always */ | ||
6040 | WAIT_REG_MEM_ENGINE(0))); /* me */ | ||
6041 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | ||
6042 | radeon_ring_write(ring, 0); | ||
6043 | radeon_ring_write(ring, 0); /* ref */ | ||
6044 | radeon_ring_write(ring, 0); /* mask */ | ||
6045 | radeon_ring_write(ring, 0x20); /* poll interval */ | ||
6046 | |||
6036 | /* compute doesn't have PFP */ | 6047 | /* compute doesn't have PFP */ |
6037 | if (usepfp) { | 6048 | if (usepfp) { |
6038 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | 6049 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ |
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index dde5c7e29eb2..a0133c74f4cf 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -903,6 +903,9 @@ void cik_sdma_vm_pad_ib(struct radeon_ib *ib) | |||
903 | void cik_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | 903 | void cik_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, |
904 | unsigned vm_id, uint64_t pd_addr) | 904 | unsigned vm_id, uint64_t pd_addr) |
905 | { | 905 | { |
906 | u32 extra_bits = (SDMA_POLL_REG_MEM_EXTRA_OP(0) | | ||
907 | SDMA_POLL_REG_MEM_EXTRA_FUNC(0)); /* always */ | ||
908 | |||
906 | radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000)); | 909 | radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000)); |
907 | if (vm_id < 8) { | 910 | if (vm_id < 8) { |
908 | radeon_ring_write(ring, (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm_id << 2)) >> 2); | 911 | radeon_ring_write(ring, (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm_id << 2)) >> 2); |
@@ -943,5 +946,12 @@ void cik_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | |||
943 | radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000)); | 946 | radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_SRBM_WRITE, 0, 0xf000)); |
944 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | 947 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
945 | radeon_ring_write(ring, 1 << vm_id); | 948 | radeon_ring_write(ring, 1 << vm_id); |
949 | |||
950 | radeon_ring_write(ring, SDMA_PACKET(SDMA_OPCODE_POLL_REG_MEM, 0, extra_bits)); | ||
951 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | ||
952 | radeon_ring_write(ring, 0); | ||
953 | radeon_ring_write(ring, 0); /* reference */ | ||
954 | radeon_ring_write(ring, 0); /* mask */ | ||
955 | radeon_ring_write(ring, (0xfff << 16) | 10); /* retry count, poll interval */ | ||
946 | } | 956 | } |
947 | 957 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 360de9f1f491..aea48c89b241 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -2516,6 +2516,16 @@ void cayman_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | |||
2516 | radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); | 2516 | radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); |
2517 | radeon_ring_write(ring, 1 << vm_id); | 2517 | radeon_ring_write(ring, 1 << vm_id); |
2518 | 2518 | ||
2519 | /* wait for the invalidate to complete */ | ||
2520 | radeon_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); | ||
2521 | radeon_ring_write(ring, (WAIT_REG_MEM_FUNCTION(0) | /* always */ | ||
2522 | WAIT_REG_MEM_ENGINE(0))); /* me */ | ||
2523 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | ||
2524 | radeon_ring_write(ring, 0); | ||
2525 | radeon_ring_write(ring, 0); /* ref */ | ||
2526 | radeon_ring_write(ring, 0); /* mask */ | ||
2527 | radeon_ring_write(ring, 0x20); /* poll interval */ | ||
2528 | |||
2519 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | 2529 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ |
2520 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | 2530 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); |
2521 | radeon_ring_write(ring, 0x0); | 2531 | radeon_ring_write(ring, 0x0); |
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c index 50f88611ff60..4be2bb7cbef3 100644 --- a/drivers/gpu/drm/radeon/ni_dma.c +++ b/drivers/gpu/drm/radeon/ni_dma.c | |||
@@ -463,5 +463,11 @@ void cayman_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | |||
463 | radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0)); | 463 | radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0)); |
464 | radeon_ring_write(ring, (0xf << 16) | (VM_INVALIDATE_REQUEST >> 2)); | 464 | radeon_ring_write(ring, (0xf << 16) | (VM_INVALIDATE_REQUEST >> 2)); |
465 | radeon_ring_write(ring, 1 << vm_id); | 465 | radeon_ring_write(ring, 1 << vm_id); |
466 | |||
467 | /* wait for invalidate to complete */ | ||
468 | radeon_ring_write(ring, DMA_SRBM_READ_PACKET); | ||
469 | radeon_ring_write(ring, (0xff << 20) | (VM_INVALIDATE_REQUEST >> 2)); | ||
470 | radeon_ring_write(ring, 0); /* mask */ | ||
471 | radeon_ring_write(ring, 0); /* value */ | ||
466 | } | 472 | } |
467 | 473 | ||
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h index 2e12e4d69253..ad7125486894 100644 --- a/drivers/gpu/drm/radeon/nid.h +++ b/drivers/gpu/drm/radeon/nid.h | |||
@@ -1133,6 +1133,23 @@ | |||
1133 | #define PACKET3_MEM_SEMAPHORE 0x39 | 1133 | #define PACKET3_MEM_SEMAPHORE 0x39 |
1134 | #define PACKET3_MPEG_INDEX 0x3A | 1134 | #define PACKET3_MPEG_INDEX 0x3A |
1135 | #define PACKET3_WAIT_REG_MEM 0x3C | 1135 | #define PACKET3_WAIT_REG_MEM 0x3C |
1136 | #define WAIT_REG_MEM_FUNCTION(x) ((x) << 0) | ||
1137 | /* 0 - always | ||
1138 | * 1 - < | ||
1139 | * 2 - <= | ||
1140 | * 3 - == | ||
1141 | * 4 - != | ||
1142 | * 5 - >= | ||
1143 | * 6 - > | ||
1144 | */ | ||
1145 | #define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4) | ||
1146 | /* 0 - reg | ||
1147 | * 1 - mem | ||
1148 | */ | ||
1149 | #define WAIT_REG_MEM_ENGINE(x) ((x) << 8) | ||
1150 | /* 0 - me | ||
1151 | * 1 - pfp | ||
1152 | */ | ||
1136 | #define PACKET3_MEM_WRITE 0x3D | 1153 | #define PACKET3_MEM_WRITE 0x3D |
1137 | #define PACKET3_PFP_SYNC_ME 0x42 | 1154 | #define PACKET3_PFP_SYNC_ME 0x42 |
1138 | #define PACKET3_SURFACE_SYNC 0x43 | 1155 | #define PACKET3_SURFACE_SYNC 0x43 |
@@ -1272,6 +1289,13 @@ | |||
1272 | (1 << 21) | \ | 1289 | (1 << 21) | \ |
1273 | (((n) & 0xFFFFF) << 0)) | 1290 | (((n) & 0xFFFFF) << 0)) |
1274 | 1291 | ||
1292 | #define DMA_SRBM_POLL_PACKET ((9 << 28) | \ | ||
1293 | (1 << 27) | \ | ||
1294 | (1 << 26)) | ||
1295 | |||
1296 | #define DMA_SRBM_READ_PACKET ((9 << 28) | \ | ||
1297 | (1 << 27)) | ||
1298 | |||
1275 | /* async DMA Packet types */ | 1299 | /* async DMA Packet types */ |
1276 | #define DMA_PACKET_WRITE 0x2 | 1300 | #define DMA_PACKET_WRITE 0x2 |
1277 | #define DMA_PACKET_COPY 0x3 | 1301 | #define DMA_PACKET_COPY 0x3 |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 850de57069be..121aff6a3b41 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -333,6 +333,20 @@ static struct radeon_asic_ring r300_gfx_ring = { | |||
333 | .set_wptr = &r100_gfx_set_wptr, | 333 | .set_wptr = &r100_gfx_set_wptr, |
334 | }; | 334 | }; |
335 | 335 | ||
336 | static struct radeon_asic_ring rv515_gfx_ring = { | ||
337 | .ib_execute = &r100_ring_ib_execute, | ||
338 | .emit_fence = &r300_fence_ring_emit, | ||
339 | .emit_semaphore = &r100_semaphore_ring_emit, | ||
340 | .cs_parse = &r300_cs_parse, | ||
341 | .ring_start = &rv515_ring_start, | ||
342 | .ring_test = &r100_ring_test, | ||
343 | .ib_test = &r100_ib_test, | ||
344 | .is_lockup = &r100_gpu_is_lockup, | ||
345 | .get_rptr = &r100_gfx_get_rptr, | ||
346 | .get_wptr = &r100_gfx_get_wptr, | ||
347 | .set_wptr = &r100_gfx_set_wptr, | ||
348 | }; | ||
349 | |||
336 | static struct radeon_asic r300_asic = { | 350 | static struct radeon_asic r300_asic = { |
337 | .init = &r300_init, | 351 | .init = &r300_init, |
338 | .fini = &r300_fini, | 352 | .fini = &r300_fini, |
@@ -748,7 +762,7 @@ static struct radeon_asic rv515_asic = { | |||
748 | .set_page = &rv370_pcie_gart_set_page, | 762 | .set_page = &rv370_pcie_gart_set_page, |
749 | }, | 763 | }, |
750 | .ring = { | 764 | .ring = { |
751 | [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring | 765 | [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring |
752 | }, | 766 | }, |
753 | .irq = { | 767 | .irq = { |
754 | .set = &rs600_irq_set, | 768 | .set = &rs600_irq_set, |
@@ -814,7 +828,7 @@ static struct radeon_asic r520_asic = { | |||
814 | .set_page = &rv370_pcie_gart_set_page, | 828 | .set_page = &rv370_pcie_gart_set_page, |
815 | }, | 829 | }, |
816 | .ring = { | 830 | .ring = { |
817 | [RADEON_RING_TYPE_GFX_INDEX] = &r300_gfx_ring | 831 | [RADEON_RING_TYPE_GFX_INDEX] = &rv515_gfx_ring |
818 | }, | 832 | }, |
819 | .irq = { | 833 | .irq = { |
820 | .set = &rs600_irq_set, | 834 | .set = &rs600_irq_set, |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index a46f73737994..d0b4f7d1140d 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -576,7 +576,7 @@ error_unreserve: | |||
576 | error_free: | 576 | error_free: |
577 | drm_free_large(vm_bos); | 577 | drm_free_large(vm_bos); |
578 | 578 | ||
579 | if (r) | 579 | if (r && r != -ERESTARTSYS) |
580 | DRM_ERROR("Couldn't update BO_VA (%d)\n", r); | 580 | DRM_ERROR("Couldn't update BO_VA (%d)\n", r); |
581 | } | 581 | } |
582 | 582 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 32522cc940a1..f7da8fe96a66 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -1287,8 +1287,39 @@ dpm_failed: | |||
1287 | return ret; | 1287 | return ret; |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | struct radeon_dpm_quirk { | ||
1291 | u32 chip_vendor; | ||
1292 | u32 chip_device; | ||
1293 | u32 subsys_vendor; | ||
1294 | u32 subsys_device; | ||
1295 | }; | ||
1296 | |||
1297 | /* cards with dpm stability problems */ | ||
1298 | static struct radeon_dpm_quirk radeon_dpm_quirk_list[] = { | ||
1299 | /* TURKS - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386534 */ | ||
1300 | { PCI_VENDOR_ID_ATI, 0x6759, 0x1682, 0x3195 }, | ||
1301 | /* TURKS - https://bugzilla.kernel.org/show_bug.cgi?id=83731 */ | ||
1302 | { PCI_VENDOR_ID_ATI, 0x6840, 0x1179, 0xfb81 }, | ||
1303 | { 0, 0, 0, 0 }, | ||
1304 | }; | ||
1305 | |||
1290 | int radeon_pm_init(struct radeon_device *rdev) | 1306 | int radeon_pm_init(struct radeon_device *rdev) |
1291 | { | 1307 | { |
1308 | struct radeon_dpm_quirk *p = radeon_dpm_quirk_list; | ||
1309 | bool disable_dpm = false; | ||
1310 | |||
1311 | /* Apply dpm quirks */ | ||
1312 | while (p && p->chip_device != 0) { | ||
1313 | if (rdev->pdev->vendor == p->chip_vendor && | ||
1314 | rdev->pdev->device == p->chip_device && | ||
1315 | rdev->pdev->subsystem_vendor == p->subsys_vendor && | ||
1316 | rdev->pdev->subsystem_device == p->subsys_device) { | ||
1317 | disable_dpm = true; | ||
1318 | break; | ||
1319 | } | ||
1320 | ++p; | ||
1321 | } | ||
1322 | |||
1292 | /* enable dpm on rv6xx+ */ | 1323 | /* enable dpm on rv6xx+ */ |
1293 | switch (rdev->family) { | 1324 | switch (rdev->family) { |
1294 | case CHIP_RV610: | 1325 | case CHIP_RV610: |
@@ -1344,6 +1375,8 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1344 | (!(rdev->flags & RADEON_IS_IGP)) && | 1375 | (!(rdev->flags & RADEON_IS_IGP)) && |
1345 | (!rdev->smc_fw)) | 1376 | (!rdev->smc_fw)) |
1346 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1377 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
1378 | else if (disable_dpm && (radeon_dpm == -1)) | ||
1379 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1347 | else if (radeon_dpm == 0) | 1380 | else if (radeon_dpm == 0) |
1348 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1381 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
1349 | else | 1382 | else |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 60df444bd075..5d89b874a1a2 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -5057,6 +5057,16 @@ void si_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | |||
5057 | radeon_ring_write(ring, 0); | 5057 | radeon_ring_write(ring, 0); |
5058 | radeon_ring_write(ring, 1 << vm_id); | 5058 | radeon_ring_write(ring, 1 << vm_id); |
5059 | 5059 | ||
5060 | /* wait for the invalidate to complete */ | ||
5061 | radeon_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); | ||
5062 | radeon_ring_write(ring, (WAIT_REG_MEM_FUNCTION(0) | /* always */ | ||
5063 | WAIT_REG_MEM_ENGINE(0))); /* me */ | ||
5064 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | ||
5065 | radeon_ring_write(ring, 0); | ||
5066 | radeon_ring_write(ring, 0); /* ref */ | ||
5067 | radeon_ring_write(ring, 0); /* mask */ | ||
5068 | radeon_ring_write(ring, 0x20); /* poll interval */ | ||
5069 | |||
5060 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | 5070 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ |
5061 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | 5071 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); |
5062 | radeon_ring_write(ring, 0x0); | 5072 | radeon_ring_write(ring, 0x0); |
diff --git a/drivers/gpu/drm/radeon/si_dma.c b/drivers/gpu/drm/radeon/si_dma.c index f5cc777e1c5f..aa7b872b2c43 100644 --- a/drivers/gpu/drm/radeon/si_dma.c +++ b/drivers/gpu/drm/radeon/si_dma.c | |||
@@ -206,6 +206,14 @@ void si_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, | |||
206 | radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0, 0)); | 206 | radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0, 0)); |
207 | radeon_ring_write(ring, (0xf << 16) | (VM_INVALIDATE_REQUEST >> 2)); | 207 | radeon_ring_write(ring, (0xf << 16) | (VM_INVALIDATE_REQUEST >> 2)); |
208 | radeon_ring_write(ring, 1 << vm_id); | 208 | radeon_ring_write(ring, 1 << vm_id); |
209 | |||
210 | /* wait for invalidate to complete */ | ||
211 | radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_POLL_REG_MEM, 0, 0, 0, 0)); | ||
212 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST); | ||
213 | radeon_ring_write(ring, 0xff << 16); /* retry */ | ||
214 | radeon_ring_write(ring, 1 << vm_id); /* mask */ | ||
215 | radeon_ring_write(ring, 0); /* value */ | ||
216 | radeon_ring_write(ring, (0 << 28) | 0x20); /* func(always) | poll interval */ | ||
209 | } | 217 | } |
210 | 218 | ||
211 | /** | 219 | /** |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 32e354b8b0ab..eff8a6444956 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -2908,6 +2908,22 @@ static int si_init_smc_spll_table(struct radeon_device *rdev) | |||
2908 | return ret; | 2908 | return ret; |
2909 | } | 2909 | } |
2910 | 2910 | ||
2911 | struct si_dpm_quirk { | ||
2912 | u32 chip_vendor; | ||
2913 | u32 chip_device; | ||
2914 | u32 subsys_vendor; | ||
2915 | u32 subsys_device; | ||
2916 | u32 max_sclk; | ||
2917 | u32 max_mclk; | ||
2918 | }; | ||
2919 | |||
2920 | /* cards with dpm stability problems */ | ||
2921 | static struct si_dpm_quirk si_dpm_quirk_list[] = { | ||
2922 | /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ | ||
2923 | { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, | ||
2924 | { 0, 0, 0, 0 }, | ||
2925 | }; | ||
2926 | |||
2911 | static void si_apply_state_adjust_rules(struct radeon_device *rdev, | 2927 | static void si_apply_state_adjust_rules(struct radeon_device *rdev, |
2912 | struct radeon_ps *rps) | 2928 | struct radeon_ps *rps) |
2913 | { | 2929 | { |
@@ -2918,7 +2934,22 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2918 | u32 mclk, sclk; | 2934 | u32 mclk, sclk; |
2919 | u16 vddc, vddci; | 2935 | u16 vddc, vddci; |
2920 | u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; | 2936 | u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; |
2937 | u32 max_sclk = 0, max_mclk = 0; | ||
2921 | int i; | 2938 | int i; |
2939 | struct si_dpm_quirk *p = si_dpm_quirk_list; | ||
2940 | |||
2941 | /* Apply dpm quirks */ | ||
2942 | while (p && p->chip_device != 0) { | ||
2943 | if (rdev->pdev->vendor == p->chip_vendor && | ||
2944 | rdev->pdev->device == p->chip_device && | ||
2945 | rdev->pdev->subsystem_vendor == p->subsys_vendor && | ||
2946 | rdev->pdev->subsystem_device == p->subsys_device) { | ||
2947 | max_sclk = p->max_sclk; | ||
2948 | max_mclk = p->max_mclk; | ||
2949 | break; | ||
2950 | } | ||
2951 | ++p; | ||
2952 | } | ||
2922 | 2953 | ||
2923 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || | 2954 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || |
2924 | ni_dpm_vblank_too_short(rdev)) | 2955 | ni_dpm_vblank_too_short(rdev)) |
@@ -2972,6 +3003,14 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2972 | if (ps->performance_levels[i].mclk > max_mclk_vddc) | 3003 | if (ps->performance_levels[i].mclk > max_mclk_vddc) |
2973 | ps->performance_levels[i].mclk = max_mclk_vddc; | 3004 | ps->performance_levels[i].mclk = max_mclk_vddc; |
2974 | } | 3005 | } |
3006 | if (max_mclk) { | ||
3007 | if (ps->performance_levels[i].mclk > max_mclk) | ||
3008 | ps->performance_levels[i].mclk = max_mclk; | ||
3009 | } | ||
3010 | if (max_sclk) { | ||
3011 | if (ps->performance_levels[i].sclk > max_sclk) | ||
3012 | ps->performance_levels[i].sclk = max_sclk; | ||
3013 | } | ||
2975 | } | 3014 | } |
2976 | 3015 | ||
2977 | /* XXX validate the min clocks required for display */ | 3016 | /* XXX validate the min clocks required for display */ |
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index 4069be89e585..84999242c747 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h | |||
@@ -1632,6 +1632,23 @@ | |||
1632 | #define PACKET3_MPEG_INDEX 0x3A | 1632 | #define PACKET3_MPEG_INDEX 0x3A |
1633 | #define PACKET3_COPY_DW 0x3B | 1633 | #define PACKET3_COPY_DW 0x3B |
1634 | #define PACKET3_WAIT_REG_MEM 0x3C | 1634 | #define PACKET3_WAIT_REG_MEM 0x3C |
1635 | #define WAIT_REG_MEM_FUNCTION(x) ((x) << 0) | ||
1636 | /* 0 - always | ||
1637 | * 1 - < | ||
1638 | * 2 - <= | ||
1639 | * 3 - == | ||
1640 | * 4 - != | ||
1641 | * 5 - >= | ||
1642 | * 6 - > | ||
1643 | */ | ||
1644 | #define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4) | ||
1645 | /* 0 - reg | ||
1646 | * 1 - mem | ||
1647 | */ | ||
1648 | #define WAIT_REG_MEM_ENGINE(x) ((x) << 8) | ||
1649 | /* 0 - me | ||
1650 | * 1 - pfp | ||
1651 | */ | ||
1635 | #define PACKET3_MEM_WRITE 0x3D | 1652 | #define PACKET3_MEM_WRITE 0x3D |
1636 | #define PACKET3_COPY_DATA 0x40 | 1653 | #define PACKET3_COPY_DATA 0x40 |
1637 | #define PACKET3_CP_DMA 0x41 | 1654 | #define PACKET3_CP_DMA 0x41 |
@@ -1835,6 +1852,7 @@ | |||
1835 | #define DMA_PACKET_TRAP 0x7 | 1852 | #define DMA_PACKET_TRAP 0x7 |
1836 | #define DMA_PACKET_SRBM_WRITE 0x9 | 1853 | #define DMA_PACKET_SRBM_WRITE 0x9 |
1837 | #define DMA_PACKET_CONSTANT_FILL 0xd | 1854 | #define DMA_PACKET_CONSTANT_FILL 0xd |
1855 | #define DMA_PACKET_POLL_REG_MEM 0xe | ||
1838 | #define DMA_PACKET_NOP 0xf | 1856 | #define DMA_PACKET_NOP 0xf |
1839 | 1857 | ||
1840 | #define VCE_STATUS 0x20004 | 1858 | #define VCE_STATUS 0x20004 |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 6529c09c46f0..a7de26d1ac80 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -574,6 +574,16 @@ config SENSORS_IIO_HWMON | |||
574 | for those channels specified in the map. This map can be provided | 574 | for those channels specified in the map. This map can be provided |
575 | either via platform data or the device tree bindings. | 575 | either via platform data or the device tree bindings. |
576 | 576 | ||
577 | config SENSORS_I5500 | ||
578 | tristate "Intel 5500/5520/X58 temperature sensor" | ||
579 | depends on X86 && PCI | ||
580 | help | ||
581 | If you say yes here you get support for the temperature | ||
582 | sensor inside the Intel 5500, 5520 and X58 chipsets. | ||
583 | |||
584 | This driver can also be built as a module. If so, the module | ||
585 | will be called i5500_temp. | ||
586 | |||
577 | config SENSORS_CORETEMP | 587 | config SENSORS_CORETEMP |
578 | tristate "Intel Core/Core2/Atom temperature sensor" | 588 | tristate "Intel Core/Core2/Atom temperature sensor" |
579 | depends on X86 | 589 | depends on X86 |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 67280643bcf0..6c941472e707 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -68,6 +68,7 @@ obj-$(CONFIG_SENSORS_GPIO_FAN) += gpio-fan.o | |||
68 | obj-$(CONFIG_SENSORS_HIH6130) += hih6130.o | 68 | obj-$(CONFIG_SENSORS_HIH6130) += hih6130.o |
69 | obj-$(CONFIG_SENSORS_HTU21) += htu21.o | 69 | obj-$(CONFIG_SENSORS_HTU21) += htu21.o |
70 | obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o | 70 | obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o |
71 | obj-$(CONFIG_SENSORS_I5500) += i5500_temp.o | ||
71 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o | 72 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o |
72 | obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o | 73 | obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o |
73 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o | 74 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o |
diff --git a/drivers/hwmon/i5500_temp.c b/drivers/hwmon/i5500_temp.c new file mode 100644 index 000000000000..3e3ccbf18b4e --- /dev/null +++ b/drivers/hwmon/i5500_temp.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * i5500_temp - Driver for Intel 5500/5520/X58 chipset thermal sensor | ||
3 | * | ||
4 | * Copyright (C) 2012, 2014 Jean Delvare <jdelvare@suse.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/jiffies.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/pci.h> | ||
23 | #include <linux/hwmon.h> | ||
24 | #include <linux/hwmon-sysfs.h> | ||
25 | #include <linux/err.h> | ||
26 | #include <linux/mutex.h> | ||
27 | |||
28 | /* Register definitions from datasheet */ | ||
29 | #define REG_TSTHRCATA 0xE2 | ||
30 | #define REG_TSCTRL 0xE8 | ||
31 | #define REG_TSTHRRPEX 0xEB | ||
32 | #define REG_TSTHRLO 0xEC | ||
33 | #define REG_TSTHRHI 0xEE | ||
34 | #define REG_CTHINT 0xF0 | ||
35 | #define REG_TSFSC 0xF3 | ||
36 | #define REG_CTSTS 0xF4 | ||
37 | #define REG_TSTHRRQPI 0xF5 | ||
38 | #define REG_CTCTRL 0xF7 | ||
39 | #define REG_TSTIMER 0xF8 | ||
40 | |||
41 | /* | ||
42 | * Sysfs stuff | ||
43 | */ | ||
44 | |||
45 | /* Sensor resolution : 0.5 degree C */ | ||
46 | static ssize_t show_temp(struct device *dev, | ||
47 | struct device_attribute *devattr, char *buf) | ||
48 | { | ||
49 | struct pci_dev *pdev = to_pci_dev(dev->parent); | ||
50 | long temp; | ||
51 | u16 tsthrhi; | ||
52 | s8 tsfsc; | ||
53 | |||
54 | pci_read_config_word(pdev, REG_TSTHRHI, &tsthrhi); | ||
55 | pci_read_config_byte(pdev, REG_TSFSC, &tsfsc); | ||
56 | temp = ((long)tsthrhi - tsfsc) * 500; | ||
57 | |||
58 | return sprintf(buf, "%ld\n", temp); | ||
59 | } | ||
60 | |||
61 | static ssize_t show_thresh(struct device *dev, | ||
62 | struct device_attribute *devattr, char *buf) | ||
63 | { | ||
64 | struct pci_dev *pdev = to_pci_dev(dev->parent); | ||
65 | int reg = to_sensor_dev_attr(devattr)->index; | ||
66 | long temp; | ||
67 | u16 tsthr; | ||
68 | |||
69 | pci_read_config_word(pdev, reg, &tsthr); | ||
70 | temp = tsthr * 500; | ||
71 | |||
72 | return sprintf(buf, "%ld\n", temp); | ||
73 | } | ||
74 | |||
75 | static ssize_t show_alarm(struct device *dev, | ||
76 | struct device_attribute *devattr, char *buf) | ||
77 | { | ||
78 | struct pci_dev *pdev = to_pci_dev(dev->parent); | ||
79 | int nr = to_sensor_dev_attr(devattr)->index; | ||
80 | u8 ctsts; | ||
81 | |||
82 | pci_read_config_byte(pdev, REG_CTSTS, &ctsts); | ||
83 | return sprintf(buf, "%u\n", (unsigned int)ctsts & (1 << nr)); | ||
84 | } | ||
85 | |||
86 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); | ||
87 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_thresh, NULL, 0xE2); | ||
88 | static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_thresh, NULL, 0xEC); | ||
89 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_thresh, NULL, 0xEE); | ||
90 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
91 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
92 | |||
93 | static struct attribute *i5500_temp_attrs[] = { | ||
94 | &dev_attr_temp1_input.attr, | ||
95 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | ||
96 | &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, | ||
97 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
98 | &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, | ||
99 | &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, | ||
100 | NULL | ||
101 | }; | ||
102 | |||
103 | ATTRIBUTE_GROUPS(i5500_temp); | ||
104 | |||
105 | static const struct pci_device_id i5500_temp_ids[] = { | ||
106 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3438) }, | ||
107 | { 0 }, | ||
108 | }; | ||
109 | |||
110 | MODULE_DEVICE_TABLE(pci, i5500_temp_ids); | ||
111 | |||
112 | static int i5500_temp_probe(struct pci_dev *pdev, | ||
113 | const struct pci_device_id *id) | ||
114 | { | ||
115 | int err; | ||
116 | struct device *hwmon_dev; | ||
117 | u32 tstimer; | ||
118 | s8 tsfsc; | ||
119 | |||
120 | err = pci_enable_device(pdev); | ||
121 | if (err) { | ||
122 | dev_err(&pdev->dev, "Failed to enable device\n"); | ||
123 | return err; | ||
124 | } | ||
125 | |||
126 | pci_read_config_byte(pdev, REG_TSFSC, &tsfsc); | ||
127 | pci_read_config_dword(pdev, REG_TSTIMER, &tstimer); | ||
128 | if (tsfsc == 0x7F && tstimer == 0x07D30D40) { | ||
129 | dev_notice(&pdev->dev, "Sensor seems to be disabled\n"); | ||
130 | return -ENODEV; | ||
131 | } | ||
132 | |||
133 | hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev, | ||
134 | "intel5500", NULL, | ||
135 | i5500_temp_groups); | ||
136 | return PTR_ERR_OR_ZERO(hwmon_dev); | ||
137 | } | ||
138 | |||
139 | static struct pci_driver i5500_temp_driver = { | ||
140 | .name = "i5500_temp", | ||
141 | .id_table = i5500_temp_ids, | ||
142 | .probe = i5500_temp_probe, | ||
143 | }; | ||
144 | |||
145 | module_pci_driver(i5500_temp_driver); | ||
146 | |||
147 | MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>"); | ||
148 | MODULE_DESCRIPTION("Intel 5500/5520/X58 chipset thermal sensor driver"); | ||
149 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index e37412da15f5..b99de00e57b8 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
@@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val) | |||
143 | case ad7998: | 143 | case ad7998: |
144 | return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG, | 144 | return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG, |
145 | val); | 145 | val); |
146 | default: | 146 | case ad7992: |
147 | case ad7993: | ||
148 | case ad7994: | ||
147 | return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG, | 149 | return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG, |
148 | val); | 150 | val); |
151 | default: | ||
152 | /* Will be written when doing a conversion */ | ||
153 | st->config = val; | ||
154 | return 0; | ||
149 | } | 155 | } |
150 | } | 156 | } |
151 | 157 | ||
@@ -155,8 +161,13 @@ static int ad799x_read_config(struct ad799x_state *st) | |||
155 | case ad7997: | 161 | case ad7997: |
156 | case ad7998: | 162 | case ad7998: |
157 | return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG); | 163 | return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG); |
158 | default: | 164 | case ad7992: |
165 | case ad7993: | ||
166 | case ad7994: | ||
159 | return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG); | 167 | return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG); |
168 | default: | ||
169 | /* No readback support */ | ||
170 | return st->config; | ||
160 | } | 171 | } |
161 | } | 172 | } |
162 | 173 | ||
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 866fe904cba2..90c8cb727cc7 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -449,6 +449,9 @@ static int iio_channel_read(struct iio_channel *chan, int *val, int *val2, | |||
449 | if (val2 == NULL) | 449 | if (val2 == NULL) |
450 | val2 = &unused; | 450 | val2 = &unused; |
451 | 451 | ||
452 | if(!iio_channel_has_info(chan->channel, info)) | ||
453 | return -EINVAL; | ||
454 | |||
452 | if (chan->indio_dev->info->read_raw_multi) { | 455 | if (chan->indio_dev->info->read_raw_multi) { |
453 | ret = chan->indio_dev->info->read_raw_multi(chan->indio_dev, | 456 | ret = chan->indio_dev->info->read_raw_multi(chan->indio_dev, |
454 | chan->channel, INDIO_MAX_RAW_ELEMENTS, | 457 | chan->channel, INDIO_MAX_RAW_ELEMENTS, |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index b4fa6f658800..9db258f7c804 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1114,7 +1114,8 @@ static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_ | |||
1114 | struct mlx4_dev *dev = to_mdev(qp->device)->dev; | 1114 | struct mlx4_dev *dev = to_mdev(qp->device)->dev; |
1115 | int err = 0; | 1115 | int err = 0; |
1116 | 1116 | ||
1117 | if (dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | 1117 | if (dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN || |
1118 | dev->caps.dmfs_high_steer_mode == MLX4_STEERING_DMFS_A0_STATIC) | ||
1118 | return 0; /* do nothing */ | 1119 | return 0; /* do nothing */ |
1119 | 1120 | ||
1120 | ib_flow = flow_attr + 1; | 1121 | ib_flow = flow_attr + 1; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index f2b978026407..77ecf6d32237 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1520,6 +1520,8 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1520 | case 7: | 1520 | case 7: |
1521 | case 8: | 1521 | case 8: |
1522 | case 9: | 1522 | case 9: |
1523 | case 10: | ||
1524 | case 13: | ||
1523 | etd->hw_version = 4; | 1525 | etd->hw_version = 4; |
1524 | break; | 1526 | break; |
1525 | default: | 1527 | default: |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index c66d1b53843e..764857b4e268 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -415,6 +415,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
415 | }, | 415 | }, |
416 | }, | 416 | }, |
417 | { | 417 | { |
418 | /* Acer Aspire 7738 */ | ||
419 | .matches = { | ||
420 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
421 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"), | ||
422 | }, | ||
423 | }, | ||
424 | { | ||
418 | /* Gericom Bellagio */ | 425 | /* Gericom Bellagio */ |
419 | .matches = { | 426 | .matches = { |
420 | DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), | 427 | DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), |
@@ -745,6 +752,35 @@ static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = { | |||
745 | { } | 752 | { } |
746 | }; | 753 | }; |
747 | 754 | ||
755 | /* | ||
756 | * Some laptops need keyboard reset before probing for the trackpad to get | ||
757 | * it detected, initialised & finally work. | ||
758 | */ | ||
759 | static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = { | ||
760 | { | ||
761 | /* Gigabyte P35 v2 - Elantech touchpad */ | ||
762 | .matches = { | ||
763 | DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), | ||
764 | DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"), | ||
765 | }, | ||
766 | }, | ||
767 | { | ||
768 | /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */ | ||
769 | .matches = { | ||
770 | DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), | ||
771 | DMI_MATCH(DMI_PRODUCT_NAME, "X3"), | ||
772 | }, | ||
773 | }, | ||
774 | { | ||
775 | /* Gigabyte P34 - Elantech touchpad */ | ||
776 | .matches = { | ||
777 | DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"), | ||
778 | DMI_MATCH(DMI_PRODUCT_NAME, "P34"), | ||
779 | }, | ||
780 | }, | ||
781 | { } | ||
782 | }; | ||
783 | |||
748 | #endif /* CONFIG_X86 */ | 784 | #endif /* CONFIG_X86 */ |
749 | 785 | ||
750 | #ifdef CONFIG_PNP | 786 | #ifdef CONFIG_PNP |
@@ -1040,6 +1076,9 @@ static int __init i8042_platform_init(void) | |||
1040 | if (dmi_check_system(i8042_dmi_dritek_table)) | 1076 | if (dmi_check_system(i8042_dmi_dritek_table)) |
1041 | i8042_dritek = true; | 1077 | i8042_dritek = true; |
1042 | 1078 | ||
1079 | if (dmi_check_system(i8042_dmi_kbdreset_table)) | ||
1080 | i8042_kbdreset = true; | ||
1081 | |||
1043 | /* | 1082 | /* |
1044 | * A20 was already enabled during early kernel init. But some buggy | 1083 | * A20 was already enabled during early kernel init. But some buggy |
1045 | * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to | 1084 | * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 924e4bf357fb..986a71c614b0 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -67,6 +67,10 @@ static bool i8042_notimeout; | |||
67 | module_param_named(notimeout, i8042_notimeout, bool, 0); | 67 | module_param_named(notimeout, i8042_notimeout, bool, 0); |
68 | MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042"); | 68 | MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042"); |
69 | 69 | ||
70 | static bool i8042_kbdreset; | ||
71 | module_param_named(kbdreset, i8042_kbdreset, bool, 0); | ||
72 | MODULE_PARM_DESC(kbdreset, "Reset device connected to KBD port"); | ||
73 | |||
70 | #ifdef CONFIG_X86 | 74 | #ifdef CONFIG_X86 |
71 | static bool i8042_dritek; | 75 | static bool i8042_dritek; |
72 | module_param_named(dritek, i8042_dritek, bool, 0); | 76 | module_param_named(dritek, i8042_dritek, bool, 0); |
@@ -790,6 +794,16 @@ static int __init i8042_check_aux(void) | |||
790 | return -1; | 794 | return -1; |
791 | 795 | ||
792 | /* | 796 | /* |
797 | * Reset keyboard (needed on some laptops to successfully detect | ||
798 | * touchpad, e.g., some Gigabyte laptop models with Elantech | ||
799 | * touchpads). | ||
800 | */ | ||
801 | if (i8042_kbdreset) { | ||
802 | pr_warn("Attempting to reset device connected to KBD port\n"); | ||
803 | i8042_kbd_write(NULL, (unsigned char) 0xff); | ||
804 | } | ||
805 | |||
806 | /* | ||
793 | * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and | 807 | * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and |
794 | * used it for a PCI card or somethig else. | 808 | * used it for a PCI card or somethig else. |
795 | */ | 809 | */ |
diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c index d111ac779c40..63cd031b2c28 100644 --- a/drivers/irqchip/irq-atmel-aic-common.c +++ b/drivers/irqchip/irq-atmel-aic-common.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #define AT91_AIC_IRQ_MIN_PRIORITY 0 | 28 | #define AT91_AIC_IRQ_MIN_PRIORITY 0 |
29 | #define AT91_AIC_IRQ_MAX_PRIORITY 7 | 29 | #define AT91_AIC_IRQ_MAX_PRIORITY 7 |
30 | 30 | ||
31 | #define AT91_AIC_SRCTYPE GENMASK(7, 6) | 31 | #define AT91_AIC_SRCTYPE GENMASK(6, 5) |
32 | #define AT91_AIC_SRCTYPE_LOW (0 << 5) | 32 | #define AT91_AIC_SRCTYPE_LOW (0 << 5) |
33 | #define AT91_AIC_SRCTYPE_FALLING (1 << 5) | 33 | #define AT91_AIC_SRCTYPE_FALLING (1 << 5) |
34 | #define AT91_AIC_SRCTYPE_HIGH (2 << 5) | 34 | #define AT91_AIC_SRCTYPE_HIGH (2 << 5) |
@@ -74,7 +74,7 @@ int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val) | |||
74 | return -EINVAL; | 74 | return -EINVAL; |
75 | } | 75 | } |
76 | 76 | ||
77 | *val &= AT91_AIC_SRCTYPE; | 77 | *val &= ~AT91_AIC_SRCTYPE; |
78 | *val |= aic_type; | 78 | *val |= aic_type; |
79 | 79 | ||
80 | return 0; | 80 | return 0; |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 86e4684adeb1..d8996bdf0f61 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -1053,7 +1053,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, | |||
1053 | * of two entries. No, the architecture doesn't let you | 1053 | * of two entries. No, the architecture doesn't let you |
1054 | * express an ITT with a single entry. | 1054 | * express an ITT with a single entry. |
1055 | */ | 1055 | */ |
1056 | nr_ites = max(2, roundup_pow_of_two(nvecs)); | 1056 | nr_ites = max(2UL, roundup_pow_of_two(nvecs)); |
1057 | sz = nr_ites * its->ite_size; | 1057 | sz = nr_ites * its->ite_size; |
1058 | sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; | 1058 | sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; |
1059 | itt = kmalloc(sz, GFP_KERNEL); | 1059 | itt = kmalloc(sz, GFP_KERNEL); |
diff --git a/drivers/irqchip/irq-hip04.c b/drivers/irqchip/irq-hip04.c index 29b8f21b74d0..6bc2deb73d53 100644 --- a/drivers/irqchip/irq-hip04.c +++ b/drivers/irqchip/irq-hip04.c | |||
@@ -381,7 +381,7 @@ hip04_of_init(struct device_node *node, struct device_node *parent) | |||
381 | * It will be refined as each CPU probes its ID. | 381 | * It will be refined as each CPU probes its ID. |
382 | */ | 382 | */ |
383 | for (i = 0; i < NR_HIP04_CPU_IF; i++) | 383 | for (i = 0; i < NR_HIP04_CPU_IF; i++) |
384 | hip04_cpu_map[i] = 0xff; | 384 | hip04_cpu_map[i] = 0xffff; |
385 | 385 | ||
386 | /* | 386 | /* |
387 | * Find out how many interrupts are supported. | 387 | * Find out how many interrupts are supported. |
diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c index 7e342df6a62f..0b0d2c00a2df 100644 --- a/drivers/irqchip/irq-mtk-sysirq.c +++ b/drivers/irqchip/irq-mtk-sysirq.c | |||
@@ -137,9 +137,9 @@ static int __init mtk_sysirq_of_init(struct device_node *node, | |||
137 | return -ENOMEM; | 137 | return -ENOMEM; |
138 | 138 | ||
139 | chip_data->intpol_base = of_io_request_and_map(node, 0, "intpol"); | 139 | chip_data->intpol_base = of_io_request_and_map(node, 0, "intpol"); |
140 | if (!chip_data->intpol_base) { | 140 | if (IS_ERR(chip_data->intpol_base)) { |
141 | pr_err("mtk_sysirq: unable to map sysirq register\n"); | 141 | pr_err("mtk_sysirq: unable to map sysirq register\n"); |
142 | ret = -ENOMEM; | 142 | ret = PTR_ERR(chip_data->intpol_base); |
143 | goto out_free; | 143 | goto out_free; |
144 | } | 144 | } |
145 | 145 | ||
diff --git a/drivers/irqchip/irq-omap-intc.c b/drivers/irqchip/irq-omap-intc.c index 28718d3e8281..c03f140acbae 100644 --- a/drivers/irqchip/irq-omap-intc.c +++ b/drivers/irqchip/irq-omap-intc.c | |||
@@ -263,7 +263,7 @@ static int __init omap_init_irq_of(struct device_node *node) | |||
263 | return ret; | 263 | return ret; |
264 | } | 264 | } |
265 | 265 | ||
266 | static int __init omap_init_irq_legacy(u32 base) | 266 | static int __init omap_init_irq_legacy(u32 base, struct device_node *node) |
267 | { | 267 | { |
268 | int j, irq_base; | 268 | int j, irq_base; |
269 | 269 | ||
@@ -277,7 +277,7 @@ static int __init omap_init_irq_legacy(u32 base) | |||
277 | irq_base = 0; | 277 | irq_base = 0; |
278 | } | 278 | } |
279 | 279 | ||
280 | domain = irq_domain_add_legacy(NULL, omap_nr_irqs, irq_base, 0, | 280 | domain = irq_domain_add_legacy(node, omap_nr_irqs, irq_base, 0, |
281 | &irq_domain_simple_ops, NULL); | 281 | &irq_domain_simple_ops, NULL); |
282 | 282 | ||
283 | omap_irq_soft_reset(); | 283 | omap_irq_soft_reset(); |
@@ -301,10 +301,26 @@ static int __init omap_init_irq(u32 base, struct device_node *node) | |||
301 | { | 301 | { |
302 | int ret; | 302 | int ret; |
303 | 303 | ||
304 | if (node) | 304 | /* |
305 | * FIXME legacy OMAP DMA driver sitting under arch/arm/plat-omap/dma.c | ||
306 | * depends is still not ready for linear IRQ domains; because of that | ||
307 | * we need to temporarily "blacklist" OMAP2 and OMAP3 devices from using | ||
308 | * linear IRQ Domain until that driver is finally fixed. | ||
309 | */ | ||
310 | if (of_device_is_compatible(node, "ti,omap2-intc") || | ||
311 | of_device_is_compatible(node, "ti,omap3-intc")) { | ||
312 | struct resource res; | ||
313 | |||
314 | if (of_address_to_resource(node, 0, &res)) | ||
315 | return -ENOMEM; | ||
316 | |||
317 | base = res.start; | ||
318 | ret = omap_init_irq_legacy(base, node); | ||
319 | } else if (node) { | ||
305 | ret = omap_init_irq_of(node); | 320 | ret = omap_init_irq_of(node); |
306 | else | 321 | } else { |
307 | ret = omap_init_irq_legacy(base); | 322 | ret = omap_init_irq_legacy(base, NULL); |
323 | } | ||
308 | 324 | ||
309 | if (ret == 0) | 325 | if (ret == 0) |
310 | omap_irq_enable_protection(); | 326 | omap_irq_enable_protection(); |
diff --git a/drivers/mcb/mcb-internal.h b/drivers/mcb/mcb-internal.h index f956ef26c0ce..fb7493dcfb79 100644 --- a/drivers/mcb/mcb-internal.h +++ b/drivers/mcb/mcb-internal.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define PCI_DEVICE_ID_MEN_CHAMELEON 0x4d45 | 7 | #define PCI_DEVICE_ID_MEN_CHAMELEON 0x4d45 |
8 | #define CHAMELEON_FILENAME_LEN 12 | 8 | #define CHAMELEON_FILENAME_LEN 12 |
9 | #define CHAMELEONV2_MAGIC 0xabce | 9 | #define CHAMELEONV2_MAGIC 0xabce |
10 | #define CHAM_HEADER_SIZE 0x200 | ||
10 | 11 | ||
11 | enum chameleon_descriptor_type { | 12 | enum chameleon_descriptor_type { |
12 | CHAMELEON_DTYPE_GENERAL = 0x0, | 13 | CHAMELEON_DTYPE_GENERAL = 0x0, |
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c index b59181965643..5e1bd5db02c8 100644 --- a/drivers/mcb/mcb-pci.c +++ b/drivers/mcb/mcb-pci.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | struct priv { | 18 | struct priv { |
19 | struct mcb_bus *bus; | 19 | struct mcb_bus *bus; |
20 | phys_addr_t mapbase; | ||
20 | void __iomem *base; | 21 | void __iomem *base; |
21 | }; | 22 | }; |
22 | 23 | ||
@@ -31,8 +32,8 @@ static int mcb_pci_get_irq(struct mcb_device *mdev) | |||
31 | 32 | ||
32 | static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 33 | static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
33 | { | 34 | { |
35 | struct resource *res; | ||
34 | struct priv *priv; | 36 | struct priv *priv; |
35 | phys_addr_t mapbase; | ||
36 | int ret; | 37 | int ret; |
37 | int num_cells; | 38 | int num_cells; |
38 | unsigned long flags; | 39 | unsigned long flags; |
@@ -47,19 +48,21 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
47 | return -ENODEV; | 48 | return -ENODEV; |
48 | } | 49 | } |
49 | 50 | ||
50 | mapbase = pci_resource_start(pdev, 0); | 51 | priv->mapbase = pci_resource_start(pdev, 0); |
51 | if (!mapbase) { | 52 | if (!priv->mapbase) { |
52 | dev_err(&pdev->dev, "No PCI resource\n"); | 53 | dev_err(&pdev->dev, "No PCI resource\n"); |
53 | goto err_start; | 54 | goto err_start; |
54 | } | 55 | } |
55 | 56 | ||
56 | ret = pci_request_region(pdev, 0, KBUILD_MODNAME); | 57 | res = request_mem_region(priv->mapbase, CHAM_HEADER_SIZE, |
57 | if (ret) { | 58 | KBUILD_MODNAME); |
58 | dev_err(&pdev->dev, "Failed to request PCI BARs\n"); | 59 | if (IS_ERR(res)) { |
60 | dev_err(&pdev->dev, "Failed to request PCI memory\n"); | ||
61 | ret = PTR_ERR(res); | ||
59 | goto err_start; | 62 | goto err_start; |
60 | } | 63 | } |
61 | 64 | ||
62 | priv->base = pci_iomap(pdev, 0, 0); | 65 | priv->base = ioremap(priv->mapbase, CHAM_HEADER_SIZE); |
63 | if (!priv->base) { | 66 | if (!priv->base) { |
64 | dev_err(&pdev->dev, "Cannot ioremap\n"); | 67 | dev_err(&pdev->dev, "Cannot ioremap\n"); |
65 | ret = -ENOMEM; | 68 | ret = -ENOMEM; |
@@ -84,7 +87,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
84 | 87 | ||
85 | priv->bus->get_irq = mcb_pci_get_irq; | 88 | priv->bus->get_irq = mcb_pci_get_irq; |
86 | 89 | ||
87 | ret = chameleon_parse_cells(priv->bus, mapbase, priv->base); | 90 | ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); |
88 | if (ret < 0) | 91 | if (ret < 0) |
89 | goto err_drvdata; | 92 | goto err_drvdata; |
90 | num_cells = ret; | 93 | num_cells = ret; |
@@ -93,8 +96,10 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
93 | 96 | ||
94 | mcb_bus_add_devices(priv->bus); | 97 | mcb_bus_add_devices(priv->bus); |
95 | 98 | ||
99 | return 0; | ||
100 | |||
96 | err_drvdata: | 101 | err_drvdata: |
97 | pci_iounmap(pdev, priv->base); | 102 | iounmap(priv->base); |
98 | err_ioremap: | 103 | err_ioremap: |
99 | pci_release_region(pdev, 0); | 104 | pci_release_region(pdev, 0); |
100 | err_start: | 105 | err_start: |
@@ -107,6 +112,10 @@ static void mcb_pci_remove(struct pci_dev *pdev) | |||
107 | struct priv *priv = pci_get_drvdata(pdev); | 112 | struct priv *priv = pci_get_drvdata(pdev); |
108 | 113 | ||
109 | mcb_release_bus(priv->bus); | 114 | mcb_release_bus(priv->bus); |
115 | |||
116 | iounmap(priv->base); | ||
117 | release_region(priv->mapbase, CHAM_HEADER_SIZE); | ||
118 | pci_disable_device(pdev); | ||
110 | } | 119 | } |
111 | 120 | ||
112 | static const struct pci_device_id mcb_pci_tbl[] = { | 121 | static const struct pci_device_id mcb_pci_tbl[] = { |
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index 9fc616c2755e..21b156242e42 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
@@ -94,6 +94,9 @@ struct cache_disk_superblock { | |||
94 | } __packed; | 94 | } __packed; |
95 | 95 | ||
96 | struct dm_cache_metadata { | 96 | struct dm_cache_metadata { |
97 | atomic_t ref_count; | ||
98 | struct list_head list; | ||
99 | |||
97 | struct block_device *bdev; | 100 | struct block_device *bdev; |
98 | struct dm_block_manager *bm; | 101 | struct dm_block_manager *bm; |
99 | struct dm_space_map *metadata_sm; | 102 | struct dm_space_map *metadata_sm; |
@@ -669,10 +672,10 @@ static void unpack_value(__le64 value_le, dm_oblock_t *block, unsigned *flags) | |||
669 | 672 | ||
670 | /*----------------------------------------------------------------*/ | 673 | /*----------------------------------------------------------------*/ |
671 | 674 | ||
672 | struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, | 675 | static struct dm_cache_metadata *metadata_open(struct block_device *bdev, |
673 | sector_t data_block_size, | 676 | sector_t data_block_size, |
674 | bool may_format_device, | 677 | bool may_format_device, |
675 | size_t policy_hint_size) | 678 | size_t policy_hint_size) |
676 | { | 679 | { |
677 | int r; | 680 | int r; |
678 | struct dm_cache_metadata *cmd; | 681 | struct dm_cache_metadata *cmd; |
@@ -683,6 +686,7 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, | |||
683 | return NULL; | 686 | return NULL; |
684 | } | 687 | } |
685 | 688 | ||
689 | atomic_set(&cmd->ref_count, 1); | ||
686 | init_rwsem(&cmd->root_lock); | 690 | init_rwsem(&cmd->root_lock); |
687 | cmd->bdev = bdev; | 691 | cmd->bdev = bdev; |
688 | cmd->data_block_size = data_block_size; | 692 | cmd->data_block_size = data_block_size; |
@@ -705,10 +709,95 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, | |||
705 | return cmd; | 709 | return cmd; |
706 | } | 710 | } |
707 | 711 | ||
712 | /* | ||
713 | * We keep a little list of ref counted metadata objects to prevent two | ||
714 | * different target instances creating separate bufio instances. This is | ||
715 | * an issue if a table is reloaded before the suspend. | ||
716 | */ | ||
717 | static DEFINE_MUTEX(table_lock); | ||
718 | static LIST_HEAD(table); | ||
719 | |||
720 | static struct dm_cache_metadata *lookup(struct block_device *bdev) | ||
721 | { | ||
722 | struct dm_cache_metadata *cmd; | ||
723 | |||
724 | list_for_each_entry(cmd, &table, list) | ||
725 | if (cmd->bdev == bdev) { | ||
726 | atomic_inc(&cmd->ref_count); | ||
727 | return cmd; | ||
728 | } | ||
729 | |||
730 | return NULL; | ||
731 | } | ||
732 | |||
733 | static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev, | ||
734 | sector_t data_block_size, | ||
735 | bool may_format_device, | ||
736 | size_t policy_hint_size) | ||
737 | { | ||
738 | struct dm_cache_metadata *cmd, *cmd2; | ||
739 | |||
740 | mutex_lock(&table_lock); | ||
741 | cmd = lookup(bdev); | ||
742 | mutex_unlock(&table_lock); | ||
743 | |||
744 | if (cmd) | ||
745 | return cmd; | ||
746 | |||
747 | cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size); | ||
748 | if (cmd) { | ||
749 | mutex_lock(&table_lock); | ||
750 | cmd2 = lookup(bdev); | ||
751 | if (cmd2) { | ||
752 | mutex_unlock(&table_lock); | ||
753 | __destroy_persistent_data_objects(cmd); | ||
754 | kfree(cmd); | ||
755 | return cmd2; | ||
756 | } | ||
757 | list_add(&cmd->list, &table); | ||
758 | mutex_unlock(&table_lock); | ||
759 | } | ||
760 | |||
761 | return cmd; | ||
762 | } | ||
763 | |||
764 | static bool same_params(struct dm_cache_metadata *cmd, sector_t data_block_size) | ||
765 | { | ||
766 | if (cmd->data_block_size != data_block_size) { | ||
767 | DMERR("data_block_size (%llu) different from that in metadata (%llu)\n", | ||
768 | (unsigned long long) data_block_size, | ||
769 | (unsigned long long) cmd->data_block_size); | ||
770 | return false; | ||
771 | } | ||
772 | |||
773 | return true; | ||
774 | } | ||
775 | |||
776 | struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev, | ||
777 | sector_t data_block_size, | ||
778 | bool may_format_device, | ||
779 | size_t policy_hint_size) | ||
780 | { | ||
781 | struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size, | ||
782 | may_format_device, policy_hint_size); | ||
783 | if (cmd && !same_params(cmd, data_block_size)) { | ||
784 | dm_cache_metadata_close(cmd); | ||
785 | return NULL; | ||
786 | } | ||
787 | |||
788 | return cmd; | ||
789 | } | ||
790 | |||
708 | void dm_cache_metadata_close(struct dm_cache_metadata *cmd) | 791 | void dm_cache_metadata_close(struct dm_cache_metadata *cmd) |
709 | { | 792 | { |
710 | __destroy_persistent_data_objects(cmd); | 793 | if (atomic_dec_and_test(&cmd->ref_count)) { |
711 | kfree(cmd); | 794 | mutex_lock(&table_lock); |
795 | list_del(&cmd->list); | ||
796 | mutex_unlock(&table_lock); | ||
797 | |||
798 | __destroy_persistent_data_objects(cmd); | ||
799 | kfree(cmd); | ||
800 | } | ||
712 | } | 801 | } |
713 | 802 | ||
714 | /* | 803 | /* |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1e96d7889f51..e1650539cc2f 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -221,7 +221,13 @@ struct cache { | |||
221 | struct list_head need_commit_migrations; | 221 | struct list_head need_commit_migrations; |
222 | sector_t migration_threshold; | 222 | sector_t migration_threshold; |
223 | wait_queue_head_t migration_wait; | 223 | wait_queue_head_t migration_wait; |
224 | atomic_t nr_migrations; | 224 | atomic_t nr_allocated_migrations; |
225 | |||
226 | /* | ||
227 | * The number of in flight migrations that are performing | ||
228 | * background io. eg, promotion, writeback. | ||
229 | */ | ||
230 | atomic_t nr_io_migrations; | ||
225 | 231 | ||
226 | wait_queue_head_t quiescing_wait; | 232 | wait_queue_head_t quiescing_wait; |
227 | atomic_t quiescing; | 233 | atomic_t quiescing; |
@@ -258,7 +264,6 @@ struct cache { | |||
258 | struct dm_deferred_set *all_io_ds; | 264 | struct dm_deferred_set *all_io_ds; |
259 | 265 | ||
260 | mempool_t *migration_pool; | 266 | mempool_t *migration_pool; |
261 | struct dm_cache_migration *next_migration; | ||
262 | 267 | ||
263 | struct dm_cache_policy *policy; | 268 | struct dm_cache_policy *policy; |
264 | unsigned policy_nr_args; | 269 | unsigned policy_nr_args; |
@@ -350,10 +355,31 @@ static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell *cel | |||
350 | dm_bio_prison_free_cell(cache->prison, cell); | 355 | dm_bio_prison_free_cell(cache->prison, cell); |
351 | } | 356 | } |
352 | 357 | ||
358 | static struct dm_cache_migration *alloc_migration(struct cache *cache) | ||
359 | { | ||
360 | struct dm_cache_migration *mg; | ||
361 | |||
362 | mg = mempool_alloc(cache->migration_pool, GFP_NOWAIT); | ||
363 | if (mg) { | ||
364 | mg->cache = cache; | ||
365 | atomic_inc(&mg->cache->nr_allocated_migrations); | ||
366 | } | ||
367 | |||
368 | return mg; | ||
369 | } | ||
370 | |||
371 | static void free_migration(struct dm_cache_migration *mg) | ||
372 | { | ||
373 | if (atomic_dec_and_test(&mg->cache->nr_allocated_migrations)) | ||
374 | wake_up(&mg->cache->migration_wait); | ||
375 | |||
376 | mempool_free(mg, mg->cache->migration_pool); | ||
377 | } | ||
378 | |||
353 | static int prealloc_data_structs(struct cache *cache, struct prealloc *p) | 379 | static int prealloc_data_structs(struct cache *cache, struct prealloc *p) |
354 | { | 380 | { |
355 | if (!p->mg) { | 381 | if (!p->mg) { |
356 | p->mg = mempool_alloc(cache->migration_pool, GFP_NOWAIT); | 382 | p->mg = alloc_migration(cache); |
357 | if (!p->mg) | 383 | if (!p->mg) |
358 | return -ENOMEM; | 384 | return -ENOMEM; |
359 | } | 385 | } |
@@ -382,7 +408,7 @@ static void prealloc_free_structs(struct cache *cache, struct prealloc *p) | |||
382 | free_prison_cell(cache, p->cell1); | 408 | free_prison_cell(cache, p->cell1); |
383 | 409 | ||
384 | if (p->mg) | 410 | if (p->mg) |
385 | mempool_free(p->mg, cache->migration_pool); | 411 | free_migration(p->mg); |
386 | } | 412 | } |
387 | 413 | ||
388 | static struct dm_cache_migration *prealloc_get_migration(struct prealloc *p) | 414 | static struct dm_cache_migration *prealloc_get_migration(struct prealloc *p) |
@@ -854,24 +880,14 @@ static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, | |||
854 | * Migration covers moving data from the origin device to the cache, or | 880 | * Migration covers moving data from the origin device to the cache, or |
855 | * vice versa. | 881 | * vice versa. |
856 | *--------------------------------------------------------------*/ | 882 | *--------------------------------------------------------------*/ |
857 | static void free_migration(struct dm_cache_migration *mg) | 883 | static void inc_io_migrations(struct cache *cache) |
858 | { | ||
859 | mempool_free(mg, mg->cache->migration_pool); | ||
860 | } | ||
861 | |||
862 | static void inc_nr_migrations(struct cache *cache) | ||
863 | { | 884 | { |
864 | atomic_inc(&cache->nr_migrations); | 885 | atomic_inc(&cache->nr_io_migrations); |
865 | } | 886 | } |
866 | 887 | ||
867 | static void dec_nr_migrations(struct cache *cache) | 888 | static void dec_io_migrations(struct cache *cache) |
868 | { | 889 | { |
869 | atomic_dec(&cache->nr_migrations); | 890 | atomic_dec(&cache->nr_io_migrations); |
870 | |||
871 | /* | ||
872 | * Wake the worker in case we're suspending the target. | ||
873 | */ | ||
874 | wake_up(&cache->migration_wait); | ||
875 | } | 891 | } |
876 | 892 | ||
877 | static void __cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, | 893 | static void __cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, |
@@ -894,11 +910,10 @@ static void cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, | |||
894 | wake_worker(cache); | 910 | wake_worker(cache); |
895 | } | 911 | } |
896 | 912 | ||
897 | static void cleanup_migration(struct dm_cache_migration *mg) | 913 | static void free_io_migration(struct dm_cache_migration *mg) |
898 | { | 914 | { |
899 | struct cache *cache = mg->cache; | 915 | dec_io_migrations(mg->cache); |
900 | free_migration(mg); | 916 | free_migration(mg); |
901 | dec_nr_migrations(cache); | ||
902 | } | 917 | } |
903 | 918 | ||
904 | static void migration_failure(struct dm_cache_migration *mg) | 919 | static void migration_failure(struct dm_cache_migration *mg) |
@@ -923,7 +938,7 @@ static void migration_failure(struct dm_cache_migration *mg) | |||
923 | cell_defer(cache, mg->new_ocell, true); | 938 | cell_defer(cache, mg->new_ocell, true); |
924 | } | 939 | } |
925 | 940 | ||
926 | cleanup_migration(mg); | 941 | free_io_migration(mg); |
927 | } | 942 | } |
928 | 943 | ||
929 | static void migration_success_pre_commit(struct dm_cache_migration *mg) | 944 | static void migration_success_pre_commit(struct dm_cache_migration *mg) |
@@ -934,7 +949,7 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) | |||
934 | if (mg->writeback) { | 949 | if (mg->writeback) { |
935 | clear_dirty(cache, mg->old_oblock, mg->cblock); | 950 | clear_dirty(cache, mg->old_oblock, mg->cblock); |
936 | cell_defer(cache, mg->old_ocell, false); | 951 | cell_defer(cache, mg->old_ocell, false); |
937 | cleanup_migration(mg); | 952 | free_io_migration(mg); |
938 | return; | 953 | return; |
939 | 954 | ||
940 | } else if (mg->demote) { | 955 | } else if (mg->demote) { |
@@ -944,14 +959,14 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) | |||
944 | mg->old_oblock); | 959 | mg->old_oblock); |
945 | if (mg->promote) | 960 | if (mg->promote) |
946 | cell_defer(cache, mg->new_ocell, true); | 961 | cell_defer(cache, mg->new_ocell, true); |
947 | cleanup_migration(mg); | 962 | free_io_migration(mg); |
948 | return; | 963 | return; |
949 | } | 964 | } |
950 | } else { | 965 | } else { |
951 | if (dm_cache_insert_mapping(cache->cmd, mg->cblock, mg->new_oblock)) { | 966 | if (dm_cache_insert_mapping(cache->cmd, mg->cblock, mg->new_oblock)) { |
952 | DMWARN_LIMIT("promotion failed; couldn't update on disk metadata"); | 967 | DMWARN_LIMIT("promotion failed; couldn't update on disk metadata"); |
953 | policy_remove_mapping(cache->policy, mg->new_oblock); | 968 | policy_remove_mapping(cache->policy, mg->new_oblock); |
954 | cleanup_migration(mg); | 969 | free_io_migration(mg); |
955 | return; | 970 | return; |
956 | } | 971 | } |
957 | } | 972 | } |
@@ -984,7 +999,7 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) | |||
984 | } else { | 999 | } else { |
985 | if (mg->invalidate) | 1000 | if (mg->invalidate) |
986 | policy_remove_mapping(cache->policy, mg->old_oblock); | 1001 | policy_remove_mapping(cache->policy, mg->old_oblock); |
987 | cleanup_migration(mg); | 1002 | free_io_migration(mg); |
988 | } | 1003 | } |
989 | 1004 | ||
990 | } else { | 1005 | } else { |
@@ -999,7 +1014,7 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) | |||
999 | bio_endio(mg->new_ocell->holder, 0); | 1014 | bio_endio(mg->new_ocell->holder, 0); |
1000 | cell_defer(cache, mg->new_ocell, false); | 1015 | cell_defer(cache, mg->new_ocell, false); |
1001 | } | 1016 | } |
1002 | cleanup_migration(mg); | 1017 | free_io_migration(mg); |
1003 | } | 1018 | } |
1004 | } | 1019 | } |
1005 | 1020 | ||
@@ -1251,7 +1266,7 @@ static void promote(struct cache *cache, struct prealloc *structs, | |||
1251 | mg->new_ocell = cell; | 1266 | mg->new_ocell = cell; |
1252 | mg->start_jiffies = jiffies; | 1267 | mg->start_jiffies = jiffies; |
1253 | 1268 | ||
1254 | inc_nr_migrations(cache); | 1269 | inc_io_migrations(cache); |
1255 | quiesce_migration(mg); | 1270 | quiesce_migration(mg); |
1256 | } | 1271 | } |
1257 | 1272 | ||
@@ -1275,7 +1290,7 @@ static void writeback(struct cache *cache, struct prealloc *structs, | |||
1275 | mg->new_ocell = NULL; | 1290 | mg->new_ocell = NULL; |
1276 | mg->start_jiffies = jiffies; | 1291 | mg->start_jiffies = jiffies; |
1277 | 1292 | ||
1278 | inc_nr_migrations(cache); | 1293 | inc_io_migrations(cache); |
1279 | quiesce_migration(mg); | 1294 | quiesce_migration(mg); |
1280 | } | 1295 | } |
1281 | 1296 | ||
@@ -1302,7 +1317,7 @@ static void demote_then_promote(struct cache *cache, struct prealloc *structs, | |||
1302 | mg->new_ocell = new_ocell; | 1317 | mg->new_ocell = new_ocell; |
1303 | mg->start_jiffies = jiffies; | 1318 | mg->start_jiffies = jiffies; |
1304 | 1319 | ||
1305 | inc_nr_migrations(cache); | 1320 | inc_io_migrations(cache); |
1306 | quiesce_migration(mg); | 1321 | quiesce_migration(mg); |
1307 | } | 1322 | } |
1308 | 1323 | ||
@@ -1330,7 +1345,7 @@ static void invalidate(struct cache *cache, struct prealloc *structs, | |||
1330 | mg->new_ocell = NULL; | 1345 | mg->new_ocell = NULL; |
1331 | mg->start_jiffies = jiffies; | 1346 | mg->start_jiffies = jiffies; |
1332 | 1347 | ||
1333 | inc_nr_migrations(cache); | 1348 | inc_io_migrations(cache); |
1334 | quiesce_migration(mg); | 1349 | quiesce_migration(mg); |
1335 | } | 1350 | } |
1336 | 1351 | ||
@@ -1412,7 +1427,7 @@ static void process_discard_bio(struct cache *cache, struct prealloc *structs, | |||
1412 | 1427 | ||
1413 | static bool spare_migration_bandwidth(struct cache *cache) | 1428 | static bool spare_migration_bandwidth(struct cache *cache) |
1414 | { | 1429 | { |
1415 | sector_t current_volume = (atomic_read(&cache->nr_migrations) + 1) * | 1430 | sector_t current_volume = (atomic_read(&cache->nr_io_migrations) + 1) * |
1416 | cache->sectors_per_block; | 1431 | cache->sectors_per_block; |
1417 | return current_volume < cache->migration_threshold; | 1432 | return current_volume < cache->migration_threshold; |
1418 | } | 1433 | } |
@@ -1764,7 +1779,7 @@ static void stop_quiescing(struct cache *cache) | |||
1764 | 1779 | ||
1765 | static void wait_for_migrations(struct cache *cache) | 1780 | static void wait_for_migrations(struct cache *cache) |
1766 | { | 1781 | { |
1767 | wait_event(cache->migration_wait, !atomic_read(&cache->nr_migrations)); | 1782 | wait_event(cache->migration_wait, !atomic_read(&cache->nr_allocated_migrations)); |
1768 | } | 1783 | } |
1769 | 1784 | ||
1770 | static void stop_worker(struct cache *cache) | 1785 | static void stop_worker(struct cache *cache) |
@@ -1876,9 +1891,6 @@ static void destroy(struct cache *cache) | |||
1876 | { | 1891 | { |
1877 | unsigned i; | 1892 | unsigned i; |
1878 | 1893 | ||
1879 | if (cache->next_migration) | ||
1880 | mempool_free(cache->next_migration, cache->migration_pool); | ||
1881 | |||
1882 | if (cache->migration_pool) | 1894 | if (cache->migration_pool) |
1883 | mempool_destroy(cache->migration_pool); | 1895 | mempool_destroy(cache->migration_pool); |
1884 | 1896 | ||
@@ -2424,7 +2436,8 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
2424 | INIT_LIST_HEAD(&cache->quiesced_migrations); | 2436 | INIT_LIST_HEAD(&cache->quiesced_migrations); |
2425 | INIT_LIST_HEAD(&cache->completed_migrations); | 2437 | INIT_LIST_HEAD(&cache->completed_migrations); |
2426 | INIT_LIST_HEAD(&cache->need_commit_migrations); | 2438 | INIT_LIST_HEAD(&cache->need_commit_migrations); |
2427 | atomic_set(&cache->nr_migrations, 0); | 2439 | atomic_set(&cache->nr_allocated_migrations, 0); |
2440 | atomic_set(&cache->nr_io_migrations, 0); | ||
2428 | init_waitqueue_head(&cache->migration_wait); | 2441 | init_waitqueue_head(&cache->migration_wait); |
2429 | 2442 | ||
2430 | init_waitqueue_head(&cache->quiescing_wait); | 2443 | init_waitqueue_head(&cache->quiescing_wait); |
@@ -2487,8 +2500,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
2487 | goto bad; | 2500 | goto bad; |
2488 | } | 2501 | } |
2489 | 2502 | ||
2490 | cache->next_migration = NULL; | ||
2491 | |||
2492 | cache->need_tick_bio = true; | 2503 | cache->need_tick_bio = true; |
2493 | cache->sized = false; | 2504 | cache->sized = false; |
2494 | cache->invalidate = false; | 2505 | cache->invalidate = false; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index b98cd9d84435..2caf5b374649 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -206,6 +206,9 @@ struct mapped_device { | |||
206 | /* zero-length flush that will be cloned and submitted to targets */ | 206 | /* zero-length flush that will be cloned and submitted to targets */ |
207 | struct bio flush_bio; | 207 | struct bio flush_bio; |
208 | 208 | ||
209 | /* the number of internal suspends */ | ||
210 | unsigned internal_suspend_count; | ||
211 | |||
209 | struct dm_stats stats; | 212 | struct dm_stats stats; |
210 | }; | 213 | }; |
211 | 214 | ||
@@ -2928,7 +2931,7 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned suspend_fla | |||
2928 | { | 2931 | { |
2929 | struct dm_table *map = NULL; | 2932 | struct dm_table *map = NULL; |
2930 | 2933 | ||
2931 | if (dm_suspended_internally_md(md)) | 2934 | if (md->internal_suspend_count++) |
2932 | return; /* nested internal suspend */ | 2935 | return; /* nested internal suspend */ |
2933 | 2936 | ||
2934 | if (dm_suspended_md(md)) { | 2937 | if (dm_suspended_md(md)) { |
@@ -2953,7 +2956,9 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned suspend_fla | |||
2953 | 2956 | ||
2954 | static void __dm_internal_resume(struct mapped_device *md) | 2957 | static void __dm_internal_resume(struct mapped_device *md) |
2955 | { | 2958 | { |
2956 | if (!dm_suspended_internally_md(md)) | 2959 | BUG_ON(!md->internal_suspend_count); |
2960 | |||
2961 | if (--md->internal_suspend_count) | ||
2957 | return; /* resume from nested internal suspend */ | 2962 | return; /* resume from nested internal suspend */ |
2958 | 2963 | ||
2959 | if (dm_suspended_md(md)) | 2964 | if (dm_suspended_md(md)) |
diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index db99ca2613ba..06931f6fa26c 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c | |||
@@ -614,7 +614,7 @@ struct cx23885_board cx23885_boards[] = { | |||
614 | .portb = CX23885_MPEG_DVB, | 614 | .portb = CX23885_MPEG_DVB, |
615 | }, | 615 | }, |
616 | [CX23885_BOARD_HAUPPAUGE_HVR4400] = { | 616 | [CX23885_BOARD_HAUPPAUGE_HVR4400] = { |
617 | .name = "Hauppauge WinTV-HVR4400", | 617 | .name = "Hauppauge WinTV-HVR4400/HVR5500", |
618 | .porta = CX23885_ANALOG_VIDEO, | 618 | .porta = CX23885_ANALOG_VIDEO, |
619 | .portb = CX23885_MPEG_DVB, | 619 | .portb = CX23885_MPEG_DVB, |
620 | .portc = CX23885_MPEG_DVB, | 620 | .portc = CX23885_MPEG_DVB, |
@@ -622,6 +622,10 @@ struct cx23885_board cx23885_boards[] = { | |||
622 | .tuner_addr = 0x60, /* 0xc0 >> 1 */ | 622 | .tuner_addr = 0x60, /* 0xc0 >> 1 */ |
623 | .tuner_bus = 1, | 623 | .tuner_bus = 1, |
624 | }, | 624 | }, |
625 | [CX23885_BOARD_HAUPPAUGE_STARBURST] = { | ||
626 | .name = "Hauppauge WinTV Starburst", | ||
627 | .portb = CX23885_MPEG_DVB, | ||
628 | }, | ||
625 | [CX23885_BOARD_AVERMEDIA_HC81R] = { | 629 | [CX23885_BOARD_AVERMEDIA_HC81R] = { |
626 | .name = "AVerTV Hybrid Express Slim HC81R", | 630 | .name = "AVerTV Hybrid Express Slim HC81R", |
627 | .tuner_type = TUNER_XC2028, | 631 | .tuner_type = TUNER_XC2028, |
@@ -936,19 +940,19 @@ struct cx23885_subid cx23885_subids[] = { | |||
936 | }, { | 940 | }, { |
937 | .subvendor = 0x0070, | 941 | .subvendor = 0x0070, |
938 | .subdevice = 0xc108, | 942 | .subdevice = 0xc108, |
939 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, | 943 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, /* Hauppauge WinTV HVR-4400 (Model 121xxx, Hybrid DVB-T/S2, IR) */ |
940 | }, { | 944 | }, { |
941 | .subvendor = 0x0070, | 945 | .subvendor = 0x0070, |
942 | .subdevice = 0xc138, | 946 | .subdevice = 0xc138, |
943 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, | 947 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, /* Hauppauge WinTV HVR-5500 (Model 121xxx, Hybrid DVB-T/C/S2, IR) */ |
944 | }, { | 948 | }, { |
945 | .subvendor = 0x0070, | 949 | .subvendor = 0x0070, |
946 | .subdevice = 0xc12a, | 950 | .subdevice = 0xc12a, |
947 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, | 951 | .card = CX23885_BOARD_HAUPPAUGE_STARBURST, /* Hauppauge WinTV Starburst (Model 121x00, DVB-S2, IR) */ |
948 | }, { | 952 | }, { |
949 | .subvendor = 0x0070, | 953 | .subvendor = 0x0070, |
950 | .subdevice = 0xc1f8, | 954 | .subdevice = 0xc1f8, |
951 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, | 955 | .card = CX23885_BOARD_HAUPPAUGE_HVR4400, /* Hauppauge WinTV HVR-5500 (Model 121xxx, Hybrid DVB-T/C/S2, IR) */ |
952 | }, { | 956 | }, { |
953 | .subvendor = 0x1461, | 957 | .subvendor = 0x1461, |
954 | .subdevice = 0xd939, | 958 | .subdevice = 0xd939, |
@@ -1545,8 +1549,9 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) | |||
1545 | cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/ | 1549 | cx_write(GPIO_ISM, 0x00000000);/* INTERRUPTS active low*/ |
1546 | break; | 1550 | break; |
1547 | case CX23885_BOARD_HAUPPAUGE_HVR4400: | 1551 | case CX23885_BOARD_HAUPPAUGE_HVR4400: |
1552 | case CX23885_BOARD_HAUPPAUGE_STARBURST: | ||
1548 | /* GPIO-8 tda10071 demod reset */ | 1553 | /* GPIO-8 tda10071 demod reset */ |
1549 | /* GPIO-9 si2165 demod reset */ | 1554 | /* GPIO-9 si2165 demod reset (only HVR4400/HVR5500)*/ |
1550 | 1555 | ||
1551 | /* Put the parts into reset and back */ | 1556 | /* Put the parts into reset and back */ |
1552 | cx23885_gpio_enable(dev, GPIO_8 | GPIO_9, 1); | 1557 | cx23885_gpio_enable(dev, GPIO_8 | GPIO_9, 1); |
@@ -1872,6 +1877,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1872 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1877 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
1873 | case CX23885_BOARD_HAUPPAUGE_HVR1290: | 1878 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
1874 | case CX23885_BOARD_HAUPPAUGE_HVR4400: | 1879 | case CX23885_BOARD_HAUPPAUGE_HVR4400: |
1880 | case CX23885_BOARD_HAUPPAUGE_STARBURST: | ||
1875 | case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE: | 1881 | case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE: |
1876 | if (dev->i2c_bus[0].i2c_rc == 0) | 1882 | if (dev->i2c_bus[0].i2c_rc == 0) |
1877 | hauppauge_eeprom(dev, eeprom+0xc0); | 1883 | hauppauge_eeprom(dev, eeprom+0xc0); |
@@ -1980,6 +1986,11 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1980 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ | 1986 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
1981 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; | 1987 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; |
1982 | break; | 1988 | break; |
1989 | case CX23885_BOARD_HAUPPAUGE_STARBURST: | ||
1990 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ | ||
1991 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ | ||
1992 | ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; | ||
1993 | break; | ||
1983 | case CX23885_BOARD_DVBSKY_T9580: | 1994 | case CX23885_BOARD_DVBSKY_T9580: |
1984 | case CX23885_BOARD_DVBSKY_T982: | 1995 | case CX23885_BOARD_DVBSKY_T982: |
1985 | ts1->gen_ctrl_val = 0x5; /* Parallel */ | 1996 | ts1->gen_ctrl_val = 0x5; /* Parallel */ |
diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 1d9d0f86ca8c..1ad49946d7fa 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c | |||
@@ -2049,11 +2049,11 @@ static void cx23885_finidev(struct pci_dev *pci_dev) | |||
2049 | 2049 | ||
2050 | cx23885_shutdown(dev); | 2050 | cx23885_shutdown(dev); |
2051 | 2051 | ||
2052 | pci_disable_device(pci_dev); | ||
2053 | |||
2054 | /* unregister stuff */ | 2052 | /* unregister stuff */ |
2055 | free_irq(pci_dev->irq, dev); | 2053 | free_irq(pci_dev->irq, dev); |
2056 | 2054 | ||
2055 | pci_disable_device(pci_dev); | ||
2056 | |||
2057 | cx23885_dev_unregister(dev); | 2057 | cx23885_dev_unregister(dev); |
2058 | vb2_dma_sg_cleanup_ctx(dev->alloc_ctx); | 2058 | vb2_dma_sg_cleanup_ctx(dev->alloc_ctx); |
2059 | v4l2_ctrl_handler_free(&dev->ctrl_handler); | 2059 | v4l2_ctrl_handler_free(&dev->ctrl_handler); |
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index c47d18270cfc..a9c450d4b54e 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c | |||
@@ -1710,6 +1710,17 @@ static int dvb_register(struct cx23885_tsport *port) | |||
1710 | break; | 1710 | break; |
1711 | } | 1711 | } |
1712 | break; | 1712 | break; |
1713 | case CX23885_BOARD_HAUPPAUGE_STARBURST: | ||
1714 | i2c_bus = &dev->i2c_bus[0]; | ||
1715 | fe0->dvb.frontend = dvb_attach(tda10071_attach, | ||
1716 | &hauppauge_tda10071_config, | ||
1717 | &i2c_bus->i2c_adap); | ||
1718 | if (fe0->dvb.frontend != NULL) { | ||
1719 | dvb_attach(a8293_attach, fe0->dvb.frontend, | ||
1720 | &i2c_bus->i2c_adap, | ||
1721 | &hauppauge_a8293_config); | ||
1722 | } | ||
1723 | break; | ||
1713 | case CX23885_BOARD_DVBSKY_T9580: | 1724 | case CX23885_BOARD_DVBSKY_T9580: |
1714 | case CX23885_BOARD_DVBSKY_S950: | 1725 | case CX23885_BOARD_DVBSKY_S950: |
1715 | i2c_bus = &dev->i2c_bus[0]; | 1726 | i2c_bus = &dev->i2c_bus[0]; |
diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index f55cd12da0fd..36f2f96c40e4 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h | |||
@@ -99,6 +99,7 @@ | |||
99 | #define CX23885_BOARD_DVBSKY_S950 49 | 99 | #define CX23885_BOARD_DVBSKY_S950 49 |
100 | #define CX23885_BOARD_DVBSKY_S952 50 | 100 | #define CX23885_BOARD_DVBSKY_S952 50 |
101 | #define CX23885_BOARD_DVBSKY_T982 51 | 101 | #define CX23885_BOARD_DVBSKY_T982 51 |
102 | #define CX23885_BOARD_HAUPPAUGE_STARBURST 52 | ||
102 | 103 | ||
103 | #define GPIO_0 0x00000001 | 104 | #define GPIO_0 0x00000001 |
104 | #define GPIO_1 0x00000002 | 105 | #define GPIO_1 0x00000002 |
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index b463fe172d16..3fe9047ef466 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c | |||
@@ -602,10 +602,13 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap) | |||
602 | strlcpy(cap->card, video->video.name, sizeof(cap->card)); | 602 | strlcpy(cap->card, video->video.name, sizeof(cap->card)); |
603 | strlcpy(cap->bus_info, "media", sizeof(cap->bus_info)); | 603 | strlcpy(cap->bus_info, "media", sizeof(cap->bus_info)); |
604 | 604 | ||
605 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | ||
606 | | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; | ||
607 | |||
605 | if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | 608 | if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
606 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 609 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
607 | else | 610 | else |
608 | cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; | 611 | cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; |
609 | 612 | ||
610 | return 0; | 613 | return 0; |
611 | } | 614 | } |
diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 8efe40337608..6d885239b16a 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c | |||
@@ -760,8 +760,9 @@ static int isi_camera_querycap(struct soc_camera_host *ici, | |||
760 | { | 760 | { |
761 | strcpy(cap->driver, "atmel-isi"); | 761 | strcpy(cap->driver, "atmel-isi"); |
762 | strcpy(cap->card, "Atmel Image Sensor Interface"); | 762 | strcpy(cap->card, "Atmel Image Sensor Interface"); |
763 | cap->capabilities = (V4L2_CAP_VIDEO_CAPTURE | | 763 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
764 | V4L2_CAP_STREAMING); | 764 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
765 | |||
765 | return 0; | 766 | return 0; |
766 | } | 767 | } |
767 | 768 | ||
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index ce72bd26a6ac..192377f55840 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c | |||
@@ -1256,7 +1256,8 @@ static int mx2_camera_querycap(struct soc_camera_host *ici, | |||
1256 | { | 1256 | { |
1257 | /* cap->name is set by the friendly caller:-> */ | 1257 | /* cap->name is set by the friendly caller:-> */ |
1258 | strlcpy(cap->card, MX2_CAM_DRIVER_DESCRIPTION, sizeof(cap->card)); | 1258 | strlcpy(cap->card, MX2_CAM_DRIVER_DESCRIPTION, sizeof(cap->card)); |
1259 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 1259 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
1260 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
1260 | 1261 | ||
1261 | return 0; | 1262 | return 0; |
1262 | } | 1263 | } |
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index a60c3bb0e4cc..0b3299dee05d 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c | |||
@@ -967,7 +967,8 @@ static int mx3_camera_querycap(struct soc_camera_host *ici, | |||
967 | { | 967 | { |
968 | /* cap->name is set by the firendly caller:-> */ | 968 | /* cap->name is set by the firendly caller:-> */ |
969 | strlcpy(cap->card, "i.MX3x Camera", sizeof(cap->card)); | 969 | strlcpy(cap->card, "i.MX3x Camera", sizeof(cap->card)); |
970 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 970 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
971 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
971 | 972 | ||
972 | return 0; | 973 | return 0; |
973 | } | 974 | } |
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c index e6b93281f246..16f65ecb70a3 100644 --- a/drivers/media/platform/soc_camera/omap1_camera.c +++ b/drivers/media/platform/soc_camera/omap1_camera.c | |||
@@ -1427,7 +1427,8 @@ static int omap1_cam_querycap(struct soc_camera_host *ici, | |||
1427 | { | 1427 | { |
1428 | /* cap->name is set by the friendly caller:-> */ | 1428 | /* cap->name is set by the friendly caller:-> */ |
1429 | strlcpy(cap->card, "OMAP1 Camera", sizeof(cap->card)); | 1429 | strlcpy(cap->card, "OMAP1 Camera", sizeof(cap->card)); |
1430 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 1430 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
1431 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
1431 | 1432 | ||
1432 | return 0; | 1433 | return 0; |
1433 | } | 1434 | } |
diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 951226af0eba..8d6e343fec0f 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c | |||
@@ -1576,7 +1576,8 @@ static int pxa_camera_querycap(struct soc_camera_host *ici, | |||
1576 | { | 1576 | { |
1577 | /* cap->name is set by the firendly caller:-> */ | 1577 | /* cap->name is set by the firendly caller:-> */ |
1578 | strlcpy(cap->card, pxa_cam_driver_description, sizeof(cap->card)); | 1578 | strlcpy(cap->card, pxa_cam_driver_description, sizeof(cap->card)); |
1579 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 1579 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
1580 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
1580 | 1581 | ||
1581 | return 0; | 1582 | return 0; |
1582 | } | 1583 | } |
diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index 0c1f55648106..9f1473c0a0cf 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c | |||
@@ -1799,7 +1799,9 @@ static int rcar_vin_querycap(struct soc_camera_host *ici, | |||
1799 | struct v4l2_capability *cap) | 1799 | struct v4l2_capability *cap) |
1800 | { | 1800 | { |
1801 | strlcpy(cap->card, "R_Car_VIN", sizeof(cap->card)); | 1801 | strlcpy(cap->card, "R_Car_VIN", sizeof(cap->card)); |
1802 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 1802 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
1803 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
1804 | |||
1803 | return 0; | 1805 | return 0; |
1804 | } | 1806 | } |
1805 | 1807 | ||
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 8b27b3eb2b25..71787702d4a2 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | |||
@@ -1652,7 +1652,9 @@ static int sh_mobile_ceu_querycap(struct soc_camera_host *ici, | |||
1652 | struct v4l2_capability *cap) | 1652 | struct v4l2_capability *cap) |
1653 | { | 1653 | { |
1654 | strlcpy(cap->card, "SuperH_Mobile_CEU", sizeof(cap->card)); | 1654 | strlcpy(cap->card, "SuperH_Mobile_CEU", sizeof(cap->card)); |
1655 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; | 1655 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
1656 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
1657 | |||
1656 | return 0; | 1658 | return 0; |
1657 | } | 1659 | } |
1658 | 1660 | ||
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 0f345b1f9014..f327c49d7e09 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c | |||
@@ -2232,7 +2232,7 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties = { | |||
2232 | { | 2232 | { |
2233 | "Mygica T230 DVB-T/T2/C", | 2233 | "Mygica T230 DVB-T/T2/C", |
2234 | { NULL }, | 2234 | { NULL }, |
2235 | { &cxusb_table[22], NULL }, | 2235 | { &cxusb_table[20], NULL }, |
2236 | }, | 2236 | }, |
2237 | } | 2237 | } |
2238 | }; | 2238 | }; |
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 1b158f1167ed..536210b39428 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | |||
@@ -89,16 +89,6 @@ static int vbi_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1}; | |||
89 | module_param_array(vbi_nr, int, NULL, 0444); | 89 | module_param_array(vbi_nr, int, NULL, 0444); |
90 | MODULE_PARM_DESC(vbi_nr, "Offset for device's vbi dev minor"); | 90 | MODULE_PARM_DESC(vbi_nr, "Offset for device's vbi dev minor"); |
91 | 91 | ||
92 | static struct v4l2_capability pvr_capability ={ | ||
93 | .driver = "pvrusb2", | ||
94 | .card = "Hauppauge WinTV pvr-usb2", | ||
95 | .bus_info = "usb", | ||
96 | .version = LINUX_VERSION_CODE, | ||
97 | .capabilities = (V4L2_CAP_VIDEO_CAPTURE | | ||
98 | V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_RADIO | | ||
99 | V4L2_CAP_READWRITE), | ||
100 | }; | ||
101 | |||
102 | static struct v4l2_fmtdesc pvr_fmtdesc [] = { | 92 | static struct v4l2_fmtdesc pvr_fmtdesc [] = { |
103 | { | 93 | { |
104 | .index = 0, | 94 | .index = 0, |
@@ -160,10 +150,22 @@ static int pvr2_querycap(struct file *file, void *priv, struct v4l2_capability * | |||
160 | struct pvr2_v4l2_fh *fh = file->private_data; | 150 | struct pvr2_v4l2_fh *fh = file->private_data; |
161 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; | 151 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; |
162 | 152 | ||
163 | memcpy(cap, &pvr_capability, sizeof(struct v4l2_capability)); | 153 | strlcpy(cap->driver, "pvrusb2", sizeof(cap->driver)); |
164 | strlcpy(cap->bus_info, pvr2_hdw_get_bus_info(hdw), | 154 | strlcpy(cap->bus_info, pvr2_hdw_get_bus_info(hdw), |
165 | sizeof(cap->bus_info)); | 155 | sizeof(cap->bus_info)); |
166 | strlcpy(cap->card, pvr2_hdw_get_desc(hdw), sizeof(cap->card)); | 156 | strlcpy(cap->card, pvr2_hdw_get_desc(hdw), sizeof(cap->card)); |
157 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | | ||
158 | V4L2_CAP_AUDIO | V4L2_CAP_RADIO | | ||
159 | V4L2_CAP_READWRITE | V4L2_CAP_DEVICE_CAPS; | ||
160 | switch (fh->pdi->devbase.vfl_type) { | ||
161 | case VFL_TYPE_GRABBER: | ||
162 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO; | ||
163 | break; | ||
164 | case VFL_TYPE_RADIO: | ||
165 | cap->device_caps = V4L2_CAP_RADIO; | ||
166 | break; | ||
167 | } | ||
168 | cap->device_caps |= V4L2_CAP_TUNER | V4L2_CAP_READWRITE; | ||
167 | return 0; | 169 | return 0; |
168 | } | 170 | } |
169 | 171 | ||
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index d09a8916e940..bc08a829bc13 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -3146,27 +3146,26 @@ static int vb2_thread(void *data) | |||
3146 | prequeue--; | 3146 | prequeue--; |
3147 | } else { | 3147 | } else { |
3148 | call_void_qop(q, wait_finish, q); | 3148 | call_void_qop(q, wait_finish, q); |
3149 | ret = vb2_internal_dqbuf(q, &fileio->b, 0); | 3149 | if (!threadio->stop) |
3150 | ret = vb2_internal_dqbuf(q, &fileio->b, 0); | ||
3150 | call_void_qop(q, wait_prepare, q); | 3151 | call_void_qop(q, wait_prepare, q); |
3151 | dprintk(5, "file io: vb2_dqbuf result: %d\n", ret); | 3152 | dprintk(5, "file io: vb2_dqbuf result: %d\n", ret); |
3152 | } | 3153 | } |
3153 | if (threadio->stop) | 3154 | if (ret || threadio->stop) |
3154 | break; | ||
3155 | if (ret) | ||
3156 | break; | 3155 | break; |
3157 | try_to_freeze(); | 3156 | try_to_freeze(); |
3158 | 3157 | ||
3159 | vb = q->bufs[fileio->b.index]; | 3158 | vb = q->bufs[fileio->b.index]; |
3160 | if (!(fileio->b.flags & V4L2_BUF_FLAG_ERROR)) | 3159 | if (!(fileio->b.flags & V4L2_BUF_FLAG_ERROR)) |
3161 | ret = threadio->fnc(vb, threadio->priv); | 3160 | if (threadio->fnc(vb, threadio->priv)) |
3162 | if (ret) | 3161 | break; |
3163 | break; | ||
3164 | call_void_qop(q, wait_finish, q); | 3162 | call_void_qop(q, wait_finish, q); |
3165 | if (set_timestamp) | 3163 | if (set_timestamp) |
3166 | v4l2_get_timestamp(&fileio->b.timestamp); | 3164 | v4l2_get_timestamp(&fileio->b.timestamp); |
3167 | ret = vb2_internal_qbuf(q, &fileio->b); | 3165 | if (!threadio->stop) |
3166 | ret = vb2_internal_qbuf(q, &fileio->b); | ||
3168 | call_void_qop(q, wait_prepare, q); | 3167 | call_void_qop(q, wait_prepare, q); |
3169 | if (ret) | 3168 | if (ret || threadio->stop) |
3170 | break; | 3169 | break; |
3171 | } | 3170 | } |
3172 | 3171 | ||
@@ -3235,11 +3234,11 @@ int vb2_thread_stop(struct vb2_queue *q) | |||
3235 | threadio->stop = true; | 3234 | threadio->stop = true; |
3236 | vb2_internal_streamoff(q, q->type); | 3235 | vb2_internal_streamoff(q, q->type); |
3237 | call_void_qop(q, wait_prepare, q); | 3236 | call_void_qop(q, wait_prepare, q); |
3237 | err = kthread_stop(threadio->thread); | ||
3238 | q->fileio = NULL; | 3238 | q->fileio = NULL; |
3239 | fileio->req.count = 0; | 3239 | fileio->req.count = 0; |
3240 | vb2_reqbufs(q, &fileio->req); | 3240 | vb2_reqbufs(q, &fileio->req); |
3241 | kfree(fileio); | 3241 | kfree(fileio); |
3242 | err = kthread_stop(threadio->thread); | ||
3243 | threadio->thread = NULL; | 3242 | threadio->thread = NULL; |
3244 | kfree(threadio); | 3243 | kfree(threadio); |
3245 | q->fileio = NULL; | 3244 | q->fileio = NULL; |
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index 52a0c2f6264f..ae498b53ee40 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c | |||
@@ -554,7 +554,8 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id) | |||
554 | return ret; | 554 | return ret; |
555 | } | 555 | } |
556 | 556 | ||
557 | ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info, | 557 | ret = mfd_add_devices(da9052->dev, PLATFORM_DEVID_AUTO, |
558 | da9052_subdev_info, | ||
558 | ARRAY_SIZE(da9052_subdev_info), NULL, 0, NULL); | 559 | ARRAY_SIZE(da9052_subdev_info), NULL, 0, NULL); |
559 | if (ret) { | 560 | if (ret) { |
560 | dev_err(da9052->dev, "mfd_add_devices failed: %d\n", ret); | 561 | dev_err(da9052->dev, "mfd_add_devices failed: %d\n", ret); |
diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c index dbdd0faeb6ce..210d1f85679e 100644 --- a/drivers/mfd/rtsx_usb.c +++ b/drivers/mfd/rtsx_usb.c | |||
@@ -681,21 +681,9 @@ static void rtsx_usb_disconnect(struct usb_interface *intf) | |||
681 | #ifdef CONFIG_PM | 681 | #ifdef CONFIG_PM |
682 | static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message) | 682 | static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message) |
683 | { | 683 | { |
684 | struct rtsx_ucr *ucr = | ||
685 | (struct rtsx_ucr *)usb_get_intfdata(intf); | ||
686 | |||
687 | dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n", | 684 | dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n", |
688 | __func__, message.event); | 685 | __func__, message.event); |
689 | 686 | ||
690 | /* | ||
691 | * Call to make sure LED is off during suspend to save more power. | ||
692 | * It is NOT a permanent state and could be turned on anytime later. | ||
693 | * Thus no need to call turn_on when resunming. | ||
694 | */ | ||
695 | mutex_lock(&ucr->dev_mutex); | ||
696 | rtsx_usb_turn_off_led(ucr); | ||
697 | mutex_unlock(&ucr->dev_mutex); | ||
698 | |||
699 | return 0; | 687 | return 0; |
700 | } | 688 | } |
701 | 689 | ||
diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c index 0d256cb002eb..d6b764349f9d 100644 --- a/drivers/mfd/tps65218.c +++ b/drivers/mfd/tps65218.c | |||
@@ -125,10 +125,21 @@ int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg, | |||
125 | } | 125 | } |
126 | EXPORT_SYMBOL_GPL(tps65218_clear_bits); | 126 | EXPORT_SYMBOL_GPL(tps65218_clear_bits); |
127 | 127 | ||
128 | static const struct regmap_range tps65218_yes_ranges[] = { | ||
129 | regmap_reg_range(TPS65218_REG_INT1, TPS65218_REG_INT2), | ||
130 | regmap_reg_range(TPS65218_REG_STATUS, TPS65218_REG_STATUS), | ||
131 | }; | ||
132 | |||
133 | static const struct regmap_access_table tps65218_volatile_table = { | ||
134 | .yes_ranges = tps65218_yes_ranges, | ||
135 | .n_yes_ranges = ARRAY_SIZE(tps65218_yes_ranges), | ||
136 | }; | ||
137 | |||
128 | static struct regmap_config tps65218_regmap_config = { | 138 | static struct regmap_config tps65218_regmap_config = { |
129 | .reg_bits = 8, | 139 | .reg_bits = 8, |
130 | .val_bits = 8, | 140 | .val_bits = 8, |
131 | .cache_type = REGCACHE_RBTREE, | 141 | .cache_type = REGCACHE_RBTREE, |
142 | .volatile_table = &tps65218_volatile_table, | ||
132 | }; | 143 | }; |
133 | 144 | ||
134 | static const struct regmap_irq tps65218_irqs[] = { | 145 | static const struct regmap_irq tps65218_irqs[] = { |
@@ -193,6 +204,7 @@ static struct regmap_irq_chip tps65218_irq_chip = { | |||
193 | 204 | ||
194 | .num_regs = 2, | 205 | .num_regs = 2, |
195 | .mask_base = TPS65218_REG_INT_MASK1, | 206 | .mask_base = TPS65218_REG_INT_MASK1, |
207 | .status_base = TPS65218_REG_INT1, | ||
196 | }; | 208 | }; |
197 | 209 | ||
198 | static const struct of_device_id of_tps65218_match_table[] = { | 210 | static const struct of_device_id of_tps65218_match_table[] = { |
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c index 51fd6b524371..d1b55fe62817 100644 --- a/drivers/misc/cxl/context.c +++ b/drivers/misc/cxl/context.c | |||
@@ -100,6 +100,46 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master, | |||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | static int cxl_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
104 | { | ||
105 | struct cxl_context *ctx = vma->vm_file->private_data; | ||
106 | unsigned long address = (unsigned long)vmf->virtual_address; | ||
107 | u64 area, offset; | ||
108 | |||
109 | offset = vmf->pgoff << PAGE_SHIFT; | ||
110 | |||
111 | pr_devel("%s: pe: %i address: 0x%lx offset: 0x%llx\n", | ||
112 | __func__, ctx->pe, address, offset); | ||
113 | |||
114 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { | ||
115 | area = ctx->afu->psn_phys; | ||
116 | if (offset > ctx->afu->adapter->ps_size) | ||
117 | return VM_FAULT_SIGBUS; | ||
118 | } else { | ||
119 | area = ctx->psn_phys; | ||
120 | if (offset > ctx->psn_size) | ||
121 | return VM_FAULT_SIGBUS; | ||
122 | } | ||
123 | |||
124 | mutex_lock(&ctx->status_mutex); | ||
125 | |||
126 | if (ctx->status != STARTED) { | ||
127 | mutex_unlock(&ctx->status_mutex); | ||
128 | pr_devel("%s: Context not started, failing problem state access\n", __func__); | ||
129 | return VM_FAULT_SIGBUS; | ||
130 | } | ||
131 | |||
132 | vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT); | ||
133 | |||
134 | mutex_unlock(&ctx->status_mutex); | ||
135 | |||
136 | return VM_FAULT_NOPAGE; | ||
137 | } | ||
138 | |||
139 | static const struct vm_operations_struct cxl_mmap_vmops = { | ||
140 | .fault = cxl_mmap_fault, | ||
141 | }; | ||
142 | |||
103 | /* | 143 | /* |
104 | * Map a per-context mmio space into the given vma. | 144 | * Map a per-context mmio space into the given vma. |
105 | */ | 145 | */ |
@@ -108,26 +148,25 @@ int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma) | |||
108 | u64 len = vma->vm_end - vma->vm_start; | 148 | u64 len = vma->vm_end - vma->vm_start; |
109 | len = min(len, ctx->psn_size); | 149 | len = min(len, ctx->psn_size); |
110 | 150 | ||
111 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { | 151 | if (ctx->afu->current_mode != CXL_MODE_DEDICATED) { |
112 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 152 | /* make sure there is a valid per process space for this AFU */ |
113 | return vm_iomap_memory(vma, ctx->afu->psn_phys, ctx->afu->adapter->ps_size); | 153 | if ((ctx->master && !ctx->afu->psa) || (!ctx->afu->pp_psa)) { |
114 | } | 154 | pr_devel("AFU doesn't support mmio space\n"); |
155 | return -EINVAL; | ||
156 | } | ||
115 | 157 | ||
116 | /* make sure there is a valid per process space for this AFU */ | 158 | /* Can't mmap until the AFU is enabled */ |
117 | if ((ctx->master && !ctx->afu->psa) || (!ctx->afu->pp_psa)) { | 159 | if (!ctx->afu->enabled) |
118 | pr_devel("AFU doesn't support mmio space\n"); | 160 | return -EBUSY; |
119 | return -EINVAL; | ||
120 | } | 161 | } |
121 | 162 | ||
122 | /* Can't mmap until the AFU is enabled */ | ||
123 | if (!ctx->afu->enabled) | ||
124 | return -EBUSY; | ||
125 | |||
126 | pr_devel("%s: mmio physical: %llx pe: %i master:%i\n", __func__, | 163 | pr_devel("%s: mmio physical: %llx pe: %i master:%i\n", __func__, |
127 | ctx->psn_phys, ctx->pe , ctx->master); | 164 | ctx->psn_phys, ctx->pe , ctx->master); |
128 | 165 | ||
166 | vma->vm_flags |= VM_IO | VM_PFNMAP; | ||
129 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 167 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
130 | return vm_iomap_memory(vma, ctx->psn_phys, len); | 168 | vma->vm_ops = &cxl_mmap_vmops; |
169 | return 0; | ||
131 | } | 170 | } |
132 | 171 | ||
133 | /* | 172 | /* |
@@ -150,12 +189,6 @@ static void __detach_context(struct cxl_context *ctx) | |||
150 | afu_release_irqs(ctx); | 189 | afu_release_irqs(ctx); |
151 | flush_work(&ctx->fault_work); /* Only needed for dedicated process */ | 190 | flush_work(&ctx->fault_work); /* Only needed for dedicated process */ |
152 | wake_up_all(&ctx->wq); | 191 | wake_up_all(&ctx->wq); |
153 | |||
154 | /* Release Problem State Area mapping */ | ||
155 | mutex_lock(&ctx->mapping_lock); | ||
156 | if (ctx->mapping) | ||
157 | unmap_mapping_range(ctx->mapping, 0, 0, 1); | ||
158 | mutex_unlock(&ctx->mapping_lock); | ||
159 | } | 192 | } |
160 | 193 | ||
161 | /* | 194 | /* |
@@ -184,6 +217,17 @@ void cxl_context_detach_all(struct cxl_afu *afu) | |||
184 | * created and torn down after the IDR removed | 217 | * created and torn down after the IDR removed |
185 | */ | 218 | */ |
186 | __detach_context(ctx); | 219 | __detach_context(ctx); |
220 | |||
221 | /* | ||
222 | * We are force detaching - remove any active PSA mappings so | ||
223 | * userspace cannot interfere with the card if it comes back. | ||
224 | * Easiest way to exercise this is to unbind and rebind the | ||
225 | * driver via sysfs while it is in use. | ||
226 | */ | ||
227 | mutex_lock(&ctx->mapping_lock); | ||
228 | if (ctx->mapping) | ||
229 | unmap_mapping_range(ctx->mapping, 0, 0, 1); | ||
230 | mutex_unlock(&ctx->mapping_lock); | ||
187 | } | 231 | } |
188 | mutex_unlock(&afu->contexts_lock); | 232 | mutex_unlock(&afu->contexts_lock); |
189 | } | 233 | } |
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c index e9f2f10dbb37..b15d8113877c 100644 --- a/drivers/misc/cxl/file.c +++ b/drivers/misc/cxl/file.c | |||
@@ -140,18 +140,20 @@ static long afu_ioctl_start_work(struct cxl_context *ctx, | |||
140 | 140 | ||
141 | pr_devel("%s: pe: %i\n", __func__, ctx->pe); | 141 | pr_devel("%s: pe: %i\n", __func__, ctx->pe); |
142 | 142 | ||
143 | mutex_lock(&ctx->status_mutex); | 143 | /* Do this outside the status_mutex to avoid a circular dependency with |
144 | if (ctx->status != OPENED) { | 144 | * the locking in cxl_mmap_fault() */ |
145 | rc = -EIO; | ||
146 | goto out; | ||
147 | } | ||
148 | |||
149 | if (copy_from_user(&work, uwork, | 145 | if (copy_from_user(&work, uwork, |
150 | sizeof(struct cxl_ioctl_start_work))) { | 146 | sizeof(struct cxl_ioctl_start_work))) { |
151 | rc = -EFAULT; | 147 | rc = -EFAULT; |
152 | goto out; | 148 | goto out; |
153 | } | 149 | } |
154 | 150 | ||
151 | mutex_lock(&ctx->status_mutex); | ||
152 | if (ctx->status != OPENED) { | ||
153 | rc = -EIO; | ||
154 | goto out; | ||
155 | } | ||
156 | |||
155 | /* | 157 | /* |
156 | * if any of the reserved fields are set or any of the unused | 158 | * if any of the reserved fields are set or any of the unused |
157 | * flags are set it's invalid | 159 | * flags are set it's invalid |
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index ff2755062b44..06ff0a2ec960 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
@@ -234,6 +234,18 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable) | |||
234 | struct mei_me_hw *hw = to_me_hw(dev); | 234 | struct mei_me_hw *hw = to_me_hw(dev); |
235 | u32 hcsr = mei_hcsr_read(hw); | 235 | u32 hcsr = mei_hcsr_read(hw); |
236 | 236 | ||
237 | /* H_RST may be found lit before reset is started, | ||
238 | * for example if preceding reset flow hasn't completed. | ||
239 | * In that case asserting H_RST will be ignored, therefore | ||
240 | * we need to clean H_RST bit to start a successful reset sequence. | ||
241 | */ | ||
242 | if ((hcsr & H_RST) == H_RST) { | ||
243 | dev_warn(dev->dev, "H_RST is set = 0x%08X", hcsr); | ||
244 | hcsr &= ~H_RST; | ||
245 | mei_me_reg_write(hw, H_CSR, hcsr); | ||
246 | hcsr = mei_hcsr_read(hw); | ||
247 | } | ||
248 | |||
237 | hcsr |= H_RST | H_IG | H_IS; | 249 | hcsr |= H_RST | H_IG | H_IS; |
238 | 250 | ||
239 | if (intr_enable) | 251 | if (intr_enable) |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 1453cd127921..f1a488ee432f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1271,6 +1271,12 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, | |||
1271 | spin_unlock_irq(&host->lock); | 1271 | spin_unlock_irq(&host->lock); |
1272 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); | 1272 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
1273 | spin_lock_irq(&host->lock); | 1273 | spin_lock_irq(&host->lock); |
1274 | |||
1275 | if (mode != MMC_POWER_OFF) | ||
1276 | sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); | ||
1277 | else | ||
1278 | sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); | ||
1279 | |||
1274 | return; | 1280 | return; |
1275 | } | 1281 | } |
1276 | 1282 | ||
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 70f77e96d409..041525d2595c 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
@@ -615,6 +615,9 @@ static void c_can_stop(struct net_device *dev) | |||
615 | 615 | ||
616 | c_can_irq_control(priv, false); | 616 | c_can_irq_control(priv, false); |
617 | 617 | ||
618 | /* put ctrl to init on stop to end ongoing transmission */ | ||
619 | priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_INIT); | ||
620 | |||
618 | /* deactivate pins */ | 621 | /* deactivate pins */ |
619 | pinctrl_pm_select_sleep_state(dev->dev.parent); | 622 | pinctrl_pm_select_sleep_state(dev->dev.parent); |
620 | priv->can.state = CAN_STATE_STOPPED; | 623 | priv->can.state = CAN_STATE_STOPPED; |
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index f363972cd77d..e36d10520e24 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
@@ -103,27 +103,34 @@ static void c_can_hw_raminit_syscon(const struct c_can_priv *priv, bool enable) | |||
103 | mask = 1 << raminit->bits.start | 1 << raminit->bits.done; | 103 | mask = 1 << raminit->bits.start | 1 << raminit->bits.done; |
104 | regmap_read(raminit->syscon, raminit->reg, &ctrl); | 104 | regmap_read(raminit->syscon, raminit->reg, &ctrl); |
105 | 105 | ||
106 | /* We clear the done and start bit first. The start bit is | 106 | /* We clear the start bit first. The start bit is |
107 | * looking at the 0 -> transition, but is not self clearing; | 107 | * looking at the 0 -> transition, but is not self clearing; |
108 | * And we clear the init done bit as well. | ||
109 | * NOTE: DONE must be written with 1 to clear it. | 108 | * NOTE: DONE must be written with 1 to clear it. |
109 | * We can't clear the DONE bit here using regmap_update_bits() | ||
110 | * as it will bypass the write if initial condition is START:0 DONE:1 | ||
111 | * e.g. on DRA7 which needs START pulse. | ||
110 | */ | 112 | */ |
111 | ctrl &= ~(1 << raminit->bits.start); | 113 | ctrl &= ~mask; /* START = 0, DONE = 0 */ |
112 | ctrl |= 1 << raminit->bits.done; | 114 | regmap_update_bits(raminit->syscon, raminit->reg, mask, ctrl); |
113 | regmap_write(raminit->syscon, raminit->reg, ctrl); | ||
114 | 115 | ||
115 | ctrl &= ~(1 << raminit->bits.done); | 116 | /* check if START bit is 0. Ignore DONE bit for now |
116 | c_can_hw_raminit_wait_syscon(priv, mask, ctrl); | 117 | * as it can be either 0 or 1. |
118 | */ | ||
119 | c_can_hw_raminit_wait_syscon(priv, 1 << raminit->bits.start, ctrl); | ||
117 | 120 | ||
118 | if (enable) { | 121 | if (enable) { |
119 | /* Set start bit and wait for the done bit. */ | 122 | /* Clear DONE bit & set START bit. */ |
120 | ctrl |= 1 << raminit->bits.start; | 123 | ctrl |= 1 << raminit->bits.start; |
121 | regmap_write(raminit->syscon, raminit->reg, ctrl); | 124 | /* DONE must be written with 1 to clear it */ |
122 | 125 | ctrl |= 1 << raminit->bits.done; | |
126 | regmap_update_bits(raminit->syscon, raminit->reg, mask, ctrl); | ||
127 | /* prevent further clearing of DONE bit */ | ||
128 | ctrl &= ~(1 << raminit->bits.done); | ||
123 | /* clear START bit if start pulse is needed */ | 129 | /* clear START bit if start pulse is needed */ |
124 | if (raminit->needs_pulse) { | 130 | if (raminit->needs_pulse) { |
125 | ctrl &= ~(1 << raminit->bits.start); | 131 | ctrl &= ~(1 << raminit->bits.start); |
126 | regmap_write(raminit->syscon, raminit->reg, ctrl); | 132 | regmap_update_bits(raminit->syscon, raminit->reg, |
133 | mask, ctrl); | ||
127 | } | 134 | } |
128 | 135 | ||
129 | ctrl |= 1 << raminit->bits.done; | 136 | ctrl |= 1 << raminit->bits.done; |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 6ac02c8d747e..3c82e02e3dae 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -808,10 +808,14 @@ static int can_changelink(struct net_device *dev, | |||
808 | if (dev->flags & IFF_UP) | 808 | if (dev->flags & IFF_UP) |
809 | return -EBUSY; | 809 | return -EBUSY; |
810 | cm = nla_data(data[IFLA_CAN_CTRLMODE]); | 810 | cm = nla_data(data[IFLA_CAN_CTRLMODE]); |
811 | if (cm->flags & ~priv->ctrlmode_supported) | 811 | |
812 | /* check whether changed bits are allowed to be modified */ | ||
813 | if (cm->mask & ~priv->ctrlmode_supported) | ||
812 | return -EOPNOTSUPP; | 814 | return -EOPNOTSUPP; |
815 | |||
816 | /* clear bits to be modified and copy the flag values */ | ||
813 | priv->ctrlmode &= ~cm->mask; | 817 | priv->ctrlmode &= ~cm->mask; |
814 | priv->ctrlmode |= cm->flags; | 818 | priv->ctrlmode |= (cm->flags & cm->mask); |
815 | 819 | ||
816 | /* CAN_CTRLMODE_FD can only be set when driver supports FD */ | 820 | /* CAN_CTRLMODE_FD can only be set when driver supports FD */ |
817 | if (priv->ctrlmode & CAN_CTRLMODE_FD) | 821 | if (priv->ctrlmode & CAN_CTRLMODE_FD) |
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index b2ecb6c5e94b..2e04b3aeeb37 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c | |||
@@ -956,6 +956,11 @@ static struct net_device *alloc_m_can_dev(void) | |||
956 | priv->can.data_bittiming_const = &m_can_data_bittiming_const; | 956 | priv->can.data_bittiming_const = &m_can_data_bittiming_const; |
957 | priv->can.do_set_mode = m_can_set_mode; | 957 | priv->can.do_set_mode = m_can_set_mode; |
958 | priv->can.do_get_berr_counter = m_can_get_berr_counter; | 958 | priv->can.do_get_berr_counter = m_can_get_berr_counter; |
959 | |||
960 | /* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.0.1 */ | ||
961 | priv->can.ctrlmode = CAN_CTRLMODE_FD_NON_ISO; | ||
962 | |||
963 | /* CAN_CTRLMODE_FD_NON_ISO can not be changed with M_CAN IP v3.0.1 */ | ||
959 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | | 964 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | |
960 | CAN_CTRLMODE_LISTENONLY | | 965 | CAN_CTRLMODE_LISTENONLY | |
961 | CAN_CTRLMODE_BERR_REPORTING | | 966 | CAN_CTRLMODE_BERR_REPORTING | |
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 541fb7a05625..7af379ca861b 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -520,10 +520,10 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, | |||
520 | skb = alloc_can_err_skb(priv->netdev, &cf); | 520 | skb = alloc_can_err_skb(priv->netdev, &cf); |
521 | if (skb) { | 521 | if (skb) { |
522 | cf->can_id |= CAN_ERR_RESTARTED; | 522 | cf->can_id |= CAN_ERR_RESTARTED; |
523 | netif_rx(skb); | ||
524 | 523 | ||
525 | stats->rx_packets++; | 524 | stats->rx_packets++; |
526 | stats->rx_bytes += cf->can_dlc; | 525 | stats->rx_bytes += cf->can_dlc; |
526 | netif_rx(skb); | ||
527 | } else { | 527 | } else { |
528 | netdev_err(priv->netdev, | 528 | netdev_err(priv->netdev, |
529 | "No memory left for err_skb\n"); | 529 | "No memory left for err_skb\n"); |
@@ -587,7 +587,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, | |||
587 | usb_sndbulkpipe(dev->udev, | 587 | usb_sndbulkpipe(dev->udev, |
588 | dev->bulk_out->bEndpointAddress), | 588 | dev->bulk_out->bEndpointAddress), |
589 | buf, msg->len, | 589 | buf, msg->len, |
590 | kvaser_usb_simple_msg_callback, priv); | 590 | kvaser_usb_simple_msg_callback, netdev); |
591 | usb_anchor_urb(urb, &priv->tx_submitted); | 591 | usb_anchor_urb(urb, &priv->tx_submitted); |
592 | 592 | ||
593 | err = usb_submit_urb(urb, GFP_ATOMIC); | 593 | err = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -662,11 +662,6 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | |||
662 | priv = dev->nets[channel]; | 662 | priv = dev->nets[channel]; |
663 | stats = &priv->netdev->stats; | 663 | stats = &priv->netdev->stats; |
664 | 664 | ||
665 | if (status & M16C_STATE_BUS_RESET) { | ||
666 | kvaser_usb_unlink_tx_urbs(priv); | ||
667 | return; | ||
668 | } | ||
669 | |||
670 | skb = alloc_can_err_skb(priv->netdev, &cf); | 665 | skb = alloc_can_err_skb(priv->netdev, &cf); |
671 | if (!skb) { | 666 | if (!skb) { |
672 | stats->rx_dropped++; | 667 | stats->rx_dropped++; |
@@ -677,7 +672,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | |||
677 | 672 | ||
678 | netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status); | 673 | netdev_dbg(priv->netdev, "Error status: 0x%02x\n", status); |
679 | 674 | ||
680 | if (status & M16C_STATE_BUS_OFF) { | 675 | if (status & (M16C_STATE_BUS_OFF | M16C_STATE_BUS_RESET)) { |
681 | cf->can_id |= CAN_ERR_BUSOFF; | 676 | cf->can_id |= CAN_ERR_BUSOFF; |
682 | 677 | ||
683 | priv->can.can_stats.bus_off++; | 678 | priv->can.can_stats.bus_off++; |
@@ -703,9 +698,7 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | |||
703 | } | 698 | } |
704 | 699 | ||
705 | new_state = CAN_STATE_ERROR_PASSIVE; | 700 | new_state = CAN_STATE_ERROR_PASSIVE; |
706 | } | 701 | } else if (status & M16C_STATE_BUS_ERROR) { |
707 | |||
708 | if (status == M16C_STATE_BUS_ERROR) { | ||
709 | if ((priv->can.state < CAN_STATE_ERROR_WARNING) && | 702 | if ((priv->can.state < CAN_STATE_ERROR_WARNING) && |
710 | ((txerr >= 96) || (rxerr >= 96))) { | 703 | ((txerr >= 96) || (rxerr >= 96))) { |
711 | cf->can_id |= CAN_ERR_CRTL; | 704 | cf->can_id |= CAN_ERR_CRTL; |
@@ -715,7 +708,8 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | |||
715 | 708 | ||
716 | priv->can.can_stats.error_warning++; | 709 | priv->can.can_stats.error_warning++; |
717 | new_state = CAN_STATE_ERROR_WARNING; | 710 | new_state = CAN_STATE_ERROR_WARNING; |
718 | } else if (priv->can.state > CAN_STATE_ERROR_ACTIVE) { | 711 | } else if ((priv->can.state > CAN_STATE_ERROR_ACTIVE) && |
712 | ((txerr < 96) && (rxerr < 96))) { | ||
719 | cf->can_id |= CAN_ERR_PROT; | 713 | cf->can_id |= CAN_ERR_PROT; |
720 | cf->data[2] = CAN_ERR_PROT_ACTIVE; | 714 | cf->data[2] = CAN_ERR_PROT_ACTIVE; |
721 | 715 | ||
@@ -770,10 +764,9 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, | |||
770 | 764 | ||
771 | priv->can.state = new_state; | 765 | priv->can.state = new_state; |
772 | 766 | ||
773 | netif_rx(skb); | ||
774 | |||
775 | stats->rx_packets++; | 767 | stats->rx_packets++; |
776 | stats->rx_bytes += cf->can_dlc; | 768 | stats->rx_bytes += cf->can_dlc; |
769 | netif_rx(skb); | ||
777 | } | 770 | } |
778 | 771 | ||
779 | static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, | 772 | static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, |
@@ -805,10 +798,9 @@ static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv, | |||
805 | stats->rx_over_errors++; | 798 | stats->rx_over_errors++; |
806 | stats->rx_errors++; | 799 | stats->rx_errors++; |
807 | 800 | ||
808 | netif_rx(skb); | ||
809 | |||
810 | stats->rx_packets++; | 801 | stats->rx_packets++; |
811 | stats->rx_bytes += cf->can_dlc; | 802 | stats->rx_bytes += cf->can_dlc; |
803 | netif_rx(skb); | ||
812 | } | 804 | } |
813 | } | 805 | } |
814 | 806 | ||
@@ -887,10 +879,9 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, | |||
887 | cf->can_dlc); | 879 | cf->can_dlc); |
888 | } | 880 | } |
889 | 881 | ||
890 | netif_rx(skb); | ||
891 | |||
892 | stats->rx_packets++; | 882 | stats->rx_packets++; |
893 | stats->rx_bytes += cf->can_dlc; | 883 | stats->rx_bytes += cf->can_dlc; |
884 | netif_rx(skb); | ||
894 | } | 885 | } |
895 | 886 | ||
896 | static void kvaser_usb_start_chip_reply(const struct kvaser_usb *dev, | 887 | static void kvaser_usb_start_chip_reply(const struct kvaser_usb *dev, |
@@ -1246,6 +1237,9 @@ static int kvaser_usb_close(struct net_device *netdev) | |||
1246 | if (err) | 1237 | if (err) |
1247 | netdev_warn(netdev, "Cannot stop device, error %d\n", err); | 1238 | netdev_warn(netdev, "Cannot stop device, error %d\n", err); |
1248 | 1239 | ||
1240 | /* reset tx contexts */ | ||
1241 | kvaser_usb_unlink_tx_urbs(priv); | ||
1242 | |||
1249 | priv->can.state = CAN_STATE_STOPPED; | 1243 | priv->can.state = CAN_STATE_STOPPED; |
1250 | close_candev(priv->netdev); | 1244 | close_candev(priv->netdev); |
1251 | 1245 | ||
@@ -1294,12 +1288,14 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
1294 | if (!urb) { | 1288 | if (!urb) { |
1295 | netdev_err(netdev, "No memory left for URBs\n"); | 1289 | netdev_err(netdev, "No memory left for URBs\n"); |
1296 | stats->tx_dropped++; | 1290 | stats->tx_dropped++; |
1297 | goto nourbmem; | 1291 | dev_kfree_skb(skb); |
1292 | return NETDEV_TX_OK; | ||
1298 | } | 1293 | } |
1299 | 1294 | ||
1300 | buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); | 1295 | buf = kmalloc(sizeof(struct kvaser_msg), GFP_ATOMIC); |
1301 | if (!buf) { | 1296 | if (!buf) { |
1302 | stats->tx_dropped++; | 1297 | stats->tx_dropped++; |
1298 | dev_kfree_skb(skb); | ||
1303 | goto nobufmem; | 1299 | goto nobufmem; |
1304 | } | 1300 | } |
1305 | 1301 | ||
@@ -1334,6 +1330,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
1334 | } | 1330 | } |
1335 | } | 1331 | } |
1336 | 1332 | ||
1333 | /* This should never happen; it implies a flow control bug */ | ||
1337 | if (!context) { | 1334 | if (!context) { |
1338 | netdev_warn(netdev, "cannot find free context\n"); | 1335 | netdev_warn(netdev, "cannot find free context\n"); |
1339 | ret = NETDEV_TX_BUSY; | 1336 | ret = NETDEV_TX_BUSY; |
@@ -1364,9 +1361,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
1364 | if (unlikely(err)) { | 1361 | if (unlikely(err)) { |
1365 | can_free_echo_skb(netdev, context->echo_index); | 1362 | can_free_echo_skb(netdev, context->echo_index); |
1366 | 1363 | ||
1367 | skb = NULL; /* set to NULL to avoid double free in | ||
1368 | * dev_kfree_skb(skb) */ | ||
1369 | |||
1370 | atomic_dec(&priv->active_tx_urbs); | 1364 | atomic_dec(&priv->active_tx_urbs); |
1371 | usb_unanchor_urb(urb); | 1365 | usb_unanchor_urb(urb); |
1372 | 1366 | ||
@@ -1388,8 +1382,6 @@ releasebuf: | |||
1388 | kfree(buf); | 1382 | kfree(buf); |
1389 | nobufmem: | 1383 | nobufmem: |
1390 | usb_free_urb(urb); | 1384 | usb_free_urb(urb); |
1391 | nourbmem: | ||
1392 | dev_kfree_skb(skb); | ||
1393 | return ret; | 1385 | return ret; |
1394 | } | 1386 | } |
1395 | 1387 | ||
@@ -1502,6 +1494,10 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
1502 | struct kvaser_usb_net_priv *priv; | 1494 | struct kvaser_usb_net_priv *priv; |
1503 | int i, err; | 1495 | int i, err; |
1504 | 1496 | ||
1497 | err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); | ||
1498 | if (err) | ||
1499 | return err; | ||
1500 | |||
1505 | netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); | 1501 | netdev = alloc_candev(sizeof(*priv), MAX_TX_URBS); |
1506 | if (!netdev) { | 1502 | if (!netdev) { |
1507 | dev_err(&intf->dev, "Cannot alloc candev\n"); | 1503 | dev_err(&intf->dev, "Cannot alloc candev\n"); |
@@ -1588,7 +1584,7 @@ static int kvaser_usb_probe(struct usb_interface *intf, | |||
1588 | { | 1584 | { |
1589 | struct kvaser_usb *dev; | 1585 | struct kvaser_usb *dev; |
1590 | int err = -ENOMEM; | 1586 | int err = -ENOMEM; |
1591 | int i; | 1587 | int i, retry = 3; |
1592 | 1588 | ||
1593 | dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL); | 1589 | dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL); |
1594 | if (!dev) | 1590 | if (!dev) |
@@ -1606,10 +1602,15 @@ static int kvaser_usb_probe(struct usb_interface *intf, | |||
1606 | 1602 | ||
1607 | usb_set_intfdata(intf, dev); | 1603 | usb_set_intfdata(intf, dev); |
1608 | 1604 | ||
1609 | for (i = 0; i < MAX_NET_DEVICES; i++) | 1605 | /* On some x86 laptops, plugging a Kvaser device again after |
1610 | kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, i); | 1606 | * an unplug makes the firmware always ignore the very first |
1607 | * command. For such a case, provide some room for retries | ||
1608 | * instead of completely exiting the driver. | ||
1609 | */ | ||
1610 | do { | ||
1611 | err = kvaser_usb_get_software_info(dev); | ||
1612 | } while (--retry && err == -ETIMEDOUT); | ||
1611 | 1613 | ||
1612 | err = kvaser_usb_get_software_info(dev); | ||
1613 | if (err) { | 1614 | if (err) { |
1614 | dev_err(&intf->dev, | 1615 | dev_err(&intf->dev, |
1615 | "Cannot get software infos, error %d\n", err); | 1616 | "Cannot get software infos, error %d\n", err); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h index 75b08c63d39f..29a09271b64a 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h | |||
@@ -767,16 +767,17 @@ | |||
767 | #define MTL_Q_RQOMR 0x40 | 767 | #define MTL_Q_RQOMR 0x40 |
768 | #define MTL_Q_RQMPOCR 0x44 | 768 | #define MTL_Q_RQMPOCR 0x44 |
769 | #define MTL_Q_RQDR 0x4c | 769 | #define MTL_Q_RQDR 0x4c |
770 | #define MTL_Q_RQFCR 0x50 | ||
770 | #define MTL_Q_IER 0x70 | 771 | #define MTL_Q_IER 0x70 |
771 | #define MTL_Q_ISR 0x74 | 772 | #define MTL_Q_ISR 0x74 |
772 | 773 | ||
773 | /* MTL queue register entry bit positions and sizes */ | 774 | /* MTL queue register entry bit positions and sizes */ |
775 | #define MTL_Q_RQFCR_RFA_INDEX 1 | ||
776 | #define MTL_Q_RQFCR_RFA_WIDTH 6 | ||
777 | #define MTL_Q_RQFCR_RFD_INDEX 17 | ||
778 | #define MTL_Q_RQFCR_RFD_WIDTH 6 | ||
774 | #define MTL_Q_RQOMR_EHFC_INDEX 7 | 779 | #define MTL_Q_RQOMR_EHFC_INDEX 7 |
775 | #define MTL_Q_RQOMR_EHFC_WIDTH 1 | 780 | #define MTL_Q_RQOMR_EHFC_WIDTH 1 |
776 | #define MTL_Q_RQOMR_RFA_INDEX 8 | ||
777 | #define MTL_Q_RQOMR_RFA_WIDTH 3 | ||
778 | #define MTL_Q_RQOMR_RFD_INDEX 13 | ||
779 | #define MTL_Q_RQOMR_RFD_WIDTH 3 | ||
780 | #define MTL_Q_RQOMR_RQS_INDEX 16 | 781 | #define MTL_Q_RQOMR_RQS_INDEX 16 |
781 | #define MTL_Q_RQOMR_RQS_WIDTH 9 | 782 | #define MTL_Q_RQOMR_RQS_WIDTH 9 |
782 | #define MTL_Q_RQOMR_RSF_INDEX 5 | 783 | #define MTL_Q_RQOMR_RSF_INDEX 5 |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c index da593c42d183..400757b49872 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c | |||
@@ -2107,10 +2107,10 @@ static void xgbe_config_flow_control_threshold(struct xgbe_prv_data *pdata) | |||
2107 | 2107 | ||
2108 | for (i = 0; i < pdata->rx_q_count; i++) { | 2108 | for (i = 0; i < pdata->rx_q_count; i++) { |
2109 | /* Activate flow control when less than 4k left in fifo */ | 2109 | /* Activate flow control when less than 4k left in fifo */ |
2110 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, RFA, 2); | 2110 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQFCR, RFA, 2); |
2111 | 2111 | ||
2112 | /* De-activate flow control when more than 6k left in fifo */ | 2112 | /* De-activate flow control when more than 6k left in fifo */ |
2113 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, RFD, 4); | 2113 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQFCR, RFD, 4); |
2114 | } | 2114 | } |
2115 | } | 2115 | } |
2116 | 2116 | ||
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 05c6af6c418f..3007d95fbb9f 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
@@ -1167,10 +1167,10 @@ static int bgmac_poll(struct napi_struct *napi, int weight) | |||
1167 | bgmac->int_status = 0; | 1167 | bgmac->int_status = 0; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | if (handled < weight) | 1170 | if (handled < weight) { |
1171 | napi_complete(napi); | 1171 | napi_complete(napi); |
1172 | 1172 | bgmac_chip_intrs_on(bgmac); | |
1173 | bgmac_chip_intrs_on(bgmac); | 1173 | } |
1174 | 1174 | ||
1175 | return handled; | 1175 | return handled; |
1176 | } | 1176 | } |
@@ -1515,6 +1515,8 @@ static int bgmac_probe(struct bcma_device *core) | |||
1515 | if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) | 1515 | if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) |
1516 | bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n"); | 1516 | bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n"); |
1517 | 1517 | ||
1518 | netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); | ||
1519 | |||
1518 | err = bgmac_mii_register(bgmac); | 1520 | err = bgmac_mii_register(bgmac); |
1519 | if (err) { | 1521 | if (err) { |
1520 | bgmac_err(bgmac, "Cannot register MDIO\n"); | 1522 | bgmac_err(bgmac, "Cannot register MDIO\n"); |
@@ -1529,8 +1531,6 @@ static int bgmac_probe(struct bcma_device *core) | |||
1529 | 1531 | ||
1530 | netif_carrier_off(net_dev); | 1532 | netif_carrier_off(net_dev); |
1531 | 1533 | ||
1532 | netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); | ||
1533 | |||
1534 | return 0; | 1534 | return 0; |
1535 | 1535 | ||
1536 | err_mii_unregister: | 1536 | err_mii_unregister: |
@@ -1549,9 +1549,9 @@ static void bgmac_remove(struct bcma_device *core) | |||
1549 | { | 1549 | { |
1550 | struct bgmac *bgmac = bcma_get_drvdata(core); | 1550 | struct bgmac *bgmac = bcma_get_drvdata(core); |
1551 | 1551 | ||
1552 | netif_napi_del(&bgmac->napi); | ||
1553 | unregister_netdev(bgmac->net_dev); | 1552 | unregister_netdev(bgmac->net_dev); |
1554 | bgmac_mii_unregister(bgmac); | 1553 | bgmac_mii_unregister(bgmac); |
1554 | netif_napi_del(&bgmac->napi); | ||
1555 | bgmac_dma_free(bgmac); | 1555 | bgmac_dma_free(bgmac); |
1556 | bcma_set_drvdata(core, NULL); | 1556 | bcma_set_drvdata(core, NULL); |
1557 | free_netdev(bgmac->net_dev); | 1557 | free_netdev(bgmac->net_dev); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index b51a18a09d4d..0a9faa134a9a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3175,7 +3175,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) | |||
3175 | } | 3175 | } |
3176 | #endif | 3176 | #endif |
3177 | if (!bnx2x_fp_lock_napi(fp)) | 3177 | if (!bnx2x_fp_lock_napi(fp)) |
3178 | return work_done; | 3178 | return budget; |
3179 | 3179 | ||
3180 | for_each_cos_in_tx_queue(fp, cos) | 3180 | for_each_cos_in_tx_queue(fp, cos) |
3181 | if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos])) | 3181 | if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos])) |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 0535f6fbdc71..ee44c827164d 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -1372,7 +1372,7 @@ static int enic_poll_msix_rq(struct napi_struct *napi, int budget) | |||
1372 | int err; | 1372 | int err; |
1373 | 1373 | ||
1374 | if (!enic_poll_lock_napi(&enic->rq[rq])) | 1374 | if (!enic_poll_lock_napi(&enic->rq[rq])) |
1375 | return work_done; | 1375 | return budget; |
1376 | /* Service RQ | 1376 | /* Service RQ |
1377 | */ | 1377 | */ |
1378 | 1378 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6c10fece1245..598c5070c629 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4406,8 +4406,9 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | |||
4406 | * distinguish various types of transports (VxLAN, GRE, NVGRE ..). So, offload | 4406 | * distinguish various types of transports (VxLAN, GRE, NVGRE ..). So, offload |
4407 | * is expected to work across all types of IP tunnels once exported. Skyhawk | 4407 | * is expected to work across all types of IP tunnels once exported. Skyhawk |
4408 | * supports offloads for either VxLAN or NVGRE, exclusively. So we export VxLAN | 4408 | * supports offloads for either VxLAN or NVGRE, exclusively. So we export VxLAN |
4409 | * offloads in hw_enc_features only when a VxLAN port is added. Note this only | 4409 | * offloads in hw_enc_features only when a VxLAN port is added. If other (non |
4410 | * ensures that other tunnels work fine while VxLAN offloads are not enabled. | 4410 | * VxLAN) tunnels are configured while VxLAN offloads are enabled, offloads for |
4411 | * those other tunnels are unexported on the fly through ndo_features_check(). | ||
4411 | * | 4412 | * |
4412 | * Skyhawk supports VxLAN offloads only for one UDP dport. So, if the stack | 4413 | * Skyhawk supports VxLAN offloads only for one UDP dport. So, if the stack |
4413 | * adds more than one port, disable offloads and don't re-enable them again | 4414 | * adds more than one port, disable offloads and don't re-enable them again |
@@ -4486,7 +4487,41 @@ static netdev_features_t be_features_check(struct sk_buff *skb, | |||
4486 | struct net_device *dev, | 4487 | struct net_device *dev, |
4487 | netdev_features_t features) | 4488 | netdev_features_t features) |
4488 | { | 4489 | { |
4489 | return vxlan_features_check(skb, features); | 4490 | struct be_adapter *adapter = netdev_priv(dev); |
4491 | u8 l4_hdr = 0; | ||
4492 | |||
4493 | /* The code below restricts offload features for some tunneled packets. | ||
4494 | * Offload features for normal (non tunnel) packets are unchanged. | ||
4495 | */ | ||
4496 | if (!skb->encapsulation || | ||
4497 | !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS)) | ||
4498 | return features; | ||
4499 | |||
4500 | /* It's an encapsulated packet and VxLAN offloads are enabled. We | ||
4501 | * should disable tunnel offload features if it's not a VxLAN packet, | ||
4502 | * as tunnel offloads have been enabled only for VxLAN. This is done to | ||
4503 | * allow other tunneled traffic like GRE work fine while VxLAN | ||
4504 | * offloads are configured in Skyhawk-R. | ||
4505 | */ | ||
4506 | switch (vlan_get_protocol(skb)) { | ||
4507 | case htons(ETH_P_IP): | ||
4508 | l4_hdr = ip_hdr(skb)->protocol; | ||
4509 | break; | ||
4510 | case htons(ETH_P_IPV6): | ||
4511 | l4_hdr = ipv6_hdr(skb)->nexthdr; | ||
4512 | break; | ||
4513 | default: | ||
4514 | return features; | ||
4515 | } | ||
4516 | |||
4517 | if (l4_hdr != IPPROTO_UDP || | ||
4518 | skb->inner_protocol_type != ENCAP_TYPE_ETHER || | ||
4519 | skb->inner_protocol != htons(ETH_P_TEB) || | ||
4520 | skb_inner_mac_header(skb) - skb_transport_header(skb) != | ||
4521 | sizeof(struct udphdr) + sizeof(struct vxlanhdr)) | ||
4522 | return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); | ||
4523 | |||
4524 | return features; | ||
4490 | } | 4525 | } |
4491 | #endif | 4526 | #endif |
4492 | 4527 | ||
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index a62fc38f045e..1c75829eb166 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -192,6 +192,10 @@ static char mv643xx_eth_driver_version[] = "1.4"; | |||
192 | #define IS_TSO_HEADER(txq, addr) \ | 192 | #define IS_TSO_HEADER(txq, addr) \ |
193 | ((addr >= txq->tso_hdrs_dma) && \ | 193 | ((addr >= txq->tso_hdrs_dma) && \ |
194 | (addr < txq->tso_hdrs_dma + txq->tx_ring_size * TSO_HEADER_SIZE)) | 194 | (addr < txq->tso_hdrs_dma + txq->tx_ring_size * TSO_HEADER_SIZE)) |
195 | |||
196 | #define DESC_DMA_MAP_SINGLE 0 | ||
197 | #define DESC_DMA_MAP_PAGE 1 | ||
198 | |||
195 | /* | 199 | /* |
196 | * RX/TX descriptors. | 200 | * RX/TX descriptors. |
197 | */ | 201 | */ |
@@ -362,6 +366,7 @@ struct tx_queue { | |||
362 | dma_addr_t tso_hdrs_dma; | 366 | dma_addr_t tso_hdrs_dma; |
363 | 367 | ||
364 | struct tx_desc *tx_desc_area; | 368 | struct tx_desc *tx_desc_area; |
369 | char *tx_desc_mapping; /* array to track the type of the dma mapping */ | ||
365 | dma_addr_t tx_desc_dma; | 370 | dma_addr_t tx_desc_dma; |
366 | int tx_desc_area_size; | 371 | int tx_desc_area_size; |
367 | 372 | ||
@@ -750,6 +755,7 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq, | |||
750 | if (txq->tx_curr_desc == txq->tx_ring_size) | 755 | if (txq->tx_curr_desc == txq->tx_ring_size) |
751 | txq->tx_curr_desc = 0; | 756 | txq->tx_curr_desc = 0; |
752 | desc = &txq->tx_desc_area[tx_index]; | 757 | desc = &txq->tx_desc_area[tx_index]; |
758 | txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE; | ||
753 | 759 | ||
754 | desc->l4i_chk = 0; | 760 | desc->l4i_chk = 0; |
755 | desc->byte_cnt = length; | 761 | desc->byte_cnt = length; |
@@ -879,14 +885,13 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb) | |||
879 | skb_frag_t *this_frag; | 885 | skb_frag_t *this_frag; |
880 | int tx_index; | 886 | int tx_index; |
881 | struct tx_desc *desc; | 887 | struct tx_desc *desc; |
882 | void *addr; | ||
883 | 888 | ||
884 | this_frag = &skb_shinfo(skb)->frags[frag]; | 889 | this_frag = &skb_shinfo(skb)->frags[frag]; |
885 | addr = page_address(this_frag->page.p) + this_frag->page_offset; | ||
886 | tx_index = txq->tx_curr_desc++; | 890 | tx_index = txq->tx_curr_desc++; |
887 | if (txq->tx_curr_desc == txq->tx_ring_size) | 891 | if (txq->tx_curr_desc == txq->tx_ring_size) |
888 | txq->tx_curr_desc = 0; | 892 | txq->tx_curr_desc = 0; |
889 | desc = &txq->tx_desc_area[tx_index]; | 893 | desc = &txq->tx_desc_area[tx_index]; |
894 | txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_PAGE; | ||
890 | 895 | ||
891 | /* | 896 | /* |
892 | * The last fragment will generate an interrupt | 897 | * The last fragment will generate an interrupt |
@@ -902,8 +907,9 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb) | |||
902 | 907 | ||
903 | desc->l4i_chk = 0; | 908 | desc->l4i_chk = 0; |
904 | desc->byte_cnt = skb_frag_size(this_frag); | 909 | desc->byte_cnt = skb_frag_size(this_frag); |
905 | desc->buf_ptr = dma_map_single(mp->dev->dev.parent, addr, | 910 | desc->buf_ptr = skb_frag_dma_map(mp->dev->dev.parent, |
906 | desc->byte_cnt, DMA_TO_DEVICE); | 911 | this_frag, 0, desc->byte_cnt, |
912 | DMA_TO_DEVICE); | ||
907 | } | 913 | } |
908 | } | 914 | } |
909 | 915 | ||
@@ -936,6 +942,7 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb, | |||
936 | if (txq->tx_curr_desc == txq->tx_ring_size) | 942 | if (txq->tx_curr_desc == txq->tx_ring_size) |
937 | txq->tx_curr_desc = 0; | 943 | txq->tx_curr_desc = 0; |
938 | desc = &txq->tx_desc_area[tx_index]; | 944 | desc = &txq->tx_desc_area[tx_index]; |
945 | txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE; | ||
939 | 946 | ||
940 | if (nr_frags) { | 947 | if (nr_frags) { |
941 | txq_submit_frag_skb(txq, skb); | 948 | txq_submit_frag_skb(txq, skb); |
@@ -1047,9 +1054,12 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
1047 | int tx_index; | 1054 | int tx_index; |
1048 | struct tx_desc *desc; | 1055 | struct tx_desc *desc; |
1049 | u32 cmd_sts; | 1056 | u32 cmd_sts; |
1057 | char desc_dma_map; | ||
1050 | 1058 | ||
1051 | tx_index = txq->tx_used_desc; | 1059 | tx_index = txq->tx_used_desc; |
1052 | desc = &txq->tx_desc_area[tx_index]; | 1060 | desc = &txq->tx_desc_area[tx_index]; |
1061 | desc_dma_map = txq->tx_desc_mapping[tx_index]; | ||
1062 | |||
1053 | cmd_sts = desc->cmd_sts; | 1063 | cmd_sts = desc->cmd_sts; |
1054 | 1064 | ||
1055 | if (cmd_sts & BUFFER_OWNED_BY_DMA) { | 1065 | if (cmd_sts & BUFFER_OWNED_BY_DMA) { |
@@ -1065,9 +1075,19 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
1065 | reclaimed++; | 1075 | reclaimed++; |
1066 | txq->tx_desc_count--; | 1076 | txq->tx_desc_count--; |
1067 | 1077 | ||
1068 | if (!IS_TSO_HEADER(txq, desc->buf_ptr)) | 1078 | if (!IS_TSO_HEADER(txq, desc->buf_ptr)) { |
1069 | dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, | 1079 | |
1070 | desc->byte_cnt, DMA_TO_DEVICE); | 1080 | if (desc_dma_map == DESC_DMA_MAP_PAGE) |
1081 | dma_unmap_page(mp->dev->dev.parent, | ||
1082 | desc->buf_ptr, | ||
1083 | desc->byte_cnt, | ||
1084 | DMA_TO_DEVICE); | ||
1085 | else | ||
1086 | dma_unmap_single(mp->dev->dev.parent, | ||
1087 | desc->buf_ptr, | ||
1088 | desc->byte_cnt, | ||
1089 | DMA_TO_DEVICE); | ||
1090 | } | ||
1071 | 1091 | ||
1072 | if (cmd_sts & TX_ENABLE_INTERRUPT) { | 1092 | if (cmd_sts & TX_ENABLE_INTERRUPT) { |
1073 | struct sk_buff *skb = __skb_dequeue(&txq->tx_skb); | 1093 | struct sk_buff *skb = __skb_dequeue(&txq->tx_skb); |
@@ -1996,6 +2016,7 @@ static int txq_init(struct mv643xx_eth_private *mp, int index) | |||
1996 | struct tx_queue *txq = mp->txq + index; | 2016 | struct tx_queue *txq = mp->txq + index; |
1997 | struct tx_desc *tx_desc; | 2017 | struct tx_desc *tx_desc; |
1998 | int size; | 2018 | int size; |
2019 | int ret; | ||
1999 | int i; | 2020 | int i; |
2000 | 2021 | ||
2001 | txq->index = index; | 2022 | txq->index = index; |
@@ -2048,18 +2069,34 @@ static int txq_init(struct mv643xx_eth_private *mp, int index) | |||
2048 | nexti * sizeof(struct tx_desc); | 2069 | nexti * sizeof(struct tx_desc); |
2049 | } | 2070 | } |
2050 | 2071 | ||
2072 | txq->tx_desc_mapping = kcalloc(txq->tx_ring_size, sizeof(char), | ||
2073 | GFP_KERNEL); | ||
2074 | if (!txq->tx_desc_mapping) { | ||
2075 | ret = -ENOMEM; | ||
2076 | goto err_free_desc_area; | ||
2077 | } | ||
2078 | |||
2051 | /* Allocate DMA buffers for TSO MAC/IP/TCP headers */ | 2079 | /* Allocate DMA buffers for TSO MAC/IP/TCP headers */ |
2052 | txq->tso_hdrs = dma_alloc_coherent(mp->dev->dev.parent, | 2080 | txq->tso_hdrs = dma_alloc_coherent(mp->dev->dev.parent, |
2053 | txq->tx_ring_size * TSO_HEADER_SIZE, | 2081 | txq->tx_ring_size * TSO_HEADER_SIZE, |
2054 | &txq->tso_hdrs_dma, GFP_KERNEL); | 2082 | &txq->tso_hdrs_dma, GFP_KERNEL); |
2055 | if (txq->tso_hdrs == NULL) { | 2083 | if (txq->tso_hdrs == NULL) { |
2056 | dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size, | 2084 | ret = -ENOMEM; |
2057 | txq->tx_desc_area, txq->tx_desc_dma); | 2085 | goto err_free_desc_mapping; |
2058 | return -ENOMEM; | ||
2059 | } | 2086 | } |
2060 | skb_queue_head_init(&txq->tx_skb); | 2087 | skb_queue_head_init(&txq->tx_skb); |
2061 | 2088 | ||
2062 | return 0; | 2089 | return 0; |
2090 | |||
2091 | err_free_desc_mapping: | ||
2092 | kfree(txq->tx_desc_mapping); | ||
2093 | err_free_desc_area: | ||
2094 | if (index == 0 && size <= mp->tx_desc_sram_size) | ||
2095 | iounmap(txq->tx_desc_area); | ||
2096 | else | ||
2097 | dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size, | ||
2098 | txq->tx_desc_area, txq->tx_desc_dma); | ||
2099 | return ret; | ||
2063 | } | 2100 | } |
2064 | 2101 | ||
2065 | static void txq_deinit(struct tx_queue *txq) | 2102 | static void txq_deinit(struct tx_queue *txq) |
@@ -2077,6 +2114,8 @@ static void txq_deinit(struct tx_queue *txq) | |||
2077 | else | 2114 | else |
2078 | dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size, | 2115 | dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size, |
2079 | txq->tx_desc_area, txq->tx_desc_dma); | 2116 | txq->tx_desc_area, txq->tx_desc_dma); |
2117 | kfree(txq->tx_desc_mapping); | ||
2118 | |||
2080 | if (txq->tso_hdrs) | 2119 | if (txq->tso_hdrs) |
2081 | dma_free_coherent(mp->dev->dev.parent, | 2120 | dma_free_coherent(mp->dev->dev.parent, |
2082 | txq->tx_ring_size * TSO_HEADER_SIZE, | 2121 | txq->tx_ring_size * TSO_HEADER_SIZE, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 43a3f9822f74..e075ff1f4e80 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -475,7 +475,8 @@ static int mlx4_en_tunnel_steer_add(struct mlx4_en_priv *priv, unsigned char *ad | |||
475 | { | 475 | { |
476 | int err; | 476 | int err; |
477 | 477 | ||
478 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | 478 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN || |
479 | priv->mdev->dev->caps.dmfs_high_steer_mode == MLX4_STEERING_DMFS_A0_STATIC) | ||
479 | return 0; /* do nothing */ | 480 | return 0; /* do nothing */ |
480 | 481 | ||
481 | err = mlx4_tunnel_steer_add(priv->mdev->dev, addr, priv->port, qpn, | 482 | err = mlx4_tunnel_steer_add(priv->mdev->dev, addr, priv->port, qpn, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 9c7ef0bffb52..ff2fffeab4c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1806,8 +1806,7 @@ static void choose_tunnel_offload_mode(struct mlx4_dev *dev, | |||
1806 | struct mlx4_dev_cap *dev_cap) | 1806 | struct mlx4_dev_cap *dev_cap) |
1807 | { | 1807 | { |
1808 | if (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED && | 1808 | if (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED && |
1809 | dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS && | 1809 | dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) |
1810 | dev->caps.dmfs_high_steer_mode != MLX4_STEERING_DMFS_A0_STATIC) | ||
1811 | dev->caps.tunnel_offload_mode = MLX4_TUNNEL_OFFLOAD_MODE_VXLAN; | 1810 | dev->caps.tunnel_offload_mode = MLX4_TUNNEL_OFFLOAD_MODE_VXLAN; |
1812 | else | 1811 | else |
1813 | dev->caps.tunnel_offload_mode = MLX4_TUNNEL_OFFLOAD_MODE_NONE; | 1812 | dev->caps.tunnel_offload_mode = MLX4_TUNNEL_OFFLOAD_MODE_NONE; |
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index 0529cad75b10..a4cdf2f8041a 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c | |||
@@ -6987,7 +6987,9 @@ static int s2io_add_isr(struct s2io_nic *sp) | |||
6987 | if (sp->s2io_entries[i].in_use == MSIX_FLG) { | 6987 | if (sp->s2io_entries[i].in_use == MSIX_FLG) { |
6988 | if (sp->s2io_entries[i].type == | 6988 | if (sp->s2io_entries[i].type == |
6989 | MSIX_RING_TYPE) { | 6989 | MSIX_RING_TYPE) { |
6990 | sprintf(sp->desc[i], "%s:MSI-X-%d-RX", | 6990 | snprintf(sp->desc[i], |
6991 | sizeof(sp->desc[i]), | ||
6992 | "%s:MSI-X-%d-RX", | ||
6991 | dev->name, i); | 6993 | dev->name, i); |
6992 | err = request_irq(sp->entries[i].vector, | 6994 | err = request_irq(sp->entries[i].vector, |
6993 | s2io_msix_ring_handle, | 6995 | s2io_msix_ring_handle, |
@@ -6996,7 +6998,9 @@ static int s2io_add_isr(struct s2io_nic *sp) | |||
6996 | sp->s2io_entries[i].arg); | 6998 | sp->s2io_entries[i].arg); |
6997 | } else if (sp->s2io_entries[i].type == | 6999 | } else if (sp->s2io_entries[i].type == |
6998 | MSIX_ALARM_TYPE) { | 7000 | MSIX_ALARM_TYPE) { |
6999 | sprintf(sp->desc[i], "%s:MSI-X-%d-TX", | 7001 | snprintf(sp->desc[i], |
7002 | sizeof(sp->desc[i]), | ||
7003 | "%s:MSI-X-%d-TX", | ||
7000 | dev->name, i); | 7004 | dev->name, i); |
7001 | err = request_irq(sp->entries[i].vector, | 7005 | err = request_irq(sp->entries[i].vector, |
7002 | s2io_msix_fifo_handle, | 7006 | s2io_msix_fifo_handle, |
@@ -8154,7 +8158,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
8154 | "%s: UDP Fragmentation Offload(UFO) enabled\n", | 8158 | "%s: UDP Fragmentation Offload(UFO) enabled\n", |
8155 | dev->name); | 8159 | dev->name); |
8156 | /* Initialize device name */ | 8160 | /* Initialize device name */ |
8157 | sprintf(sp->name, "%s Neterion %s", dev->name, sp->product_name); | 8161 | snprintf(sp->name, sizeof(sp->name), "%s Neterion %s", dev->name, |
8162 | sp->product_name); | ||
8158 | 8163 | ||
8159 | if (vlan_tag_strip) | 8164 | if (vlan_tag_strip) |
8160 | sp->vlan_strip_flag = 1; | 8165 | sp->vlan_strip_flag = 1; |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index a47fe67fdf58..afb8efb25781 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -2388,7 +2388,10 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) | |||
2388 | 2388 | ||
2389 | work_done = netxen_process_rcv_ring(sds_ring, budget); | 2389 | work_done = netxen_process_rcv_ring(sds_ring, budget); |
2390 | 2390 | ||
2391 | if ((work_done < budget) && tx_complete) { | 2391 | if (!tx_complete) |
2392 | work_done = budget; | ||
2393 | |||
2394 | if (work_done < budget) { | ||
2392 | napi_complete(&sds_ring->napi); | 2395 | napi_complete(&sds_ring->napi); |
2393 | if (test_bit(__NX_DEV_UP, &adapter->state)) | 2396 | if (test_bit(__NX_DEV_UP, &adapter->state)) |
2394 | netxen_nic_enable_int(sds_ring); | 2397 | netxen_nic_enable_int(sds_ring); |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index fe0277a35507..4da8bd263997 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -396,6 +396,9 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
396 | [TSU_ADRL31] = 0x01fc, | 396 | [TSU_ADRL31] = 0x01fc, |
397 | }; | 397 | }; |
398 | 398 | ||
399 | static void sh_eth_rcv_snd_disable(struct net_device *ndev); | ||
400 | static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev); | ||
401 | |||
399 | static bool sh_eth_is_gether(struct sh_eth_private *mdp) | 402 | static bool sh_eth_is_gether(struct sh_eth_private *mdp) |
400 | { | 403 | { |
401 | return mdp->reg_offset == sh_eth_offset_gigabit; | 404 | return mdp->reg_offset == sh_eth_offset_gigabit; |
@@ -498,6 +501,8 @@ static struct sh_eth_cpu_data r8a779x_data = { | |||
498 | EESR_ECI, | 501 | EESR_ECI, |
499 | .fdr_value = 0x00000f0f, | 502 | .fdr_value = 0x00000f0f, |
500 | 503 | ||
504 | .trscer_err_mask = DESC_I_RINT8, | ||
505 | |||
501 | .apr = 1, | 506 | .apr = 1, |
502 | .mpr = 1, | 507 | .mpr = 1, |
503 | .tpauser = 1, | 508 | .tpauser = 1, |
@@ -538,8 +543,6 @@ static struct sh_eth_cpu_data sh7724_data = { | |||
538 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | | 543 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | |
539 | EESR_ECI, | 544 | EESR_ECI, |
540 | 545 | ||
541 | .trscer_err_mask = DESC_I_RINT8, | ||
542 | |||
543 | .apr = 1, | 546 | .apr = 1, |
544 | .mpr = 1, | 547 | .mpr = 1, |
545 | .tpauser = 1, | 548 | .tpauser = 1, |
@@ -1120,6 +1123,7 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1120 | int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring; | 1123 | int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring; |
1121 | int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; | 1124 | int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; |
1122 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1; | 1125 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1; |
1126 | dma_addr_t dma_addr; | ||
1123 | 1127 | ||
1124 | mdp->cur_rx = 0; | 1128 | mdp->cur_rx = 0; |
1125 | mdp->cur_tx = 0; | 1129 | mdp->cur_tx = 0; |
@@ -1133,7 +1137,6 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1133 | /* skb */ | 1137 | /* skb */ |
1134 | mdp->rx_skbuff[i] = NULL; | 1138 | mdp->rx_skbuff[i] = NULL; |
1135 | skb = netdev_alloc_skb(ndev, skbuff_size); | 1139 | skb = netdev_alloc_skb(ndev, skbuff_size); |
1136 | mdp->rx_skbuff[i] = skb; | ||
1137 | if (skb == NULL) | 1140 | if (skb == NULL) |
1138 | break; | 1141 | break; |
1139 | sh_eth_set_receive_align(skb); | 1142 | sh_eth_set_receive_align(skb); |
@@ -1142,9 +1145,15 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1142 | rxdesc = &mdp->rx_ring[i]; | 1145 | rxdesc = &mdp->rx_ring[i]; |
1143 | /* The size of the buffer is a multiple of 16 bytes. */ | 1146 | /* The size of the buffer is a multiple of 16 bytes. */ |
1144 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); | 1147 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); |
1145 | dma_map_single(&ndev->dev, skb->data, rxdesc->buffer_length, | 1148 | dma_addr = dma_map_single(&ndev->dev, skb->data, |
1146 | DMA_FROM_DEVICE); | 1149 | rxdesc->buffer_length, |
1147 | rxdesc->addr = virt_to_phys(skb->data); | 1150 | DMA_FROM_DEVICE); |
1151 | if (dma_mapping_error(&ndev->dev, dma_addr)) { | ||
1152 | kfree_skb(skb); | ||
1153 | break; | ||
1154 | } | ||
1155 | mdp->rx_skbuff[i] = skb; | ||
1156 | rxdesc->addr = dma_addr; | ||
1148 | rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP); | 1157 | rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP); |
1149 | 1158 | ||
1150 | /* Rx descriptor address set */ | 1159 | /* Rx descriptor address set */ |
@@ -1316,8 +1325,10 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start) | |||
1316 | RFLR); | 1325 | RFLR); |
1317 | 1326 | ||
1318 | sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR); | 1327 | sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR); |
1319 | if (start) | 1328 | if (start) { |
1329 | mdp->irq_enabled = true; | ||
1320 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); | 1330 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); |
1331 | } | ||
1321 | 1332 | ||
1322 | /* PAUSE Prohibition */ | 1333 | /* PAUSE Prohibition */ |
1323 | val = (sh_eth_read(ndev, ECMR) & ECMR_DM) | | 1334 | val = (sh_eth_read(ndev, ECMR) & ECMR_DM) | |
@@ -1356,6 +1367,33 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start) | |||
1356 | return ret; | 1367 | return ret; |
1357 | } | 1368 | } |
1358 | 1369 | ||
1370 | static void sh_eth_dev_exit(struct net_device *ndev) | ||
1371 | { | ||
1372 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
1373 | int i; | ||
1374 | |||
1375 | /* Deactivate all TX descriptors, so DMA should stop at next | ||
1376 | * packet boundary if it's currently running | ||
1377 | */ | ||
1378 | for (i = 0; i < mdp->num_tx_ring; i++) | ||
1379 | mdp->tx_ring[i].status &= ~cpu_to_edmac(mdp, TD_TACT); | ||
1380 | |||
1381 | /* Disable TX FIFO egress to MAC */ | ||
1382 | sh_eth_rcv_snd_disable(ndev); | ||
1383 | |||
1384 | /* Stop RX DMA at next packet boundary */ | ||
1385 | sh_eth_write(ndev, 0, EDRRR); | ||
1386 | |||
1387 | /* Aside from TX DMA, we can't tell when the hardware is | ||
1388 | * really stopped, so we need to reset to make sure. | ||
1389 | * Before doing that, wait for long enough to *probably* | ||
1390 | * finish transmitting the last packet and poll stats. | ||
1391 | */ | ||
1392 | msleep(2); /* max frame time at 10 Mbps < 1250 us */ | ||
1393 | sh_eth_get_stats(ndev); | ||
1394 | sh_eth_reset(ndev); | ||
1395 | } | ||
1396 | |||
1359 | /* free Tx skb function */ | 1397 | /* free Tx skb function */ |
1360 | static int sh_eth_txfree(struct net_device *ndev) | 1398 | static int sh_eth_txfree(struct net_device *ndev) |
1361 | { | 1399 | { |
@@ -1400,6 +1438,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1400 | u16 pkt_len = 0; | 1438 | u16 pkt_len = 0; |
1401 | u32 desc_status; | 1439 | u32 desc_status; |
1402 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1; | 1440 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1; |
1441 | dma_addr_t dma_addr; | ||
1403 | 1442 | ||
1404 | boguscnt = min(boguscnt, *quota); | 1443 | boguscnt = min(boguscnt, *quota); |
1405 | limit = boguscnt; | 1444 | limit = boguscnt; |
@@ -1447,9 +1486,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1447 | mdp->rx_skbuff[entry] = NULL; | 1486 | mdp->rx_skbuff[entry] = NULL; |
1448 | if (mdp->cd->rpadir) | 1487 | if (mdp->cd->rpadir) |
1449 | skb_reserve(skb, NET_IP_ALIGN); | 1488 | skb_reserve(skb, NET_IP_ALIGN); |
1450 | dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr, | 1489 | dma_unmap_single(&ndev->dev, rxdesc->addr, |
1451 | ALIGN(mdp->rx_buf_sz, 16), | 1490 | ALIGN(mdp->rx_buf_sz, 16), |
1452 | DMA_FROM_DEVICE); | 1491 | DMA_FROM_DEVICE); |
1453 | skb_put(skb, pkt_len); | 1492 | skb_put(skb, pkt_len); |
1454 | skb->protocol = eth_type_trans(skb, ndev); | 1493 | skb->protocol = eth_type_trans(skb, ndev); |
1455 | netif_receive_skb(skb); | 1494 | netif_receive_skb(skb); |
@@ -1469,15 +1508,20 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1469 | 1508 | ||
1470 | if (mdp->rx_skbuff[entry] == NULL) { | 1509 | if (mdp->rx_skbuff[entry] == NULL) { |
1471 | skb = netdev_alloc_skb(ndev, skbuff_size); | 1510 | skb = netdev_alloc_skb(ndev, skbuff_size); |
1472 | mdp->rx_skbuff[entry] = skb; | ||
1473 | if (skb == NULL) | 1511 | if (skb == NULL) |
1474 | break; /* Better luck next round. */ | 1512 | break; /* Better luck next round. */ |
1475 | sh_eth_set_receive_align(skb); | 1513 | sh_eth_set_receive_align(skb); |
1476 | dma_map_single(&ndev->dev, skb->data, | 1514 | dma_addr = dma_map_single(&ndev->dev, skb->data, |
1477 | rxdesc->buffer_length, DMA_FROM_DEVICE); | 1515 | rxdesc->buffer_length, |
1516 | DMA_FROM_DEVICE); | ||
1517 | if (dma_mapping_error(&ndev->dev, dma_addr)) { | ||
1518 | kfree_skb(skb); | ||
1519 | break; | ||
1520 | } | ||
1521 | mdp->rx_skbuff[entry] = skb; | ||
1478 | 1522 | ||
1479 | skb_checksum_none_assert(skb); | 1523 | skb_checksum_none_assert(skb); |
1480 | rxdesc->addr = virt_to_phys(skb->data); | 1524 | rxdesc->addr = dma_addr; |
1481 | } | 1525 | } |
1482 | if (entry >= mdp->num_rx_ring - 1) | 1526 | if (entry >= mdp->num_rx_ring - 1) |
1483 | rxdesc->status |= | 1527 | rxdesc->status |= |
@@ -1573,7 +1617,6 @@ ignore_link: | |||
1573 | if (intr_status & EESR_RFRMER) { | 1617 | if (intr_status & EESR_RFRMER) { |
1574 | /* Receive Frame Overflow int */ | 1618 | /* Receive Frame Overflow int */ |
1575 | ndev->stats.rx_frame_errors++; | 1619 | ndev->stats.rx_frame_errors++; |
1576 | netif_err(mdp, rx_err, ndev, "Receive Abort\n"); | ||
1577 | } | 1620 | } |
1578 | } | 1621 | } |
1579 | 1622 | ||
@@ -1592,13 +1635,11 @@ ignore_link: | |||
1592 | if (intr_status & EESR_RDE) { | 1635 | if (intr_status & EESR_RDE) { |
1593 | /* Receive Descriptor Empty int */ | 1636 | /* Receive Descriptor Empty int */ |
1594 | ndev->stats.rx_over_errors++; | 1637 | ndev->stats.rx_over_errors++; |
1595 | netif_err(mdp, rx_err, ndev, "Receive Descriptor Empty\n"); | ||
1596 | } | 1638 | } |
1597 | 1639 | ||
1598 | if (intr_status & EESR_RFE) { | 1640 | if (intr_status & EESR_RFE) { |
1599 | /* Receive FIFO Overflow int */ | 1641 | /* Receive FIFO Overflow int */ |
1600 | ndev->stats.rx_fifo_errors++; | 1642 | ndev->stats.rx_fifo_errors++; |
1601 | netif_err(mdp, rx_err, ndev, "Receive FIFO Overflow\n"); | ||
1602 | } | 1643 | } |
1603 | 1644 | ||
1604 | if (!mdp->cd->no_ade && (intr_status & EESR_ADE)) { | 1645 | if (!mdp->cd->no_ade && (intr_status & EESR_ADE)) { |
@@ -1653,7 +1694,12 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1653 | if (intr_status & (EESR_RX_CHECK | cd->tx_check | cd->eesr_err_check)) | 1694 | if (intr_status & (EESR_RX_CHECK | cd->tx_check | cd->eesr_err_check)) |
1654 | ret = IRQ_HANDLED; | 1695 | ret = IRQ_HANDLED; |
1655 | else | 1696 | else |
1656 | goto other_irq; | 1697 | goto out; |
1698 | |||
1699 | if (!likely(mdp->irq_enabled)) { | ||
1700 | sh_eth_write(ndev, 0, EESIPR); | ||
1701 | goto out; | ||
1702 | } | ||
1657 | 1703 | ||
1658 | if (intr_status & EESR_RX_CHECK) { | 1704 | if (intr_status & EESR_RX_CHECK) { |
1659 | if (napi_schedule_prep(&mdp->napi)) { | 1705 | if (napi_schedule_prep(&mdp->napi)) { |
@@ -1684,7 +1730,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1684 | sh_eth_error(ndev, intr_status); | 1730 | sh_eth_error(ndev, intr_status); |
1685 | } | 1731 | } |
1686 | 1732 | ||
1687 | other_irq: | 1733 | out: |
1688 | spin_unlock(&mdp->lock); | 1734 | spin_unlock(&mdp->lock); |
1689 | 1735 | ||
1690 | return ret; | 1736 | return ret; |
@@ -1712,7 +1758,8 @@ static int sh_eth_poll(struct napi_struct *napi, int budget) | |||
1712 | napi_complete(napi); | 1758 | napi_complete(napi); |
1713 | 1759 | ||
1714 | /* Reenable Rx interrupts */ | 1760 | /* Reenable Rx interrupts */ |
1715 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); | 1761 | if (mdp->irq_enabled) |
1762 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); | ||
1716 | out: | 1763 | out: |
1717 | return budget - quota; | 1764 | return budget - quota; |
1718 | } | 1765 | } |
@@ -1827,6 +1874,9 @@ static int sh_eth_get_settings(struct net_device *ndev, | |||
1827 | unsigned long flags; | 1874 | unsigned long flags; |
1828 | int ret; | 1875 | int ret; |
1829 | 1876 | ||
1877 | if (!mdp->phydev) | ||
1878 | return -ENODEV; | ||
1879 | |||
1830 | spin_lock_irqsave(&mdp->lock, flags); | 1880 | spin_lock_irqsave(&mdp->lock, flags); |
1831 | ret = phy_ethtool_gset(mdp->phydev, ecmd); | 1881 | ret = phy_ethtool_gset(mdp->phydev, ecmd); |
1832 | spin_unlock_irqrestore(&mdp->lock, flags); | 1882 | spin_unlock_irqrestore(&mdp->lock, flags); |
@@ -1841,6 +1891,9 @@ static int sh_eth_set_settings(struct net_device *ndev, | |||
1841 | unsigned long flags; | 1891 | unsigned long flags; |
1842 | int ret; | 1892 | int ret; |
1843 | 1893 | ||
1894 | if (!mdp->phydev) | ||
1895 | return -ENODEV; | ||
1896 | |||
1844 | spin_lock_irqsave(&mdp->lock, flags); | 1897 | spin_lock_irqsave(&mdp->lock, flags); |
1845 | 1898 | ||
1846 | /* disable tx and rx */ | 1899 | /* disable tx and rx */ |
@@ -1875,6 +1928,9 @@ static int sh_eth_nway_reset(struct net_device *ndev) | |||
1875 | unsigned long flags; | 1928 | unsigned long flags; |
1876 | int ret; | 1929 | int ret; |
1877 | 1930 | ||
1931 | if (!mdp->phydev) | ||
1932 | return -ENODEV; | ||
1933 | |||
1878 | spin_lock_irqsave(&mdp->lock, flags); | 1934 | spin_lock_irqsave(&mdp->lock, flags); |
1879 | ret = phy_start_aneg(mdp->phydev); | 1935 | ret = phy_start_aneg(mdp->phydev); |
1880 | spin_unlock_irqrestore(&mdp->lock, flags); | 1936 | spin_unlock_irqrestore(&mdp->lock, flags); |
@@ -1959,40 +2015,50 @@ static int sh_eth_set_ringparam(struct net_device *ndev, | |||
1959 | return -EINVAL; | 2015 | return -EINVAL; |
1960 | 2016 | ||
1961 | if (netif_running(ndev)) { | 2017 | if (netif_running(ndev)) { |
2018 | netif_device_detach(ndev); | ||
1962 | netif_tx_disable(ndev); | 2019 | netif_tx_disable(ndev); |
1963 | /* Disable interrupts by clearing the interrupt mask. */ | 2020 | |
1964 | sh_eth_write(ndev, 0x0000, EESIPR); | 2021 | /* Serialise with the interrupt handler and NAPI, then |
1965 | /* Stop the chip's Tx and Rx processes. */ | 2022 | * disable interrupts. We have to clear the |
1966 | sh_eth_write(ndev, 0, EDTRR); | 2023 | * irq_enabled flag first to ensure that interrupts |
1967 | sh_eth_write(ndev, 0, EDRRR); | 2024 | * won't be re-enabled. |
2025 | */ | ||
2026 | mdp->irq_enabled = false; | ||
1968 | synchronize_irq(ndev->irq); | 2027 | synchronize_irq(ndev->irq); |
1969 | } | 2028 | napi_synchronize(&mdp->napi); |
2029 | sh_eth_write(ndev, 0x0000, EESIPR); | ||
1970 | 2030 | ||
1971 | /* Free all the skbuffs in the Rx queue. */ | 2031 | sh_eth_dev_exit(ndev); |
1972 | sh_eth_ring_free(ndev); | 2032 | |
1973 | /* Free DMA buffer */ | 2033 | /* Free all the skbuffs in the Rx queue. */ |
1974 | sh_eth_free_dma_buffer(mdp); | 2034 | sh_eth_ring_free(ndev); |
2035 | /* Free DMA buffer */ | ||
2036 | sh_eth_free_dma_buffer(mdp); | ||
2037 | } | ||
1975 | 2038 | ||
1976 | /* Set new parameters */ | 2039 | /* Set new parameters */ |
1977 | mdp->num_rx_ring = ring->rx_pending; | 2040 | mdp->num_rx_ring = ring->rx_pending; |
1978 | mdp->num_tx_ring = ring->tx_pending; | 2041 | mdp->num_tx_ring = ring->tx_pending; |
1979 | 2042 | ||
1980 | ret = sh_eth_ring_init(ndev); | ||
1981 | if (ret < 0) { | ||
1982 | netdev_err(ndev, "%s: sh_eth_ring_init failed.\n", __func__); | ||
1983 | return ret; | ||
1984 | } | ||
1985 | ret = sh_eth_dev_init(ndev, false); | ||
1986 | if (ret < 0) { | ||
1987 | netdev_err(ndev, "%s: sh_eth_dev_init failed.\n", __func__); | ||
1988 | return ret; | ||
1989 | } | ||
1990 | |||
1991 | if (netif_running(ndev)) { | 2043 | if (netif_running(ndev)) { |
2044 | ret = sh_eth_ring_init(ndev); | ||
2045 | if (ret < 0) { | ||
2046 | netdev_err(ndev, "%s: sh_eth_ring_init failed.\n", | ||
2047 | __func__); | ||
2048 | return ret; | ||
2049 | } | ||
2050 | ret = sh_eth_dev_init(ndev, false); | ||
2051 | if (ret < 0) { | ||
2052 | netdev_err(ndev, "%s: sh_eth_dev_init failed.\n", | ||
2053 | __func__); | ||
2054 | return ret; | ||
2055 | } | ||
2056 | |||
2057 | mdp->irq_enabled = true; | ||
1992 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); | 2058 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); |
1993 | /* Setting the Rx mode will start the Rx process. */ | 2059 | /* Setting the Rx mode will start the Rx process. */ |
1994 | sh_eth_write(ndev, EDRRR_R, EDRRR); | 2060 | sh_eth_write(ndev, EDRRR_R, EDRRR); |
1995 | netif_wake_queue(ndev); | 2061 | netif_device_attach(ndev); |
1996 | } | 2062 | } |
1997 | 2063 | ||
1998 | return 0; | 2064 | return 0; |
@@ -2108,6 +2174,9 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2108 | } | 2174 | } |
2109 | spin_unlock_irqrestore(&mdp->lock, flags); | 2175 | spin_unlock_irqrestore(&mdp->lock, flags); |
2110 | 2176 | ||
2177 | if (skb_padto(skb, ETH_ZLEN)) | ||
2178 | return NETDEV_TX_OK; | ||
2179 | |||
2111 | entry = mdp->cur_tx % mdp->num_tx_ring; | 2180 | entry = mdp->cur_tx % mdp->num_tx_ring; |
2112 | mdp->tx_skbuff[entry] = skb; | 2181 | mdp->tx_skbuff[entry] = skb; |
2113 | txdesc = &mdp->tx_ring[entry]; | 2182 | txdesc = &mdp->tx_ring[entry]; |
@@ -2117,10 +2186,11 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2117 | skb->len + 2); | 2186 | skb->len + 2); |
2118 | txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len, | 2187 | txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len, |
2119 | DMA_TO_DEVICE); | 2188 | DMA_TO_DEVICE); |
2120 | if (skb->len < ETH_ZLEN) | 2189 | if (dma_mapping_error(&ndev->dev, txdesc->addr)) { |
2121 | txdesc->buffer_length = ETH_ZLEN; | 2190 | kfree_skb(skb); |
2122 | else | 2191 | return NETDEV_TX_OK; |
2123 | txdesc->buffer_length = skb->len; | 2192 | } |
2193 | txdesc->buffer_length = skb->len; | ||
2124 | 2194 | ||
2125 | if (entry >= mdp->num_tx_ring - 1) | 2195 | if (entry >= mdp->num_tx_ring - 1) |
2126 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); | 2196 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); |
@@ -2172,24 +2242,26 @@ static int sh_eth_close(struct net_device *ndev) | |||
2172 | 2242 | ||
2173 | netif_stop_queue(ndev); | 2243 | netif_stop_queue(ndev); |
2174 | 2244 | ||
2175 | /* Disable interrupts by clearing the interrupt mask. */ | 2245 | /* Serialise with the interrupt handler and NAPI, then disable |
2246 | * interrupts. We have to clear the irq_enabled flag first to | ||
2247 | * ensure that interrupts won't be re-enabled. | ||
2248 | */ | ||
2249 | mdp->irq_enabled = false; | ||
2250 | synchronize_irq(ndev->irq); | ||
2251 | napi_disable(&mdp->napi); | ||
2176 | sh_eth_write(ndev, 0x0000, EESIPR); | 2252 | sh_eth_write(ndev, 0x0000, EESIPR); |
2177 | 2253 | ||
2178 | /* Stop the chip's Tx and Rx processes. */ | 2254 | sh_eth_dev_exit(ndev); |
2179 | sh_eth_write(ndev, 0, EDTRR); | ||
2180 | sh_eth_write(ndev, 0, EDRRR); | ||
2181 | 2255 | ||
2182 | sh_eth_get_stats(ndev); | ||
2183 | /* PHY Disconnect */ | 2256 | /* PHY Disconnect */ |
2184 | if (mdp->phydev) { | 2257 | if (mdp->phydev) { |
2185 | phy_stop(mdp->phydev); | 2258 | phy_stop(mdp->phydev); |
2186 | phy_disconnect(mdp->phydev); | 2259 | phy_disconnect(mdp->phydev); |
2260 | mdp->phydev = NULL; | ||
2187 | } | 2261 | } |
2188 | 2262 | ||
2189 | free_irq(ndev->irq, ndev); | 2263 | free_irq(ndev->irq, ndev); |
2190 | 2264 | ||
2191 | napi_disable(&mdp->napi); | ||
2192 | |||
2193 | /* Free all the skbuffs in the Rx queue. */ | 2265 | /* Free all the skbuffs in the Rx queue. */ |
2194 | sh_eth_ring_free(ndev); | 2266 | sh_eth_ring_free(ndev); |
2195 | 2267 | ||
@@ -2417,7 +2489,7 @@ static int sh_eth_tsu_purge_all(struct net_device *ndev) | |||
2417 | struct sh_eth_private *mdp = netdev_priv(ndev); | 2489 | struct sh_eth_private *mdp = netdev_priv(ndev); |
2418 | int i, ret; | 2490 | int i, ret; |
2419 | 2491 | ||
2420 | if (unlikely(!mdp->cd->tsu)) | 2492 | if (!mdp->cd->tsu) |
2421 | return 0; | 2493 | return 0; |
2422 | 2494 | ||
2423 | for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++) { | 2495 | for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++) { |
@@ -2440,7 +2512,7 @@ static void sh_eth_tsu_purge_mcast(struct net_device *ndev) | |||
2440 | void *reg_offset = sh_eth_tsu_get_offset(mdp, TSU_ADRH0); | 2512 | void *reg_offset = sh_eth_tsu_get_offset(mdp, TSU_ADRH0); |
2441 | int i; | 2513 | int i; |
2442 | 2514 | ||
2443 | if (unlikely(!mdp->cd->tsu)) | 2515 | if (!mdp->cd->tsu) |
2444 | return; | 2516 | return; |
2445 | 2517 | ||
2446 | for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) { | 2518 | for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) { |
@@ -2450,8 +2522,8 @@ static void sh_eth_tsu_purge_mcast(struct net_device *ndev) | |||
2450 | } | 2522 | } |
2451 | } | 2523 | } |
2452 | 2524 | ||
2453 | /* Multicast reception directions set */ | 2525 | /* Update promiscuous flag and multicast filter */ |
2454 | static void sh_eth_set_multicast_list(struct net_device *ndev) | 2526 | static void sh_eth_set_rx_mode(struct net_device *ndev) |
2455 | { | 2527 | { |
2456 | struct sh_eth_private *mdp = netdev_priv(ndev); | 2528 | struct sh_eth_private *mdp = netdev_priv(ndev); |
2457 | u32 ecmr_bits; | 2529 | u32 ecmr_bits; |
@@ -2462,7 +2534,9 @@ static void sh_eth_set_multicast_list(struct net_device *ndev) | |||
2462 | /* Initial condition is MCT = 1, PRM = 0. | 2534 | /* Initial condition is MCT = 1, PRM = 0. |
2463 | * Depending on ndev->flags, set PRM or clear MCT | 2535 | * Depending on ndev->flags, set PRM or clear MCT |
2464 | */ | 2536 | */ |
2465 | ecmr_bits = (sh_eth_read(ndev, ECMR) & ~ECMR_PRM) | ECMR_MCT; | 2537 | ecmr_bits = sh_eth_read(ndev, ECMR) & ~ECMR_PRM; |
2538 | if (mdp->cd->tsu) | ||
2539 | ecmr_bits |= ECMR_MCT; | ||
2466 | 2540 | ||
2467 | if (!(ndev->flags & IFF_MULTICAST)) { | 2541 | if (!(ndev->flags & IFF_MULTICAST)) { |
2468 | sh_eth_tsu_purge_mcast(ndev); | 2542 | sh_eth_tsu_purge_mcast(ndev); |
@@ -2491,9 +2565,6 @@ static void sh_eth_set_multicast_list(struct net_device *ndev) | |||
2491 | } | 2565 | } |
2492 | } | 2566 | } |
2493 | } | 2567 | } |
2494 | } else { | ||
2495 | /* Normal, unicast/broadcast-only mode. */ | ||
2496 | ecmr_bits = (ecmr_bits & ~ECMR_PRM) | ECMR_MCT; | ||
2497 | } | 2568 | } |
2498 | 2569 | ||
2499 | /* update the ethernet mode */ | 2570 | /* update the ethernet mode */ |
@@ -2701,6 +2772,7 @@ static const struct net_device_ops sh_eth_netdev_ops = { | |||
2701 | .ndo_stop = sh_eth_close, | 2772 | .ndo_stop = sh_eth_close, |
2702 | .ndo_start_xmit = sh_eth_start_xmit, | 2773 | .ndo_start_xmit = sh_eth_start_xmit, |
2703 | .ndo_get_stats = sh_eth_get_stats, | 2774 | .ndo_get_stats = sh_eth_get_stats, |
2775 | .ndo_set_rx_mode = sh_eth_set_rx_mode, | ||
2704 | .ndo_tx_timeout = sh_eth_tx_timeout, | 2776 | .ndo_tx_timeout = sh_eth_tx_timeout, |
2705 | .ndo_do_ioctl = sh_eth_do_ioctl, | 2777 | .ndo_do_ioctl = sh_eth_do_ioctl, |
2706 | .ndo_validate_addr = eth_validate_addr, | 2778 | .ndo_validate_addr = eth_validate_addr, |
@@ -2713,7 +2785,7 @@ static const struct net_device_ops sh_eth_netdev_ops_tsu = { | |||
2713 | .ndo_stop = sh_eth_close, | 2785 | .ndo_stop = sh_eth_close, |
2714 | .ndo_start_xmit = sh_eth_start_xmit, | 2786 | .ndo_start_xmit = sh_eth_start_xmit, |
2715 | .ndo_get_stats = sh_eth_get_stats, | 2787 | .ndo_get_stats = sh_eth_get_stats, |
2716 | .ndo_set_rx_mode = sh_eth_set_multicast_list, | 2788 | .ndo_set_rx_mode = sh_eth_set_rx_mode, |
2717 | .ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid, | 2789 | .ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid, |
2718 | .ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid, | 2790 | .ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid, |
2719 | .ndo_tx_timeout = sh_eth_tx_timeout, | 2791 | .ndo_tx_timeout = sh_eth_tx_timeout, |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index 7bfaf1c81ea2..259d03f353e1 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -513,6 +513,7 @@ struct sh_eth_private { | |||
513 | u32 rx_buf_sz; /* Based on MTU+slack. */ | 513 | u32 rx_buf_sz; /* Based on MTU+slack. */ |
514 | int edmac_endian; | 514 | int edmac_endian; |
515 | struct napi_struct napi; | 515 | struct napi_struct napi; |
516 | bool irq_enabled; | ||
516 | /* MII transceiver section. */ | 517 | /* MII transceiver section. */ |
517 | u32 phy_id; /* PHY ID */ | 518 | u32 phy_id; /* PHY ID */ |
518 | struct mii_bus *mii_bus; /* MDIO bus control */ | 519 | struct mii_bus *mii_bus; /* MDIO bus control */ |
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 23545e1e605a..11288d4fc85f 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | |||
@@ -473,13 +473,19 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no, | |||
473 | /* allocate memory for RX skbuff array */ | 473 | /* allocate memory for RX skbuff array */ |
474 | rx_ring->rx_skbuff_dma = kmalloc_array(rx_rsize, | 474 | rx_ring->rx_skbuff_dma = kmalloc_array(rx_rsize, |
475 | sizeof(dma_addr_t), GFP_KERNEL); | 475 | sizeof(dma_addr_t), GFP_KERNEL); |
476 | if (rx_ring->rx_skbuff_dma == NULL) | 476 | if (!rx_ring->rx_skbuff_dma) { |
477 | goto dmamem_err; | 477 | dma_free_coherent(priv->device, |
478 | rx_rsize * sizeof(struct sxgbe_rx_norm_desc), | ||
479 | rx_ring->dma_rx, rx_ring->dma_rx_phy); | ||
480 | goto error; | ||
481 | } | ||
478 | 482 | ||
479 | rx_ring->rx_skbuff = kmalloc_array(rx_rsize, | 483 | rx_ring->rx_skbuff = kmalloc_array(rx_rsize, |
480 | sizeof(struct sk_buff *), GFP_KERNEL); | 484 | sizeof(struct sk_buff *), GFP_KERNEL); |
481 | if (rx_ring->rx_skbuff == NULL) | 485 | if (!rx_ring->rx_skbuff) { |
482 | goto rxbuff_err; | 486 | kfree(rx_ring->rx_skbuff_dma); |
487 | goto error; | ||
488 | } | ||
483 | 489 | ||
484 | /* initialise the buffers */ | 490 | /* initialise the buffers */ |
485 | for (desc_index = 0; desc_index < rx_rsize; desc_index++) { | 491 | for (desc_index = 0; desc_index < rx_rsize; desc_index++) { |
@@ -501,13 +507,6 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no, | |||
501 | err_init_rx_buffers: | 507 | err_init_rx_buffers: |
502 | while (--desc_index >= 0) | 508 | while (--desc_index >= 0) |
503 | free_rx_ring(priv->device, rx_ring, desc_index); | 509 | free_rx_ring(priv->device, rx_ring, desc_index); |
504 | kfree(rx_ring->rx_skbuff); | ||
505 | rxbuff_err: | ||
506 | kfree(rx_ring->rx_skbuff_dma); | ||
507 | dmamem_err: | ||
508 | dma_free_coherent(priv->device, | ||
509 | rx_rsize * sizeof(struct sxgbe_rx_norm_desc), | ||
510 | rx_ring->dma_rx, rx_ring->dma_rx_phy); | ||
511 | error: | 510 | error: |
512 | return -ENOMEM; | 511 | return -ENOMEM; |
513 | } | 512 | } |
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c index 866560ea9e18..b02eed12bfc5 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | |||
@@ -108,10 +108,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev) | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | /* Get MAC address if available (DT) */ | ||
112 | if (mac) | ||
113 | ether_addr_copy(priv->dev->dev_addr, mac); | ||
114 | |||
115 | priv = sxgbe_drv_probe(&(pdev->dev), plat_dat, addr); | 111 | priv = sxgbe_drv_probe(&(pdev->dev), plat_dat, addr); |
116 | if (!priv) { | 112 | if (!priv) { |
117 | pr_err("%s: main driver probe failed\n", __func__); | 113 | pr_err("%s: main driver probe failed\n", __func__); |
@@ -125,6 +121,10 @@ static int sxgbe_platform_probe(struct platform_device *pdev) | |||
125 | goto err_drv_remove; | 121 | goto err_drv_remove; |
126 | } | 122 | } |
127 | 123 | ||
124 | /* Get MAC address if available (DT) */ | ||
125 | if (mac) | ||
126 | ether_addr_copy(priv->dev->dev_addr, mac); | ||
127 | |||
128 | /* Get the TX/RX IRQ numbers */ | 128 | /* Get the TX/RX IRQ numbers */ |
129 | for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) { | 129 | for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) { |
130 | priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++); | 130 | priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5ef493aa5387..9c11c4d0f3fd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -2795,6 +2795,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
2795 | * @addr: iobase memory address | 2795 | * @addr: iobase memory address |
2796 | * Description: this is the main probe function used to | 2796 | * Description: this is the main probe function used to |
2797 | * call the alloc_etherdev, allocate the priv structure. | 2797 | * call the alloc_etherdev, allocate the priv structure. |
2798 | * Return: | ||
2799 | * on success the new private structure is returned, otherwise the error | ||
2800 | * pointer. | ||
2798 | */ | 2801 | */ |
2799 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, | 2802 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, |
2800 | struct plat_stmmacenet_data *plat_dat, | 2803 | struct plat_stmmacenet_data *plat_dat, |
@@ -2806,7 +2809,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
2806 | 2809 | ||
2807 | ndev = alloc_etherdev(sizeof(struct stmmac_priv)); | 2810 | ndev = alloc_etherdev(sizeof(struct stmmac_priv)); |
2808 | if (!ndev) | 2811 | if (!ndev) |
2809 | return NULL; | 2812 | return ERR_PTR(-ENOMEM); |
2810 | 2813 | ||
2811 | SET_NETDEV_DEV(ndev, device); | 2814 | SET_NETDEV_DEV(ndev, device); |
2812 | 2815 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index a1ba3a0c28da..2b9d404f8586 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1643,16 +1643,24 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, | |||
1643 | unsigned short vid) | 1643 | unsigned short vid) |
1644 | { | 1644 | { |
1645 | int ret; | 1645 | int ret; |
1646 | int unreg_mcast_mask; | 1646 | int unreg_mcast_mask = 0; |
1647 | u32 port_mask; | ||
1647 | 1648 | ||
1648 | if (priv->ndev->flags & IFF_ALLMULTI) | 1649 | if (priv->data.dual_emac) { |
1649 | unreg_mcast_mask = ALE_ALL_PORTS; | 1650 | port_mask = (1 << (priv->emac_port + 1)) | ALE_PORT_HOST; |
1650 | else | ||
1651 | unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2; | ||
1652 | 1651 | ||
1653 | ret = cpsw_ale_add_vlan(priv->ale, vid, | 1652 | if (priv->ndev->flags & IFF_ALLMULTI) |
1654 | ALE_ALL_PORTS << priv->host_port, | 1653 | unreg_mcast_mask = port_mask; |
1655 | 0, ALE_ALL_PORTS << priv->host_port, | 1654 | } else { |
1655 | port_mask = ALE_ALL_PORTS; | ||
1656 | |||
1657 | if (priv->ndev->flags & IFF_ALLMULTI) | ||
1658 | unreg_mcast_mask = ALE_ALL_PORTS; | ||
1659 | else | ||
1660 | unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2; | ||
1661 | } | ||
1662 | |||
1663 | ret = cpsw_ale_add_vlan(priv->ale, vid, port_mask, 0, port_mask, | ||
1656 | unreg_mcast_mask << priv->host_port); | 1664 | unreg_mcast_mask << priv->host_port); |
1657 | if (ret != 0) | 1665 | if (ret != 0) |
1658 | return ret; | 1666 | return ret; |
@@ -1663,8 +1671,7 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, | |||
1663 | goto clean_vid; | 1671 | goto clean_vid; |
1664 | 1672 | ||
1665 | ret = cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, | 1673 | ret = cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, |
1666 | ALE_ALL_PORTS << priv->host_port, | 1674 | port_mask, ALE_VLAN, vid, 0); |
1667 | ALE_VLAN, vid, 0); | ||
1668 | if (ret != 0) | 1675 | if (ret != 0) |
1669 | goto clean_vlan_ucast; | 1676 | goto clean_vlan_ucast; |
1670 | return 0; | 1677 | return 0; |
@@ -1685,6 +1692,19 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, | |||
1685 | if (vid == priv->data.default_vlan) | 1692 | if (vid == priv->data.default_vlan) |
1686 | return 0; | 1693 | return 0; |
1687 | 1694 | ||
1695 | if (priv->data.dual_emac) { | ||
1696 | /* In dual EMAC, reserved VLAN id should not be used for | ||
1697 | * creating VLAN interfaces as this can break the dual | ||
1698 | * EMAC port separation | ||
1699 | */ | ||
1700 | int i; | ||
1701 | |||
1702 | for (i = 0; i < priv->data.slaves; i++) { | ||
1703 | if (vid == priv->slaves[i].port_vlan) | ||
1704 | return -EINVAL; | ||
1705 | } | ||
1706 | } | ||
1707 | |||
1688 | dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); | 1708 | dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); |
1689 | return cpsw_add_vlan_ale_entry(priv, vid); | 1709 | return cpsw_add_vlan_ale_entry(priv, vid); |
1690 | } | 1710 | } |
@@ -1698,6 +1718,15 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, | |||
1698 | if (vid == priv->data.default_vlan) | 1718 | if (vid == priv->data.default_vlan) |
1699 | return 0; | 1719 | return 0; |
1700 | 1720 | ||
1721 | if (priv->data.dual_emac) { | ||
1722 | int i; | ||
1723 | |||
1724 | for (i = 0; i < priv->data.slaves; i++) { | ||
1725 | if (vid == priv->slaves[i].port_vlan) | ||
1726 | return -EINVAL; | ||
1727 | } | ||
1728 | } | ||
1729 | |||
1701 | dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); | 1730 | dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); |
1702 | ret = cpsw_ale_del_vlan(priv->ale, vid, 0); | 1731 | ret = cpsw_ale_del_vlan(priv->ale, vid, 0); |
1703 | if (ret != 0) | 1732 | if (ret != 0) |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index ea712512c7d1..5fae4354722c 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/of.h> | 62 | #include <linux/of.h> |
63 | #include <linux/of_address.h> | 63 | #include <linux/of_address.h> |
64 | #include <linux/of_device.h> | 64 | #include <linux/of_device.h> |
65 | #include <linux/of_mdio.h> | ||
65 | #include <linux/of_irq.h> | 66 | #include <linux/of_irq.h> |
66 | #include <linux/of_net.h> | 67 | #include <linux/of_net.h> |
67 | 68 | ||
@@ -343,9 +344,7 @@ struct emac_priv { | |||
343 | u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS]; | 344 | u32 multicast_hash_cnt[EMAC_NUM_MULTICAST_BITS]; |
344 | u32 rx_addr_type; | 345 | u32 rx_addr_type; |
345 | const char *phy_id; | 346 | const char *phy_id; |
346 | #ifdef CONFIG_OF | ||
347 | struct device_node *phy_node; | 347 | struct device_node *phy_node; |
348 | #endif | ||
349 | struct phy_device *phydev; | 348 | struct phy_device *phydev; |
350 | spinlock_t lock; | 349 | spinlock_t lock; |
351 | /*platform specific members*/ | 350 | /*platform specific members*/ |
@@ -922,6 +921,16 @@ static void emac_int_disable(struct emac_priv *priv) | |||
922 | if (priv->int_disable) | 921 | if (priv->int_disable) |
923 | priv->int_disable(); | 922 | priv->int_disable(); |
924 | 923 | ||
924 | /* NOTE: Rx Threshold and Misc interrupts are not enabled */ | ||
925 | |||
926 | /* ack rxen only then a new pulse will be generated */ | ||
927 | emac_write(EMAC_DM646X_MACEOIVECTOR, | ||
928 | EMAC_DM646X_MAC_EOI_C0_RXEN); | ||
929 | |||
930 | /* ack txen- only then a new pulse will be generated */ | ||
931 | emac_write(EMAC_DM646X_MACEOIVECTOR, | ||
932 | EMAC_DM646X_MAC_EOI_C0_TXEN); | ||
933 | |||
925 | local_irq_restore(flags); | 934 | local_irq_restore(flags); |
926 | 935 | ||
927 | } else { | 936 | } else { |
@@ -951,15 +960,6 @@ static void emac_int_enable(struct emac_priv *priv) | |||
951 | * register */ | 960 | * register */ |
952 | 961 | ||
953 | /* NOTE: Rx Threshold and Misc interrupts are not enabled */ | 962 | /* NOTE: Rx Threshold and Misc interrupts are not enabled */ |
954 | |||
955 | /* ack rxen only then a new pulse will be generated */ | ||
956 | emac_write(EMAC_DM646X_MACEOIVECTOR, | ||
957 | EMAC_DM646X_MAC_EOI_C0_RXEN); | ||
958 | |||
959 | /* ack txen- only then a new pulse will be generated */ | ||
960 | emac_write(EMAC_DM646X_MACEOIVECTOR, | ||
961 | EMAC_DM646X_MAC_EOI_C0_TXEN); | ||
962 | |||
963 | } else { | 963 | } else { |
964 | /* Set DM644x control registers for interrupt control */ | 964 | /* Set DM644x control registers for interrupt control */ |
965 | emac_ctrl_write(EMAC_CTRL_EWCTL, 0x1); | 965 | emac_ctrl_write(EMAC_CTRL_EWCTL, 0x1); |
@@ -1537,7 +1537,13 @@ static int emac_dev_open(struct net_device *ndev) | |||
1537 | int i = 0; | 1537 | int i = 0; |
1538 | struct emac_priv *priv = netdev_priv(ndev); | 1538 | struct emac_priv *priv = netdev_priv(ndev); |
1539 | 1539 | ||
1540 | pm_runtime_get(&priv->pdev->dev); | 1540 | ret = pm_runtime_get_sync(&priv->pdev->dev); |
1541 | if (ret < 0) { | ||
1542 | pm_runtime_put_noidle(&priv->pdev->dev); | ||
1543 | dev_err(&priv->pdev->dev, "%s: failed to get_sync(%d)\n", | ||
1544 | __func__, ret); | ||
1545 | return ret; | ||
1546 | } | ||
1541 | 1547 | ||
1542 | netif_carrier_off(ndev); | 1548 | netif_carrier_off(ndev); |
1543 | for (cnt = 0; cnt < ETH_ALEN; cnt++) | 1549 | for (cnt = 0; cnt < ETH_ALEN; cnt++) |
@@ -1596,8 +1602,20 @@ static int emac_dev_open(struct net_device *ndev) | |||
1596 | cpdma_ctlr_start(priv->dma); | 1602 | cpdma_ctlr_start(priv->dma); |
1597 | 1603 | ||
1598 | priv->phydev = NULL; | 1604 | priv->phydev = NULL; |
1605 | |||
1606 | if (priv->phy_node) { | ||
1607 | priv->phydev = of_phy_connect(ndev, priv->phy_node, | ||
1608 | &emac_adjust_link, 0, 0); | ||
1609 | if (!priv->phydev) { | ||
1610 | dev_err(emac_dev, "could not connect to phy %s\n", | ||
1611 | priv->phy_node->full_name); | ||
1612 | ret = -ENODEV; | ||
1613 | goto err; | ||
1614 | } | ||
1615 | } | ||
1616 | |||
1599 | /* use the first phy on the bus if pdata did not give us a phy id */ | 1617 | /* use the first phy on the bus if pdata did not give us a phy id */ |
1600 | if (!priv->phy_id) { | 1618 | if (!priv->phydev && !priv->phy_id) { |
1601 | struct device *phy; | 1619 | struct device *phy; |
1602 | 1620 | ||
1603 | phy = bus_find_device(&mdio_bus_type, NULL, NULL, | 1621 | phy = bus_find_device(&mdio_bus_type, NULL, NULL, |
@@ -1606,7 +1624,7 @@ static int emac_dev_open(struct net_device *ndev) | |||
1606 | priv->phy_id = dev_name(phy); | 1624 | priv->phy_id = dev_name(phy); |
1607 | } | 1625 | } |
1608 | 1626 | ||
1609 | if (priv->phy_id && *priv->phy_id) { | 1627 | if (!priv->phydev && priv->phy_id && *priv->phy_id) { |
1610 | priv->phydev = phy_connect(ndev, priv->phy_id, | 1628 | priv->phydev = phy_connect(ndev, priv->phy_id, |
1611 | &emac_adjust_link, | 1629 | &emac_adjust_link, |
1612 | PHY_INTERFACE_MODE_MII); | 1630 | PHY_INTERFACE_MODE_MII); |
@@ -1627,7 +1645,9 @@ static int emac_dev_open(struct net_device *ndev) | |||
1627 | "(mii_bus:phy_addr=%s, id=%x)\n", | 1645 | "(mii_bus:phy_addr=%s, id=%x)\n", |
1628 | priv->phydev->drv->name, dev_name(&priv->phydev->dev), | 1646 | priv->phydev->drv->name, dev_name(&priv->phydev->dev), |
1629 | priv->phydev->phy_id); | 1647 | priv->phydev->phy_id); |
1630 | } else { | 1648 | } |
1649 | |||
1650 | if (!priv->phydev) { | ||
1631 | /* No PHY , fix the link, speed and duplex settings */ | 1651 | /* No PHY , fix the link, speed and duplex settings */ |
1632 | dev_notice(emac_dev, "no phy, defaulting to 100/full\n"); | 1652 | dev_notice(emac_dev, "no phy, defaulting to 100/full\n"); |
1633 | priv->link = 1; | 1653 | priv->link = 1; |
@@ -1724,6 +1744,15 @@ static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) | |||
1724 | struct emac_priv *priv = netdev_priv(ndev); | 1744 | struct emac_priv *priv = netdev_priv(ndev); |
1725 | u32 mac_control; | 1745 | u32 mac_control; |
1726 | u32 stats_clear_mask; | 1746 | u32 stats_clear_mask; |
1747 | int err; | ||
1748 | |||
1749 | err = pm_runtime_get_sync(&priv->pdev->dev); | ||
1750 | if (err < 0) { | ||
1751 | pm_runtime_put_noidle(&priv->pdev->dev); | ||
1752 | dev_err(&priv->pdev->dev, "%s: failed to get_sync(%d)\n", | ||
1753 | __func__, err); | ||
1754 | return &ndev->stats; | ||
1755 | } | ||
1727 | 1756 | ||
1728 | /* update emac hardware stats and reset the registers*/ | 1757 | /* update emac hardware stats and reset the registers*/ |
1729 | 1758 | ||
@@ -1766,6 +1795,8 @@ static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) | |||
1766 | ndev->stats.tx_fifo_errors += emac_read(EMAC_TXUNDERRUN); | 1795 | ndev->stats.tx_fifo_errors += emac_read(EMAC_TXUNDERRUN); |
1767 | emac_write(EMAC_TXUNDERRUN, stats_clear_mask); | 1796 | emac_write(EMAC_TXUNDERRUN, stats_clear_mask); |
1768 | 1797 | ||
1798 | pm_runtime_put(&priv->pdev->dev); | ||
1799 | |||
1769 | return &ndev->stats; | 1800 | return &ndev->stats; |
1770 | } | 1801 | } |
1771 | 1802 | ||
@@ -1859,7 +1890,7 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) | |||
1859 | static int davinci_emac_probe(struct platform_device *pdev) | 1890 | static int davinci_emac_probe(struct platform_device *pdev) |
1860 | { | 1891 | { |
1861 | int rc = 0; | 1892 | int rc = 0; |
1862 | struct resource *res; | 1893 | struct resource *res, *res_ctrl; |
1863 | struct net_device *ndev; | 1894 | struct net_device *ndev; |
1864 | struct emac_priv *priv; | 1895 | struct emac_priv *priv; |
1865 | unsigned long hw_ram_addr; | 1896 | unsigned long hw_ram_addr; |
@@ -1876,6 +1907,7 @@ static int davinci_emac_probe(struct platform_device *pdev) | |||
1876 | return -EBUSY; | 1907 | return -EBUSY; |
1877 | } | 1908 | } |
1878 | emac_bus_frequency = clk_get_rate(emac_clk); | 1909 | emac_bus_frequency = clk_get_rate(emac_clk); |
1910 | devm_clk_put(&pdev->dev, emac_clk); | ||
1879 | 1911 | ||
1880 | /* TODO: Probe PHY here if possible */ | 1912 | /* TODO: Probe PHY here if possible */ |
1881 | 1913 | ||
@@ -1917,11 +1949,20 @@ static int davinci_emac_probe(struct platform_device *pdev) | |||
1917 | rc = PTR_ERR(priv->remap_addr); | 1949 | rc = PTR_ERR(priv->remap_addr); |
1918 | goto no_pdata; | 1950 | goto no_pdata; |
1919 | } | 1951 | } |
1952 | |||
1953 | res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
1954 | if (res_ctrl) { | ||
1955 | priv->ctrl_base = | ||
1956 | devm_ioremap_resource(&pdev->dev, res_ctrl); | ||
1957 | if (IS_ERR(priv->ctrl_base)) | ||
1958 | goto no_pdata; | ||
1959 | } else { | ||
1960 | priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset; | ||
1961 | } | ||
1962 | |||
1920 | priv->emac_base = priv->remap_addr + pdata->ctrl_reg_offset; | 1963 | priv->emac_base = priv->remap_addr + pdata->ctrl_reg_offset; |
1921 | ndev->base_addr = (unsigned long)priv->remap_addr; | 1964 | ndev->base_addr = (unsigned long)priv->remap_addr; |
1922 | 1965 | ||
1923 | priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset; | ||
1924 | |||
1925 | hw_ram_addr = pdata->hw_ram_addr; | 1966 | hw_ram_addr = pdata->hw_ram_addr; |
1926 | if (!hw_ram_addr) | 1967 | if (!hw_ram_addr) |
1927 | hw_ram_addr = (u32 __force)res->start + pdata->ctrl_ram_offset; | 1968 | hw_ram_addr = (u32 __force)res->start + pdata->ctrl_ram_offset; |
@@ -1980,12 +2021,22 @@ static int davinci_emac_probe(struct platform_device *pdev) | |||
1980 | ndev->ethtool_ops = ðtool_ops; | 2021 | ndev->ethtool_ops = ðtool_ops; |
1981 | netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); | 2022 | netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); |
1982 | 2023 | ||
2024 | pm_runtime_enable(&pdev->dev); | ||
2025 | rc = pm_runtime_get_sync(&pdev->dev); | ||
2026 | if (rc < 0) { | ||
2027 | pm_runtime_put_noidle(&pdev->dev); | ||
2028 | dev_err(&pdev->dev, "%s: failed to get_sync(%d)\n", | ||
2029 | __func__, rc); | ||
2030 | goto no_cpdma_chan; | ||
2031 | } | ||
2032 | |||
1983 | /* register the network device */ | 2033 | /* register the network device */ |
1984 | SET_NETDEV_DEV(ndev, &pdev->dev); | 2034 | SET_NETDEV_DEV(ndev, &pdev->dev); |
1985 | rc = register_netdev(ndev); | 2035 | rc = register_netdev(ndev); |
1986 | if (rc) { | 2036 | if (rc) { |
1987 | dev_err(&pdev->dev, "error in register_netdev\n"); | 2037 | dev_err(&pdev->dev, "error in register_netdev\n"); |
1988 | rc = -ENODEV; | 2038 | rc = -ENODEV; |
2039 | pm_runtime_put(&pdev->dev); | ||
1989 | goto no_cpdma_chan; | 2040 | goto no_cpdma_chan; |
1990 | } | 2041 | } |
1991 | 2042 | ||
@@ -1995,9 +2046,7 @@ static int davinci_emac_probe(struct platform_device *pdev) | |||
1995 | "(regs: %p, irq: %d)\n", | 2046 | "(regs: %p, irq: %d)\n", |
1996 | (void *)priv->emac_base_phys, ndev->irq); | 2047 | (void *)priv->emac_base_phys, ndev->irq); |
1997 | } | 2048 | } |
1998 | 2049 | pm_runtime_put(&pdev->dev); | |
1999 | pm_runtime_enable(&pdev->dev); | ||
2000 | pm_runtime_resume(&pdev->dev); | ||
2001 | 2050 | ||
2002 | return 0; | 2051 | return 0; |
2003 | 2052 | ||
@@ -2071,9 +2120,14 @@ static const struct emac_platform_data am3517_emac_data = { | |||
2071 | .hw_ram_addr = 0x01e20000, | 2120 | .hw_ram_addr = 0x01e20000, |
2072 | }; | 2121 | }; |
2073 | 2122 | ||
2123 | static const struct emac_platform_data dm816_emac_data = { | ||
2124 | .version = EMAC_VERSION_2, | ||
2125 | }; | ||
2126 | |||
2074 | static const struct of_device_id davinci_emac_of_match[] = { | 2127 | static const struct of_device_id davinci_emac_of_match[] = { |
2075 | {.compatible = "ti,davinci-dm6467-emac", }, | 2128 | {.compatible = "ti,davinci-dm6467-emac", }, |
2076 | {.compatible = "ti,am3517-emac", .data = &am3517_emac_data, }, | 2129 | {.compatible = "ti,am3517-emac", .data = &am3517_emac_data, }, |
2130 | {.compatible = "ti,dm816-emac", .data = &dm816_emac_data, }, | ||
2077 | {}, | 2131 | {}, |
2078 | }; | 2132 | }; |
2079 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); | 2133 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); |
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index a14d87783245..2e195289ddf4 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c | |||
@@ -377,9 +377,11 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) | |||
377 | }; | 377 | }; |
378 | 378 | ||
379 | dst = ip6_route_output(dev_net(dev), NULL, &fl6); | 379 | dst = ip6_route_output(dev_net(dev), NULL, &fl6); |
380 | if (IS_ERR(dst)) | 380 | if (dst->error) { |
381 | ret = dst->error; | ||
382 | dst_release(dst); | ||
381 | goto err; | 383 | goto err; |
382 | 384 | } | |
383 | skb_dst_drop(skb); | 385 | skb_dst_drop(skb); |
384 | skb_dst_set(skb, dst); | 386 | skb_dst_set(skb, dst); |
385 | err = ip6_local_out(skb); | 387 | err = ip6_local_out(skb); |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 2e2244221cbe..b74a272243ae 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -834,9 +834,6 @@ static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) | |||
834 | index &= ~3; | 834 | index &= ~3; |
835 | } | 835 | } |
836 | 836 | ||
837 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); | ||
838 | |||
839 | data |= __le32_to_cpu(tmp) & ~mask; | ||
840 | tmp = __cpu_to_le32(data); | 837 | tmp = __cpu_to_le32(data); |
841 | 838 | ||
842 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); | 839 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); |
@@ -875,9 +872,6 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) | |||
875 | index &= ~3; | 872 | index &= ~3; |
876 | } | 873 | } |
877 | 874 | ||
878 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); | ||
879 | |||
880 | data |= __le32_to_cpu(tmp) & ~mask; | ||
881 | tmp = __cpu_to_le32(data); | 875 | tmp = __cpu_to_le32(data); |
882 | 876 | ||
883 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); | 877 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); |
@@ -927,12 +921,6 @@ static void sram_write(struct r8152 *tp, u16 addr, u16 data) | |||
927 | ocp_reg_write(tp, OCP_SRAM_DATA, data); | 921 | ocp_reg_write(tp, OCP_SRAM_DATA, data); |
928 | } | 922 | } |
929 | 923 | ||
930 | static u16 sram_read(struct r8152 *tp, u16 addr) | ||
931 | { | ||
932 | ocp_reg_write(tp, OCP_SRAM_ADDR, addr); | ||
933 | return ocp_reg_read(tp, OCP_SRAM_DATA); | ||
934 | } | ||
935 | |||
936 | static int read_mii_word(struct net_device *netdev, int phy_id, int reg) | 924 | static int read_mii_word(struct net_device *netdev, int phy_id, int reg) |
937 | { | 925 | { |
938 | struct r8152 *tp = netdev_priv(netdev); | 926 | struct r8152 *tp = netdev_priv(netdev); |
@@ -2573,24 +2561,18 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) | |||
2573 | data = ocp_reg_read(tp, OCP_POWER_CFG); | 2561 | data = ocp_reg_read(tp, OCP_POWER_CFG); |
2574 | data |= EN_10M_PLLOFF; | 2562 | data |= EN_10M_PLLOFF; |
2575 | ocp_reg_write(tp, OCP_POWER_CFG, data); | 2563 | ocp_reg_write(tp, OCP_POWER_CFG, data); |
2576 | data = sram_read(tp, SRAM_IMPEDANCE); | 2564 | sram_write(tp, SRAM_IMPEDANCE, 0x0b13); |
2577 | data &= ~RX_DRIVING_MASK; | ||
2578 | sram_write(tp, SRAM_IMPEDANCE, data); | ||
2579 | 2565 | ||
2580 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR); | 2566 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR); |
2581 | ocp_data |= PFM_PWM_SWITCH; | 2567 | ocp_data |= PFM_PWM_SWITCH; |
2582 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data); | 2568 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data); |
2583 | 2569 | ||
2584 | data = sram_read(tp, SRAM_LPF_CFG); | 2570 | /* Enable LPF corner auto tune */ |
2585 | data |= LPF_AUTO_TUNE; | 2571 | sram_write(tp, SRAM_LPF_CFG, 0xf70f); |
2586 | sram_write(tp, SRAM_LPF_CFG, data); | ||
2587 | 2572 | ||
2588 | data = sram_read(tp, SRAM_10M_AMP1); | 2573 | /* Adjust 10M Amplitude */ |
2589 | data |= GDAC_IB_UPALL; | 2574 | sram_write(tp, SRAM_10M_AMP1, 0x00af); |
2590 | sram_write(tp, SRAM_10M_AMP1, data); | 2575 | sram_write(tp, SRAM_10M_AMP2, 0x0208); |
2591 | data = sram_read(tp, SRAM_10M_AMP2); | ||
2592 | data |= AMP_DN; | ||
2593 | sram_write(tp, SRAM_10M_AMP2, data); | ||
2594 | 2576 | ||
2595 | set_bit(PHY_RESET, &tp->flags); | 2577 | set_bit(PHY_RESET, &tp->flags); |
2596 | } | 2578 | } |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 9a72640237cb..62b0bf4fdf6b 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -285,6 +285,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) | |||
285 | 285 | ||
286 | __ath_cancel_work(sc); | 286 | __ath_cancel_work(sc); |
287 | 287 | ||
288 | disable_irq(sc->irq); | ||
288 | tasklet_disable(&sc->intr_tq); | 289 | tasklet_disable(&sc->intr_tq); |
289 | tasklet_disable(&sc->bcon_tasklet); | 290 | tasklet_disable(&sc->bcon_tasklet); |
290 | spin_lock_bh(&sc->sc_pcu_lock); | 291 | spin_lock_bh(&sc->sc_pcu_lock); |
@@ -331,6 +332,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) | |||
331 | r = -EIO; | 332 | r = -EIO; |
332 | 333 | ||
333 | out: | 334 | out: |
335 | enable_irq(sc->irq); | ||
334 | spin_unlock_bh(&sc->sc_pcu_lock); | 336 | spin_unlock_bh(&sc->sc_pcu_lock); |
335 | tasklet_enable(&sc->bcon_tasklet); | 337 | tasklet_enable(&sc->bcon_tasklet); |
336 | tasklet_enable(&sc->intr_tq); | 338 | tasklet_enable(&sc->intr_tq); |
@@ -512,9 +514,6 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
512 | if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) | 514 | if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) |
513 | return IRQ_NONE; | 515 | return IRQ_NONE; |
514 | 516 | ||
515 | if (!AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags)) | ||
516 | return IRQ_NONE; | ||
517 | |||
518 | /* shared irq, not for us */ | 517 | /* shared irq, not for us */ |
519 | if (!ath9k_hw_intrpend(ah)) | 518 | if (!ath9k_hw_intrpend(ah)) |
520 | return IRQ_NONE; | 519 | return IRQ_NONE; |
@@ -529,7 +528,7 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
529 | ath9k_debug_sync_cause(sc, sync_cause); | 528 | ath9k_debug_sync_cause(sc, sync_cause); |
530 | status &= ah->imask; /* discard unasked-for bits */ | 529 | status &= ah->imask; /* discard unasked-for bits */ |
531 | 530 | ||
532 | if (AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags)) | 531 | if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) |
533 | return IRQ_HANDLED; | 532 | return IRQ_HANDLED; |
534 | 533 | ||
535 | /* | 534 | /* |
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index ea63fbd228ed..352b4f28f82c 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c | |||
@@ -114,17 +114,6 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov, | |||
114 | ret = of_overlay_apply_one(ov, tchild, child); | 114 | ret = of_overlay_apply_one(ov, tchild, child); |
115 | if (ret) | 115 | if (ret) |
116 | return ret; | 116 | return ret; |
117 | |||
118 | /* The properties are already copied, now do the child nodes */ | ||
119 | for_each_child_of_node(child, grandchild) { | ||
120 | ret = of_overlay_apply_single_device_node(ov, tchild, grandchild); | ||
121 | if (ret) { | ||
122 | pr_err("%s: Failed to apply single node @%s/%s\n", | ||
123 | __func__, tchild->full_name, | ||
124 | grandchild->name); | ||
125 | return ret; | ||
126 | } | ||
127 | } | ||
128 | } | 117 | } |
129 | 118 | ||
130 | return ret; | 119 | return ret; |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 5b33c6a21807..b0d50d70a8a1 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -188,7 +188,7 @@ static void of_dma_configure(struct device *dev) | |||
188 | size = dev->coherent_dma_mask; | 188 | size = dev->coherent_dma_mask; |
189 | } else { | 189 | } else { |
190 | offset = PFN_DOWN(paddr - dma_addr); | 190 | offset = PFN_DOWN(paddr - dma_addr); |
191 | dev_dbg(dev, "dma_pfn_offset(%#08lx)\n", dev->dma_pfn_offset); | 191 | dev_dbg(dev, "dma_pfn_offset(%#08lx)\n", offset); |
192 | } | 192 | } |
193 | dev->dma_pfn_offset = offset; | 193 | dev->dma_pfn_offset = offset; |
194 | 194 | ||
@@ -566,6 +566,10 @@ static int of_platform_notify(struct notifier_block *nb, | |||
566 | if (!of_node_check_flag(rd->dn->parent, OF_POPULATED_BUS)) | 566 | if (!of_node_check_flag(rd->dn->parent, OF_POPULATED_BUS)) |
567 | return NOTIFY_OK; /* not for us */ | 567 | return NOTIFY_OK; /* not for us */ |
568 | 568 | ||
569 | /* already populated? (driver using of_populate manually) */ | ||
570 | if (of_node_check_flag(rd->dn, OF_POPULATED)) | ||
571 | return NOTIFY_OK; | ||
572 | |||
569 | /* pdev_parent may be NULL when no bus platform device */ | 573 | /* pdev_parent may be NULL when no bus platform device */ |
570 | pdev_parent = of_find_device_by_node(rd->dn->parent); | 574 | pdev_parent = of_find_device_by_node(rd->dn->parent); |
571 | pdev = of_platform_device_create(rd->dn, NULL, | 575 | pdev = of_platform_device_create(rd->dn, NULL, |
@@ -581,6 +585,11 @@ static int of_platform_notify(struct notifier_block *nb, | |||
581 | break; | 585 | break; |
582 | 586 | ||
583 | case OF_RECONFIG_CHANGE_REMOVE: | 587 | case OF_RECONFIG_CHANGE_REMOVE: |
588 | |||
589 | /* already depopulated? */ | ||
590 | if (!of_node_check_flag(rd->dn, OF_POPULATED)) | ||
591 | return NOTIFY_OK; | ||
592 | |||
584 | /* find our device by node */ | 593 | /* find our device by node */ |
585 | pdev = of_find_device_by_node(rd->dn); | 594 | pdev = of_find_device_by_node(rd->dn); |
586 | if (pdev == NULL) | 595 | if (pdev == NULL) |
diff --git a/drivers/of/unittest-data/tests-overlay.dtsi b/drivers/of/unittest-data/tests-overlay.dtsi index 75976da22b2e..a2b687d5f324 100644 --- a/drivers/of/unittest-data/tests-overlay.dtsi +++ b/drivers/of/unittest-data/tests-overlay.dtsi | |||
@@ -176,5 +176,60 @@ | |||
176 | }; | 176 | }; |
177 | }; | 177 | }; |
178 | 178 | ||
179 | overlay10 { | ||
180 | fragment@0 { | ||
181 | target-path = "/testcase-data/overlay-node/test-bus"; | ||
182 | __overlay__ { | ||
183 | |||
184 | /* suppress DTC warning */ | ||
185 | #address-cells = <1>; | ||
186 | #size-cells = <0>; | ||
187 | |||
188 | test-selftest10 { | ||
189 | compatible = "selftest"; | ||
190 | status = "okay"; | ||
191 | reg = <10>; | ||
192 | |||
193 | #address-cells = <1>; | ||
194 | #size-cells = <0>; | ||
195 | |||
196 | test-selftest101 { | ||
197 | compatible = "selftest"; | ||
198 | status = "okay"; | ||
199 | reg = <1>; | ||
200 | }; | ||
201 | |||
202 | }; | ||
203 | }; | ||
204 | }; | ||
205 | }; | ||
206 | |||
207 | overlay11 { | ||
208 | fragment@0 { | ||
209 | target-path = "/testcase-data/overlay-node/test-bus"; | ||
210 | __overlay__ { | ||
211 | |||
212 | /* suppress DTC warning */ | ||
213 | #address-cells = <1>; | ||
214 | #size-cells = <0>; | ||
215 | |||
216 | test-selftest11 { | ||
217 | compatible = "selftest"; | ||
218 | status = "okay"; | ||
219 | reg = <11>; | ||
220 | |||
221 | #address-cells = <1>; | ||
222 | #size-cells = <0>; | ||
223 | |||
224 | test-selftest111 { | ||
225 | compatible = "selftest"; | ||
226 | status = "okay"; | ||
227 | reg = <1>; | ||
228 | }; | ||
229 | |||
230 | }; | ||
231 | }; | ||
232 | }; | ||
233 | }; | ||
179 | }; | 234 | }; |
180 | }; | 235 | }; |
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 844838e11ef1..41a4a138f53b 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c | |||
@@ -978,6 +978,9 @@ static int selftest_probe(struct platform_device *pdev) | |||
978 | } | 978 | } |
979 | 979 | ||
980 | dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); | 980 | dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); |
981 | |||
982 | of_platform_populate(np, NULL, NULL, &pdev->dev); | ||
983 | |||
981 | return 0; | 984 | return 0; |
982 | } | 985 | } |
983 | 986 | ||
@@ -1385,6 +1388,39 @@ static void of_selftest_overlay_8(void) | |||
1385 | selftest(1, "overlay test %d passed\n", 8); | 1388 | selftest(1, "overlay test %d passed\n", 8); |
1386 | } | 1389 | } |
1387 | 1390 | ||
1391 | /* test insertion of a bus with parent devices */ | ||
1392 | static void of_selftest_overlay_10(void) | ||
1393 | { | ||
1394 | int ret; | ||
1395 | char *child_path; | ||
1396 | |||
1397 | /* device should disable */ | ||
1398 | ret = of_selftest_apply_overlay_check(10, 10, 0, 1); | ||
1399 | if (selftest(ret == 0, "overlay test %d failed; overlay application\n", 10)) | ||
1400 | return; | ||
1401 | |||
1402 | child_path = kasprintf(GFP_KERNEL, "%s/test-selftest101", | ||
1403 | selftest_path(10)); | ||
1404 | if (selftest(child_path, "overlay test %d failed; kasprintf\n", 10)) | ||
1405 | return; | ||
1406 | |||
1407 | ret = of_path_platform_device_exists(child_path); | ||
1408 | kfree(child_path); | ||
1409 | if (selftest(ret, "overlay test %d failed; no child device\n", 10)) | ||
1410 | return; | ||
1411 | } | ||
1412 | |||
1413 | /* test insertion of a bus with parent devices (and revert) */ | ||
1414 | static void of_selftest_overlay_11(void) | ||
1415 | { | ||
1416 | int ret; | ||
1417 | |||
1418 | /* device should disable */ | ||
1419 | ret = of_selftest_apply_revert_overlay_check(11, 11, 0, 1); | ||
1420 | if (selftest(ret == 0, "overlay test %d failed; overlay application\n", 11)) | ||
1421 | return; | ||
1422 | } | ||
1423 | |||
1388 | static void __init of_selftest_overlay(void) | 1424 | static void __init of_selftest_overlay(void) |
1389 | { | 1425 | { |
1390 | struct device_node *bus_np = NULL; | 1426 | struct device_node *bus_np = NULL; |
@@ -1433,6 +1469,9 @@ static void __init of_selftest_overlay(void) | |||
1433 | of_selftest_overlay_6(); | 1469 | of_selftest_overlay_6(); |
1434 | of_selftest_overlay_8(); | 1470 | of_selftest_overlay_8(); |
1435 | 1471 | ||
1472 | of_selftest_overlay_10(); | ||
1473 | of_selftest_overlay_11(); | ||
1474 | |||
1436 | out: | 1475 | out: |
1437 | of_node_put(bus_np); | 1476 | of_node_put(bus_np); |
1438 | } | 1477 | } |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 37e71ff6408d..dceb9ddfd99a 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -694,9 +694,8 @@ lba_fixup_bus(struct pci_bus *bus) | |||
694 | int i; | 694 | int i; |
695 | /* PCI-PCI Bridge */ | 695 | /* PCI-PCI Bridge */ |
696 | pci_read_bridge_bases(bus); | 696 | pci_read_bridge_bases(bus); |
697 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { | 697 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) |
698 | pci_claim_resource(bus->self, i); | 698 | pci_claim_bridge_resource(bus->self, i); |
699 | } | ||
700 | } else { | 699 | } else { |
701 | /* Host-PCI Bridge */ | 700 | /* Host-PCI Bridge */ |
702 | int err; | 701 | int err; |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 73aef51a28f0..8fb16188cd82 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -228,6 +228,49 @@ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
228 | } | 228 | } |
229 | EXPORT_SYMBOL(pci_bus_alloc_resource); | 229 | EXPORT_SYMBOL(pci_bus_alloc_resource); |
230 | 230 | ||
231 | /* | ||
232 | * The @idx resource of @dev should be a PCI-PCI bridge window. If this | ||
233 | * resource fits inside a window of an upstream bridge, do nothing. If it | ||
234 | * overlaps an upstream window but extends outside it, clip the resource so | ||
235 | * it fits completely inside. | ||
236 | */ | ||
237 | bool pci_bus_clip_resource(struct pci_dev *dev, int idx) | ||
238 | { | ||
239 | struct pci_bus *bus = dev->bus; | ||
240 | struct resource *res = &dev->resource[idx]; | ||
241 | struct resource orig_res = *res; | ||
242 | struct resource *r; | ||
243 | int i; | ||
244 | |||
245 | pci_bus_for_each_resource(bus, r, i) { | ||
246 | resource_size_t start, end; | ||
247 | |||
248 | if (!r) | ||
249 | continue; | ||
250 | |||
251 | if (resource_type(res) != resource_type(r)) | ||
252 | continue; | ||
253 | |||
254 | start = max(r->start, res->start); | ||
255 | end = min(r->end, res->end); | ||
256 | |||
257 | if (start > end) | ||
258 | continue; /* no overlap */ | ||
259 | |||
260 | if (res->start == start && res->end == end) | ||
261 | return false; /* no change */ | ||
262 | |||
263 | res->start = start; | ||
264 | res->end = end; | ||
265 | dev_printk(KERN_DEBUG, &dev->dev, "%pR clipped to %pR\n", | ||
266 | &orig_res, res); | ||
267 | |||
268 | return true; | ||
269 | } | ||
270 | |||
271 | return false; | ||
272 | } | ||
273 | |||
231 | void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } | 274 | void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } |
232 | 275 | ||
233 | /** | 276 | /** |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cab05f31223f..e9d4fd861ba1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -3271,7 +3271,8 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) | |||
3271 | { | 3271 | { |
3272 | struct pci_dev *pdev; | 3272 | struct pci_dev *pdev; |
3273 | 3273 | ||
3274 | if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self) | 3274 | if (pci_is_root_bus(dev->bus) || dev->subordinate || |
3275 | !dev->bus->self || dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) | ||
3275 | return -ENOTTY; | 3276 | return -ENOTTY; |
3276 | 3277 | ||
3277 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) | 3278 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) |
@@ -3305,7 +3306,8 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) | |||
3305 | { | 3306 | { |
3306 | struct pci_dev *pdev; | 3307 | struct pci_dev *pdev; |
3307 | 3308 | ||
3308 | if (dev->subordinate || !dev->slot) | 3309 | if (dev->subordinate || !dev->slot || |
3310 | dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) | ||
3309 | return -ENOTTY; | 3311 | return -ENOTTY; |
3310 | 3312 | ||
3311 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) | 3313 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) |
@@ -3557,6 +3559,20 @@ int pci_try_reset_function(struct pci_dev *dev) | |||
3557 | } | 3559 | } |
3558 | EXPORT_SYMBOL_GPL(pci_try_reset_function); | 3560 | EXPORT_SYMBOL_GPL(pci_try_reset_function); |
3559 | 3561 | ||
3562 | /* Do any devices on or below this bus prevent a bus reset? */ | ||
3563 | static bool pci_bus_resetable(struct pci_bus *bus) | ||
3564 | { | ||
3565 | struct pci_dev *dev; | ||
3566 | |||
3567 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
3568 | if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || | ||
3569 | (dev->subordinate && !pci_bus_resetable(dev->subordinate))) | ||
3570 | return false; | ||
3571 | } | ||
3572 | |||
3573 | return true; | ||
3574 | } | ||
3575 | |||
3560 | /* Lock devices from the top of the tree down */ | 3576 | /* Lock devices from the top of the tree down */ |
3561 | static void pci_bus_lock(struct pci_bus *bus) | 3577 | static void pci_bus_lock(struct pci_bus *bus) |
3562 | { | 3578 | { |
@@ -3607,6 +3623,22 @@ unlock: | |||
3607 | return 0; | 3623 | return 0; |
3608 | } | 3624 | } |
3609 | 3625 | ||
3626 | /* Do any devices on or below this slot prevent a bus reset? */ | ||
3627 | static bool pci_slot_resetable(struct pci_slot *slot) | ||
3628 | { | ||
3629 | struct pci_dev *dev; | ||
3630 | |||
3631 | list_for_each_entry(dev, &slot->bus->devices, bus_list) { | ||
3632 | if (!dev->slot || dev->slot != slot) | ||
3633 | continue; | ||
3634 | if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || | ||
3635 | (dev->subordinate && !pci_bus_resetable(dev->subordinate))) | ||
3636 | return false; | ||
3637 | } | ||
3638 | |||
3639 | return true; | ||
3640 | } | ||
3641 | |||
3610 | /* Lock devices from the top of the tree down */ | 3642 | /* Lock devices from the top of the tree down */ |
3611 | static void pci_slot_lock(struct pci_slot *slot) | 3643 | static void pci_slot_lock(struct pci_slot *slot) |
3612 | { | 3644 | { |
@@ -3728,7 +3760,7 @@ static int pci_slot_reset(struct pci_slot *slot, int probe) | |||
3728 | { | 3760 | { |
3729 | int rc; | 3761 | int rc; |
3730 | 3762 | ||
3731 | if (!slot) | 3763 | if (!slot || !pci_slot_resetable(slot)) |
3732 | return -ENOTTY; | 3764 | return -ENOTTY; |
3733 | 3765 | ||
3734 | if (!probe) | 3766 | if (!probe) |
@@ -3820,7 +3852,7 @@ EXPORT_SYMBOL_GPL(pci_try_reset_slot); | |||
3820 | 3852 | ||
3821 | static int pci_bus_reset(struct pci_bus *bus, int probe) | 3853 | static int pci_bus_reset(struct pci_bus *bus, int probe) |
3822 | { | 3854 | { |
3823 | if (!bus->self) | 3855 | if (!bus->self || !pci_bus_resetable(bus)) |
3824 | return -ENOTTY; | 3856 | return -ENOTTY; |
3825 | 3857 | ||
3826 | if (probe) | 3858 | if (probe) |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 8aff29a804ff..d54632a1db43 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -208,6 +208,7 @@ void __pci_bus_size_bridges(struct pci_bus *bus, | |||
208 | void __pci_bus_assign_resources(const struct pci_bus *bus, | 208 | void __pci_bus_assign_resources(const struct pci_bus *bus, |
209 | struct list_head *realloc_head, | 209 | struct list_head *realloc_head, |
210 | struct list_head *fail_head); | 210 | struct list_head *fail_head); |
211 | bool pci_bus_clip_resource(struct pci_dev *dev, int idx); | ||
211 | 212 | ||
212 | /** | 213 | /** |
213 | * pci_ari_enabled - query ARI forwarding status | 214 | * pci_ari_enabled - query ARI forwarding status |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index ed6f89b6efe5..e52356aa09b8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -3028,6 +3028,20 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x8169, | |||
3028 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, PCI_ANY_ID, | 3028 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, PCI_ANY_ID, |
3029 | quirk_broken_intx_masking); | 3029 | quirk_broken_intx_masking); |
3030 | 3030 | ||
3031 | static void quirk_no_bus_reset(struct pci_dev *dev) | ||
3032 | { | ||
3033 | dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; | ||
3034 | } | ||
3035 | |||
3036 | /* | ||
3037 | * Atheros AR93xx chips do not behave after a bus reset. The device will | ||
3038 | * throw a Link Down error on AER-capable systems and regardless of AER, | ||
3039 | * config space of the device is never accessible again and typically | ||
3040 | * causes the system to hang or reset when access is attempted. | ||
3041 | * http://www.spinics.net/lists/linux-pci/msg34797.html | ||
3042 | */ | ||
3043 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); | ||
3044 | |||
3031 | #ifdef CONFIG_ACPI | 3045 | #ifdef CONFIG_ACPI |
3032 | /* | 3046 | /* |
3033 | * Apple: Shutdown Cactus Ridge Thunderbolt controller. | 3047 | * Apple: Shutdown Cactus Ridge Thunderbolt controller. |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 0482235eee92..e3e17f3c0f0f 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -530,9 +530,8 @@ EXPORT_SYMBOL(pci_setup_cardbus); | |||
530 | config space writes, so it's quite possible that an I/O window of | 530 | config space writes, so it's quite possible that an I/O window of |
531 | the bridge will have some undesirable address (e.g. 0) after the | 531 | the bridge will have some undesirable address (e.g. 0) after the |
532 | first write. Ditto 64-bit prefetchable MMIO. */ | 532 | first write. Ditto 64-bit prefetchable MMIO. */ |
533 | static void pci_setup_bridge_io(struct pci_bus *bus) | 533 | static void pci_setup_bridge_io(struct pci_dev *bridge) |
534 | { | 534 | { |
535 | struct pci_dev *bridge = bus->self; | ||
536 | struct resource *res; | 535 | struct resource *res; |
537 | struct pci_bus_region region; | 536 | struct pci_bus_region region; |
538 | unsigned long io_mask; | 537 | unsigned long io_mask; |
@@ -545,7 +544,7 @@ static void pci_setup_bridge_io(struct pci_bus *bus) | |||
545 | io_mask = PCI_IO_1K_RANGE_MASK; | 544 | io_mask = PCI_IO_1K_RANGE_MASK; |
546 | 545 | ||
547 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | 546 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ |
548 | res = bus->resource[0]; | 547 | res = &bridge->resource[PCI_BRIDGE_RESOURCES + 0]; |
549 | pcibios_resource_to_bus(bridge->bus, ®ion, res); | 548 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
550 | if (res->flags & IORESOURCE_IO) { | 549 | if (res->flags & IORESOURCE_IO) { |
551 | pci_read_config_word(bridge, PCI_IO_BASE, &l); | 550 | pci_read_config_word(bridge, PCI_IO_BASE, &l); |
@@ -568,15 +567,14 @@ static void pci_setup_bridge_io(struct pci_bus *bus) | |||
568 | pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, io_upper16); | 567 | pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, io_upper16); |
569 | } | 568 | } |
570 | 569 | ||
571 | static void pci_setup_bridge_mmio(struct pci_bus *bus) | 570 | static void pci_setup_bridge_mmio(struct pci_dev *bridge) |
572 | { | 571 | { |
573 | struct pci_dev *bridge = bus->self; | ||
574 | struct resource *res; | 572 | struct resource *res; |
575 | struct pci_bus_region region; | 573 | struct pci_bus_region region; |
576 | u32 l; | 574 | u32 l; |
577 | 575 | ||
578 | /* Set up the top and bottom of the PCI Memory segment for this bus. */ | 576 | /* Set up the top and bottom of the PCI Memory segment for this bus. */ |
579 | res = bus->resource[1]; | 577 | res = &bridge->resource[PCI_BRIDGE_RESOURCES + 1]; |
580 | pcibios_resource_to_bus(bridge->bus, ®ion, res); | 578 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
581 | if (res->flags & IORESOURCE_MEM) { | 579 | if (res->flags & IORESOURCE_MEM) { |
582 | l = (region.start >> 16) & 0xfff0; | 580 | l = (region.start >> 16) & 0xfff0; |
@@ -588,9 +586,8 @@ static void pci_setup_bridge_mmio(struct pci_bus *bus) | |||
588 | pci_write_config_dword(bridge, PCI_MEMORY_BASE, l); | 586 | pci_write_config_dword(bridge, PCI_MEMORY_BASE, l); |
589 | } | 587 | } |
590 | 588 | ||
591 | static void pci_setup_bridge_mmio_pref(struct pci_bus *bus) | 589 | static void pci_setup_bridge_mmio_pref(struct pci_dev *bridge) |
592 | { | 590 | { |
593 | struct pci_dev *bridge = bus->self; | ||
594 | struct resource *res; | 591 | struct resource *res; |
595 | struct pci_bus_region region; | 592 | struct pci_bus_region region; |
596 | u32 l, bu, lu; | 593 | u32 l, bu, lu; |
@@ -602,7 +599,7 @@ static void pci_setup_bridge_mmio_pref(struct pci_bus *bus) | |||
602 | 599 | ||
603 | /* Set up PREF base/limit. */ | 600 | /* Set up PREF base/limit. */ |
604 | bu = lu = 0; | 601 | bu = lu = 0; |
605 | res = bus->resource[2]; | 602 | res = &bridge->resource[PCI_BRIDGE_RESOURCES + 2]; |
606 | pcibios_resource_to_bus(bridge->bus, ®ion, res); | 603 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
607 | if (res->flags & IORESOURCE_PREFETCH) { | 604 | if (res->flags & IORESOURCE_PREFETCH) { |
608 | l = (region.start >> 16) & 0xfff0; | 605 | l = (region.start >> 16) & 0xfff0; |
@@ -630,13 +627,13 @@ static void __pci_setup_bridge(struct pci_bus *bus, unsigned long type) | |||
630 | &bus->busn_res); | 627 | &bus->busn_res); |
631 | 628 | ||
632 | if (type & IORESOURCE_IO) | 629 | if (type & IORESOURCE_IO) |
633 | pci_setup_bridge_io(bus); | 630 | pci_setup_bridge_io(bridge); |
634 | 631 | ||
635 | if (type & IORESOURCE_MEM) | 632 | if (type & IORESOURCE_MEM) |
636 | pci_setup_bridge_mmio(bus); | 633 | pci_setup_bridge_mmio(bridge); |
637 | 634 | ||
638 | if (type & IORESOURCE_PREFETCH) | 635 | if (type & IORESOURCE_PREFETCH) |
639 | pci_setup_bridge_mmio_pref(bus); | 636 | pci_setup_bridge_mmio_pref(bridge); |
640 | 637 | ||
641 | pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl); | 638 | pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl); |
642 | } | 639 | } |
@@ -649,6 +646,41 @@ void pci_setup_bridge(struct pci_bus *bus) | |||
649 | __pci_setup_bridge(bus, type); | 646 | __pci_setup_bridge(bus, type); |
650 | } | 647 | } |
651 | 648 | ||
649 | |||
650 | int pci_claim_bridge_resource(struct pci_dev *bridge, int i) | ||
651 | { | ||
652 | if (i < PCI_BRIDGE_RESOURCES || i > PCI_BRIDGE_RESOURCE_END) | ||
653 | return 0; | ||
654 | |||
655 | if (pci_claim_resource(bridge, i) == 0) | ||
656 | return 0; /* claimed the window */ | ||
657 | |||
658 | if ((bridge->class >> 8) != PCI_CLASS_BRIDGE_PCI) | ||
659 | return 0; | ||
660 | |||
661 | if (!pci_bus_clip_resource(bridge, i)) | ||
662 | return -EINVAL; /* clipping didn't change anything */ | ||
663 | |||
664 | switch (i - PCI_BRIDGE_RESOURCES) { | ||
665 | case 0: | ||
666 | pci_setup_bridge_io(bridge); | ||
667 | break; | ||
668 | case 1: | ||
669 | pci_setup_bridge_mmio(bridge); | ||
670 | break; | ||
671 | case 2: | ||
672 | pci_setup_bridge_mmio_pref(bridge); | ||
673 | break; | ||
674 | default: | ||
675 | return -EINVAL; | ||
676 | } | ||
677 | |||
678 | if (pci_claim_resource(bridge, i) == 0) | ||
679 | return 0; /* claimed a smaller window */ | ||
680 | |||
681 | return -EINVAL; | ||
682 | } | ||
683 | |||
652 | /* Check whether the bridge supports optional I/O and | 684 | /* Check whether the bridge supports optional I/O and |
653 | prefetchable memory ranges. If not, the respective | 685 | prefetchable memory ranges. If not, the respective |
654 | base/limit registers must be read-only and read as 0. */ | 686 | base/limit registers must be read-only and read as 0. */ |
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c index e34da13885e8..27fa62ce6136 100644 --- a/drivers/phy/phy-miphy28lp.c +++ b/drivers/phy/phy-miphy28lp.c | |||
@@ -1050,7 +1050,8 @@ static int miphy28lp_init(struct phy *phy) | |||
1050 | ret = miphy28lp_init_usb3(miphy_phy); | 1050 | ret = miphy28lp_init_usb3(miphy_phy); |
1051 | break; | 1051 | break; |
1052 | default: | 1052 | default: |
1053 | return -EINVAL; | 1053 | ret = -EINVAL; |
1054 | break; | ||
1054 | } | 1055 | } |
1055 | 1056 | ||
1056 | mutex_unlock(&miphy_dev->miphy_mutex); | 1057 | mutex_unlock(&miphy_dev->miphy_mutex); |
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c index c96e8183a8ff..efe724f97e02 100644 --- a/drivers/phy/phy-omap-control.c +++ b/drivers/phy/phy-omap-control.c | |||
@@ -29,10 +29,9 @@ | |||
29 | /** | 29 | /** |
30 | * omap_control_pcie_pcs - set the PCS delay count | 30 | * omap_control_pcie_pcs - set the PCS delay count |
31 | * @dev: the control module device | 31 | * @dev: the control module device |
32 | * @id: index of the pcie PHY (should be 1 or 2) | ||
33 | * @delay: 8 bit delay value | 32 | * @delay: 8 bit delay value |
34 | */ | 33 | */ |
35 | void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay) | 34 | void omap_control_pcie_pcs(struct device *dev, u8 delay) |
36 | { | 35 | { |
37 | u32 val; | 36 | u32 val; |
38 | struct omap_control_phy *control_phy; | 37 | struct omap_control_phy *control_phy; |
@@ -55,8 +54,8 @@ void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay) | |||
55 | 54 | ||
56 | val = readl(control_phy->pcie_pcs); | 55 | val = readl(control_phy->pcie_pcs); |
57 | val &= ~(OMAP_CTRL_PCIE_PCS_MASK << | 56 | val &= ~(OMAP_CTRL_PCIE_PCS_MASK << |
58 | (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT)); | 57 | OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); |
59 | val |= delay << (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); | 58 | val |= (delay << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); |
60 | writel(val, control_phy->pcie_pcs); | 59 | writel(val, control_phy->pcie_pcs); |
61 | } | 60 | } |
62 | EXPORT_SYMBOL_GPL(omap_control_pcie_pcs); | 61 | EXPORT_SYMBOL_GPL(omap_control_pcie_pcs); |
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index fb02a67c9181..a2b08f3ccb03 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
@@ -244,7 +244,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) | |||
244 | else | 244 | else |
245 | data->num_phys = 3; | 245 | data->num_phys = 3; |
246 | 246 | ||
247 | if (of_device_is_compatible(np, "allwinner,sun4i-a10-usb-phy")) | 247 | if (of_device_is_compatible(np, "allwinner,sun4i-a10-usb-phy") || |
248 | of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy")) | ||
248 | data->disc_thresh = 3; | 249 | data->disc_thresh = 3; |
249 | else | 250 | else |
250 | data->disc_thresh = 2; | 251 | data->disc_thresh = 2; |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 1387b4d4afe3..465de2c800f2 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -82,7 +82,6 @@ struct ti_pipe3 { | |||
82 | struct clk *refclk; | 82 | struct clk *refclk; |
83 | struct clk *div_clk; | 83 | struct clk *div_clk; |
84 | struct pipe3_dpll_map *dpll_map; | 84 | struct pipe3_dpll_map *dpll_map; |
85 | u8 id; | ||
86 | }; | 85 | }; |
87 | 86 | ||
88 | static struct pipe3_dpll_map dpll_map_usb[] = { | 87 | static struct pipe3_dpll_map dpll_map_usb[] = { |
@@ -217,8 +216,13 @@ static int ti_pipe3_init(struct phy *x) | |||
217 | u32 val; | 216 | u32 val; |
218 | int ret = 0; | 217 | int ret = 0; |
219 | 218 | ||
219 | /* | ||
220 | * Set pcie_pcs register to 0x96 for proper functioning of phy | ||
221 | * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table | ||
222 | * 18-1804. | ||
223 | */ | ||
220 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { | 224 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { |
221 | omap_control_pcie_pcs(phy->control_dev, phy->id, 0xF1); | 225 | omap_control_pcie_pcs(phy->control_dev, 0x96); |
222 | return 0; | 226 | return 0; |
223 | } | 227 | } |
224 | 228 | ||
@@ -347,8 +351,6 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
347 | } | 351 | } |
348 | 352 | ||
349 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 353 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { |
350 | if (of_property_read_u8(node, "id", &phy->id) < 0) | ||
351 | phy->id = 1; | ||
352 | 354 | ||
353 | clk = devm_clk_get(phy->dev, "dpll_ref"); | 355 | clk = devm_clk_get(phy->dev, "dpll_ref"); |
354 | if (IS_ERR(clk)) { | 356 | if (IS_ERR(clk)) { |
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index e4f65510c87e..89dca77ca038 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -1801,14 +1801,15 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev) | |||
1801 | if (pctldev == NULL) | 1801 | if (pctldev == NULL) |
1802 | return; | 1802 | return; |
1803 | 1803 | ||
1804 | mutex_lock(&pinctrldev_list_mutex); | ||
1805 | mutex_lock(&pctldev->mutex); | 1804 | mutex_lock(&pctldev->mutex); |
1806 | |||
1807 | pinctrl_remove_device_debugfs(pctldev); | 1805 | pinctrl_remove_device_debugfs(pctldev); |
1806 | mutex_unlock(&pctldev->mutex); | ||
1808 | 1807 | ||
1809 | if (!IS_ERR(pctldev->p)) | 1808 | if (!IS_ERR(pctldev->p)) |
1810 | pinctrl_put(pctldev->p); | 1809 | pinctrl_put(pctldev->p); |
1811 | 1810 | ||
1811 | mutex_lock(&pinctrldev_list_mutex); | ||
1812 | mutex_lock(&pctldev->mutex); | ||
1812 | /* TODO: check that no pinmuxes are still active? */ | 1813 | /* TODO: check that no pinmuxes are still active? */ |
1813 | list_del(&pctldev->node); | 1814 | list_del(&pctldev->node); |
1814 | /* Destroy descriptor tree */ | 1815 | /* Destroy descriptor tree */ |
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 3c22dbebc80f..43eacc924b7e 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -1398,10 +1398,7 @@ static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
1398 | { | 1398 | { |
1399 | struct irq_chip *chip = irq_get_chip(irq); | 1399 | struct irq_chip *chip = irq_get_chip(irq); |
1400 | struct rockchip_pin_bank *bank = irq_get_handler_data(irq); | 1400 | struct rockchip_pin_bank *bank = irq_get_handler_data(irq); |
1401 | u32 polarity = 0, data = 0; | ||
1402 | u32 pend; | 1401 | u32 pend; |
1403 | bool edge_changed = false; | ||
1404 | unsigned long flags; | ||
1405 | 1402 | ||
1406 | dev_dbg(bank->drvdata->dev, "got irq for bank %s\n", bank->name); | 1403 | dev_dbg(bank->drvdata->dev, "got irq for bank %s\n", bank->name); |
1407 | 1404 | ||
@@ -1409,12 +1406,6 @@ static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
1409 | 1406 | ||
1410 | pend = readl_relaxed(bank->reg_base + GPIO_INT_STATUS); | 1407 | pend = readl_relaxed(bank->reg_base + GPIO_INT_STATUS); |
1411 | 1408 | ||
1412 | if (bank->toggle_edge_mode) { | ||
1413 | polarity = readl_relaxed(bank->reg_base + | ||
1414 | GPIO_INT_POLARITY); | ||
1415 | data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT); | ||
1416 | } | ||
1417 | |||
1418 | while (pend) { | 1409 | while (pend) { |
1419 | unsigned int virq; | 1410 | unsigned int virq; |
1420 | 1411 | ||
@@ -1434,27 +1425,31 @@ static void rockchip_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
1434 | * needs manual intervention. | 1425 | * needs manual intervention. |
1435 | */ | 1426 | */ |
1436 | if (bank->toggle_edge_mode & BIT(irq)) { | 1427 | if (bank->toggle_edge_mode & BIT(irq)) { |
1437 | if (data & BIT(irq)) | 1428 | u32 data, data_old, polarity; |
1438 | polarity &= ~BIT(irq); | 1429 | unsigned long flags; |
1439 | else | ||
1440 | polarity |= BIT(irq); | ||
1441 | 1430 | ||
1442 | edge_changed = true; | 1431 | data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT); |
1443 | } | 1432 | do { |
1433 | spin_lock_irqsave(&bank->slock, flags); | ||
1444 | 1434 | ||
1445 | generic_handle_irq(virq); | 1435 | polarity = readl_relaxed(bank->reg_base + |
1446 | } | 1436 | GPIO_INT_POLARITY); |
1437 | if (data & BIT(irq)) | ||
1438 | polarity &= ~BIT(irq); | ||
1439 | else | ||
1440 | polarity |= BIT(irq); | ||
1441 | writel(polarity, | ||
1442 | bank->reg_base + GPIO_INT_POLARITY); | ||
1447 | 1443 | ||
1448 | if (bank->toggle_edge_mode && edge_changed) { | 1444 | spin_unlock_irqrestore(&bank->slock, flags); |
1449 | /* Interrupt params should only be set with ints disabled */ | ||
1450 | spin_lock_irqsave(&bank->slock, flags); | ||
1451 | 1445 | ||
1452 | data = readl_relaxed(bank->reg_base + GPIO_INTEN); | 1446 | data_old = data; |
1453 | writel_relaxed(0, bank->reg_base + GPIO_INTEN); | 1447 | data = readl_relaxed(bank->reg_base + |
1454 | writel(polarity, bank->reg_base + GPIO_INT_POLARITY); | 1448 | GPIO_EXT_PORT); |
1455 | writel(data, bank->reg_base + GPIO_INTEN); | 1449 | } while ((data & BIT(irq)) != (data_old & BIT(irq))); |
1450 | } | ||
1456 | 1451 | ||
1457 | spin_unlock_irqrestore(&bank->slock, flags); | 1452 | generic_handle_irq(virq); |
1458 | } | 1453 | } |
1459 | 1454 | ||
1460 | chained_irq_exit(chip, desc); | 1455 | chained_irq_exit(chip, desc); |
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index c5cef59f5965..779950c62e53 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c | |||
@@ -798,10 +798,8 @@ static int pinmux_xway_probe(struct platform_device *pdev) | |||
798 | 798 | ||
799 | /* load the gpio chip */ | 799 | /* load the gpio chip */ |
800 | xway_chip.dev = &pdev->dev; | 800 | xway_chip.dev = &pdev->dev; |
801 | of_gpiochip_add(&xway_chip); | ||
802 | ret = gpiochip_add(&xway_chip); | 801 | ret = gpiochip_add(&xway_chip); |
803 | if (ret) { | 802 | if (ret) { |
804 | of_gpiochip_remove(&xway_chip); | ||
805 | dev_err(&pdev->dev, "Failed to register gpio chip\n"); | 803 | dev_err(&pdev->dev, "Failed to register gpio chip\n"); |
806 | return ret; | 804 | return ret; |
807 | } | 805 | } |
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index e730935fa457..ed7017df065d 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c | |||
@@ -865,10 +865,10 @@ static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action, | |||
865 | 865 | ||
866 | static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) | 866 | static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) |
867 | { | 867 | { |
868 | int i = 0; | 868 | int i; |
869 | const struct msm_function *func = pctrl->soc->functions; | 869 | const struct msm_function *func = pctrl->soc->functions; |
870 | 870 | ||
871 | for (; i <= pctrl->soc->nfunctions; i++) | 871 | for (i = 0; i < pctrl->soc->nfunctions; i++) |
872 | if (!strcmp(func[i].name, "ps_hold")) { | 872 | if (!strcmp(func[i].name, "ps_hold")) { |
873 | pctrl->restart_nb.notifier_call = msm_ps_hold_restart; | 873 | pctrl->restart_nb.notifier_call = msm_ps_hold_restart; |
874 | pctrl->restart_nb.priority = 128; | 874 | pctrl->restart_nb.priority = 128; |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 9411eae39a4e..3d21efe11d7b 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -2,11 +2,9 @@ | |||
2 | * Driver for Dell laptop extras | 2 | * Driver for Dell laptop extras |
3 | * | 3 | * |
4 | * Copyright (c) Red Hat <mjg@redhat.com> | 4 | * Copyright (c) Red Hat <mjg@redhat.com> |
5 | * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com> | ||
6 | * Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com> | ||
7 | * | 5 | * |
8 | * Based on documentation in the libsmbios package: | 6 | * Based on documentation in the libsmbios package, Copyright (C) 2005 Dell |
9 | * Copyright (C) 2005-2014 Dell Inc. | 7 | * Inc. |
10 | * | 8 | * |
11 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -34,13 +32,6 @@ | |||
34 | #include "../../firmware/dcdbas.h" | 32 | #include "../../firmware/dcdbas.h" |
35 | 33 | ||
36 | #define BRIGHTNESS_TOKEN 0x7d | 34 | #define BRIGHTNESS_TOKEN 0x7d |
37 | #define KBD_LED_OFF_TOKEN 0x01E1 | ||
38 | #define KBD_LED_ON_TOKEN 0x01E2 | ||
39 | #define KBD_LED_AUTO_TOKEN 0x01E3 | ||
40 | #define KBD_LED_AUTO_25_TOKEN 0x02EA | ||
41 | #define KBD_LED_AUTO_50_TOKEN 0x02EB | ||
42 | #define KBD_LED_AUTO_75_TOKEN 0x02EC | ||
43 | #define KBD_LED_AUTO_100_TOKEN 0x02F6 | ||
44 | 35 | ||
45 | /* This structure will be modified by the firmware when we enter | 36 | /* This structure will be modified by the firmware when we enter |
46 | * system management mode, hence the volatiles */ | 37 | * system management mode, hence the volatiles */ |
@@ -71,13 +62,6 @@ struct calling_interface_structure { | |||
71 | 62 | ||
72 | struct quirk_entry { | 63 | struct quirk_entry { |
73 | u8 touchpad_led; | 64 | u8 touchpad_led; |
74 | |||
75 | int needs_kbd_timeouts; | ||
76 | /* | ||
77 | * Ordered list of timeouts expressed in seconds. | ||
78 | * The list must end with -1 | ||
79 | */ | ||
80 | int kbd_timeouts[]; | ||
81 | }; | 65 | }; |
82 | 66 | ||
83 | static struct quirk_entry *quirks; | 67 | static struct quirk_entry *quirks; |
@@ -92,15 +76,6 @@ static int __init dmi_matched(const struct dmi_system_id *dmi) | |||
92 | return 1; | 76 | return 1; |
93 | } | 77 | } |
94 | 78 | ||
95 | /* | ||
96 | * These values come from Windows utility provided by Dell. If any other value | ||
97 | * is used then BIOS silently set timeout to 0 without any error message. | ||
98 | */ | ||
99 | static struct quirk_entry quirk_dell_xps13_9333 = { | ||
100 | .needs_kbd_timeouts = 1, | ||
101 | .kbd_timeouts = { 0, 5, 15, 60, 5 * 60, 15 * 60, -1 }, | ||
102 | }; | ||
103 | |||
104 | static int da_command_address; | 79 | static int da_command_address; |
105 | static int da_command_code; | 80 | static int da_command_code; |
106 | static int da_num_tokens; | 81 | static int da_num_tokens; |
@@ -292,15 +267,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = { | |||
292 | }, | 267 | }, |
293 | .driver_data = &quirk_dell_vostro_v130, | 268 | .driver_data = &quirk_dell_vostro_v130, |
294 | }, | 269 | }, |
295 | { | ||
296 | .callback = dmi_matched, | ||
297 | .ident = "Dell XPS13 9333", | ||
298 | .matches = { | ||
299 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
300 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS13 9333"), | ||
301 | }, | ||
302 | .driver_data = &quirk_dell_xps13_9333, | ||
303 | }, | ||
304 | { } | 270 | { } |
305 | }; | 271 | }; |
306 | 272 | ||
@@ -365,29 +331,17 @@ static void __init find_tokens(const struct dmi_header *dm, void *dummy) | |||
365 | } | 331 | } |
366 | } | 332 | } |
367 | 333 | ||
368 | static int find_token_id(int tokenid) | 334 | static int find_token_location(int tokenid) |
369 | { | 335 | { |
370 | int i; | 336 | int i; |
371 | |||
372 | for (i = 0; i < da_num_tokens; i++) { | 337 | for (i = 0; i < da_num_tokens; i++) { |
373 | if (da_tokens[i].tokenID == tokenid) | 338 | if (da_tokens[i].tokenID == tokenid) |
374 | return i; | 339 | return da_tokens[i].location; |
375 | } | 340 | } |
376 | 341 | ||
377 | return -1; | 342 | return -1; |
378 | } | 343 | } |
379 | 344 | ||
380 | static int find_token_location(int tokenid) | ||
381 | { | ||
382 | int id; | ||
383 | |||
384 | id = find_token_id(tokenid); | ||
385 | if (id == -1) | ||
386 | return -1; | ||
387 | |||
388 | return da_tokens[id].location; | ||
389 | } | ||
390 | |||
391 | static struct calling_interface_buffer * | 345 | static struct calling_interface_buffer * |
392 | dell_send_request(struct calling_interface_buffer *buffer, int class, | 346 | dell_send_request(struct calling_interface_buffer *buffer, int class, |
393 | int select) | 347 | int select) |
@@ -408,20 +362,6 @@ dell_send_request(struct calling_interface_buffer *buffer, int class, | |||
408 | return buffer; | 362 | return buffer; |
409 | } | 363 | } |
410 | 364 | ||
411 | static inline int dell_smi_error(int value) | ||
412 | { | ||
413 | switch (value) { | ||
414 | case 0: /* Completed successfully */ | ||
415 | return 0; | ||
416 | case -1: /* Completed with error */ | ||
417 | return -EIO; | ||
418 | case -2: /* Function not supported */ | ||
419 | return -ENXIO; | ||
420 | default: /* Unknown error */ | ||
421 | return -EINVAL; | ||
422 | } | ||
423 | } | ||
424 | |||
425 | /* Derived from information in DellWirelessCtl.cpp: | 365 | /* Derived from information in DellWirelessCtl.cpp: |
426 | Class 17, select 11 is radio control. It returns an array of 32-bit values. | 366 | Class 17, select 11 is radio control. It returns an array of 32-bit values. |
427 | 367 | ||
@@ -776,7 +716,7 @@ static int dell_send_intensity(struct backlight_device *bd) | |||
776 | else | 716 | else |
777 | dell_send_request(buffer, 1, 1); | 717 | dell_send_request(buffer, 1, 1); |
778 | 718 | ||
779 | out: | 719 | out: |
780 | release_buffer(); | 720 | release_buffer(); |
781 | return ret; | 721 | return ret; |
782 | } | 722 | } |
@@ -800,7 +740,7 @@ static int dell_get_intensity(struct backlight_device *bd) | |||
800 | 740 | ||
801 | ret = buffer->output[1]; | 741 | ret = buffer->output[1]; |
802 | 742 | ||
803 | out: | 743 | out: |
804 | release_buffer(); | 744 | release_buffer(); |
805 | return ret; | 745 | return ret; |
806 | } | 746 | } |
@@ -849,984 +789,6 @@ static void touchpad_led_exit(void) | |||
849 | led_classdev_unregister(&touchpad_led); | 789 | led_classdev_unregister(&touchpad_led); |
850 | } | 790 | } |
851 | 791 | ||
852 | /* | ||
853 | * Derived from information in smbios-keyboard-ctl: | ||
854 | * | ||
855 | * cbClass 4 | ||
856 | * cbSelect 11 | ||
857 | * Keyboard illumination | ||
858 | * cbArg1 determines the function to be performed | ||
859 | * | ||
860 | * cbArg1 0x0 = Get Feature Information | ||
861 | * cbRES1 Standard return codes (0, -1, -2) | ||
862 | * cbRES2, word0 Bitmap of user-selectable modes | ||
863 | * bit 0 Always off (All systems) | ||
864 | * bit 1 Always on (Travis ATG, Siberia) | ||
865 | * bit 2 Auto: ALS-based On; ALS-based Off (Travis ATG) | ||
866 | * bit 3 Auto: ALS- and input-activity-based On; input-activity based Off | ||
867 | * bit 4 Auto: Input-activity-based On; input-activity based Off | ||
868 | * bit 5 Auto: Input-activity-based On (illumination level 25%); input-activity based Off | ||
869 | * bit 6 Auto: Input-activity-based On (illumination level 50%); input-activity based Off | ||
870 | * bit 7 Auto: Input-activity-based On (illumination level 75%); input-activity based Off | ||
871 | * bit 8 Auto: Input-activity-based On (illumination level 100%); input-activity based Off | ||
872 | * bits 9-15 Reserved for future use | ||
873 | * cbRES2, byte2 Reserved for future use | ||
874 | * cbRES2, byte3 Keyboard illumination type | ||
875 | * 0 Reserved | ||
876 | * 1 Tasklight | ||
877 | * 2 Backlight | ||
878 | * 3-255 Reserved for future use | ||
879 | * cbRES3, byte0 Supported auto keyboard illumination trigger bitmap. | ||
880 | * bit 0 Any keystroke | ||
881 | * bit 1 Touchpad activity | ||
882 | * bit 2 Pointing stick | ||
883 | * bit 3 Any mouse | ||
884 | * bits 4-7 Reserved for future use | ||
885 | * cbRES3, byte1 Supported timeout unit bitmap | ||
886 | * bit 0 Seconds | ||
887 | * bit 1 Minutes | ||
888 | * bit 2 Hours | ||
889 | * bit 3 Days | ||
890 | * bits 4-7 Reserved for future use | ||
891 | * cbRES3, byte2 Number of keyboard light brightness levels | ||
892 | * cbRES4, byte0 Maximum acceptable seconds value (0 if seconds not supported). | ||
893 | * cbRES4, byte1 Maximum acceptable minutes value (0 if minutes not supported). | ||
894 | * cbRES4, byte2 Maximum acceptable hours value (0 if hours not supported). | ||
895 | * cbRES4, byte3 Maximum acceptable days value (0 if days not supported) | ||
896 | * | ||
897 | * cbArg1 0x1 = Get Current State | ||
898 | * cbRES1 Standard return codes (0, -1, -2) | ||
899 | * cbRES2, word0 Bitmap of current mode state | ||
900 | * bit 0 Always off (All systems) | ||
901 | * bit 1 Always on (Travis ATG, Siberia) | ||
902 | * bit 2 Auto: ALS-based On; ALS-based Off (Travis ATG) | ||
903 | * bit 3 Auto: ALS- and input-activity-based On; input-activity based Off | ||
904 | * bit 4 Auto: Input-activity-based On; input-activity based Off | ||
905 | * bit 5 Auto: Input-activity-based On (illumination level 25%); input-activity based Off | ||
906 | * bit 6 Auto: Input-activity-based On (illumination level 50%); input-activity based Off | ||
907 | * bit 7 Auto: Input-activity-based On (illumination level 75%); input-activity based Off | ||
908 | * bit 8 Auto: Input-activity-based On (illumination level 100%); input-activity based Off | ||
909 | * bits 9-15 Reserved for future use | ||
910 | * Note: Only One bit can be set | ||
911 | * cbRES2, byte2 Currently active auto keyboard illumination triggers. | ||
912 | * bit 0 Any keystroke | ||
913 | * bit 1 Touchpad activity | ||
914 | * bit 2 Pointing stick | ||
915 | * bit 3 Any mouse | ||
916 | * bits 4-7 Reserved for future use | ||
917 | * cbRES2, byte3 Current Timeout | ||
918 | * bits 7:6 Timeout units indicator: | ||
919 | * 00b Seconds | ||
920 | * 01b Minutes | ||
921 | * 10b Hours | ||
922 | * 11b Days | ||
923 | * bits 5:0 Timeout value (0-63) in sec/min/hr/day | ||
924 | * NOTE: A value of 0 means always on (no timeout) if any bits of RES3 byte | ||
925 | * are set upon return from the [Get feature information] call. | ||
926 | * cbRES3, byte0 Current setting of ALS value that turns the light on or off. | ||
927 | * cbRES3, byte1 Current ALS reading | ||
928 | * cbRES3, byte2 Current keyboard light level. | ||
929 | * | ||
930 | * cbArg1 0x2 = Set New State | ||
931 | * cbRES1 Standard return codes (0, -1, -2) | ||
932 | * cbArg2, word0 Bitmap of current mode state | ||
933 | * bit 0 Always off (All systems) | ||
934 | * bit 1 Always on (Travis ATG, Siberia) | ||
935 | * bit 2 Auto: ALS-based On; ALS-based Off (Travis ATG) | ||
936 | * bit 3 Auto: ALS- and input-activity-based On; input-activity based Off | ||
937 | * bit 4 Auto: Input-activity-based On; input-activity based Off | ||
938 | * bit 5 Auto: Input-activity-based On (illumination level 25%); input-activity based Off | ||
939 | * bit 6 Auto: Input-activity-based On (illumination level 50%); input-activity based Off | ||
940 | * bit 7 Auto: Input-activity-based On (illumination level 75%); input-activity based Off | ||
941 | * bit 8 Auto: Input-activity-based On (illumination level 100%); input-activity based Off | ||
942 | * bits 9-15 Reserved for future use | ||
943 | * Note: Only One bit can be set | ||
944 | * cbArg2, byte2 Desired auto keyboard illumination triggers. Must remain inactive to allow | ||
945 | * keyboard to turn off automatically. | ||
946 | * bit 0 Any keystroke | ||
947 | * bit 1 Touchpad activity | ||
948 | * bit 2 Pointing stick | ||
949 | * bit 3 Any mouse | ||
950 | * bits 4-7 Reserved for future use | ||
951 | * cbArg2, byte3 Desired Timeout | ||
952 | * bits 7:6 Timeout units indicator: | ||
953 | * 00b Seconds | ||
954 | * 01b Minutes | ||
955 | * 10b Hours | ||
956 | * 11b Days | ||
957 | * bits 5:0 Timeout value (0-63) in sec/min/hr/day | ||
958 | * cbArg3, byte0 Desired setting of ALS value that turns the light on or off. | ||
959 | * cbArg3, byte2 Desired keyboard light level. | ||
960 | */ | ||
961 | |||
962 | |||
963 | enum kbd_timeout_unit { | ||
964 | KBD_TIMEOUT_SECONDS = 0, | ||
965 | KBD_TIMEOUT_MINUTES, | ||
966 | KBD_TIMEOUT_HOURS, | ||
967 | KBD_TIMEOUT_DAYS, | ||
968 | }; | ||
969 | |||
970 | enum kbd_mode_bit { | ||
971 | KBD_MODE_BIT_OFF = 0, | ||
972 | KBD_MODE_BIT_ON, | ||
973 | KBD_MODE_BIT_ALS, | ||
974 | KBD_MODE_BIT_TRIGGER_ALS, | ||
975 | KBD_MODE_BIT_TRIGGER, | ||
976 | KBD_MODE_BIT_TRIGGER_25, | ||
977 | KBD_MODE_BIT_TRIGGER_50, | ||
978 | KBD_MODE_BIT_TRIGGER_75, | ||
979 | KBD_MODE_BIT_TRIGGER_100, | ||
980 | }; | ||
981 | |||
982 | #define kbd_is_als_mode_bit(bit) \ | ||
983 | ((bit) == KBD_MODE_BIT_ALS || (bit) == KBD_MODE_BIT_TRIGGER_ALS) | ||
984 | #define kbd_is_trigger_mode_bit(bit) \ | ||
985 | ((bit) >= KBD_MODE_BIT_TRIGGER_ALS && (bit) <= KBD_MODE_BIT_TRIGGER_100) | ||
986 | #define kbd_is_level_mode_bit(bit) \ | ||
987 | ((bit) >= KBD_MODE_BIT_TRIGGER_25 && (bit) <= KBD_MODE_BIT_TRIGGER_100) | ||
988 | |||
989 | struct kbd_info { | ||
990 | u16 modes; | ||
991 | u8 type; | ||
992 | u8 triggers; | ||
993 | u8 levels; | ||
994 | u8 seconds; | ||
995 | u8 minutes; | ||
996 | u8 hours; | ||
997 | u8 days; | ||
998 | }; | ||
999 | |||
1000 | struct kbd_state { | ||
1001 | u8 mode_bit; | ||
1002 | u8 triggers; | ||
1003 | u8 timeout_value; | ||
1004 | u8 timeout_unit; | ||
1005 | u8 als_setting; | ||
1006 | u8 als_value; | ||
1007 | u8 level; | ||
1008 | }; | ||
1009 | |||
1010 | static const int kbd_tokens[] = { | ||
1011 | KBD_LED_OFF_TOKEN, | ||
1012 | KBD_LED_AUTO_25_TOKEN, | ||
1013 | KBD_LED_AUTO_50_TOKEN, | ||
1014 | KBD_LED_AUTO_75_TOKEN, | ||
1015 | KBD_LED_AUTO_100_TOKEN, | ||
1016 | KBD_LED_ON_TOKEN, | ||
1017 | }; | ||
1018 | |||
1019 | static u16 kbd_token_bits; | ||
1020 | |||
1021 | static struct kbd_info kbd_info; | ||
1022 | static bool kbd_als_supported; | ||
1023 | static bool kbd_triggers_supported; | ||
1024 | |||
1025 | static u8 kbd_mode_levels[16]; | ||
1026 | static int kbd_mode_levels_count; | ||
1027 | |||
1028 | static u8 kbd_previous_level; | ||
1029 | static u8 kbd_previous_mode_bit; | ||
1030 | |||
1031 | static bool kbd_led_present; | ||
1032 | |||
1033 | /* | ||
1034 | * NOTE: there are three ways to set the keyboard backlight level. | ||
1035 | * First, via kbd_state.mode_bit (assigning KBD_MODE_BIT_TRIGGER_* value). | ||
1036 | * Second, via kbd_state.level (assigning numerical value <= kbd_info.levels). | ||
1037 | * Third, via SMBIOS tokens (KBD_LED_* in kbd_tokens) | ||
1038 | * | ||
1039 | * There are laptops which support only one of these methods. If we want to | ||
1040 | * support as many machines as possible we need to implement all three methods. | ||
1041 | * The first two methods use the kbd_state structure. The third uses SMBIOS | ||
1042 | * tokens. If kbd_info.levels == 0, the machine does not support setting the | ||
1043 | * keyboard backlight level via kbd_state.level. | ||
1044 | */ | ||
1045 | |||
1046 | static int kbd_get_info(struct kbd_info *info) | ||
1047 | { | ||
1048 | u8 units; | ||
1049 | int ret; | ||
1050 | |||
1051 | get_buffer(); | ||
1052 | |||
1053 | buffer->input[0] = 0x0; | ||
1054 | dell_send_request(buffer, 4, 11); | ||
1055 | ret = buffer->output[0]; | ||
1056 | |||
1057 | if (ret) { | ||
1058 | ret = dell_smi_error(ret); | ||
1059 | goto out; | ||
1060 | } | ||
1061 | |||
1062 | info->modes = buffer->output[1] & 0xFFFF; | ||
1063 | info->type = (buffer->output[1] >> 24) & 0xFF; | ||
1064 | info->triggers = buffer->output[2] & 0xFF; | ||
1065 | units = (buffer->output[2] >> 8) & 0xFF; | ||
1066 | info->levels = (buffer->output[2] >> 16) & 0xFF; | ||
1067 | |||
1068 | if (units & BIT(0)) | ||
1069 | info->seconds = (buffer->output[3] >> 0) & 0xFF; | ||
1070 | if (units & BIT(1)) | ||
1071 | info->minutes = (buffer->output[3] >> 8) & 0xFF; | ||
1072 | if (units & BIT(2)) | ||
1073 | info->hours = (buffer->output[3] >> 16) & 0xFF; | ||
1074 | if (units & BIT(3)) | ||
1075 | info->days = (buffer->output[3] >> 24) & 0xFF; | ||
1076 | |||
1077 | out: | ||
1078 | release_buffer(); | ||
1079 | return ret; | ||
1080 | } | ||
1081 | |||
1082 | static unsigned int kbd_get_max_level(void) | ||
1083 | { | ||
1084 | if (kbd_info.levels != 0) | ||
1085 | return kbd_info.levels; | ||
1086 | if (kbd_mode_levels_count > 0) | ||
1087 | return kbd_mode_levels_count - 1; | ||
1088 | return 0; | ||
1089 | } | ||
1090 | |||
1091 | static int kbd_get_level(struct kbd_state *state) | ||
1092 | { | ||
1093 | int i; | ||
1094 | |||
1095 | if (kbd_info.levels != 0) | ||
1096 | return state->level; | ||
1097 | |||
1098 | if (kbd_mode_levels_count > 0) { | ||
1099 | for (i = 0; i < kbd_mode_levels_count; ++i) | ||
1100 | if (kbd_mode_levels[i] == state->mode_bit) | ||
1101 | return i; | ||
1102 | return 0; | ||
1103 | } | ||
1104 | |||
1105 | return -EINVAL; | ||
1106 | } | ||
1107 | |||
1108 | static int kbd_set_level(struct kbd_state *state, u8 level) | ||
1109 | { | ||
1110 | if (kbd_info.levels != 0) { | ||
1111 | if (level != 0) | ||
1112 | kbd_previous_level = level; | ||
1113 | if (state->level == level) | ||
1114 | return 0; | ||
1115 | state->level = level; | ||
1116 | if (level != 0 && state->mode_bit == KBD_MODE_BIT_OFF) | ||
1117 | state->mode_bit = kbd_previous_mode_bit; | ||
1118 | else if (level == 0 && state->mode_bit != KBD_MODE_BIT_OFF) { | ||
1119 | kbd_previous_mode_bit = state->mode_bit; | ||
1120 | state->mode_bit = KBD_MODE_BIT_OFF; | ||
1121 | } | ||
1122 | return 0; | ||
1123 | } | ||
1124 | |||
1125 | if (kbd_mode_levels_count > 0 && level < kbd_mode_levels_count) { | ||
1126 | if (level != 0) | ||
1127 | kbd_previous_level = level; | ||
1128 | state->mode_bit = kbd_mode_levels[level]; | ||
1129 | return 0; | ||
1130 | } | ||
1131 | |||
1132 | return -EINVAL; | ||
1133 | } | ||
1134 | |||
1135 | static int kbd_get_state(struct kbd_state *state) | ||
1136 | { | ||
1137 | int ret; | ||
1138 | |||
1139 | get_buffer(); | ||
1140 | |||
1141 | buffer->input[0] = 0x1; | ||
1142 | dell_send_request(buffer, 4, 11); | ||
1143 | ret = buffer->output[0]; | ||
1144 | |||
1145 | if (ret) { | ||
1146 | ret = dell_smi_error(ret); | ||
1147 | goto out; | ||
1148 | } | ||
1149 | |||
1150 | state->mode_bit = ffs(buffer->output[1] & 0xFFFF); | ||
1151 | if (state->mode_bit != 0) | ||
1152 | state->mode_bit--; | ||
1153 | |||
1154 | state->triggers = (buffer->output[1] >> 16) & 0xFF; | ||
1155 | state->timeout_value = (buffer->output[1] >> 24) & 0x3F; | ||
1156 | state->timeout_unit = (buffer->output[1] >> 30) & 0x3; | ||
1157 | state->als_setting = buffer->output[2] & 0xFF; | ||
1158 | state->als_value = (buffer->output[2] >> 8) & 0xFF; | ||
1159 | state->level = (buffer->output[2] >> 16) & 0xFF; | ||
1160 | |||
1161 | out: | ||
1162 | release_buffer(); | ||
1163 | return ret; | ||
1164 | } | ||
1165 | |||
1166 | static int kbd_set_state(struct kbd_state *state) | ||
1167 | { | ||
1168 | int ret; | ||
1169 | |||
1170 | get_buffer(); | ||
1171 | buffer->input[0] = 0x2; | ||
1172 | buffer->input[1] = BIT(state->mode_bit) & 0xFFFF; | ||
1173 | buffer->input[1] |= (state->triggers & 0xFF) << 16; | ||
1174 | buffer->input[1] |= (state->timeout_value & 0x3F) << 24; | ||
1175 | buffer->input[1] |= (state->timeout_unit & 0x3) << 30; | ||
1176 | buffer->input[2] = state->als_setting & 0xFF; | ||
1177 | buffer->input[2] |= (state->level & 0xFF) << 16; | ||
1178 | dell_send_request(buffer, 4, 11); | ||
1179 | ret = buffer->output[0]; | ||
1180 | release_buffer(); | ||
1181 | |||
1182 | return dell_smi_error(ret); | ||
1183 | } | ||
1184 | |||
1185 | static int kbd_set_state_safe(struct kbd_state *state, struct kbd_state *old) | ||
1186 | { | ||
1187 | int ret; | ||
1188 | |||
1189 | ret = kbd_set_state(state); | ||
1190 | if (ret == 0) | ||
1191 | return 0; | ||
1192 | |||
1193 | /* | ||
1194 | * When setting the new state fails,try to restore the previous one. | ||
1195 | * This is needed on some machines where BIOS sets a default state when | ||
1196 | * setting a new state fails. This default state could be all off. | ||
1197 | */ | ||
1198 | |||
1199 | if (kbd_set_state(old)) | ||
1200 | pr_err("Setting old previous keyboard state failed\n"); | ||
1201 | |||
1202 | return ret; | ||
1203 | } | ||
1204 | |||
1205 | static int kbd_set_token_bit(u8 bit) | ||
1206 | { | ||
1207 | int id; | ||
1208 | int ret; | ||
1209 | |||
1210 | if (bit >= ARRAY_SIZE(kbd_tokens)) | ||
1211 | return -EINVAL; | ||
1212 | |||
1213 | id = find_token_id(kbd_tokens[bit]); | ||
1214 | if (id == -1) | ||
1215 | return -EINVAL; | ||
1216 | |||
1217 | get_buffer(); | ||
1218 | buffer->input[0] = da_tokens[id].location; | ||
1219 | buffer->input[1] = da_tokens[id].value; | ||
1220 | dell_send_request(buffer, 1, 0); | ||
1221 | ret = buffer->output[0]; | ||
1222 | release_buffer(); | ||
1223 | |||
1224 | return dell_smi_error(ret); | ||
1225 | } | ||
1226 | |||
1227 | static int kbd_get_token_bit(u8 bit) | ||
1228 | { | ||
1229 | int id; | ||
1230 | int ret; | ||
1231 | int val; | ||
1232 | |||
1233 | if (bit >= ARRAY_SIZE(kbd_tokens)) | ||
1234 | return -EINVAL; | ||
1235 | |||
1236 | id = find_token_id(kbd_tokens[bit]); | ||
1237 | if (id == -1) | ||
1238 | return -EINVAL; | ||
1239 | |||
1240 | get_buffer(); | ||
1241 | buffer->input[0] = da_tokens[id].location; | ||
1242 | dell_send_request(buffer, 0, 0); | ||
1243 | ret = buffer->output[0]; | ||
1244 | val = buffer->output[1]; | ||
1245 | release_buffer(); | ||
1246 | |||
1247 | if (ret) | ||
1248 | return dell_smi_error(ret); | ||
1249 | |||
1250 | return (val == da_tokens[id].value); | ||
1251 | } | ||
1252 | |||
1253 | static int kbd_get_first_active_token_bit(void) | ||
1254 | { | ||
1255 | int i; | ||
1256 | int ret; | ||
1257 | |||
1258 | for (i = 0; i < ARRAY_SIZE(kbd_tokens); ++i) { | ||
1259 | ret = kbd_get_token_bit(i); | ||
1260 | if (ret == 1) | ||
1261 | return i; | ||
1262 | } | ||
1263 | |||
1264 | return ret; | ||
1265 | } | ||
1266 | |||
1267 | static int kbd_get_valid_token_counts(void) | ||
1268 | { | ||
1269 | return hweight16(kbd_token_bits); | ||
1270 | } | ||
1271 | |||
1272 | static inline int kbd_init_info(void) | ||
1273 | { | ||
1274 | struct kbd_state state; | ||
1275 | int ret; | ||
1276 | int i; | ||
1277 | |||
1278 | ret = kbd_get_info(&kbd_info); | ||
1279 | if (ret) | ||
1280 | return ret; | ||
1281 | |||
1282 | kbd_get_state(&state); | ||
1283 | |||
1284 | /* NOTE: timeout value is stored in 6 bits so max value is 63 */ | ||
1285 | if (kbd_info.seconds > 63) | ||
1286 | kbd_info.seconds = 63; | ||
1287 | if (kbd_info.minutes > 63) | ||
1288 | kbd_info.minutes = 63; | ||
1289 | if (kbd_info.hours > 63) | ||
1290 | kbd_info.hours = 63; | ||
1291 | if (kbd_info.days > 63) | ||
1292 | kbd_info.days = 63; | ||
1293 | |||
1294 | /* NOTE: On tested machines ON mode did not work and caused | ||
1295 | * problems (turned backlight off) so do not use it | ||
1296 | */ | ||
1297 | kbd_info.modes &= ~BIT(KBD_MODE_BIT_ON); | ||
1298 | |||
1299 | kbd_previous_level = kbd_get_level(&state); | ||
1300 | kbd_previous_mode_bit = state.mode_bit; | ||
1301 | |||
1302 | if (kbd_previous_level == 0 && kbd_get_max_level() != 0) | ||
1303 | kbd_previous_level = 1; | ||
1304 | |||
1305 | if (kbd_previous_mode_bit == KBD_MODE_BIT_OFF) { | ||
1306 | kbd_previous_mode_bit = | ||
1307 | ffs(kbd_info.modes & ~BIT(KBD_MODE_BIT_OFF)); | ||
1308 | if (kbd_previous_mode_bit != 0) | ||
1309 | kbd_previous_mode_bit--; | ||
1310 | } | ||
1311 | |||
1312 | if (kbd_info.modes & (BIT(KBD_MODE_BIT_ALS) | | ||
1313 | BIT(KBD_MODE_BIT_TRIGGER_ALS))) | ||
1314 | kbd_als_supported = true; | ||
1315 | |||
1316 | if (kbd_info.modes & ( | ||
1317 | BIT(KBD_MODE_BIT_TRIGGER_ALS) | BIT(KBD_MODE_BIT_TRIGGER) | | ||
1318 | BIT(KBD_MODE_BIT_TRIGGER_25) | BIT(KBD_MODE_BIT_TRIGGER_50) | | ||
1319 | BIT(KBD_MODE_BIT_TRIGGER_75) | BIT(KBD_MODE_BIT_TRIGGER_100) | ||
1320 | )) | ||
1321 | kbd_triggers_supported = true; | ||
1322 | |||
1323 | /* kbd_mode_levels[0] is reserved, see below */ | ||
1324 | for (i = 0; i < 16; ++i) | ||
1325 | if (kbd_is_level_mode_bit(i) && (BIT(i) & kbd_info.modes)) | ||
1326 | kbd_mode_levels[1 + kbd_mode_levels_count++] = i; | ||
1327 | |||
1328 | /* | ||
1329 | * Find the first supported mode and assign to kbd_mode_levels[0]. | ||
1330 | * This should be 0 (off), but we cannot depend on the BIOS to | ||
1331 | * support 0. | ||
1332 | */ | ||
1333 | if (kbd_mode_levels_count > 0) { | ||
1334 | for (i = 0; i < 16; ++i) { | ||
1335 | if (BIT(i) & kbd_info.modes) { | ||
1336 | kbd_mode_levels[0] = i; | ||
1337 | break; | ||
1338 | } | ||
1339 | } | ||
1340 | kbd_mode_levels_count++; | ||
1341 | } | ||
1342 | |||
1343 | return 0; | ||
1344 | |||
1345 | } | ||
1346 | |||
1347 | static inline void kbd_init_tokens(void) | ||
1348 | { | ||
1349 | int i; | ||
1350 | |||
1351 | for (i = 0; i < ARRAY_SIZE(kbd_tokens); ++i) | ||
1352 | if (find_token_id(kbd_tokens[i]) != -1) | ||
1353 | kbd_token_bits |= BIT(i); | ||
1354 | } | ||
1355 | |||
1356 | static void kbd_init(void) | ||
1357 | { | ||
1358 | int ret; | ||
1359 | |||
1360 | ret = kbd_init_info(); | ||
1361 | kbd_init_tokens(); | ||
1362 | |||
1363 | if (kbd_token_bits != 0 || ret == 0) | ||
1364 | kbd_led_present = true; | ||
1365 | } | ||
1366 | |||
1367 | static ssize_t kbd_led_timeout_store(struct device *dev, | ||
1368 | struct device_attribute *attr, | ||
1369 | const char *buf, size_t count) | ||
1370 | { | ||
1371 | struct kbd_state new_state; | ||
1372 | struct kbd_state state; | ||
1373 | bool convert; | ||
1374 | int value; | ||
1375 | int ret; | ||
1376 | char ch; | ||
1377 | u8 unit; | ||
1378 | int i; | ||
1379 | |||
1380 | ret = sscanf(buf, "%d %c", &value, &ch); | ||
1381 | if (ret < 1) | ||
1382 | return -EINVAL; | ||
1383 | else if (ret == 1) | ||
1384 | ch = 's'; | ||
1385 | |||
1386 | if (value < 0) | ||
1387 | return -EINVAL; | ||
1388 | |||
1389 | convert = false; | ||
1390 | |||
1391 | switch (ch) { | ||
1392 | case 's': | ||
1393 | if (value > kbd_info.seconds) | ||
1394 | convert = true; | ||
1395 | unit = KBD_TIMEOUT_SECONDS; | ||
1396 | break; | ||
1397 | case 'm': | ||
1398 | if (value > kbd_info.minutes) | ||
1399 | convert = true; | ||
1400 | unit = KBD_TIMEOUT_MINUTES; | ||
1401 | break; | ||
1402 | case 'h': | ||
1403 | if (value > kbd_info.hours) | ||
1404 | convert = true; | ||
1405 | unit = KBD_TIMEOUT_HOURS; | ||
1406 | break; | ||
1407 | case 'd': | ||
1408 | if (value > kbd_info.days) | ||
1409 | convert = true; | ||
1410 | unit = KBD_TIMEOUT_DAYS; | ||
1411 | break; | ||
1412 | default: | ||
1413 | return -EINVAL; | ||
1414 | } | ||
1415 | |||
1416 | if (quirks && quirks->needs_kbd_timeouts) | ||
1417 | convert = true; | ||
1418 | |||
1419 | if (convert) { | ||
1420 | /* Convert value from current units to seconds */ | ||
1421 | switch (unit) { | ||
1422 | case KBD_TIMEOUT_DAYS: | ||
1423 | value *= 24; | ||
1424 | case KBD_TIMEOUT_HOURS: | ||
1425 | value *= 60; | ||
1426 | case KBD_TIMEOUT_MINUTES: | ||
1427 | value *= 60; | ||
1428 | unit = KBD_TIMEOUT_SECONDS; | ||
1429 | } | ||
1430 | |||
1431 | if (quirks && quirks->needs_kbd_timeouts) { | ||
1432 | for (i = 0; quirks->kbd_timeouts[i] != -1; i++) { | ||
1433 | if (value <= quirks->kbd_timeouts[i]) { | ||
1434 | value = quirks->kbd_timeouts[i]; | ||
1435 | break; | ||
1436 | } | ||
1437 | } | ||
1438 | } | ||
1439 | |||
1440 | if (value <= kbd_info.seconds && kbd_info.seconds) { | ||
1441 | unit = KBD_TIMEOUT_SECONDS; | ||
1442 | } else if (value / 60 <= kbd_info.minutes && kbd_info.minutes) { | ||
1443 | value /= 60; | ||
1444 | unit = KBD_TIMEOUT_MINUTES; | ||
1445 | } else if (value / (60 * 60) <= kbd_info.hours && kbd_info.hours) { | ||
1446 | value /= (60 * 60); | ||
1447 | unit = KBD_TIMEOUT_HOURS; | ||
1448 | } else if (value / (60 * 60 * 24) <= kbd_info.days && kbd_info.days) { | ||
1449 | value /= (60 * 60 * 24); | ||
1450 | unit = KBD_TIMEOUT_DAYS; | ||
1451 | } else { | ||
1452 | return -EINVAL; | ||
1453 | } | ||
1454 | } | ||
1455 | |||
1456 | ret = kbd_get_state(&state); | ||
1457 | if (ret) | ||
1458 | return ret; | ||
1459 | |||
1460 | new_state = state; | ||
1461 | new_state.timeout_value = value; | ||
1462 | new_state.timeout_unit = unit; | ||
1463 | |||
1464 | ret = kbd_set_state_safe(&new_state, &state); | ||
1465 | if (ret) | ||
1466 | return ret; | ||
1467 | |||
1468 | return count; | ||
1469 | } | ||
1470 | |||
1471 | static ssize_t kbd_led_timeout_show(struct device *dev, | ||
1472 | struct device_attribute *attr, char *buf) | ||
1473 | { | ||
1474 | struct kbd_state state; | ||
1475 | int ret; | ||
1476 | int len; | ||
1477 | |||
1478 | ret = kbd_get_state(&state); | ||
1479 | if (ret) | ||
1480 | return ret; | ||
1481 | |||
1482 | len = sprintf(buf, "%d", state.timeout_value); | ||
1483 | |||
1484 | switch (state.timeout_unit) { | ||
1485 | case KBD_TIMEOUT_SECONDS: | ||
1486 | return len + sprintf(buf+len, "s\n"); | ||
1487 | case KBD_TIMEOUT_MINUTES: | ||
1488 | return len + sprintf(buf+len, "m\n"); | ||
1489 | case KBD_TIMEOUT_HOURS: | ||
1490 | return len + sprintf(buf+len, "h\n"); | ||
1491 | case KBD_TIMEOUT_DAYS: | ||
1492 | return len + sprintf(buf+len, "d\n"); | ||
1493 | default: | ||
1494 | return -EINVAL; | ||
1495 | } | ||
1496 | |||
1497 | return len; | ||
1498 | } | ||
1499 | |||
1500 | static DEVICE_ATTR(stop_timeout, S_IRUGO | S_IWUSR, | ||
1501 | kbd_led_timeout_show, kbd_led_timeout_store); | ||
1502 | |||
1503 | static const char * const kbd_led_triggers[] = { | ||
1504 | "keyboard", | ||
1505 | "touchpad", | ||
1506 | /*"trackstick"*/ NULL, /* NOTE: trackstick is just alias for touchpad */ | ||
1507 | "mouse", | ||
1508 | }; | ||
1509 | |||
1510 | static ssize_t kbd_led_triggers_store(struct device *dev, | ||
1511 | struct device_attribute *attr, | ||
1512 | const char *buf, size_t count) | ||
1513 | { | ||
1514 | struct kbd_state new_state; | ||
1515 | struct kbd_state state; | ||
1516 | bool triggers_enabled = false; | ||
1517 | bool als_enabled = false; | ||
1518 | bool disable_als = false; | ||
1519 | bool enable_als = false; | ||
1520 | int trigger_bit = -1; | ||
1521 | char trigger[21]; | ||
1522 | int i, ret; | ||
1523 | |||
1524 | ret = sscanf(buf, "%20s", trigger); | ||
1525 | if (ret != 1) | ||
1526 | return -EINVAL; | ||
1527 | |||
1528 | if (trigger[0] != '+' && trigger[0] != '-') | ||
1529 | return -EINVAL; | ||
1530 | |||
1531 | ret = kbd_get_state(&state); | ||
1532 | if (ret) | ||
1533 | return ret; | ||
1534 | |||
1535 | if (kbd_als_supported) | ||
1536 | als_enabled = kbd_is_als_mode_bit(state.mode_bit); | ||
1537 | |||
1538 | if (kbd_triggers_supported) | ||
1539 | triggers_enabled = kbd_is_trigger_mode_bit(state.mode_bit); | ||
1540 | |||
1541 | if (kbd_als_supported) { | ||
1542 | if (strcmp(trigger, "+als") == 0) { | ||
1543 | if (als_enabled) | ||
1544 | return count; | ||
1545 | enable_als = true; | ||
1546 | } else if (strcmp(trigger, "-als") == 0) { | ||
1547 | if (!als_enabled) | ||
1548 | return count; | ||
1549 | disable_als = true; | ||
1550 | } | ||
1551 | } | ||
1552 | |||
1553 | if (enable_als || disable_als) { | ||
1554 | new_state = state; | ||
1555 | if (enable_als) { | ||
1556 | if (triggers_enabled) | ||
1557 | new_state.mode_bit = KBD_MODE_BIT_TRIGGER_ALS; | ||
1558 | else | ||
1559 | new_state.mode_bit = KBD_MODE_BIT_ALS; | ||
1560 | } else { | ||
1561 | if (triggers_enabled) { | ||
1562 | new_state.mode_bit = KBD_MODE_BIT_TRIGGER; | ||
1563 | kbd_set_level(&new_state, kbd_previous_level); | ||
1564 | } else { | ||
1565 | new_state.mode_bit = KBD_MODE_BIT_ON; | ||
1566 | } | ||
1567 | } | ||
1568 | if (!(kbd_info.modes & BIT(new_state.mode_bit))) | ||
1569 | return -EINVAL; | ||
1570 | ret = kbd_set_state_safe(&new_state, &state); | ||
1571 | if (ret) | ||
1572 | return ret; | ||
1573 | kbd_previous_mode_bit = new_state.mode_bit; | ||
1574 | return count; | ||
1575 | } | ||
1576 | |||
1577 | if (kbd_triggers_supported) { | ||
1578 | for (i = 0; i < ARRAY_SIZE(kbd_led_triggers); ++i) { | ||
1579 | if (!(kbd_info.triggers & BIT(i))) | ||
1580 | continue; | ||
1581 | if (!kbd_led_triggers[i]) | ||
1582 | continue; | ||
1583 | if (strcmp(trigger+1, kbd_led_triggers[i]) != 0) | ||
1584 | continue; | ||
1585 | if (trigger[0] == '+' && | ||
1586 | triggers_enabled && (state.triggers & BIT(i))) | ||
1587 | return count; | ||
1588 | if (trigger[0] == '-' && | ||
1589 | (!triggers_enabled || !(state.triggers & BIT(i)))) | ||
1590 | return count; | ||
1591 | trigger_bit = i; | ||
1592 | break; | ||
1593 | } | ||
1594 | } | ||
1595 | |||
1596 | if (trigger_bit != -1) { | ||
1597 | new_state = state; | ||
1598 | if (trigger[0] == '+') | ||
1599 | new_state.triggers |= BIT(trigger_bit); | ||
1600 | else { | ||
1601 | new_state.triggers &= ~BIT(trigger_bit); | ||
1602 | /* NOTE: trackstick bit (2) must be disabled when | ||
1603 | * disabling touchpad bit (1), otherwise touchpad | ||
1604 | * bit (1) will not be disabled */ | ||
1605 | if (trigger_bit == 1) | ||
1606 | new_state.triggers &= ~BIT(2); | ||
1607 | } | ||
1608 | if ((kbd_info.triggers & new_state.triggers) != | ||
1609 | new_state.triggers) | ||
1610 | return -EINVAL; | ||
1611 | if (new_state.triggers && !triggers_enabled) { | ||
1612 | if (als_enabled) | ||
1613 | new_state.mode_bit = KBD_MODE_BIT_TRIGGER_ALS; | ||
1614 | else { | ||
1615 | new_state.mode_bit = KBD_MODE_BIT_TRIGGER; | ||
1616 | kbd_set_level(&new_state, kbd_previous_level); | ||
1617 | } | ||
1618 | } else if (new_state.triggers == 0) { | ||
1619 | if (als_enabled) | ||
1620 | new_state.mode_bit = KBD_MODE_BIT_ALS; | ||
1621 | else | ||
1622 | kbd_set_level(&new_state, 0); | ||
1623 | } | ||
1624 | if (!(kbd_info.modes & BIT(new_state.mode_bit))) | ||
1625 | return -EINVAL; | ||
1626 | ret = kbd_set_state_safe(&new_state, &state); | ||
1627 | if (ret) | ||
1628 | return ret; | ||
1629 | if (new_state.mode_bit != KBD_MODE_BIT_OFF) | ||
1630 | kbd_previous_mode_bit = new_state.mode_bit; | ||
1631 | return count; | ||
1632 | } | ||
1633 | |||
1634 | return -EINVAL; | ||
1635 | } | ||
1636 | |||
1637 | static ssize_t kbd_led_triggers_show(struct device *dev, | ||
1638 | struct device_attribute *attr, char *buf) | ||
1639 | { | ||
1640 | struct kbd_state state; | ||
1641 | bool triggers_enabled; | ||
1642 | int level, i, ret; | ||
1643 | int len = 0; | ||
1644 | |||
1645 | ret = kbd_get_state(&state); | ||
1646 | if (ret) | ||
1647 | return ret; | ||
1648 | |||
1649 | len = 0; | ||
1650 | |||
1651 | if (kbd_triggers_supported) { | ||
1652 | triggers_enabled = kbd_is_trigger_mode_bit(state.mode_bit); | ||
1653 | level = kbd_get_level(&state); | ||
1654 | for (i = 0; i < ARRAY_SIZE(kbd_led_triggers); ++i) { | ||
1655 | if (!(kbd_info.triggers & BIT(i))) | ||
1656 | continue; | ||
1657 | if (!kbd_led_triggers[i]) | ||
1658 | continue; | ||
1659 | if ((triggers_enabled || level <= 0) && | ||
1660 | (state.triggers & BIT(i))) | ||
1661 | buf[len++] = '+'; | ||
1662 | else | ||
1663 | buf[len++] = '-'; | ||
1664 | len += sprintf(buf+len, "%s ", kbd_led_triggers[i]); | ||
1665 | } | ||
1666 | } | ||
1667 | |||
1668 | if (kbd_als_supported) { | ||
1669 | if (kbd_is_als_mode_bit(state.mode_bit)) | ||
1670 | len += sprintf(buf+len, "+als "); | ||
1671 | else | ||
1672 | len += sprintf(buf+len, "-als "); | ||
1673 | } | ||
1674 | |||
1675 | if (len) | ||
1676 | buf[len - 1] = '\n'; | ||
1677 | |||
1678 | return len; | ||
1679 | } | ||
1680 | |||
1681 | static DEVICE_ATTR(start_triggers, S_IRUGO | S_IWUSR, | ||
1682 | kbd_led_triggers_show, kbd_led_triggers_store); | ||
1683 | |||
1684 | static ssize_t kbd_led_als_store(struct device *dev, | ||
1685 | struct device_attribute *attr, | ||
1686 | const char *buf, size_t count) | ||
1687 | { | ||
1688 | struct kbd_state state; | ||
1689 | struct kbd_state new_state; | ||
1690 | u8 setting; | ||
1691 | int ret; | ||
1692 | |||
1693 | ret = kstrtou8(buf, 10, &setting); | ||
1694 | if (ret) | ||
1695 | return ret; | ||
1696 | |||
1697 | ret = kbd_get_state(&state); | ||
1698 | if (ret) | ||
1699 | return ret; | ||
1700 | |||
1701 | new_state = state; | ||
1702 | new_state.als_setting = setting; | ||
1703 | |||
1704 | ret = kbd_set_state_safe(&new_state, &state); | ||
1705 | if (ret) | ||
1706 | return ret; | ||
1707 | |||
1708 | return count; | ||
1709 | } | ||
1710 | |||
1711 | static ssize_t kbd_led_als_show(struct device *dev, | ||
1712 | struct device_attribute *attr, char *buf) | ||
1713 | { | ||
1714 | struct kbd_state state; | ||
1715 | int ret; | ||
1716 | |||
1717 | ret = kbd_get_state(&state); | ||
1718 | if (ret) | ||
1719 | return ret; | ||
1720 | |||
1721 | return sprintf(buf, "%d\n", state.als_setting); | ||
1722 | } | ||
1723 | |||
1724 | static DEVICE_ATTR(als_setting, S_IRUGO | S_IWUSR, | ||
1725 | kbd_led_als_show, kbd_led_als_store); | ||
1726 | |||
1727 | static struct attribute *kbd_led_attrs[] = { | ||
1728 | &dev_attr_stop_timeout.attr, | ||
1729 | &dev_attr_start_triggers.attr, | ||
1730 | &dev_attr_als_setting.attr, | ||
1731 | NULL, | ||
1732 | }; | ||
1733 | ATTRIBUTE_GROUPS(kbd_led); | ||
1734 | |||
1735 | static enum led_brightness kbd_led_level_get(struct led_classdev *led_cdev) | ||
1736 | { | ||
1737 | int ret; | ||
1738 | u16 num; | ||
1739 | struct kbd_state state; | ||
1740 | |||
1741 | if (kbd_get_max_level()) { | ||
1742 | ret = kbd_get_state(&state); | ||
1743 | if (ret) | ||
1744 | return 0; | ||
1745 | ret = kbd_get_level(&state); | ||
1746 | if (ret < 0) | ||
1747 | return 0; | ||
1748 | return ret; | ||
1749 | } | ||
1750 | |||
1751 | if (kbd_get_valid_token_counts()) { | ||
1752 | ret = kbd_get_first_active_token_bit(); | ||
1753 | if (ret < 0) | ||
1754 | return 0; | ||
1755 | for (num = kbd_token_bits; num != 0 && ret > 0; --ret) | ||
1756 | num &= num - 1; /* clear the first bit set */ | ||
1757 | if (num == 0) | ||
1758 | return 0; | ||
1759 | return ffs(num) - 1; | ||
1760 | } | ||
1761 | |||
1762 | pr_warn("Keyboard brightness level control not supported\n"); | ||
1763 | return 0; | ||
1764 | } | ||
1765 | |||
1766 | static void kbd_led_level_set(struct led_classdev *led_cdev, | ||
1767 | enum led_brightness value) | ||
1768 | { | ||
1769 | struct kbd_state state; | ||
1770 | struct kbd_state new_state; | ||
1771 | u16 num; | ||
1772 | |||
1773 | if (kbd_get_max_level()) { | ||
1774 | if (kbd_get_state(&state)) | ||
1775 | return; | ||
1776 | new_state = state; | ||
1777 | if (kbd_set_level(&new_state, value)) | ||
1778 | return; | ||
1779 | kbd_set_state_safe(&new_state, &state); | ||
1780 | return; | ||
1781 | } | ||
1782 | |||
1783 | if (kbd_get_valid_token_counts()) { | ||
1784 | for (num = kbd_token_bits; num != 0 && value > 0; --value) | ||
1785 | num &= num - 1; /* clear the first bit set */ | ||
1786 | if (num == 0) | ||
1787 | return; | ||
1788 | kbd_set_token_bit(ffs(num) - 1); | ||
1789 | return; | ||
1790 | } | ||
1791 | |||
1792 | pr_warn("Keyboard brightness level control not supported\n"); | ||
1793 | } | ||
1794 | |||
1795 | static struct led_classdev kbd_led = { | ||
1796 | .name = "dell::kbd_backlight", | ||
1797 | .brightness_set = kbd_led_level_set, | ||
1798 | .brightness_get = kbd_led_level_get, | ||
1799 | .groups = kbd_led_groups, | ||
1800 | }; | ||
1801 | |||
1802 | static int __init kbd_led_init(struct device *dev) | ||
1803 | { | ||
1804 | kbd_init(); | ||
1805 | if (!kbd_led_present) | ||
1806 | return -ENODEV; | ||
1807 | kbd_led.max_brightness = kbd_get_max_level(); | ||
1808 | if (!kbd_led.max_brightness) { | ||
1809 | kbd_led.max_brightness = kbd_get_valid_token_counts(); | ||
1810 | if (kbd_led.max_brightness) | ||
1811 | kbd_led.max_brightness--; | ||
1812 | } | ||
1813 | return led_classdev_register(dev, &kbd_led); | ||
1814 | } | ||
1815 | |||
1816 | static void brightness_set_exit(struct led_classdev *led_cdev, | ||
1817 | enum led_brightness value) | ||
1818 | { | ||
1819 | /* Don't change backlight level on exit */ | ||
1820 | }; | ||
1821 | |||
1822 | static void kbd_led_exit(void) | ||
1823 | { | ||
1824 | if (!kbd_led_present) | ||
1825 | return; | ||
1826 | kbd_led.brightness_set = brightness_set_exit; | ||
1827 | led_classdev_unregister(&kbd_led); | ||
1828 | } | ||
1829 | |||
1830 | static int __init dell_init(void) | 792 | static int __init dell_init(void) |
1831 | { | 793 | { |
1832 | int max_intensity = 0; | 794 | int max_intensity = 0; |
@@ -1879,8 +841,6 @@ static int __init dell_init(void) | |||
1879 | if (quirks && quirks->touchpad_led) | 841 | if (quirks && quirks->touchpad_led) |
1880 | touchpad_led_init(&platform_device->dev); | 842 | touchpad_led_init(&platform_device->dev); |
1881 | 843 | ||
1882 | kbd_led_init(&platform_device->dev); | ||
1883 | |||
1884 | dell_laptop_dir = debugfs_create_dir("dell_laptop", NULL); | 844 | dell_laptop_dir = debugfs_create_dir("dell_laptop", NULL); |
1885 | if (dell_laptop_dir != NULL) | 845 | if (dell_laptop_dir != NULL) |
1886 | debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL, | 846 | debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL, |
@@ -1948,7 +908,6 @@ static void __exit dell_exit(void) | |||
1948 | debugfs_remove_recursive(dell_laptop_dir); | 908 | debugfs_remove_recursive(dell_laptop_dir); |
1949 | if (quirks && quirks->touchpad_led) | 909 | if (quirks && quirks->touchpad_led) |
1950 | touchpad_led_exit(); | 910 | touchpad_led_exit(); |
1951 | kbd_led_exit(); | ||
1952 | i8042_remove_filter(dell_laptop_i8042_filter); | 911 | i8042_remove_filter(dell_laptop_i8042_filter); |
1953 | cancel_delayed_work_sync(&dell_rfkill_work); | 912 | cancel_delayed_work_sync(&dell_rfkill_work); |
1954 | backlight_device_unregister(dell_backlight_device); | 913 | backlight_device_unregister(dell_backlight_device); |
@@ -1965,7 +924,5 @@ module_init(dell_init); | |||
1965 | module_exit(dell_exit); | 924 | module_exit(dell_exit); |
1966 | 925 | ||
1967 | MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); | 926 | MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); |
1968 | MODULE_AUTHOR("Gabriele Mazzotta <gabriele.mzt@gmail.com>"); | ||
1969 | MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); | ||
1970 | MODULE_DESCRIPTION("Dell laptop driver"); | 927 | MODULE_DESCRIPTION("Dell laptop driver"); |
1971 | MODULE_LICENSE("GPL"); | 928 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e225711bb8bc..9c48fb32f660 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1488,7 +1488,7 @@ struct regulator *regulator_get_optional(struct device *dev, const char *id) | |||
1488 | } | 1488 | } |
1489 | EXPORT_SYMBOL_GPL(regulator_get_optional); | 1489 | EXPORT_SYMBOL_GPL(regulator_get_optional); |
1490 | 1490 | ||
1491 | /* Locks held by regulator_put() */ | 1491 | /* regulator_list_mutex lock held by regulator_put() */ |
1492 | static void _regulator_put(struct regulator *regulator) | 1492 | static void _regulator_put(struct regulator *regulator) |
1493 | { | 1493 | { |
1494 | struct regulator_dev *rdev; | 1494 | struct regulator_dev *rdev; |
@@ -1503,12 +1503,14 @@ static void _regulator_put(struct regulator *regulator) | |||
1503 | /* remove any sysfs entries */ | 1503 | /* remove any sysfs entries */ |
1504 | if (regulator->dev) | 1504 | if (regulator->dev) |
1505 | sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); | 1505 | sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); |
1506 | mutex_lock(&rdev->mutex); | ||
1506 | kfree(regulator->supply_name); | 1507 | kfree(regulator->supply_name); |
1507 | list_del(®ulator->list); | 1508 | list_del(®ulator->list); |
1508 | kfree(regulator); | 1509 | kfree(regulator); |
1509 | 1510 | ||
1510 | rdev->open_count--; | 1511 | rdev->open_count--; |
1511 | rdev->exclusive = 0; | 1512 | rdev->exclusive = 0; |
1513 | mutex_unlock(&rdev->mutex); | ||
1512 | 1514 | ||
1513 | module_put(rdev->owner); | 1515 | module_put(rdev->owner); |
1514 | } | 1516 | } |
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 2809ae0d6bcd..ff828117798f 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
@@ -405,6 +405,40 @@ static struct regulator_ops s2mps14_reg_ops; | |||
405 | .enable_mask = S2MPS14_ENABLE_MASK \ | 405 | .enable_mask = S2MPS14_ENABLE_MASK \ |
406 | } | 406 | } |
407 | 407 | ||
408 | #define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \ | ||
409 | .name = "BUCK"#num, \ | ||
410 | .id = S2MPS13_BUCK##num, \ | ||
411 | .ops = &s2mps14_reg_ops, \ | ||
412 | .type = REGULATOR_VOLTAGE, \ | ||
413 | .owner = THIS_MODULE, \ | ||
414 | .min_uV = min, \ | ||
415 | .uV_step = step, \ | ||
416 | .linear_min_sel = min_sel, \ | ||
417 | .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \ | ||
418 | .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \ | ||
419 | .vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \ | ||
420 | .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \ | ||
421 | .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \ | ||
422 | .enable_mask = S2MPS14_ENABLE_MASK \ | ||
423 | } | ||
424 | |||
425 | #define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \ | ||
426 | .name = "BUCK"#num, \ | ||
427 | .id = S2MPS13_BUCK##num, \ | ||
428 | .ops = &s2mps14_reg_ops, \ | ||
429 | .type = REGULATOR_VOLTAGE, \ | ||
430 | .owner = THIS_MODULE, \ | ||
431 | .min_uV = min, \ | ||
432 | .uV_step = step, \ | ||
433 | .linear_min_sel = min_sel, \ | ||
434 | .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \ | ||
435 | .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \ | ||
436 | .vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \ | ||
437 | .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \ | ||
438 | .enable_reg = S2MPS13_REG_B1CTRL + (num) * 2 - 1, \ | ||
439 | .enable_mask = S2MPS14_ENABLE_MASK \ | ||
440 | } | ||
441 | |||
408 | static const struct regulator_desc s2mps13_regulators[] = { | 442 | static const struct regulator_desc s2mps13_regulators[] = { |
409 | regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00), | 443 | regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00), |
410 | regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C), | 444 | regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C), |
@@ -452,10 +486,10 @@ static const struct regulator_desc s2mps13_regulators[] = { | |||
452 | regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10), | 486 | regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10), |
453 | regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10), | 487 | regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10), |
454 | regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10), | 488 | regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10), |
455 | regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10), | 489 | regulator_desc_s2mps13_buck7(7, MIN_500_MV, STEP_6_25_MV, 0x10), |
456 | regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20), | 490 | regulator_desc_s2mps13_buck8_10(8, MIN_1000_MV, STEP_12_5_MV, 0x20), |
457 | regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20), | 491 | regulator_desc_s2mps13_buck8_10(9, MIN_1000_MV, STEP_12_5_MV, 0x20), |
458 | regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10), | 492 | regulator_desc_s2mps13_buck8_10(10, MIN_500_MV, STEP_6_25_MV, 0x10), |
459 | }; | 493 | }; |
460 | 494 | ||
461 | static int s2mps14_regulator_enable(struct regulator_dev *rdev) | 495 | static int s2mps14_regulator_enable(struct regulator_dev *rdev) |
diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c index eebc52cb6984..3d95c87160b3 100644 --- a/drivers/reset/reset-sunxi.c +++ b/drivers/reset/reset-sunxi.c | |||
@@ -102,6 +102,8 @@ static int sunxi_reset_init(struct device_node *np) | |||
102 | goto err_alloc; | 102 | goto err_alloc; |
103 | } | 103 | } |
104 | 104 | ||
105 | spin_lock_init(&data->lock); | ||
106 | |||
105 | data->rcdev.owner = THIS_MODULE; | 107 | data->rcdev.owner = THIS_MODULE; |
106 | data->rcdev.nr_resets = size * 32; | 108 | data->rcdev.nr_resets = size * 32; |
107 | data->rcdev.ops = &sunxi_reset_ops; | 109 | data->rcdev.ops = &sunxi_reset_ops; |
@@ -157,6 +159,8 @@ static int sunxi_reset_probe(struct platform_device *pdev) | |||
157 | if (IS_ERR(data->membase)) | 159 | if (IS_ERR(data->membase)) |
158 | return PTR_ERR(data->membase); | 160 | return PTR_ERR(data->membase); |
159 | 161 | ||
162 | spin_lock_init(&data->lock); | ||
163 | |||
160 | data->rcdev.owner = THIS_MODULE; | 164 | data->rcdev.owner = THIS_MODULE; |
161 | data->rcdev.nr_resets = resource_size(res) * 32; | 165 | data->rcdev.nr_resets = resource_size(res) * 32; |
162 | data->rcdev.ops = &sunxi_reset_ops; | 166 | data->rcdev.ops = &sunxi_reset_ops; |
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index b5e7c4670205..89ac1d5083c6 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c | |||
@@ -832,6 +832,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume); | |||
832 | static const struct platform_device_id s5m_rtc_id[] = { | 832 | static const struct platform_device_id s5m_rtc_id[] = { |
833 | { "s5m-rtc", S5M8767X }, | 833 | { "s5m-rtc", S5M8767X }, |
834 | { "s2mps14-rtc", S2MPS14X }, | 834 | { "s2mps14-rtc", S2MPS14X }, |
835 | { }, | ||
835 | }; | 836 | }; |
836 | 837 | ||
837 | static struct platform_driver s5m_rtc_driver = { | 838 | static struct platform_driver s5m_rtc_driver = { |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index f407e3763432..642c77c76b84 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1784,6 +1784,8 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel, | |||
1784 | QETH_DBF_TEXT(SETUP, 2, "idxanswr"); | 1784 | QETH_DBF_TEXT(SETUP, 2, "idxanswr"); |
1785 | card = CARD_FROM_CDEV(channel->ccwdev); | 1785 | card = CARD_FROM_CDEV(channel->ccwdev); |
1786 | iob = qeth_get_buffer(channel); | 1786 | iob = qeth_get_buffer(channel); |
1787 | if (!iob) | ||
1788 | return -ENOMEM; | ||
1787 | iob->callback = idx_reply_cb; | 1789 | iob->callback = idx_reply_cb; |
1788 | memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1)); | 1790 | memcpy(&channel->ccw, READ_CCW, sizeof(struct ccw1)); |
1789 | channel->ccw.count = QETH_BUFSIZE; | 1791 | channel->ccw.count = QETH_BUFSIZE; |
@@ -1834,6 +1836,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel, | |||
1834 | QETH_DBF_TEXT(SETUP, 2, "idxactch"); | 1836 | QETH_DBF_TEXT(SETUP, 2, "idxactch"); |
1835 | 1837 | ||
1836 | iob = qeth_get_buffer(channel); | 1838 | iob = qeth_get_buffer(channel); |
1839 | if (!iob) | ||
1840 | return -ENOMEM; | ||
1837 | iob->callback = idx_reply_cb; | 1841 | iob->callback = idx_reply_cb; |
1838 | memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1)); | 1842 | memcpy(&channel->ccw, WRITE_CCW, sizeof(struct ccw1)); |
1839 | channel->ccw.count = IDX_ACTIVATE_SIZE; | 1843 | channel->ccw.count = IDX_ACTIVATE_SIZE; |
@@ -2021,10 +2025,36 @@ void qeth_prepare_control_data(struct qeth_card *card, int len, | |||
2021 | } | 2025 | } |
2022 | EXPORT_SYMBOL_GPL(qeth_prepare_control_data); | 2026 | EXPORT_SYMBOL_GPL(qeth_prepare_control_data); |
2023 | 2027 | ||
2028 | /** | ||
2029 | * qeth_send_control_data() - send control command to the card | ||
2030 | * @card: qeth_card structure pointer | ||
2031 | * @len: size of the command buffer | ||
2032 | * @iob: qeth_cmd_buffer pointer | ||
2033 | * @reply_cb: callback function pointer | ||
2034 | * @cb_card: pointer to the qeth_card structure | ||
2035 | * @cb_reply: pointer to the qeth_reply structure | ||
2036 | * @cb_cmd: pointer to the original iob for non-IPA | ||
2037 | * commands, or to the qeth_ipa_cmd structure | ||
2038 | * for the IPA commands. | ||
2039 | * @reply_param: private pointer passed to the callback | ||
2040 | * | ||
2041 | * Returns the value of the `return_code' field of the response | ||
2042 | * block returned from the hardware, or other error indication. | ||
2043 | * Value of zero indicates successful execution of the command. | ||
2044 | * | ||
2045 | * Callback function gets called one or more times, with cb_cmd | ||
2046 | * pointing to the response returned by the hardware. Callback | ||
2047 | * function must return non-zero if more reply blocks are expected, | ||
2048 | * and zero if the last or only reply block is received. Callback | ||
2049 | * function can get the value of the reply_param pointer from the | ||
2050 | * field 'param' of the structure qeth_reply. | ||
2051 | */ | ||
2052 | |||
2024 | int qeth_send_control_data(struct qeth_card *card, int len, | 2053 | int qeth_send_control_data(struct qeth_card *card, int len, |
2025 | struct qeth_cmd_buffer *iob, | 2054 | struct qeth_cmd_buffer *iob, |
2026 | int (*reply_cb)(struct qeth_card *, struct qeth_reply *, | 2055 | int (*reply_cb)(struct qeth_card *cb_card, |
2027 | unsigned long), | 2056 | struct qeth_reply *cb_reply, |
2057 | unsigned long cb_cmd), | ||
2028 | void *reply_param) | 2058 | void *reply_param) |
2029 | { | 2059 | { |
2030 | int rc; | 2060 | int rc; |
@@ -2914,9 +2944,16 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *card, | |||
2914 | struct qeth_cmd_buffer *iob; | 2944 | struct qeth_cmd_buffer *iob; |
2915 | struct qeth_ipa_cmd *cmd; | 2945 | struct qeth_ipa_cmd *cmd; |
2916 | 2946 | ||
2917 | iob = qeth_wait_for_buffer(&card->write); | 2947 | iob = qeth_get_buffer(&card->write); |
2918 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 2948 | if (iob) { |
2919 | qeth_fill_ipacmd_header(card, cmd, ipacmd, prot); | 2949 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
2950 | qeth_fill_ipacmd_header(card, cmd, ipacmd, prot); | ||
2951 | } else { | ||
2952 | dev_warn(&card->gdev->dev, | ||
2953 | "The qeth driver ran out of channel command buffers\n"); | ||
2954 | QETH_DBF_MESSAGE(1, "%s The qeth driver ran out of channel command buffers", | ||
2955 | dev_name(&card->gdev->dev)); | ||
2956 | } | ||
2920 | 2957 | ||
2921 | return iob; | 2958 | return iob; |
2922 | } | 2959 | } |
@@ -2932,6 +2969,12 @@ void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | |||
2932 | } | 2969 | } |
2933 | EXPORT_SYMBOL_GPL(qeth_prepare_ipa_cmd); | 2970 | EXPORT_SYMBOL_GPL(qeth_prepare_ipa_cmd); |
2934 | 2971 | ||
2972 | /** | ||
2973 | * qeth_send_ipa_cmd() - send an IPA command | ||
2974 | * | ||
2975 | * See qeth_send_control_data() for explanation of the arguments. | ||
2976 | */ | ||
2977 | |||
2935 | int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | 2978 | int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, |
2936 | int (*reply_cb)(struct qeth_card *, struct qeth_reply*, | 2979 | int (*reply_cb)(struct qeth_card *, struct qeth_reply*, |
2937 | unsigned long), | 2980 | unsigned long), |
@@ -2968,6 +3011,8 @@ int qeth_send_startlan(struct qeth_card *card) | |||
2968 | QETH_DBF_TEXT(SETUP, 2, "strtlan"); | 3011 | QETH_DBF_TEXT(SETUP, 2, "strtlan"); |
2969 | 3012 | ||
2970 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_STARTLAN, 0); | 3013 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_STARTLAN, 0); |
3014 | if (!iob) | ||
3015 | return -ENOMEM; | ||
2971 | rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); | 3016 | rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); |
2972 | return rc; | 3017 | return rc; |
2973 | } | 3018 | } |
@@ -3013,11 +3058,13 @@ static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, | |||
3013 | 3058 | ||
3014 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETADAPTERPARMS, | 3059 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETADAPTERPARMS, |
3015 | QETH_PROT_IPV4); | 3060 | QETH_PROT_IPV4); |
3016 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 3061 | if (iob) { |
3017 | cmd->data.setadapterparms.hdr.cmdlength = cmdlen; | 3062 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
3018 | cmd->data.setadapterparms.hdr.command_code = command; | 3063 | cmd->data.setadapterparms.hdr.cmdlength = cmdlen; |
3019 | cmd->data.setadapterparms.hdr.used_total = 1; | 3064 | cmd->data.setadapterparms.hdr.command_code = command; |
3020 | cmd->data.setadapterparms.hdr.seq_no = 1; | 3065 | cmd->data.setadapterparms.hdr.used_total = 1; |
3066 | cmd->data.setadapterparms.hdr.seq_no = 1; | ||
3067 | } | ||
3021 | 3068 | ||
3022 | return iob; | 3069 | return iob; |
3023 | } | 3070 | } |
@@ -3030,6 +3077,8 @@ int qeth_query_setadapterparms(struct qeth_card *card) | |||
3030 | QETH_CARD_TEXT(card, 3, "queryadp"); | 3077 | QETH_CARD_TEXT(card, 3, "queryadp"); |
3031 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED, | 3078 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED, |
3032 | sizeof(struct qeth_ipacmd_setadpparms)); | 3079 | sizeof(struct qeth_ipacmd_setadpparms)); |
3080 | if (!iob) | ||
3081 | return -ENOMEM; | ||
3033 | rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL); | 3082 | rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL); |
3034 | return rc; | 3083 | return rc; |
3035 | } | 3084 | } |
@@ -3080,6 +3129,8 @@ int qeth_query_ipassists(struct qeth_card *card, enum qeth_prot_versions prot) | |||
3080 | 3129 | ||
3081 | QETH_DBF_TEXT_(SETUP, 2, "qipassi%i", prot); | 3130 | QETH_DBF_TEXT_(SETUP, 2, "qipassi%i", prot); |
3082 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_QIPASSIST, prot); | 3131 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_QIPASSIST, prot); |
3132 | if (!iob) | ||
3133 | return -ENOMEM; | ||
3083 | rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL); | 3134 | rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL); |
3084 | return rc; | 3135 | return rc; |
3085 | } | 3136 | } |
@@ -3119,6 +3170,8 @@ int qeth_query_switch_attributes(struct qeth_card *card, | |||
3119 | return -ENOMEDIUM; | 3170 | return -ENOMEDIUM; |
3120 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES, | 3171 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES, |
3121 | sizeof(struct qeth_ipacmd_setadpparms_hdr)); | 3172 | sizeof(struct qeth_ipacmd_setadpparms_hdr)); |
3173 | if (!iob) | ||
3174 | return -ENOMEM; | ||
3122 | return qeth_send_ipa_cmd(card, iob, | 3175 | return qeth_send_ipa_cmd(card, iob, |
3123 | qeth_query_switch_attributes_cb, sw_info); | 3176 | qeth_query_switch_attributes_cb, sw_info); |
3124 | } | 3177 | } |
@@ -3146,6 +3199,8 @@ static int qeth_query_setdiagass(struct qeth_card *card) | |||
3146 | 3199 | ||
3147 | QETH_DBF_TEXT(SETUP, 2, "qdiagass"); | 3200 | QETH_DBF_TEXT(SETUP, 2, "qdiagass"); |
3148 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); | 3201 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); |
3202 | if (!iob) | ||
3203 | return -ENOMEM; | ||
3149 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 3204 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
3150 | cmd->data.diagass.subcmd_len = 16; | 3205 | cmd->data.diagass.subcmd_len = 16; |
3151 | cmd->data.diagass.subcmd = QETH_DIAGS_CMD_QUERY; | 3206 | cmd->data.diagass.subcmd = QETH_DIAGS_CMD_QUERY; |
@@ -3197,6 +3252,8 @@ int qeth_hw_trap(struct qeth_card *card, enum qeth_diags_trap_action action) | |||
3197 | 3252 | ||
3198 | QETH_DBF_TEXT(SETUP, 2, "diagtrap"); | 3253 | QETH_DBF_TEXT(SETUP, 2, "diagtrap"); |
3199 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); | 3254 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); |
3255 | if (!iob) | ||
3256 | return -ENOMEM; | ||
3200 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 3257 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
3201 | cmd->data.diagass.subcmd_len = 80; | 3258 | cmd->data.diagass.subcmd_len = 80; |
3202 | cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRAP; | 3259 | cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRAP; |
@@ -4162,6 +4219,8 @@ void qeth_setadp_promisc_mode(struct qeth_card *card) | |||
4162 | 4219 | ||
4163 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, | 4220 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, |
4164 | sizeof(struct qeth_ipacmd_setadpparms)); | 4221 | sizeof(struct qeth_ipacmd_setadpparms)); |
4222 | if (!iob) | ||
4223 | return; | ||
4165 | cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); | 4224 | cmd = (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); |
4166 | cmd->data.setadapterparms.data.mode = mode; | 4225 | cmd->data.setadapterparms.data.mode = mode; |
4167 | qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); | 4226 | qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); |
@@ -4232,6 +4291,8 @@ int qeth_setadpparms_change_macaddr(struct qeth_card *card) | |||
4232 | 4291 | ||
4233 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS, | 4292 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS, |
4234 | sizeof(struct qeth_ipacmd_setadpparms)); | 4293 | sizeof(struct qeth_ipacmd_setadpparms)); |
4294 | if (!iob) | ||
4295 | return -ENOMEM; | ||
4235 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 4296 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
4236 | cmd->data.setadapterparms.data.change_addr.cmd = CHANGE_ADDR_READ_MAC; | 4297 | cmd->data.setadapterparms.data.change_addr.cmd = CHANGE_ADDR_READ_MAC; |
4237 | cmd->data.setadapterparms.data.change_addr.addr_size = OSA_ADDR_LEN; | 4298 | cmd->data.setadapterparms.data.change_addr.addr_size = OSA_ADDR_LEN; |
@@ -4345,6 +4406,8 @@ static int qeth_setadpparms_set_access_ctrl(struct qeth_card *card, | |||
4345 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL, | 4406 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL, |
4346 | sizeof(struct qeth_ipacmd_setadpparms_hdr) + | 4407 | sizeof(struct qeth_ipacmd_setadpparms_hdr) + |
4347 | sizeof(struct qeth_set_access_ctrl)); | 4408 | sizeof(struct qeth_set_access_ctrl)); |
4409 | if (!iob) | ||
4410 | return -ENOMEM; | ||
4348 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 4411 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
4349 | access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl; | 4412 | access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl; |
4350 | access_ctrl_req->subcmd_code = isolation; | 4413 | access_ctrl_req->subcmd_code = isolation; |
@@ -4588,6 +4651,10 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) | |||
4588 | 4651 | ||
4589 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, | 4652 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, |
4590 | QETH_SNMP_SETADP_CMDLENGTH + req_len); | 4653 | QETH_SNMP_SETADP_CMDLENGTH + req_len); |
4654 | if (!iob) { | ||
4655 | rc = -ENOMEM; | ||
4656 | goto out; | ||
4657 | } | ||
4591 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 4658 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
4592 | memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len); | 4659 | memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len); |
4593 | rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len, | 4660 | rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len, |
@@ -4599,7 +4666,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) | |||
4599 | if (copy_to_user(udata, qinfo.udata, qinfo.udata_len)) | 4666 | if (copy_to_user(udata, qinfo.udata, qinfo.udata_len)) |
4600 | rc = -EFAULT; | 4667 | rc = -EFAULT; |
4601 | } | 4668 | } |
4602 | 4669 | out: | |
4603 | kfree(ureq); | 4670 | kfree(ureq); |
4604 | kfree(qinfo.udata); | 4671 | kfree(qinfo.udata); |
4605 | return rc; | 4672 | return rc; |
@@ -4670,6 +4737,10 @@ int qeth_query_oat_command(struct qeth_card *card, char __user *udata) | |||
4670 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, | 4737 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, |
4671 | sizeof(struct qeth_ipacmd_setadpparms_hdr) + | 4738 | sizeof(struct qeth_ipacmd_setadpparms_hdr) + |
4672 | sizeof(struct qeth_query_oat)); | 4739 | sizeof(struct qeth_query_oat)); |
4740 | if (!iob) { | ||
4741 | rc = -ENOMEM; | ||
4742 | goto out_free; | ||
4743 | } | ||
4673 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 4744 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
4674 | oat_req = &cmd->data.setadapterparms.data.query_oat; | 4745 | oat_req = &cmd->data.setadapterparms.data.query_oat; |
4675 | oat_req->subcmd_code = oat_data.command; | 4746 | oat_req->subcmd_code = oat_data.command; |
@@ -4735,6 +4806,8 @@ static int qeth_query_card_info(struct qeth_card *card, | |||
4735 | return -EOPNOTSUPP; | 4806 | return -EOPNOTSUPP; |
4736 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_CARD_INFO, | 4807 | iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_CARD_INFO, |
4737 | sizeof(struct qeth_ipacmd_setadpparms_hdr)); | 4808 | sizeof(struct qeth_ipacmd_setadpparms_hdr)); |
4809 | if (!iob) | ||
4810 | return -ENOMEM; | ||
4738 | return qeth_send_ipa_cmd(card, iob, qeth_query_card_info_cb, | 4811 | return qeth_send_ipa_cmd(card, iob, qeth_query_card_info_cb, |
4739 | (void *)carrier_info); | 4812 | (void *)carrier_info); |
4740 | } | 4813 | } |
@@ -5060,11 +5133,23 @@ retriable: | |||
5060 | card->options.adp.supported_funcs = 0; | 5133 | card->options.adp.supported_funcs = 0; |
5061 | card->options.sbp.supported_funcs = 0; | 5134 | card->options.sbp.supported_funcs = 0; |
5062 | card->info.diagass_support = 0; | 5135 | card->info.diagass_support = 0; |
5063 | qeth_query_ipassists(card, QETH_PROT_IPV4); | 5136 | rc = qeth_query_ipassists(card, QETH_PROT_IPV4); |
5064 | if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) | 5137 | if (rc == -ENOMEM) |
5065 | qeth_query_setadapterparms(card); | 5138 | goto out; |
5066 | if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) | 5139 | if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) { |
5067 | qeth_query_setdiagass(card); | 5140 | rc = qeth_query_setadapterparms(card); |
5141 | if (rc < 0) { | ||
5142 | QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); | ||
5143 | goto out; | ||
5144 | } | ||
5145 | } | ||
5146 | if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) { | ||
5147 | rc = qeth_query_setdiagass(card); | ||
5148 | if (rc < 0) { | ||
5149 | QETH_DBF_TEXT_(SETUP, 2, "7err%d", rc); | ||
5150 | goto out; | ||
5151 | } | ||
5152 | } | ||
5068 | return 0; | 5153 | return 0; |
5069 | out: | 5154 | out: |
5070 | dev_warn(&card->gdev->dev, "The qeth device driver failed to recover " | 5155 | dev_warn(&card->gdev->dev, "The qeth device driver failed to recover " |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index f5f409d85295..0ea0869120cf 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -27,10 +27,7 @@ static int qeth_l2_set_offline(struct ccwgroup_device *); | |||
27 | static int qeth_l2_stop(struct net_device *); | 27 | static int qeth_l2_stop(struct net_device *); |
28 | static int qeth_l2_send_delmac(struct qeth_card *, __u8 *); | 28 | static int qeth_l2_send_delmac(struct qeth_card *, __u8 *); |
29 | static int qeth_l2_send_setdelmac(struct qeth_card *, __u8 *, | 29 | static int qeth_l2_send_setdelmac(struct qeth_card *, __u8 *, |
30 | enum qeth_ipa_cmds, | 30 | enum qeth_ipa_cmds); |
31 | int (*reply_cb) (struct qeth_card *, | ||
32 | struct qeth_reply*, | ||
33 | unsigned long)); | ||
34 | static void qeth_l2_set_multicast_list(struct net_device *); | 31 | static void qeth_l2_set_multicast_list(struct net_device *); |
35 | static int qeth_l2_recover(void *); | 32 | static int qeth_l2_recover(void *); |
36 | static void qeth_bridgeport_query_support(struct qeth_card *card); | 33 | static void qeth_bridgeport_query_support(struct qeth_card *card); |
@@ -129,56 +126,71 @@ static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no) | |||
129 | return ndev; | 126 | return ndev; |
130 | } | 127 | } |
131 | 128 | ||
132 | static int qeth_l2_send_setgroupmac_cb(struct qeth_card *card, | 129 | static int qeth_setdel_makerc(struct qeth_card *card, int retcode) |
133 | struct qeth_reply *reply, | ||
134 | unsigned long data) | ||
135 | { | 130 | { |
136 | struct qeth_ipa_cmd *cmd; | 131 | int rc; |
137 | __u8 *mac; | ||
138 | 132 | ||
139 | QETH_CARD_TEXT(card, 2, "L2Sgmacb"); | 133 | if (retcode) |
140 | cmd = (struct qeth_ipa_cmd *) data; | 134 | QETH_CARD_TEXT_(card, 2, "err%04x", retcode); |
141 | mac = &cmd->data.setdelmac.mac[0]; | 135 | switch (retcode) { |
142 | /* MAC already registered, needed in couple/uncouple case */ | 136 | case IPA_RC_SUCCESS: |
143 | if (cmd->hdr.return_code == IPA_RC_L2_DUP_MAC) { | 137 | rc = 0; |
144 | QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s \n", | 138 | break; |
145 | mac, QETH_CARD_IFNAME(card)); | 139 | case IPA_RC_L2_UNSUPPORTED_CMD: |
146 | cmd->hdr.return_code = 0; | 140 | rc = -ENOSYS; |
141 | break; | ||
142 | case IPA_RC_L2_ADDR_TABLE_FULL: | ||
143 | rc = -ENOSPC; | ||
144 | break; | ||
145 | case IPA_RC_L2_DUP_MAC: | ||
146 | case IPA_RC_L2_DUP_LAYER3_MAC: | ||
147 | rc = -EEXIST; | ||
148 | break; | ||
149 | case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP: | ||
150 | case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP: | ||
151 | rc = -EPERM; | ||
152 | break; | ||
153 | case IPA_RC_L2_MAC_NOT_FOUND: | ||
154 | rc = -ENOENT; | ||
155 | break; | ||
156 | case -ENOMEM: | ||
157 | rc = -ENOMEM; | ||
158 | break; | ||
159 | default: | ||
160 | rc = -EIO; | ||
161 | break; | ||
147 | } | 162 | } |
148 | if (cmd->hdr.return_code) | 163 | return rc; |
149 | QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %x\n", | ||
150 | mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code); | ||
151 | return 0; | ||
152 | } | 164 | } |
153 | 165 | ||
154 | static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac) | 166 | static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac) |
155 | { | 167 | { |
156 | QETH_CARD_TEXT(card, 2, "L2Sgmac"); | 168 | int rc; |
157 | return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETGMAC, | ||
158 | qeth_l2_send_setgroupmac_cb); | ||
159 | } | ||
160 | |||
161 | static int qeth_l2_send_delgroupmac_cb(struct qeth_card *card, | ||
162 | struct qeth_reply *reply, | ||
163 | unsigned long data) | ||
164 | { | ||
165 | struct qeth_ipa_cmd *cmd; | ||
166 | __u8 *mac; | ||
167 | 169 | ||
168 | QETH_CARD_TEXT(card, 2, "L2Dgmacb"); | 170 | QETH_CARD_TEXT(card, 2, "L2Sgmac"); |
169 | cmd = (struct qeth_ipa_cmd *) data; | 171 | rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac, |
170 | mac = &cmd->data.setdelmac.mac[0]; | 172 | IPA_CMD_SETGMAC)); |
171 | if (cmd->hdr.return_code) | 173 | if (rc == -EEXIST) |
172 | QETH_DBF_MESSAGE(2, "Could not delete group MAC %pM on %s: %x\n", | 174 | QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s\n", |
173 | mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code); | 175 | mac, QETH_CARD_IFNAME(card)); |
174 | return 0; | 176 | else if (rc) |
177 | QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %d\n", | ||
178 | mac, QETH_CARD_IFNAME(card), rc); | ||
179 | return rc; | ||
175 | } | 180 | } |
176 | 181 | ||
177 | static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) | 182 | static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) |
178 | { | 183 | { |
184 | int rc; | ||
185 | |||
179 | QETH_CARD_TEXT(card, 2, "L2Dgmac"); | 186 | QETH_CARD_TEXT(card, 2, "L2Dgmac"); |
180 | return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELGMAC, | 187 | rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac, |
181 | qeth_l2_send_delgroupmac_cb); | 188 | IPA_CMD_DELGMAC)); |
189 | if (rc) | ||
190 | QETH_DBF_MESSAGE(2, | ||
191 | "Could not delete group MAC %pM on %s: %d\n", | ||
192 | mac, QETH_CARD_IFNAME(card), rc); | ||
193 | return rc; | ||
182 | } | 194 | } |
183 | 195 | ||
184 | static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) | 196 | static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) |
@@ -196,10 +208,11 @@ static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) | |||
196 | mc->is_vmac = vmac; | 208 | mc->is_vmac = vmac; |
197 | 209 | ||
198 | if (vmac) { | 210 | if (vmac) { |
199 | rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, | 211 | rc = qeth_setdel_makerc(card, |
200 | NULL); | 212 | qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC)); |
201 | } else { | 213 | } else { |
202 | rc = qeth_l2_send_setgroupmac(card, mac); | 214 | rc = qeth_setdel_makerc(card, |
215 | qeth_l2_send_setgroupmac(card, mac)); | ||
203 | } | 216 | } |
204 | 217 | ||
205 | if (!rc) | 218 | if (!rc) |
@@ -217,7 +230,7 @@ static void qeth_l2_del_all_mc(struct qeth_card *card, int del) | |||
217 | if (del) { | 230 | if (del) { |
218 | if (mc->is_vmac) | 231 | if (mc->is_vmac) |
219 | qeth_l2_send_setdelmac(card, mc->mc_addr, | 232 | qeth_l2_send_setdelmac(card, mc->mc_addr, |
220 | IPA_CMD_DELVMAC, NULL); | 233 | IPA_CMD_DELVMAC); |
221 | else | 234 | else |
222 | qeth_l2_send_delgroupmac(card, mc->mc_addr); | 235 | qeth_l2_send_delgroupmac(card, mc->mc_addr); |
223 | } | 236 | } |
@@ -290,6 +303,8 @@ static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i, | |||
290 | 303 | ||
291 | QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd); | 304 | QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd); |
292 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); | 305 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); |
306 | if (!iob) | ||
307 | return -ENOMEM; | ||
293 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 308 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
294 | cmd->data.setdelvlan.vlan_id = i; | 309 | cmd->data.setdelvlan.vlan_id = i; |
295 | return qeth_send_ipa_cmd(card, iob, | 310 | return qeth_send_ipa_cmd(card, iob, |
@@ -312,6 +327,7 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, | |||
312 | { | 327 | { |
313 | struct qeth_card *card = dev->ml_priv; | 328 | struct qeth_card *card = dev->ml_priv; |
314 | struct qeth_vlan_vid *id; | 329 | struct qeth_vlan_vid *id; |
330 | int rc; | ||
315 | 331 | ||
316 | QETH_CARD_TEXT_(card, 4, "aid:%d", vid); | 332 | QETH_CARD_TEXT_(card, 4, "aid:%d", vid); |
317 | if (!vid) | 333 | if (!vid) |
@@ -327,7 +343,11 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, | |||
327 | id = kmalloc(sizeof(struct qeth_vlan_vid), GFP_ATOMIC); | 343 | id = kmalloc(sizeof(struct qeth_vlan_vid), GFP_ATOMIC); |
328 | if (id) { | 344 | if (id) { |
329 | id->vid = vid; | 345 | id->vid = vid; |
330 | qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN); | 346 | rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN); |
347 | if (rc) { | ||
348 | kfree(id); | ||
349 | return rc; | ||
350 | } | ||
331 | spin_lock_bh(&card->vlanlock); | 351 | spin_lock_bh(&card->vlanlock); |
332 | list_add_tail(&id->list, &card->vid_list); | 352 | list_add_tail(&id->list, &card->vid_list); |
333 | spin_unlock_bh(&card->vlanlock); | 353 | spin_unlock_bh(&card->vlanlock); |
@@ -342,6 +362,7 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, | |||
342 | { | 362 | { |
343 | struct qeth_vlan_vid *id, *tmpid = NULL; | 363 | struct qeth_vlan_vid *id, *tmpid = NULL; |
344 | struct qeth_card *card = dev->ml_priv; | 364 | struct qeth_card *card = dev->ml_priv; |
365 | int rc = 0; | ||
345 | 366 | ||
346 | QETH_CARD_TEXT_(card, 4, "kid:%d", vid); | 367 | QETH_CARD_TEXT_(card, 4, "kid:%d", vid); |
347 | if (card->info.type == QETH_CARD_TYPE_OSM) { | 368 | if (card->info.type == QETH_CARD_TYPE_OSM) { |
@@ -362,11 +383,11 @@ static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, | |||
362 | } | 383 | } |
363 | spin_unlock_bh(&card->vlanlock); | 384 | spin_unlock_bh(&card->vlanlock); |
364 | if (tmpid) { | 385 | if (tmpid) { |
365 | qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); | 386 | rc = qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); |
366 | kfree(tmpid); | 387 | kfree(tmpid); |
367 | } | 388 | } |
368 | qeth_l2_set_multicast_list(card->dev); | 389 | qeth_l2_set_multicast_list(card->dev); |
369 | return 0; | 390 | return rc; |
370 | } | 391 | } |
371 | 392 | ||
372 | static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode) | 393 | static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode) |
@@ -538,91 +559,62 @@ out: | |||
538 | } | 559 | } |
539 | 560 | ||
540 | static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac, | 561 | static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac, |
541 | enum qeth_ipa_cmds ipacmd, | 562 | enum qeth_ipa_cmds ipacmd) |
542 | int (*reply_cb) (struct qeth_card *, | ||
543 | struct qeth_reply*, | ||
544 | unsigned long)) | ||
545 | { | 563 | { |
546 | struct qeth_ipa_cmd *cmd; | 564 | struct qeth_ipa_cmd *cmd; |
547 | struct qeth_cmd_buffer *iob; | 565 | struct qeth_cmd_buffer *iob; |
548 | 566 | ||
549 | QETH_CARD_TEXT(card, 2, "L2sdmac"); | 567 | QETH_CARD_TEXT(card, 2, "L2sdmac"); |
550 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); | 568 | iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); |
569 | if (!iob) | ||
570 | return -ENOMEM; | ||
551 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 571 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
552 | cmd->data.setdelmac.mac_length = OSA_ADDR_LEN; | 572 | cmd->data.setdelmac.mac_length = OSA_ADDR_LEN; |
553 | memcpy(&cmd->data.setdelmac.mac, mac, OSA_ADDR_LEN); | 573 | memcpy(&cmd->data.setdelmac.mac, mac, OSA_ADDR_LEN); |
554 | return qeth_send_ipa_cmd(card, iob, reply_cb, NULL); | 574 | return qeth_send_ipa_cmd(card, iob, NULL, NULL); |
555 | } | 575 | } |
556 | 576 | ||
557 | static int qeth_l2_send_setmac_cb(struct qeth_card *card, | 577 | static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac) |
558 | struct qeth_reply *reply, | ||
559 | unsigned long data) | ||
560 | { | 578 | { |
561 | struct qeth_ipa_cmd *cmd; | 579 | int rc; |
562 | 580 | ||
563 | QETH_CARD_TEXT(card, 2, "L2Smaccb"); | 581 | QETH_CARD_TEXT(card, 2, "L2Setmac"); |
564 | cmd = (struct qeth_ipa_cmd *) data; | 582 | rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac, |
565 | if (cmd->hdr.return_code) { | 583 | IPA_CMD_SETVMAC)); |
566 | QETH_CARD_TEXT_(card, 2, "L2er%x", cmd->hdr.return_code); | 584 | if (rc == 0) { |
585 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; | ||
586 | memcpy(card->dev->dev_addr, mac, OSA_ADDR_LEN); | ||
587 | dev_info(&card->gdev->dev, | ||
588 | "MAC address %pM successfully registered on device %s\n", | ||
589 | card->dev->dev_addr, card->dev->name); | ||
590 | } else { | ||
567 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; | 591 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; |
568 | switch (cmd->hdr.return_code) { | 592 | switch (rc) { |
569 | case IPA_RC_L2_DUP_MAC: | 593 | case -EEXIST: |
570 | case IPA_RC_L2_DUP_LAYER3_MAC: | ||
571 | dev_warn(&card->gdev->dev, | 594 | dev_warn(&card->gdev->dev, |
572 | "MAC address %pM already exists\n", | 595 | "MAC address %pM already exists\n", mac); |
573 | cmd->data.setdelmac.mac); | ||
574 | break; | 596 | break; |
575 | case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP: | 597 | case -EPERM: |
576 | case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP: | ||
577 | dev_warn(&card->gdev->dev, | 598 | dev_warn(&card->gdev->dev, |
578 | "MAC address %pM is not authorized\n", | 599 | "MAC address %pM is not authorized\n", mac); |
579 | cmd->data.setdelmac.mac); | ||
580 | break; | ||
581 | default: | ||
582 | break; | 600 | break; |
583 | } | 601 | } |
584 | } else { | ||
585 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; | ||
586 | memcpy(card->dev->dev_addr, cmd->data.setdelmac.mac, | ||
587 | OSA_ADDR_LEN); | ||
588 | dev_info(&card->gdev->dev, | ||
589 | "MAC address %pM successfully registered on device %s\n", | ||
590 | card->dev->dev_addr, card->dev->name); | ||
591 | } | ||
592 | return 0; | ||
593 | } | ||
594 | |||
595 | static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac) | ||
596 | { | ||
597 | QETH_CARD_TEXT(card, 2, "L2Setmac"); | ||
598 | return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, | ||
599 | qeth_l2_send_setmac_cb); | ||
600 | } | ||
601 | |||
602 | static int qeth_l2_send_delmac_cb(struct qeth_card *card, | ||
603 | struct qeth_reply *reply, | ||
604 | unsigned long data) | ||
605 | { | ||
606 | struct qeth_ipa_cmd *cmd; | ||
607 | |||
608 | QETH_CARD_TEXT(card, 2, "L2Dmaccb"); | ||
609 | cmd = (struct qeth_ipa_cmd *) data; | ||
610 | if (cmd->hdr.return_code) { | ||
611 | QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code); | ||
612 | return 0; | ||
613 | } | 602 | } |
614 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; | 603 | return rc; |
615 | |||
616 | return 0; | ||
617 | } | 604 | } |
618 | 605 | ||
619 | static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac) | 606 | static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac) |
620 | { | 607 | { |
608 | int rc; | ||
609 | |||
621 | QETH_CARD_TEXT(card, 2, "L2Delmac"); | 610 | QETH_CARD_TEXT(card, 2, "L2Delmac"); |
622 | if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) | 611 | if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) |
623 | return 0; | 612 | return 0; |
624 | return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, | 613 | rc = qeth_setdel_makerc(card, qeth_l2_send_setdelmac(card, mac, |
625 | qeth_l2_send_delmac_cb); | 614 | IPA_CMD_DELVMAC)); |
615 | if (rc == 0) | ||
616 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; | ||
617 | return rc; | ||
626 | } | 618 | } |
627 | 619 | ||
628 | static int qeth_l2_request_initial_mac(struct qeth_card *card) | 620 | static int qeth_l2_request_initial_mac(struct qeth_card *card) |
@@ -650,7 +642,7 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) | |||
650 | if (rc) { | 642 | if (rc) { |
651 | QETH_DBF_MESSAGE(2, "couldn't get MAC address on " | 643 | QETH_DBF_MESSAGE(2, "couldn't get MAC address on " |
652 | "device %s: x%x\n", CARD_BUS_ID(card), rc); | 644 | "device %s: x%x\n", CARD_BUS_ID(card), rc); |
653 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 645 | QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc); |
654 | return rc; | 646 | return rc; |
655 | } | 647 | } |
656 | QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, OSA_ADDR_LEN); | 648 | QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, OSA_ADDR_LEN); |
@@ -686,7 +678,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) | |||
686 | return -ERESTARTSYS; | 678 | return -ERESTARTSYS; |
687 | } | 679 | } |
688 | rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); | 680 | rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); |
689 | if (!rc || (rc == IPA_RC_L2_MAC_NOT_FOUND)) | 681 | if (!rc || (rc == -ENOENT)) |
690 | rc = qeth_l2_send_setmac(card, addr->sa_data); | 682 | rc = qeth_l2_send_setmac(card, addr->sa_data); |
691 | return rc ? -EINVAL : 0; | 683 | return rc ? -EINVAL : 0; |
692 | } | 684 | } |
@@ -995,7 +987,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
995 | recover_flag = card->state; | 987 | recover_flag = card->state; |
996 | rc = qeth_core_hardsetup_card(card); | 988 | rc = qeth_core_hardsetup_card(card); |
997 | if (rc) { | 989 | if (rc) { |
998 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); | 990 | QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc); |
999 | rc = -ENODEV; | 991 | rc = -ENODEV; |
1000 | goto out_remove; | 992 | goto out_remove; |
1001 | } | 993 | } |
@@ -1728,6 +1720,8 @@ static void qeth_bridgeport_query_support(struct qeth_card *card) | |||
1728 | 1720 | ||
1729 | QETH_CARD_TEXT(card, 2, "brqsuppo"); | 1721 | QETH_CARD_TEXT(card, 2, "brqsuppo"); |
1730 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); | 1722 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); |
1723 | if (!iob) | ||
1724 | return; | ||
1731 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1725 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1732 | cmd->data.sbp.hdr.cmdlength = | 1726 | cmd->data.sbp.hdr.cmdlength = |
1733 | sizeof(struct qeth_ipacmd_sbp_hdr) + | 1727 | sizeof(struct qeth_ipacmd_sbp_hdr) + |
@@ -1803,6 +1797,8 @@ int qeth_bridgeport_query_ports(struct qeth_card *card, | |||
1803 | if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS)) | 1797 | if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS)) |
1804 | return -EOPNOTSUPP; | 1798 | return -EOPNOTSUPP; |
1805 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); | 1799 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); |
1800 | if (!iob) | ||
1801 | return -ENOMEM; | ||
1806 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1802 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1807 | cmd->data.sbp.hdr.cmdlength = | 1803 | cmd->data.sbp.hdr.cmdlength = |
1808 | sizeof(struct qeth_ipacmd_sbp_hdr); | 1804 | sizeof(struct qeth_ipacmd_sbp_hdr); |
@@ -1815,9 +1811,7 @@ int qeth_bridgeport_query_ports(struct qeth_card *card, | |||
1815 | if (rc) | 1811 | if (rc) |
1816 | return rc; | 1812 | return rc; |
1817 | rc = qeth_bridgeport_makerc(card, &cbctl, IPA_SBP_QUERY_BRIDGE_PORTS); | 1813 | rc = qeth_bridgeport_makerc(card, &cbctl, IPA_SBP_QUERY_BRIDGE_PORTS); |
1818 | if (rc) | 1814 | return rc; |
1819 | return rc; | ||
1820 | return 0; | ||
1821 | } | 1815 | } |
1822 | EXPORT_SYMBOL_GPL(qeth_bridgeport_query_ports); | 1816 | EXPORT_SYMBOL_GPL(qeth_bridgeport_query_ports); |
1823 | 1817 | ||
@@ -1871,6 +1865,8 @@ int qeth_bridgeport_setrole(struct qeth_card *card, enum qeth_sbp_roles role) | |||
1871 | if (!(card->options.sbp.supported_funcs & setcmd)) | 1865 | if (!(card->options.sbp.supported_funcs & setcmd)) |
1872 | return -EOPNOTSUPP; | 1866 | return -EOPNOTSUPP; |
1873 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); | 1867 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETBRIDGEPORT, 0); |
1868 | if (!iob) | ||
1869 | return -ENOMEM; | ||
1874 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1870 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1875 | cmd->data.sbp.hdr.cmdlength = cmdlength; | 1871 | cmd->data.sbp.hdr.cmdlength = cmdlength; |
1876 | cmd->data.sbp.hdr.command_code = setcmd; | 1872 | cmd->data.sbp.hdr.command_code = setcmd; |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 1432b10e95ad..04e42c649134 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -547,6 +547,8 @@ static int qeth_l3_send_setdelmc(struct qeth_card *card, | |||
547 | QETH_CARD_TEXT(card, 4, "setdelmc"); | 547 | QETH_CARD_TEXT(card, 4, "setdelmc"); |
548 | 548 | ||
549 | iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto); | 549 | iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto); |
550 | if (!iob) | ||
551 | return -ENOMEM; | ||
550 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 552 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
551 | memcpy(&cmd->data.setdelipm.mac, addr->mac, OSA_ADDR_LEN); | 553 | memcpy(&cmd->data.setdelipm.mac, addr->mac, OSA_ADDR_LEN); |
552 | if (addr->proto == QETH_PROT_IPV6) | 554 | if (addr->proto == QETH_PROT_IPV6) |
@@ -586,6 +588,8 @@ static int qeth_l3_send_setdelip(struct qeth_card *card, | |||
586 | QETH_CARD_TEXT_(card, 4, "flags%02X", flags); | 588 | QETH_CARD_TEXT_(card, 4, "flags%02X", flags); |
587 | 589 | ||
588 | iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto); | 590 | iob = qeth_get_ipacmd_buffer(card, ipacmd, addr->proto); |
591 | if (!iob) | ||
592 | return -ENOMEM; | ||
589 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 593 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
590 | if (addr->proto == QETH_PROT_IPV6) { | 594 | if (addr->proto == QETH_PROT_IPV6) { |
591 | memcpy(cmd->data.setdelip6.ip_addr, &addr->u.a6.addr, | 595 | memcpy(cmd->data.setdelip6.ip_addr, &addr->u.a6.addr, |
@@ -614,6 +618,8 @@ static int qeth_l3_send_setrouting(struct qeth_card *card, | |||
614 | 618 | ||
615 | QETH_CARD_TEXT(card, 4, "setroutg"); | 619 | QETH_CARD_TEXT(card, 4, "setroutg"); |
616 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETRTG, prot); | 620 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETRTG, prot); |
621 | if (!iob) | ||
622 | return -ENOMEM; | ||
617 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 623 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
618 | cmd->data.setrtg.type = (type); | 624 | cmd->data.setrtg.type = (type); |
619 | rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); | 625 | rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); |
@@ -1047,12 +1053,14 @@ static struct qeth_cmd_buffer *qeth_l3_get_setassparms_cmd( | |||
1047 | QETH_CARD_TEXT(card, 4, "getasscm"); | 1053 | QETH_CARD_TEXT(card, 4, "getasscm"); |
1048 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETASSPARMS, prot); | 1054 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETASSPARMS, prot); |
1049 | 1055 | ||
1050 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1056 | if (iob) { |
1051 | cmd->data.setassparms.hdr.assist_no = ipa_func; | 1057 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1052 | cmd->data.setassparms.hdr.length = 8 + len; | 1058 | cmd->data.setassparms.hdr.assist_no = ipa_func; |
1053 | cmd->data.setassparms.hdr.command_code = cmd_code; | 1059 | cmd->data.setassparms.hdr.length = 8 + len; |
1054 | cmd->data.setassparms.hdr.return_code = 0; | 1060 | cmd->data.setassparms.hdr.command_code = cmd_code; |
1055 | cmd->data.setassparms.hdr.seq_no = 0; | 1061 | cmd->data.setassparms.hdr.return_code = 0; |
1062 | cmd->data.setassparms.hdr.seq_no = 0; | ||
1063 | } | ||
1056 | 1064 | ||
1057 | return iob; | 1065 | return iob; |
1058 | } | 1066 | } |
@@ -1088,6 +1096,8 @@ static int qeth_l3_send_simple_setassparms_ipv6(struct qeth_card *card, | |||
1088 | QETH_CARD_TEXT(card, 4, "simassp6"); | 1096 | QETH_CARD_TEXT(card, 4, "simassp6"); |
1089 | iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code, | 1097 | iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code, |
1090 | 0, QETH_PROT_IPV6); | 1098 | 0, QETH_PROT_IPV6); |
1099 | if (!iob) | ||
1100 | return -ENOMEM; | ||
1091 | rc = qeth_l3_send_setassparms(card, iob, 0, 0, | 1101 | rc = qeth_l3_send_setassparms(card, iob, 0, 0, |
1092 | qeth_l3_default_setassparms_cb, NULL); | 1102 | qeth_l3_default_setassparms_cb, NULL); |
1093 | return rc; | 1103 | return rc; |
@@ -1106,6 +1116,8 @@ static int qeth_l3_send_simple_setassparms(struct qeth_card *card, | |||
1106 | length = sizeof(__u32); | 1116 | length = sizeof(__u32); |
1107 | iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code, | 1117 | iob = qeth_l3_get_setassparms_cmd(card, ipa_func, cmd_code, |
1108 | length, QETH_PROT_IPV4); | 1118 | length, QETH_PROT_IPV4); |
1119 | if (!iob) | ||
1120 | return -ENOMEM; | ||
1109 | rc = qeth_l3_send_setassparms(card, iob, length, data, | 1121 | rc = qeth_l3_send_setassparms(card, iob, length, data, |
1110 | qeth_l3_default_setassparms_cb, NULL); | 1122 | qeth_l3_default_setassparms_cb, NULL); |
1111 | return rc; | 1123 | return rc; |
@@ -1492,6 +1504,8 @@ static int qeth_l3_iqd_read_initial_mac(struct qeth_card *card) | |||
1492 | 1504 | ||
1493 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR, | 1505 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR, |
1494 | QETH_PROT_IPV6); | 1506 | QETH_PROT_IPV6); |
1507 | if (!iob) | ||
1508 | return -ENOMEM; | ||
1495 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1509 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1496 | *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) = | 1510 | *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) = |
1497 | card->info.unique_id; | 1511 | card->info.unique_id; |
@@ -1535,6 +1549,8 @@ static int qeth_l3_get_unique_id(struct qeth_card *card) | |||
1535 | 1549 | ||
1536 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR, | 1550 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_CREATE_ADDR, |
1537 | QETH_PROT_IPV6); | 1551 | QETH_PROT_IPV6); |
1552 | if (!iob) | ||
1553 | return -ENOMEM; | ||
1538 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1554 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1539 | *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) = | 1555 | *((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) = |
1540 | card->info.unique_id; | 1556 | card->info.unique_id; |
@@ -1609,6 +1625,8 @@ qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd) | |||
1609 | QETH_DBF_TEXT(SETUP, 2, "diagtrac"); | 1625 | QETH_DBF_TEXT(SETUP, 2, "diagtrac"); |
1610 | 1626 | ||
1611 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); | 1627 | iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SET_DIAG_ASS, 0); |
1628 | if (!iob) | ||
1629 | return -ENOMEM; | ||
1612 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 1630 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1613 | cmd->data.diagass.subcmd_len = 16; | 1631 | cmd->data.diagass.subcmd_len = 16; |
1614 | cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRACE; | 1632 | cmd->data.diagass.subcmd = QETH_DIAGS_CMD_TRACE; |
@@ -2440,6 +2458,8 @@ static int qeth_l3_query_arp_cache_info(struct qeth_card *card, | |||
2440 | IPA_CMD_ASS_ARP_QUERY_INFO, | 2458 | IPA_CMD_ASS_ARP_QUERY_INFO, |
2441 | sizeof(struct qeth_arp_query_data) - sizeof(char), | 2459 | sizeof(struct qeth_arp_query_data) - sizeof(char), |
2442 | prot); | 2460 | prot); |
2461 | if (!iob) | ||
2462 | return -ENOMEM; | ||
2443 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 2463 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
2444 | cmd->data.setassparms.data.query_arp.request_bits = 0x000F; | 2464 | cmd->data.setassparms.data.query_arp.request_bits = 0x000F; |
2445 | cmd->data.setassparms.data.query_arp.reply_bits = 0; | 2465 | cmd->data.setassparms.data.query_arp.reply_bits = 0; |
@@ -2533,6 +2553,8 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card, | |||
2533 | IPA_CMD_ASS_ARP_ADD_ENTRY, | 2553 | IPA_CMD_ASS_ARP_ADD_ENTRY, |
2534 | sizeof(struct qeth_arp_cache_entry), | 2554 | sizeof(struct qeth_arp_cache_entry), |
2535 | QETH_PROT_IPV4); | 2555 | QETH_PROT_IPV4); |
2556 | if (!iob) | ||
2557 | return -ENOMEM; | ||
2536 | rc = qeth_l3_send_setassparms(card, iob, | 2558 | rc = qeth_l3_send_setassparms(card, iob, |
2537 | sizeof(struct qeth_arp_cache_entry), | 2559 | sizeof(struct qeth_arp_cache_entry), |
2538 | (unsigned long) entry, | 2560 | (unsigned long) entry, |
@@ -2572,6 +2594,8 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card, | |||
2572 | IPA_CMD_ASS_ARP_REMOVE_ENTRY, | 2594 | IPA_CMD_ASS_ARP_REMOVE_ENTRY, |
2573 | 12, | 2595 | 12, |
2574 | QETH_PROT_IPV4); | 2596 | QETH_PROT_IPV4); |
2597 | if (!iob) | ||
2598 | return -ENOMEM; | ||
2575 | rc = qeth_l3_send_setassparms(card, iob, | 2599 | rc = qeth_l3_send_setassparms(card, iob, |
2576 | 12, (unsigned long)buf, | 2600 | 12, (unsigned long)buf, |
2577 | qeth_l3_default_setassparms_cb, NULL); | 2601 | qeth_l3_default_setassparms_cb, NULL); |
@@ -3259,6 +3283,8 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = { | |||
3259 | 3283 | ||
3260 | static int qeth_l3_setup_netdev(struct qeth_card *card) | 3284 | static int qeth_l3_setup_netdev(struct qeth_card *card) |
3261 | { | 3285 | { |
3286 | int rc; | ||
3287 | |||
3262 | if (card->info.type == QETH_CARD_TYPE_OSD || | 3288 | if (card->info.type == QETH_CARD_TYPE_OSD || |
3263 | card->info.type == QETH_CARD_TYPE_OSX) { | 3289 | card->info.type == QETH_CARD_TYPE_OSX) { |
3264 | if ((card->info.link_type == QETH_LINK_TYPE_LANE_TR) || | 3290 | if ((card->info.link_type == QETH_LINK_TYPE_LANE_TR) || |
@@ -3290,7 +3316,9 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) | |||
3290 | return -ENODEV; | 3316 | return -ENODEV; |
3291 | card->dev->flags |= IFF_NOARP; | 3317 | card->dev->flags |= IFF_NOARP; |
3292 | card->dev->netdev_ops = &qeth_l3_netdev_ops; | 3318 | card->dev->netdev_ops = &qeth_l3_netdev_ops; |
3293 | qeth_l3_iqd_read_initial_mac(card); | 3319 | rc = qeth_l3_iqd_read_initial_mac(card); |
3320 | if (rc) | ||
3321 | return rc; | ||
3294 | if (card->options.hsuid[0]) | 3322 | if (card->options.hsuid[0]) |
3295 | memcpy(card->dev->perm_addr, card->options.hsuid, 9); | 3323 | memcpy(card->dev->perm_addr, card->options.hsuid, 9); |
3296 | } else | 3324 | } else |
@@ -3357,7 +3385,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3357 | recover_flag = card->state; | 3385 | recover_flag = card->state; |
3358 | rc = qeth_core_hardsetup_card(card); | 3386 | rc = qeth_core_hardsetup_card(card); |
3359 | if (rc) { | 3387 | if (rc) { |
3360 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); | 3388 | QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc); |
3361 | rc = -ENODEV; | 3389 | rc = -ENODEV; |
3362 | goto out_remove; | 3390 | goto out_remove; |
3363 | } | 3391 | } |
@@ -3398,7 +3426,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3398 | contin: | 3426 | contin: |
3399 | rc = qeth_l3_setadapter_parms(card); | 3427 | rc = qeth_l3_setadapter_parms(card); |
3400 | if (rc) | 3428 | if (rc) |
3401 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); | 3429 | QETH_DBF_TEXT_(SETUP, 2, "2err%04x", rc); |
3402 | if (!card->options.sniffer) { | 3430 | if (!card->options.sniffer) { |
3403 | rc = qeth_l3_start_ipassists(card); | 3431 | rc = qeth_l3_start_ipassists(card); |
3404 | if (rc) { | 3432 | if (rc) { |
@@ -3407,10 +3435,10 @@ contin: | |||
3407 | } | 3435 | } |
3408 | rc = qeth_l3_setrouting_v4(card); | 3436 | rc = qeth_l3_setrouting_v4(card); |
3409 | if (rc) | 3437 | if (rc) |
3410 | QETH_DBF_TEXT_(SETUP, 2, "4err%d", rc); | 3438 | QETH_DBF_TEXT_(SETUP, 2, "4err%04x", rc); |
3411 | rc = qeth_l3_setrouting_v6(card); | 3439 | rc = qeth_l3_setrouting_v6(card); |
3412 | if (rc) | 3440 | if (rc) |
3413 | QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc); | 3441 | QETH_DBF_TEXT_(SETUP, 2, "5err%04x", rc); |
3414 | } | 3442 | } |
3415 | netif_tx_disable(card->dev); | 3443 | netif_tx_disable(card->dev); |
3416 | 3444 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index df4e27cd996a..9219953ee949 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -683,6 +683,7 @@ static void ipr_init_ipr_cmnd(struct ipr_cmnd *ipr_cmd, | |||
683 | ipr_reinit_ipr_cmnd(ipr_cmd); | 683 | ipr_reinit_ipr_cmnd(ipr_cmd); |
684 | ipr_cmd->u.scratch = 0; | 684 | ipr_cmd->u.scratch = 0; |
685 | ipr_cmd->sibling = NULL; | 685 | ipr_cmd->sibling = NULL; |
686 | ipr_cmd->eh_comp = NULL; | ||
686 | ipr_cmd->fast_done = fast_done; | 687 | ipr_cmd->fast_done = fast_done; |
687 | init_timer(&ipr_cmd->timer); | 688 | init_timer(&ipr_cmd->timer); |
688 | } | 689 | } |
@@ -848,6 +849,8 @@ static void ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd) | |||
848 | 849 | ||
849 | scsi_dma_unmap(ipr_cmd->scsi_cmd); | 850 | scsi_dma_unmap(ipr_cmd->scsi_cmd); |
850 | scsi_cmd->scsi_done(scsi_cmd); | 851 | scsi_cmd->scsi_done(scsi_cmd); |
852 | if (ipr_cmd->eh_comp) | ||
853 | complete(ipr_cmd->eh_comp); | ||
851 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); | 854 | list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); |
852 | } | 855 | } |
853 | 856 | ||
@@ -4811,6 +4814,84 @@ static int ipr_slave_alloc(struct scsi_device *sdev) | |||
4811 | return rc; | 4814 | return rc; |
4812 | } | 4815 | } |
4813 | 4816 | ||
4817 | /** | ||
4818 | * ipr_match_lun - Match function for specified LUN | ||
4819 | * @ipr_cmd: ipr command struct | ||
4820 | * @device: device to match (sdev) | ||
4821 | * | ||
4822 | * Returns: | ||
4823 | * 1 if command matches sdev / 0 if command does not match sdev | ||
4824 | **/ | ||
4825 | static int ipr_match_lun(struct ipr_cmnd *ipr_cmd, void *device) | ||
4826 | { | ||
4827 | if (ipr_cmd->scsi_cmd && ipr_cmd->scsi_cmd->device == device) | ||
4828 | return 1; | ||
4829 | return 0; | ||
4830 | } | ||
4831 | |||
4832 | /** | ||
4833 | * ipr_wait_for_ops - Wait for matching commands to complete | ||
4834 | * @ipr_cmd: ipr command struct | ||
4835 | * @device: device to match (sdev) | ||
4836 | * @match: match function to use | ||
4837 | * | ||
4838 | * Returns: | ||
4839 | * SUCCESS / FAILED | ||
4840 | **/ | ||
4841 | static int ipr_wait_for_ops(struct ipr_ioa_cfg *ioa_cfg, void *device, | ||
4842 | int (*match)(struct ipr_cmnd *, void *)) | ||
4843 | { | ||
4844 | struct ipr_cmnd *ipr_cmd; | ||
4845 | int wait; | ||
4846 | unsigned long flags; | ||
4847 | struct ipr_hrr_queue *hrrq; | ||
4848 | signed long timeout = IPR_ABORT_TASK_TIMEOUT; | ||
4849 | DECLARE_COMPLETION_ONSTACK(comp); | ||
4850 | |||
4851 | ENTER; | ||
4852 | do { | ||
4853 | wait = 0; | ||
4854 | |||
4855 | for_each_hrrq(hrrq, ioa_cfg) { | ||
4856 | spin_lock_irqsave(hrrq->lock, flags); | ||
4857 | list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { | ||
4858 | if (match(ipr_cmd, device)) { | ||
4859 | ipr_cmd->eh_comp = ∁ | ||
4860 | wait++; | ||
4861 | } | ||
4862 | } | ||
4863 | spin_unlock_irqrestore(hrrq->lock, flags); | ||
4864 | } | ||
4865 | |||
4866 | if (wait) { | ||
4867 | timeout = wait_for_completion_timeout(&comp, timeout); | ||
4868 | |||
4869 | if (!timeout) { | ||
4870 | wait = 0; | ||
4871 | |||
4872 | for_each_hrrq(hrrq, ioa_cfg) { | ||
4873 | spin_lock_irqsave(hrrq->lock, flags); | ||
4874 | list_for_each_entry(ipr_cmd, &hrrq->hrrq_pending_q, queue) { | ||
4875 | if (match(ipr_cmd, device)) { | ||
4876 | ipr_cmd->eh_comp = NULL; | ||
4877 | wait++; | ||
4878 | } | ||
4879 | } | ||
4880 | spin_unlock_irqrestore(hrrq->lock, flags); | ||
4881 | } | ||
4882 | |||
4883 | if (wait) | ||
4884 | dev_err(&ioa_cfg->pdev->dev, "Timed out waiting for aborted commands\n"); | ||
4885 | LEAVE; | ||
4886 | return wait ? FAILED : SUCCESS; | ||
4887 | } | ||
4888 | } | ||
4889 | } while (wait); | ||
4890 | |||
4891 | LEAVE; | ||
4892 | return SUCCESS; | ||
4893 | } | ||
4894 | |||
4814 | static int ipr_eh_host_reset(struct scsi_cmnd *cmd) | 4895 | static int ipr_eh_host_reset(struct scsi_cmnd *cmd) |
4815 | { | 4896 | { |
4816 | struct ipr_ioa_cfg *ioa_cfg; | 4897 | struct ipr_ioa_cfg *ioa_cfg; |
@@ -5030,11 +5111,17 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd *scsi_cmd) | |||
5030 | static int ipr_eh_dev_reset(struct scsi_cmnd *cmd) | 5111 | static int ipr_eh_dev_reset(struct scsi_cmnd *cmd) |
5031 | { | 5112 | { |
5032 | int rc; | 5113 | int rc; |
5114 | struct ipr_ioa_cfg *ioa_cfg; | ||
5115 | |||
5116 | ioa_cfg = (struct ipr_ioa_cfg *) cmd->device->host->hostdata; | ||
5033 | 5117 | ||
5034 | spin_lock_irq(cmd->device->host->host_lock); | 5118 | spin_lock_irq(cmd->device->host->host_lock); |
5035 | rc = __ipr_eh_dev_reset(cmd); | 5119 | rc = __ipr_eh_dev_reset(cmd); |
5036 | spin_unlock_irq(cmd->device->host->host_lock); | 5120 | spin_unlock_irq(cmd->device->host->host_lock); |
5037 | 5121 | ||
5122 | if (rc == SUCCESS) | ||
5123 | rc = ipr_wait_for_ops(ioa_cfg, cmd->device, ipr_match_lun); | ||
5124 | |||
5038 | return rc; | 5125 | return rc; |
5039 | } | 5126 | } |
5040 | 5127 | ||
@@ -5234,13 +5321,18 @@ static int ipr_eh_abort(struct scsi_cmnd *scsi_cmd) | |||
5234 | { | 5321 | { |
5235 | unsigned long flags; | 5322 | unsigned long flags; |
5236 | int rc; | 5323 | int rc; |
5324 | struct ipr_ioa_cfg *ioa_cfg; | ||
5237 | 5325 | ||
5238 | ENTER; | 5326 | ENTER; |
5239 | 5327 | ||
5328 | ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; | ||
5329 | |||
5240 | spin_lock_irqsave(scsi_cmd->device->host->host_lock, flags); | 5330 | spin_lock_irqsave(scsi_cmd->device->host->host_lock, flags); |
5241 | rc = ipr_cancel_op(scsi_cmd); | 5331 | rc = ipr_cancel_op(scsi_cmd); |
5242 | spin_unlock_irqrestore(scsi_cmd->device->host->host_lock, flags); | 5332 | spin_unlock_irqrestore(scsi_cmd->device->host->host_lock, flags); |
5243 | 5333 | ||
5334 | if (rc == SUCCESS) | ||
5335 | rc = ipr_wait_for_ops(ioa_cfg, scsi_cmd->device, ipr_match_lun); | ||
5244 | LEAVE; | 5336 | LEAVE; |
5245 | return rc; | 5337 | return rc; |
5246 | } | 5338 | } |
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index b4f3eec51bc9..ec03b42fa2b9 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
@@ -1606,6 +1606,7 @@ struct ipr_cmnd { | |||
1606 | struct scsi_device *sdev; | 1606 | struct scsi_device *sdev; |
1607 | } u; | 1607 | } u; |
1608 | 1608 | ||
1609 | struct completion *eh_comp; | ||
1609 | struct ipr_hrr_queue *hrrq; | 1610 | struct ipr_hrr_queue *hrrq; |
1610 | struct ipr_ioa_cfg *ioa_cfg; | 1611 | struct ipr_ioa_cfg *ioa_cfg; |
1611 | }; | 1612 | }; |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index e02885451425..9b3829931f40 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -986,9 +986,9 @@ int scsi_device_get(struct scsi_device *sdev) | |||
986 | return -ENXIO; | 986 | return -ENXIO; |
987 | if (!get_device(&sdev->sdev_gendev)) | 987 | if (!get_device(&sdev->sdev_gendev)) |
988 | return -ENXIO; | 988 | return -ENXIO; |
989 | /* We can fail this if we're doing SCSI operations | 989 | /* We can fail try_module_get if we're doing SCSI operations |
990 | * from module exit (like cache flush) */ | 990 | * from module exit (like cache flush) */ |
991 | try_module_get(sdev->host->hostt->module); | 991 | __module_get(sdev->host->hostt->module); |
992 | 992 | ||
993 | return 0; | 993 | return 0; |
994 | } | 994 | } |
@@ -1004,14 +1004,7 @@ EXPORT_SYMBOL(scsi_device_get); | |||
1004 | */ | 1004 | */ |
1005 | void scsi_device_put(struct scsi_device *sdev) | 1005 | void scsi_device_put(struct scsi_device *sdev) |
1006 | { | 1006 | { |
1007 | #ifdef CONFIG_MODULE_UNLOAD | 1007 | module_put(sdev->host->hostt->module); |
1008 | struct module *module = sdev->host->hostt->module; | ||
1009 | |||
1010 | /* The module refcount will be zero if scsi_device_get() | ||
1011 | * was called from a module removal routine */ | ||
1012 | if (module && module_refcount(module) != 0) | ||
1013 | module_put(module); | ||
1014 | #endif | ||
1015 | put_device(&sdev->sdev_gendev); | 1008 | put_device(&sdev->sdev_gendev); |
1016 | } | 1009 | } |
1017 | EXPORT_SYMBOL(scsi_device_put); | 1010 | EXPORT_SYMBOL(scsi_device_put); |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 7b8b51bc29b4..4aca1b0378c2 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -1623,7 +1623,7 @@ resp_rsup_opcodes(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
1623 | req_opcode = cmd[3]; | 1623 | req_opcode = cmd[3]; |
1624 | req_sa = get_unaligned_be16(cmd + 4); | 1624 | req_sa = get_unaligned_be16(cmd + 4); |
1625 | alloc_len = get_unaligned_be32(cmd + 6); | 1625 | alloc_len = get_unaligned_be32(cmd + 6); |
1626 | if (alloc_len < 4 && alloc_len > 0xffff) { | 1626 | if (alloc_len < 4 || alloc_len > 0xffff) { |
1627 | mk_sense_invalid_fld(scp, SDEB_IN_CDB, 6, -1); | 1627 | mk_sense_invalid_fld(scp, SDEB_IN_CDB, 6, -1); |
1628 | return check_condition_result; | 1628 | return check_condition_result; |
1629 | } | 1629 | } |
@@ -1631,7 +1631,7 @@ resp_rsup_opcodes(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) | |||
1631 | a_len = 8192; | 1631 | a_len = 8192; |
1632 | else | 1632 | else |
1633 | a_len = alloc_len; | 1633 | a_len = alloc_len; |
1634 | arr = kzalloc((a_len < 256) ? 320 : a_len + 64, GFP_KERNEL); | 1634 | arr = kzalloc((a_len < 256) ? 320 : a_len + 64, GFP_ATOMIC); |
1635 | if (NULL == arr) { | 1635 | if (NULL == arr) { |
1636 | mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, | 1636 | mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, |
1637 | INSUFF_RES_ASCQ); | 1637 | INSUFF_RES_ASCQ); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9ea95dd3e260..17bb541f7cc2 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -591,7 +591,6 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) | |||
591 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) | 591 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) |
592 | { | 592 | { |
593 | struct scatterlist *first_chunk = NULL; | 593 | struct scatterlist *first_chunk = NULL; |
594 | gfp_t gfp_mask = mq ? GFP_NOIO : GFP_ATOMIC; | ||
595 | int ret; | 594 | int ret; |
596 | 595 | ||
597 | BUG_ON(!nents); | 596 | BUG_ON(!nents); |
@@ -606,7 +605,7 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) | |||
606 | } | 605 | } |
607 | 606 | ||
608 | ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, | 607 | ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, |
609 | first_chunk, gfp_mask, scsi_sg_alloc); | 608 | first_chunk, GFP_ATOMIC, scsi_sg_alloc); |
610 | if (unlikely(ret)) | 609 | if (unlikely(ret)) |
611 | scsi_free_sgtable(sdb, mq); | 610 | scsi_free_sgtable(sdb, mq); |
612 | return ret; | 611 | return ret; |
@@ -1144,7 +1143,17 @@ int scsi_init_io(struct scsi_cmnd *cmd) | |||
1144 | struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; | 1143 | struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; |
1145 | int ivecs, count; | 1144 | int ivecs, count; |
1146 | 1145 | ||
1147 | BUG_ON(prot_sdb == NULL); | 1146 | if (prot_sdb == NULL) { |
1147 | /* | ||
1148 | * This can happen if someone (e.g. multipath) | ||
1149 | * queues a command to a device on an adapter | ||
1150 | * that does not support DIX. | ||
1151 | */ | ||
1152 | WARN_ON_ONCE(1); | ||
1153 | error = BLKPREP_KILL; | ||
1154 | goto err_exit; | ||
1155 | } | ||
1156 | |||
1148 | ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); | 1157 | ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); |
1149 | 1158 | ||
1150 | if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) { | 1159 | if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) { |
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 7281316a5ecb..a67d37c7e3c0 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c | |||
@@ -271,7 +271,6 @@ int dw_spi_mid_init(struct dw_spi *dws) | |||
271 | iounmap(clk_reg); | 271 | iounmap(clk_reg); |
272 | 272 | ||
273 | dws->num_cs = 16; | 273 | dws->num_cs = 16; |
274 | dws->fifo_len = 40; /* FIFO has 40 words buffer */ | ||
275 | 274 | ||
276 | #ifdef CONFIG_SPI_DW_MID_DMA | 275 | #ifdef CONFIG_SPI_DW_MID_DMA |
277 | dws->dma_priv = kzalloc(sizeof(struct mid_dma), GFP_KERNEL); | 276 | dws->dma_priv = kzalloc(sizeof(struct mid_dma), GFP_KERNEL); |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index d0d5542efc06..8edcd1b84562 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -621,13 +621,13 @@ static void spi_hw_init(struct dw_spi *dws) | |||
621 | if (!dws->fifo_len) { | 621 | if (!dws->fifo_len) { |
622 | u32 fifo; | 622 | u32 fifo; |
623 | 623 | ||
624 | for (fifo = 2; fifo <= 257; fifo++) { | 624 | for (fifo = 2; fifo <= 256; fifo++) { |
625 | dw_writew(dws, DW_SPI_TXFLTR, fifo); | 625 | dw_writew(dws, DW_SPI_TXFLTR, fifo); |
626 | if (fifo != dw_readw(dws, DW_SPI_TXFLTR)) | 626 | if (fifo != dw_readw(dws, DW_SPI_TXFLTR)) |
627 | break; | 627 | break; |
628 | } | 628 | } |
629 | 629 | ||
630 | dws->fifo_len = (fifo == 257) ? 0 : fifo; | 630 | dws->fifo_len = (fifo == 2) ? 0 : fifo - 1; |
631 | dw_writew(dws, DW_SPI_TXFLTR, 0); | 631 | dw_writew(dws, DW_SPI_TXFLTR, 0); |
632 | } | 632 | } |
633 | } | 633 | } |
@@ -673,7 +673,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
673 | if (dws->dma_ops && dws->dma_ops->dma_init) { | 673 | if (dws->dma_ops && dws->dma_ops->dma_init) { |
674 | ret = dws->dma_ops->dma_init(dws); | 674 | ret = dws->dma_ops->dma_init(dws); |
675 | if (ret) { | 675 | if (ret) { |
676 | dev_warn(&master->dev, "DMA init failed\n"); | 676 | dev_warn(dev, "DMA init failed\n"); |
677 | dws->dma_inited = 0; | 677 | dws->dma_inited = 0; |
678 | } | 678 | } |
679 | } | 679 | } |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 05c623cfb078..23822e7df6c1 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -546,8 +546,8 @@ static void giveback(struct driver_data *drv_data) | |||
546 | cs_deassert(drv_data); | 546 | cs_deassert(drv_data); |
547 | } | 547 | } |
548 | 548 | ||
549 | spi_finalize_current_message(drv_data->master); | ||
550 | drv_data->cur_chip = NULL; | 549 | drv_data->cur_chip = NULL; |
550 | spi_finalize_current_message(drv_data->master); | ||
551 | } | 551 | } |
552 | 552 | ||
553 | static void reset_sccr1(struct driver_data *drv_data) | 553 | static void reset_sccr1(struct driver_data *drv_data) |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 96a5fc0878d8..3ab7a21445fc 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -82,7 +82,7 @@ struct sh_msiof_spi_priv { | |||
82 | #define MDR1_SYNCMD_LR 0x30000000 /* L/R mode */ | 82 | #define MDR1_SYNCMD_LR 0x30000000 /* L/R mode */ |
83 | #define MDR1_SYNCAC_SHIFT 25 /* Sync Polarity (1 = Active-low) */ | 83 | #define MDR1_SYNCAC_SHIFT 25 /* Sync Polarity (1 = Active-low) */ |
84 | #define MDR1_BITLSB_SHIFT 24 /* MSB/LSB First (1 = LSB first) */ | 84 | #define MDR1_BITLSB_SHIFT 24 /* MSB/LSB First (1 = LSB first) */ |
85 | #define MDR1_FLD_MASK 0x000000c0 /* Frame Sync Signal Interval (0-3) */ | 85 | #define MDR1_FLD_MASK 0x0000000c /* Frame Sync Signal Interval (0-3) */ |
86 | #define MDR1_FLD_SHIFT 2 | 86 | #define MDR1_FLD_SHIFT 2 |
87 | #define MDR1_XXSTP 0x00000001 /* Transmission/Reception Stop on FIFO */ | 87 | #define MDR1_XXSTP 0x00000001 /* Transmission/Reception Stop on FIFO */ |
88 | /* TMDR1 */ | 88 | /* TMDR1 */ |
diff --git a/drivers/staging/media/tlg2300/Kconfig b/drivers/staging/media/tlg2300/Kconfig index 81784c6f7b88..77d8753f6ba4 100644 --- a/drivers/staging/media/tlg2300/Kconfig +++ b/drivers/staging/media/tlg2300/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config VIDEO_TLG2300 | 1 | config VIDEO_TLG2300 |
2 | tristate "Telegent TLG2300 USB video capture support (Deprecated)" | 2 | tristate "Telegent TLG2300 USB video capture support (Deprecated)" |
3 | depends on VIDEO_DEV && I2C && SND && DVB_CORE | 3 | depends on VIDEO_DEV && I2C && SND && DVB_CORE |
4 | depends on MEDIA_USB_SUPPORT | ||
4 | select VIDEO_TUNER | 5 | select VIDEO_TUNER |
5 | select VIDEO_TVEEPROM | 6 | select VIDEO_TVEEPROM |
6 | depends on RC_CORE | 7 | depends on RC_CORE |
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 86c72ba0a0cd..f8c5fc371c4c 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c | |||
@@ -2177,7 +2177,7 @@ bool BBbVT3253Init(struct vnt_private *priv) | |||
2177 | /* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ | 2177 | /* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ |
2178 | /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/ | 2178 | /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/ |
2179 | /* Select VC1/VC2, CR215 = 0x02->0x06 */ | 2179 | /* Select VC1/VC2, CR215 = 0x02->0x06 */ |
2180 | bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06); | 2180 | bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06); |
2181 | /* }} */ | 2181 | /* }} */ |
2182 | 2182 | ||
2183 | for (ii = 0; ii < CB_VT3253B0_AGC; ii++) | 2183 | for (ii = 0; ii < CB_VT3253B0_AGC; ii++) |
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index c8f739dd346e..70f870541f92 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c | |||
@@ -182,6 +182,14 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) | |||
182 | if (pDevice->byCurrentCh == uConnectionChannel) | 182 | if (pDevice->byCurrentCh == uConnectionChannel) |
183 | return bResult; | 183 | return bResult; |
184 | 184 | ||
185 | /* Set VGA to max sensitivity */ | ||
186 | if (pDevice->bUpdateBBVGA && | ||
187 | pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) { | ||
188 | pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; | ||
189 | |||
190 | BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); | ||
191 | } | ||
192 | |||
185 | /* clear NAV */ | 193 | /* clear NAV */ |
186 | MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV); | 194 | MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV); |
187 | 195 | ||
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 83e4162c0094..cd1a277d853b 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -1232,7 +1232,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1232 | 1232 | ||
1233 | head_td = priv->apCurrTD[dma_idx]; | 1233 | head_td = priv->apCurrTD[dma_idx]; |
1234 | 1234 | ||
1235 | head_td->m_td1TD1.byTCR = (TCR_EDP|TCR_STP); | 1235 | head_td->m_td1TD1.byTCR = 0; |
1236 | 1236 | ||
1237 | head_td->pTDInfo->skb = skb; | 1237 | head_td->pTDInfo->skb = skb; |
1238 | 1238 | ||
@@ -1257,6 +1257,11 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1257 | 1257 | ||
1258 | priv->bPWBitOn = false; | 1258 | priv->bPWBitOn = false; |
1259 | 1259 | ||
1260 | /* Set TSR1 & ReqCount in TxDescHead */ | ||
1261 | head_td->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU); | ||
1262 | head_td->m_td1TD1.wReqCount = | ||
1263 | cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); | ||
1264 | |||
1260 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; | 1265 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; |
1261 | 1266 | ||
1262 | if (dma_idx == TYPE_AC0DMA) | 1267 | if (dma_idx == TYPE_AC0DMA) |
@@ -1500,9 +1505,11 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
1500 | if (conf->enable_beacon) { | 1505 | if (conf->enable_beacon) { |
1501 | vnt_beacon_enable(priv, vif, conf); | 1506 | vnt_beacon_enable(priv, vif, conf); |
1502 | 1507 | ||
1503 | MACvRegBitsOn(priv, MAC_REG_TCR, TCR_AUTOBCNTX); | 1508 | MACvRegBitsOn(priv->PortOffset, MAC_REG_TCR, |
1509 | TCR_AUTOBCNTX); | ||
1504 | } else { | 1510 | } else { |
1505 | MACvRegBitsOff(priv, MAC_REG_TCR, TCR_AUTOBCNTX); | 1511 | MACvRegBitsOff(priv->PortOffset, MAC_REG_TCR, |
1512 | TCR_AUTOBCNTX); | ||
1506 | } | 1513 | } |
1507 | } | 1514 | } |
1508 | 1515 | ||
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 61c39dd7ad01..b5b0155961f2 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c | |||
@@ -1204,13 +1204,10 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, | |||
1204 | 1204 | ||
1205 | ptdCurr = (PSTxDesc)pHeadTD; | 1205 | ptdCurr = (PSTxDesc)pHeadTD; |
1206 | 1206 | ||
1207 | ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; | 1207 | ptdCurr->pTDInfo->dwReqCount = cbReqCount; |
1208 | ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; | 1208 | ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; |
1209 | ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; | 1209 | ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; |
1210 | ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma); | 1210 | ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma); |
1211 | /* Set TSR1 & ReqCount in TxDescHead */ | ||
1212 | ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU); | ||
1213 | ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount)); | ||
1214 | 1211 | ||
1215 | return cbHeaderLength; | 1212 | return cbHeaderLength; |
1216 | } | 1213 | } |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index c1188ac053c9..2ccbc0788353 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -608,6 +608,7 @@ static int imx_thermal_suspend(struct device *dev) | |||
608 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP); | 608 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP); |
609 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); | 609 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); |
610 | data->mode = THERMAL_DEVICE_DISABLED; | 610 | data->mode = THERMAL_DEVICE_DISABLED; |
611 | clk_disable_unprepare(data->thermal_clk); | ||
611 | 612 | ||
612 | return 0; | 613 | return 0; |
613 | } | 614 | } |
@@ -617,6 +618,7 @@ static int imx_thermal_resume(struct device *dev) | |||
617 | struct imx_thermal_data *data = dev_get_drvdata(dev); | 618 | struct imx_thermal_data *data = dev_get_drvdata(dev); |
618 | struct regmap *map = data->tempmon; | 619 | struct regmap *map = data->tempmon; |
619 | 620 | ||
621 | clk_prepare_enable(data->thermal_clk); | ||
620 | /* Enabled thermal sensor after resume */ | 622 | /* Enabled thermal sensor after resume */ |
621 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN); | 623 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN); |
622 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP); | 624 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP); |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index e145b66df444..d717f3dab6f1 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(of_thermal_is_trip_valid); | |||
149 | * | 149 | * |
150 | * Return: pointer to trip points table, NULL otherwise | 150 | * Return: pointer to trip points table, NULL otherwise |
151 | */ | 151 | */ |
152 | const struct thermal_trip * const | 152 | const struct thermal_trip * |
153 | of_thermal_get_trip_points(struct thermal_zone_device *tz) | 153 | of_thermal_get_trip_points(struct thermal_zone_device *tz) |
154 | { | 154 | { |
155 | struct __thermal_zone *data = tz->devdata; | 155 | struct __thermal_zone *data = tz->devdata; |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 8803e693fe68..2580a4872f90 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -63,7 +63,7 @@ struct rcar_thermal_priv { | |||
63 | struct mutex lock; | 63 | struct mutex lock; |
64 | struct list_head list; | 64 | struct list_head list; |
65 | int id; | 65 | int id; |
66 | int ctemp; | 66 | u32 ctemp; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define rcar_thermal_for_each_priv(pos, common) \ | 69 | #define rcar_thermal_for_each_priv(pos, common) \ |
@@ -145,7 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
145 | { | 145 | { |
146 | struct device *dev = rcar_priv_to_dev(priv); | 146 | struct device *dev = rcar_priv_to_dev(priv); |
147 | int i; | 147 | int i; |
148 | int ctemp, old, new; | 148 | u32 ctemp, old, new; |
149 | int ret = -EINVAL; | 149 | int ret = -EINVAL; |
150 | 150 | ||
151 | mutex_lock(&priv->lock); | 151 | mutex_lock(&priv->lock); |
@@ -372,6 +372,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
372 | int i; | 372 | int i; |
373 | int ret = -ENODEV; | 373 | int ret = -ENODEV; |
374 | int idle = IDLE_INTERVAL; | 374 | int idle = IDLE_INTERVAL; |
375 | u32 enr_bits = 0; | ||
375 | 376 | ||
376 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); | 377 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
377 | if (!common) | 378 | if (!common) |
@@ -390,7 +391,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
390 | 391 | ||
391 | /* | 392 | /* |
392 | * platform has IRQ support. | 393 | * platform has IRQ support. |
393 | * Then, drier use common register | 394 | * Then, driver uses common registers |
394 | */ | 395 | */ |
395 | 396 | ||
396 | ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, | 397 | ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, |
@@ -408,9 +409,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
408 | if (IS_ERR(common->base)) | 409 | if (IS_ERR(common->base)) |
409 | return PTR_ERR(common->base); | 410 | return PTR_ERR(common->base); |
410 | 411 | ||
411 | /* enable temperature comparation */ | ||
412 | rcar_thermal_common_write(common, ENR, 0x00030303); | ||
413 | |||
414 | idle = 0; /* polling delay is not needed */ | 412 | idle = 0; /* polling delay is not needed */ |
415 | } | 413 | } |
416 | 414 | ||
@@ -452,8 +450,15 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
452 | rcar_thermal_irq_enable(priv); | 450 | rcar_thermal_irq_enable(priv); |
453 | 451 | ||
454 | list_move_tail(&priv->list, &common->head); | 452 | list_move_tail(&priv->list, &common->head); |
453 | |||
454 | /* update ENR bits */ | ||
455 | enr_bits |= 3 << (i * 8); | ||
455 | } | 456 | } |
456 | 457 | ||
458 | /* enable temperature comparation */ | ||
459 | if (irq) | ||
460 | rcar_thermal_common_write(common, ENR, enr_bits); | ||
461 | |||
457 | platform_set_drvdata(pdev, common); | 462 | platform_set_drvdata(pdev, common); |
458 | 463 | ||
459 | dev_info(dev, "%d sensor probed\n", i); | 464 | dev_info(dev, "%d sensor probed\n", i); |
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 9083e7520623..0531c752fbbb 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h | |||
@@ -91,7 +91,7 @@ int of_parse_thermal_zones(void); | |||
91 | void of_thermal_destroy_zones(void); | 91 | void of_thermal_destroy_zones(void); |
92 | int of_thermal_get_ntrips(struct thermal_zone_device *); | 92 | int of_thermal_get_ntrips(struct thermal_zone_device *); |
93 | bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); | 93 | bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); |
94 | const struct thermal_trip * const | 94 | const struct thermal_trip * |
95 | of_thermal_get_trip_points(struct thermal_zone_device *); | 95 | of_thermal_get_trip_points(struct thermal_zone_device *); |
96 | #else | 96 | #else |
97 | static inline int of_parse_thermal_zones(void) { return 0; } | 97 | static inline int of_parse_thermal_zones(void) { return 0; } |
@@ -105,7 +105,7 @@ static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, | |||
105 | { | 105 | { |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | static inline const struct thermal_trip * const | 108 | static inline const struct thermal_trip * |
109 | of_thermal_get_trip_points(struct thermal_zone_device *tz) | 109 | of_thermal_get_trip_points(struct thermal_zone_device *tz) |
110 | { | 110 | { |
111 | return NULL; | 111 | return NULL; |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index d2b496750d59..4ddfa60c9222 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2399,17 +2399,12 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, | |||
2399 | 2399 | ||
2400 | poll_wait(file, &tty->read_wait, wait); | 2400 | poll_wait(file, &tty->read_wait, wait); |
2401 | poll_wait(file, &tty->write_wait, wait); | 2401 | poll_wait(file, &tty->write_wait, wait); |
2402 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2403 | mask |= POLLHUP; | ||
2404 | if (input_available_p(tty, 1)) | 2402 | if (input_available_p(tty, 1)) |
2405 | mask |= POLLIN | POLLRDNORM; | 2403 | mask |= POLLIN | POLLRDNORM; |
2406 | else if (mask & POLLHUP) { | ||
2407 | tty_flush_to_ldisc(tty); | ||
2408 | if (input_available_p(tty, 1)) | ||
2409 | mask |= POLLIN | POLLRDNORM; | ||
2410 | } | ||
2411 | if (tty->packet && tty->link->ctrl_status) | 2404 | if (tty->packet && tty->link->ctrl_status) |
2412 | mask |= POLLPRI | POLLIN | POLLRDNORM; | 2405 | mask |= POLLPRI | POLLIN | POLLRDNORM; |
2406 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2407 | mask |= POLLHUP; | ||
2413 | if (tty_hung_up_p(file)) | 2408 | if (tty_hung_up_p(file)) |
2414 | mask |= POLLHUP; | 2409 | mask |= POLLHUP; |
2415 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { | 2410 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 31feeb2d0a66..d1f8dc6aabcb 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1815,7 +1815,7 @@ pci_wch_ch353_setup(struct serial_private *priv, | |||
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | static int | 1817 | static int |
1818 | pci_wch_ch382_setup(struct serial_private *priv, | 1818 | pci_wch_ch38x_setup(struct serial_private *priv, |
1819 | const struct pciserial_board *board, | 1819 | const struct pciserial_board *board, |
1820 | struct uart_8250_port *port, int idx) | 1820 | struct uart_8250_port *port, int idx) |
1821 | { | 1821 | { |
@@ -1880,6 +1880,7 @@ pci_wch_ch382_setup(struct serial_private *priv, | |||
1880 | 1880 | ||
1881 | #define PCIE_VENDOR_ID_WCH 0x1c00 | 1881 | #define PCIE_VENDOR_ID_WCH 0x1c00 |
1882 | #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 | 1882 | #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 |
1883 | #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 | ||
1883 | 1884 | ||
1884 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ | 1885 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ |
1885 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 | 1886 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 |
@@ -2571,13 +2572,21 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
2571 | .subdevice = PCI_ANY_ID, | 2572 | .subdevice = PCI_ANY_ID, |
2572 | .setup = pci_wch_ch353_setup, | 2573 | .setup = pci_wch_ch353_setup, |
2573 | }, | 2574 | }, |
2574 | /* WCH CH382 2S1P card (16750 clone) */ | 2575 | /* WCH CH382 2S1P card (16850 clone) */ |
2575 | { | 2576 | { |
2576 | .vendor = PCIE_VENDOR_ID_WCH, | 2577 | .vendor = PCIE_VENDOR_ID_WCH, |
2577 | .device = PCIE_DEVICE_ID_WCH_CH382_2S1P, | 2578 | .device = PCIE_DEVICE_ID_WCH_CH382_2S1P, |
2578 | .subvendor = PCI_ANY_ID, | 2579 | .subvendor = PCI_ANY_ID, |
2579 | .subdevice = PCI_ANY_ID, | 2580 | .subdevice = PCI_ANY_ID, |
2580 | .setup = pci_wch_ch382_setup, | 2581 | .setup = pci_wch_ch38x_setup, |
2582 | }, | ||
2583 | /* WCH CH384 4S card (16850 clone) */ | ||
2584 | { | ||
2585 | .vendor = PCIE_VENDOR_ID_WCH, | ||
2586 | .device = PCIE_DEVICE_ID_WCH_CH384_4S, | ||
2587 | .subvendor = PCI_ANY_ID, | ||
2588 | .subdevice = PCI_ANY_ID, | ||
2589 | .setup = pci_wch_ch38x_setup, | ||
2581 | }, | 2590 | }, |
2582 | /* | 2591 | /* |
2583 | * ASIX devices with FIFO bug | 2592 | * ASIX devices with FIFO bug |
@@ -2876,6 +2885,7 @@ enum pci_board_num_t { | |||
2876 | pbn_fintek_4, | 2885 | pbn_fintek_4, |
2877 | pbn_fintek_8, | 2886 | pbn_fintek_8, |
2878 | pbn_fintek_12, | 2887 | pbn_fintek_12, |
2888 | pbn_wch384_4, | ||
2879 | }; | 2889 | }; |
2880 | 2890 | ||
2881 | /* | 2891 | /* |
@@ -3675,6 +3685,14 @@ static struct pciserial_board pci_boards[] = { | |||
3675 | .base_baud = 115200, | 3685 | .base_baud = 115200, |
3676 | .first_offset = 0x40, | 3686 | .first_offset = 0x40, |
3677 | }, | 3687 | }, |
3688 | |||
3689 | [pbn_wch384_4] = { | ||
3690 | .flags = FL_BASE0, | ||
3691 | .num_ports = 4, | ||
3692 | .base_baud = 115200, | ||
3693 | .uart_offset = 8, | ||
3694 | .first_offset = 0xC0, | ||
3695 | }, | ||
3678 | }; | 3696 | }; |
3679 | 3697 | ||
3680 | static const struct pci_device_id blacklist[] = { | 3698 | static const struct pci_device_id blacklist[] = { |
@@ -3687,6 +3705,7 @@ static const struct pci_device_id blacklist[] = { | |||
3687 | { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */ | 3705 | { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */ |
3688 | { PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */ | 3706 | { PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */ |
3689 | { PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */ | 3707 | { PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */ |
3708 | { PCI_DEVICE(0x1c00, 0x3470), }, /* WCH CH384 4S */ | ||
3690 | }; | 3709 | }; |
3691 | 3710 | ||
3692 | /* | 3711 | /* |
@@ -5400,6 +5419,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
5400 | PCI_ANY_ID, PCI_ANY_ID, | 5419 | PCI_ANY_ID, PCI_ANY_ID, |
5401 | 0, 0, pbn_b0_bt_2_115200 }, | 5420 | 0, 0, pbn_b0_bt_2_115200 }, |
5402 | 5421 | ||
5422 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, | ||
5423 | PCI_ANY_ID, PCI_ANY_ID, | ||
5424 | 0, 0, pbn_wch384_4 }, | ||
5425 | |||
5403 | /* | 5426 | /* |
5404 | * Commtech, Inc. Fastcom adapters | 5427 | * Commtech, Inc. Fastcom adapters |
5405 | */ | 5428 | */ |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 19273e31d224..107e80722575 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -1757,32 +1757,43 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { | |||
1757 | #endif | 1757 | #endif |
1758 | 1758 | ||
1759 | #if defined(CONFIG_ARCH_EXYNOS) | 1759 | #if defined(CONFIG_ARCH_EXYNOS) |
1760 | #define EXYNOS_COMMON_SERIAL_DRV_DATA \ | ||
1761 | .info = &(struct s3c24xx_uart_info) { \ | ||
1762 | .name = "Samsung Exynos UART", \ | ||
1763 | .type = PORT_S3C6400, \ | ||
1764 | .has_divslot = 1, \ | ||
1765 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, \ | ||
1766 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, \ | ||
1767 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, \ | ||
1768 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, \ | ||
1769 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, \ | ||
1770 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, \ | ||
1771 | .def_clk_sel = S3C2410_UCON_CLKSEL0, \ | ||
1772 | .num_clks = 1, \ | ||
1773 | .clksel_mask = 0, \ | ||
1774 | .clksel_shift = 0, \ | ||
1775 | }, \ | ||
1776 | .def_cfg = &(struct s3c2410_uartcfg) { \ | ||
1777 | .ucon = S5PV210_UCON_DEFAULT, \ | ||
1778 | .ufcon = S5PV210_UFCON_DEFAULT, \ | ||
1779 | .has_fracval = 1, \ | ||
1780 | } \ | ||
1781 | |||
1760 | static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { | 1782 | static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { |
1761 | .info = &(struct s3c24xx_uart_info) { | 1783 | EXYNOS_COMMON_SERIAL_DRV_DATA, |
1762 | .name = "Samsung Exynos4 UART", | ||
1763 | .type = PORT_S3C6400, | ||
1764 | .has_divslot = 1, | ||
1765 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, | ||
1766 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, | ||
1767 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, | ||
1768 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, | ||
1769 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, | ||
1770 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, | ||
1771 | .def_clk_sel = S3C2410_UCON_CLKSEL0, | ||
1772 | .num_clks = 1, | ||
1773 | .clksel_mask = 0, | ||
1774 | .clksel_shift = 0, | ||
1775 | }, | ||
1776 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1777 | .ucon = S5PV210_UCON_DEFAULT, | ||
1778 | .ufcon = S5PV210_UFCON_DEFAULT, | ||
1779 | .has_fracval = 1, | ||
1780 | }, | ||
1781 | .fifosize = { 256, 64, 16, 16 }, | 1784 | .fifosize = { 256, 64, 16, 16 }, |
1782 | }; | 1785 | }; |
1786 | |||
1787 | static struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = { | ||
1788 | EXYNOS_COMMON_SERIAL_DRV_DATA, | ||
1789 | .fifosize = { 64, 256, 16, 256 }, | ||
1790 | }; | ||
1791 | |||
1783 | #define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data) | 1792 | #define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data) |
1793 | #define EXYNOS5433_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos5433_serial_drv_data) | ||
1784 | #else | 1794 | #else |
1785 | #define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL | 1795 | #define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL |
1796 | #define EXYNOS5433_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1786 | #endif | 1797 | #endif |
1787 | 1798 | ||
1788 | static struct platform_device_id s3c24xx_serial_driver_ids[] = { | 1799 | static struct platform_device_id s3c24xx_serial_driver_ids[] = { |
@@ -1804,6 +1815,9 @@ static struct platform_device_id s3c24xx_serial_driver_ids[] = { | |||
1804 | }, { | 1815 | }, { |
1805 | .name = "exynos4210-uart", | 1816 | .name = "exynos4210-uart", |
1806 | .driver_data = EXYNOS4210_SERIAL_DRV_DATA, | 1817 | .driver_data = EXYNOS4210_SERIAL_DRV_DATA, |
1818 | }, { | ||
1819 | .name = "exynos5433-uart", | ||
1820 | .driver_data = EXYNOS5433_SERIAL_DRV_DATA, | ||
1807 | }, | 1821 | }, |
1808 | { }, | 1822 | { }, |
1809 | }; | 1823 | }; |
@@ -1823,6 +1837,8 @@ static const struct of_device_id s3c24xx_uart_dt_match[] = { | |||
1823 | .data = (void *)S5PV210_SERIAL_DRV_DATA }, | 1837 | .data = (void *)S5PV210_SERIAL_DRV_DATA }, |
1824 | { .compatible = "samsung,exynos4210-uart", | 1838 | { .compatible = "samsung,exynos4210-uart", |
1825 | .data = (void *)EXYNOS4210_SERIAL_DRV_DATA }, | 1839 | .data = (void *)EXYNOS4210_SERIAL_DRV_DATA }, |
1840 | { .compatible = "samsung,exynos5433-uart", | ||
1841 | .data = (void *)EXYNOS5433_SERIAL_DRV_DATA }, | ||
1826 | {}, | 1842 | {}, |
1827 | }; | 1843 | }; |
1828 | MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match); | 1844 | MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match); |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 57ca61b14670..984605bb5bf1 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -2164,7 +2164,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2164 | break; | 2164 | break; |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | dev_info(port->dev, "%s%d at %s (irq = %d, base_baud = %d) is a %s\n", | 2167 | printk(KERN_INFO "%s%s%s%d at %s (irq = %d, base_baud = %d) is a %s\n", |
2168 | port->dev ? dev_name(port->dev) : "", | ||
2169 | port->dev ? ": " : "", | ||
2168 | drv->dev_name, | 2170 | drv->dev_name, |
2169 | drv->tty_driver->name_base + port->line, | 2171 | drv->tty_driver->name_base + port->line, |
2170 | address, port->irq, port->uartclk / 16, uart_type(port)); | 2172 | address, port->irq, port->uartclk / 16, uart_type(port)); |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 4f35b43e2475..51f066aa375e 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1464,6 +1464,9 @@ static int tty_reopen(struct tty_struct *tty) | |||
1464 | driver->subtype == PTY_TYPE_MASTER) | 1464 | driver->subtype == PTY_TYPE_MASTER) |
1465 | return -EIO; | 1465 | return -EIO; |
1466 | 1466 | ||
1467 | if (test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN)) | ||
1468 | return -EBUSY; | ||
1469 | |||
1467 | tty->count++; | 1470 | tty->count++; |
1468 | 1471 | ||
1469 | WARN_ON(!tty->ldisc); | 1472 | WARN_ON(!tty->ldisc); |
@@ -2106,10 +2109,6 @@ retry_open: | |||
2106 | retval = -ENODEV; | 2109 | retval = -ENODEV; |
2107 | filp->f_flags = saved_flags; | 2110 | filp->f_flags = saved_flags; |
2108 | 2111 | ||
2109 | if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) && | ||
2110 | !capable(CAP_SYS_ADMIN)) | ||
2111 | retval = -EBUSY; | ||
2112 | |||
2113 | if (retval) { | 2112 | if (retval) { |
2114 | #ifdef TTY_DEBUG_HANGUP | 2113 | #ifdef TTY_DEBUG_HANGUP |
2115 | printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__, | 2114 | printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__, |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5b9825a4538a..a57dc8866fc5 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -669,7 +669,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
669 | if (!ci) | 669 | if (!ci) |
670 | return -ENOMEM; | 670 | return -ENOMEM; |
671 | 671 | ||
672 | platform_set_drvdata(pdev, ci); | ||
673 | ci->dev = dev; | 672 | ci->dev = dev; |
674 | ci->platdata = dev_get_platdata(dev); | 673 | ci->platdata = dev_get_platdata(dev); |
675 | ci->imx28_write_fix = !!(ci->platdata->flags & | 674 | ci->imx28_write_fix = !!(ci->platdata->flags & |
@@ -783,6 +782,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
783 | } | 782 | } |
784 | } | 783 | } |
785 | 784 | ||
785 | platform_set_drvdata(pdev, ci); | ||
786 | ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, | 786 | ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, |
787 | ci->platdata->name, ci); | 787 | ci->platdata->name, ci); |
788 | if (ret) | 788 | if (ret) |
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index c1694cff1eaf..48731d0bab35 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c | |||
@@ -91,6 +91,7 @@ static int host_start(struct ci_hdrc *ci) | |||
91 | if (!hcd) | 91 | if (!hcd) |
92 | return -ENOMEM; | 92 | return -ENOMEM; |
93 | 93 | ||
94 | dev_set_drvdata(ci->dev, ci); | ||
94 | hcd->rsrc_start = ci->hw_bank.phys; | 95 | hcd->rsrc_start = ci->hw_bank.phys; |
95 | hcd->rsrc_len = ci->hw_bank.size; | 96 | hcd->rsrc_len = ci->hw_bank.size; |
96 | hcd->regs = ci->hw_bank.abs; | 97 | hcd->regs = ci->hw_bank.abs; |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168ec2d75..79242008085b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -2567,7 +2567,7 @@ error: | |||
2567 | * s3c_hsotg_ep_disable - disable given endpoint | 2567 | * s3c_hsotg_ep_disable - disable given endpoint |
2568 | * @ep: The endpoint to disable. | 2568 | * @ep: The endpoint to disable. |
2569 | */ | 2569 | */ |
2570 | static int s3c_hsotg_ep_disable(struct usb_ep *ep) | 2570 | static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) |
2571 | { | 2571 | { |
2572 | struct s3c_hsotg_ep *hs_ep = our_ep(ep); | 2572 | struct s3c_hsotg_ep *hs_ep = our_ep(ep); |
2573 | struct dwc2_hsotg *hsotg = hs_ep->parent; | 2573 | struct dwc2_hsotg *hsotg = hs_ep->parent; |
@@ -2588,7 +2588,7 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep) | |||
2588 | 2588 | ||
2589 | spin_lock_irqsave(&hsotg->lock, flags); | 2589 | spin_lock_irqsave(&hsotg->lock, flags); |
2590 | /* terminate all requests with shutdown */ | 2590 | /* terminate all requests with shutdown */ |
2591 | kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false); | 2591 | kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, force); |
2592 | 2592 | ||
2593 | hsotg->fifo_map &= ~(1<<hs_ep->fifo_index); | 2593 | hsotg->fifo_map &= ~(1<<hs_ep->fifo_index); |
2594 | hs_ep->fifo_index = 0; | 2594 | hs_ep->fifo_index = 0; |
@@ -2609,6 +2609,10 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep) | |||
2609 | return 0; | 2609 | return 0; |
2610 | } | 2610 | } |
2611 | 2611 | ||
2612 | static int s3c_hsotg_ep_disable(struct usb_ep *ep) | ||
2613 | { | ||
2614 | return s3c_hsotg_ep_disable_force(ep, false); | ||
2615 | } | ||
2612 | /** | 2616 | /** |
2613 | * on_list - check request is on the given endpoint | 2617 | * on_list - check request is on the given endpoint |
2614 | * @ep: The endpoint to check. | 2618 | * @ep: The endpoint to check. |
@@ -2924,7 +2928,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) | |||
2924 | 2928 | ||
2925 | /* all endpoints should be shutdown */ | 2929 | /* all endpoints should be shutdown */ |
2926 | for (ep = 1; ep < hsotg->num_of_eps; ep++) | 2930 | for (ep = 1; ep < hsotg->num_of_eps; ep++) |
2927 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2931 | s3c_hsotg_ep_disable_force(&hsotg->eps[ep].ep, true); |
2928 | 2932 | ||
2929 | spin_lock_irqsave(&hsotg->lock, flags); | 2933 | spin_lock_irqsave(&hsotg->lock, flags); |
2930 | 2934 | ||
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 7c4faf738747..b642a2f998f9 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 | 33 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 |
34 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e | 34 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e |
35 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 | 35 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 |
36 | #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 | ||
37 | #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 | ||
36 | 38 | ||
37 | struct dwc3_pci { | 39 | struct dwc3_pci { |
38 | struct device *dev; | 40 | struct device *dev; |
@@ -219,6 +221,8 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
219 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, | 221 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, |
220 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, | 222 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, |
221 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, | 223 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, |
224 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTLP), }, | ||
225 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTH), }, | ||
222 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, | 226 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, |
223 | { } /* Terminating Entry */ | 227 | { } /* Terminating Entry */ |
224 | }; | 228 | }; |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f03b136ecfce..8f65ab3a3b92 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -882,8 +882,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) | |||
882 | 882 | ||
883 | if (i == (request->num_mapped_sgs - 1) || | 883 | if (i == (request->num_mapped_sgs - 1) || |
884 | sg_is_last(s)) { | 884 | sg_is_last(s)) { |
885 | if (list_is_last(&req->list, | 885 | if (list_empty(&dep->request_list)) |
886 | &dep->request_list)) | ||
887 | last_one = true; | 886 | last_one = true; |
888 | chain = false; | 887 | chain = false; |
889 | } | 888 | } |
@@ -901,6 +900,9 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) | |||
901 | if (last_one) | 900 | if (last_one) |
902 | break; | 901 | break; |
903 | } | 902 | } |
903 | |||
904 | if (last_one) | ||
905 | break; | ||
904 | } else { | 906 | } else { |
905 | dma = req->request.dma; | 907 | dma = req->request.dma; |
906 | length = req->request.length; | 908 | length = req->request.length; |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 6e04e302dc3a..a1bc3e3a0b09 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -399,8 +399,9 @@ static int hidg_setup(struct usb_function *f, | |||
399 | value = __le16_to_cpu(ctrl->wValue); | 399 | value = __le16_to_cpu(ctrl->wValue); |
400 | length = __le16_to_cpu(ctrl->wLength); | 400 | length = __le16_to_cpu(ctrl->wLength); |
401 | 401 | ||
402 | VDBG(cdev, "hid_setup crtl_request : bRequestType:0x%x bRequest:0x%x " | 402 | VDBG(cdev, |
403 | "Value:0x%x\n", ctrl->bRequestType, ctrl->bRequest, value); | 403 | "%s crtl_request : bRequestType:0x%x bRequest:0x%x Value:0x%x\n", |
404 | __func__, ctrl->bRequestType, ctrl->bRequest, value); | ||
404 | 405 | ||
405 | switch ((ctrl->bRequestType << 8) | ctrl->bRequest) { | 406 | switch ((ctrl->bRequestType << 8) | ctrl->bRequest) { |
406 | case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 | 407 | case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 |
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index a90440300735..259b656c0b3e 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -520,7 +520,7 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req) | |||
520 | req = midi_alloc_ep_req(ep, midi->buflen); | 520 | req = midi_alloc_ep_req(ep, midi->buflen); |
521 | 521 | ||
522 | if (!req) { | 522 | if (!req) { |
523 | ERROR(midi, "gmidi_transmit: alloc_ep_request failed\n"); | 523 | ERROR(midi, "%s: alloc_ep_request failed\n", __func__); |
524 | return; | 524 | return; |
525 | } | 525 | } |
526 | req->length = 0; | 526 | req->length = 0; |
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index f7b203293205..e9715845f82e 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c | |||
@@ -897,7 +897,6 @@ static void f_audio_free_inst(struct usb_function_instance *f) | |||
897 | struct f_uac1_opts *opts; | 897 | struct f_uac1_opts *opts; |
898 | 898 | ||
899 | opts = container_of(f, struct f_uac1_opts, func_inst); | 899 | opts = container_of(f, struct f_uac1_opts, func_inst); |
900 | gaudio_cleanup(opts->card); | ||
901 | if (opts->fn_play_alloc) | 900 | if (opts->fn_play_alloc) |
902 | kfree(opts->fn_play); | 901 | kfree(opts->fn_play); |
903 | if (opts->fn_cap_alloc) | 902 | if (opts->fn_cap_alloc) |
@@ -935,6 +934,7 @@ static void f_audio_free(struct usb_function *f) | |||
935 | struct f_audio *audio = func_to_audio(f); | 934 | struct f_audio *audio = func_to_audio(f); |
936 | struct f_uac1_opts *opts; | 935 | struct f_uac1_opts *opts; |
937 | 936 | ||
937 | gaudio_cleanup(&audio->card); | ||
938 | opts = container_of(f->fi, struct f_uac1_opts, func_inst); | 938 | opts = container_of(f->fi, struct f_uac1_opts, func_inst); |
939 | kfree(audio); | 939 | kfree(audio); |
940 | mutex_lock(&opts->lock); | 940 | mutex_lock(&opts->lock); |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index c744e4975d74..db49ec4c748e 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
@@ -441,6 +441,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
441 | kbuf = memdup_user(buf, len); | 441 | kbuf = memdup_user(buf, len); |
442 | if (IS_ERR(kbuf)) { | 442 | if (IS_ERR(kbuf)) { |
443 | value = PTR_ERR(kbuf); | 443 | value = PTR_ERR(kbuf); |
444 | kbuf = NULL; | ||
444 | goto free1; | 445 | goto free1; |
445 | } | 446 | } |
446 | 447 | ||
@@ -449,6 +450,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
449 | data->name, len, (int) value); | 450 | data->name, len, (int) value); |
450 | free1: | 451 | free1: |
451 | mutex_unlock(&data->lock); | 452 | mutex_unlock(&data->lock); |
453 | kfree (kbuf); | ||
452 | return value; | 454 | return value; |
453 | } | 455 | } |
454 | 456 | ||
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index ce882371786b..9f93bed42052 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c | |||
@@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep, | |||
716 | req->using_dma = 1; | 716 | req->using_dma = 1; |
717 | req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length) | 717 | req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length) |
718 | | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE | 718 | | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE |
719 | | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE; | 719 | | USBA_DMA_END_BUF_EN; |
720 | 720 | ||
721 | if (ep->is_in) | 721 | if (!ep->is_in) |
722 | req->ctrl |= USBA_DMA_END_BUF_EN; | 722 | req->ctrl |= USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE; |
723 | 723 | ||
724 | /* | 724 | /* |
725 | * Add this request to the queue and submit for DMA if | 725 | * Add this request to the queue and submit for DMA if |
@@ -828,7 +828,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
828 | { | 828 | { |
829 | struct usba_ep *ep = to_usba_ep(_ep); | 829 | struct usba_ep *ep = to_usba_ep(_ep); |
830 | struct usba_udc *udc = ep->udc; | 830 | struct usba_udc *udc = ep->udc; |
831 | struct usba_request *req = to_usba_req(_req); | 831 | struct usba_request *req; |
832 | unsigned long flags; | 832 | unsigned long flags; |
833 | u32 status; | 833 | u32 status; |
834 | 834 | ||
@@ -837,6 +837,16 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
837 | 837 | ||
838 | spin_lock_irqsave(&udc->lock, flags); | 838 | spin_lock_irqsave(&udc->lock, flags); |
839 | 839 | ||
840 | list_for_each_entry(req, &ep->queue, queue) { | ||
841 | if (&req->req == _req) | ||
842 | break; | ||
843 | } | ||
844 | |||
845 | if (&req->req != _req) { | ||
846 | spin_unlock_irqrestore(&udc->lock, flags); | ||
847 | return -EINVAL; | ||
848 | } | ||
849 | |||
840 | if (req->using_dma) { | 850 | if (req->using_dma) { |
841 | /* | 851 | /* |
842 | * If this request is currently being transferred, | 852 | * If this request is currently being transferred, |
@@ -1563,7 +1573,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep) | |||
1563 | if ((epstatus & epctrl) & USBA_RX_BK_RDY) { | 1573 | if ((epstatus & epctrl) & USBA_RX_BK_RDY) { |
1564 | DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name); | 1574 | DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name); |
1565 | receive_data(ep); | 1575 | receive_data(ep); |
1566 | usba_ep_writel(ep, CLR_STA, USBA_RX_BK_RDY); | ||
1567 | } | 1576 | } |
1568 | } | 1577 | } |
1569 | 1578 | ||
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index ff67ceac77c4..d4fe8d769bd6 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c | |||
@@ -718,10 +718,11 @@ static int ep_queue(struct bdc_ep *ep, struct bdc_req *req) | |||
718 | struct bdc *bdc; | 718 | struct bdc *bdc; |
719 | int ret = 0; | 719 | int ret = 0; |
720 | 720 | ||
721 | bdc = ep->bdc; | ||
722 | if (!req || !ep || !ep->usb_ep.desc) | 721 | if (!req || !ep || !ep->usb_ep.desc) |
723 | return -EINVAL; | 722 | return -EINVAL; |
724 | 723 | ||
724 | bdc = ep->bdc; | ||
725 | |||
725 | req->usb_req.actual = 0; | 726 | req->usb_req.actual = 0; |
726 | req->usb_req.status = -EINPROGRESS; | 727 | req->usb_req.status = -EINPROGRESS; |
727 | req->epnum = ep->ep_num; | 728 | req->epnum = ep->ep_num; |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index e113fd73aeae..f9a332775c47 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1581,6 +1581,10 @@ iso_stream_schedule ( | |||
1581 | else | 1581 | else |
1582 | next = (now + 2 + 7) & ~0x07; /* full frame cache */ | 1582 | next = (now + 2 + 7) & ~0x07; /* full frame cache */ |
1583 | 1583 | ||
1584 | /* If needed, initialize last_iso_frame so that this URB will be seen */ | ||
1585 | if (ehci->isoc_count == 0) | ||
1586 | ehci->last_iso_frame = now >> 3; | ||
1587 | |||
1584 | /* | 1588 | /* |
1585 | * Use ehci->last_iso_frame as the base. There can't be any | 1589 | * Use ehci->last_iso_frame as the base. There can't be any |
1586 | * TDs scheduled for earlier than that. | 1590 | * TDs scheduled for earlier than that. |
@@ -1600,11 +1604,11 @@ iso_stream_schedule ( | |||
1600 | */ | 1604 | */ |
1601 | now2 = (now - base) & (mod - 1); | 1605 | now2 = (now - base) & (mod - 1); |
1602 | 1606 | ||
1603 | /* Is the schedule already full? */ | 1607 | /* Is the schedule about to wrap around? */ |
1604 | if (unlikely(!empty && start < period)) { | 1608 | if (unlikely(!empty && start < period)) { |
1605 | ehci_dbg(ehci, "iso sched full %p (%u-%u < %u mod %u)\n", | 1609 | ehci_dbg(ehci, "request %p would overflow (%u-%u < %u mod %u)\n", |
1606 | urb, stream->next_uframe, base, period, mod); | 1610 | urb, stream->next_uframe, base, period, mod); |
1607 | status = -ENOSPC; | 1611 | status = -EFBIG; |
1608 | goto fail; | 1612 | goto fail; |
1609 | } | 1613 | } |
1610 | 1614 | ||
@@ -1671,10 +1675,6 @@ iso_stream_schedule ( | |||
1671 | urb->start_frame = start & (mod - 1); | 1675 | urb->start_frame = start & (mod - 1); |
1672 | if (!stream->highspeed) | 1676 | if (!stream->highspeed) |
1673 | urb->start_frame >>= 3; | 1677 | urb->start_frame >>= 3; |
1674 | |||
1675 | /* Make sure scan_isoc() sees these */ | ||
1676 | if (ehci->isoc_count == 0) | ||
1677 | ehci->last_iso_frame = now >> 3; | ||
1678 | return status; | 1678 | return status; |
1679 | 1679 | ||
1680 | fail: | 1680 | fail: |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 19a9af1b4d74..ff9af29b4e9f 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -451,7 +451,7 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
451 | 451 | ||
452 | u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); | 452 | u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); |
453 | if (IS_ERR(u_phy)) { | 453 | if (IS_ERR(u_phy)) { |
454 | err = PTR_ERR(u_phy); | 454 | err = -EPROBE_DEFER; |
455 | goto cleanup_clk_en; | 455 | goto cleanup_clk_en; |
456 | } | 456 | } |
457 | hcd->usb_phy = u_phy; | 457 | hcd->usb_phy = u_phy; |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index dd483c13565b..ce636466edb7 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -567,7 +567,8 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
567 | { | 567 | { |
568 | void __iomem *base; | 568 | void __iomem *base; |
569 | u32 control; | 569 | u32 control; |
570 | u32 fminterval; | 570 | u32 fminterval = 0; |
571 | bool no_fminterval = false; | ||
571 | int cnt; | 572 | int cnt; |
572 | 573 | ||
573 | if (!mmio_resource_enabled(pdev, 0)) | 574 | if (!mmio_resource_enabled(pdev, 0)) |
@@ -577,6 +578,13 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
577 | if (base == NULL) | 578 | if (base == NULL) |
578 | return; | 579 | return; |
579 | 580 | ||
581 | /* | ||
582 | * ULi M5237 OHCI controller locks the whole system when accessing | ||
583 | * the OHCI_FMINTERVAL offset. | ||
584 | */ | ||
585 | if (pdev->vendor == PCI_VENDOR_ID_AL && pdev->device == 0x5237) | ||
586 | no_fminterval = true; | ||
587 | |||
580 | control = readl(base + OHCI_CONTROL); | 588 | control = readl(base + OHCI_CONTROL); |
581 | 589 | ||
582 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ | 590 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ |
@@ -615,7 +623,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
615 | } | 623 | } |
616 | 624 | ||
617 | /* software reset of the controller, preserving HcFmInterval */ | 625 | /* software reset of the controller, preserving HcFmInterval */ |
618 | fminterval = readl(base + OHCI_FMINTERVAL); | 626 | if (!no_fminterval) |
627 | fminterval = readl(base + OHCI_FMINTERVAL); | ||
628 | |||
619 | writel(OHCI_HCR, base + OHCI_CMDSTATUS); | 629 | writel(OHCI_HCR, base + OHCI_CMDSTATUS); |
620 | 630 | ||
621 | /* reset requires max 10 us delay */ | 631 | /* reset requires max 10 us delay */ |
@@ -624,7 +634,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
624 | break; | 634 | break; |
625 | udelay(1); | 635 | udelay(1); |
626 | } | 636 | } |
627 | writel(fminterval, base + OHCI_FMINTERVAL); | 637 | |
638 | if (!no_fminterval) | ||
639 | writel(fminterval, base + OHCI_FMINTERVAL); | ||
628 | 640 | ||
629 | /* Now the controller is safely in SUSPEND and nothing can wake it up */ | 641 | /* Now the controller is safely in SUSPEND and nothing can wake it up */ |
630 | iounmap(base); | 642 | iounmap(base); |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 142b601f9563..7f76c8a12f89 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -82,6 +82,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
82 | "must be suspended extra slowly", | 82 | "must be suspended extra slowly", |
83 | pdev->revision); | 83 | pdev->revision); |
84 | } | 84 | } |
85 | if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) | ||
86 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
85 | /* Fresco Logic confirms: all revisions of this chip do not | 87 | /* Fresco Logic confirms: all revisions of this chip do not |
86 | * support MSI, even though some of them claim to in their PCI | 88 | * support MSI, even though some of them claim to in their PCI |
87 | * capabilities. | 89 | * capabilities. |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 01fcbb5eb06e..c50d8d202618 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3803,6 +3803,15 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3803 | return -EINVAL; | 3803 | return -EINVAL; |
3804 | } | 3804 | } |
3805 | 3805 | ||
3806 | if (setup == SETUP_CONTEXT_ONLY) { | ||
3807 | slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx); | ||
3808 | if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) == | ||
3809 | SLOT_STATE_DEFAULT) { | ||
3810 | xhci_dbg(xhci, "Slot already in default state\n"); | ||
3811 | return 0; | ||
3812 | } | ||
3813 | } | ||
3814 | |||
3806 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); | 3815 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
3807 | if (!command) | 3816 | if (!command) |
3808 | return -ENOMEM; | 3817 | return -ENOMEM; |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 9d68372dd9aa..b005010240e5 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -72,6 +72,8 @@ config USB_MUSB_DA8XX | |||
72 | 72 | ||
73 | config USB_MUSB_TUSB6010 | 73 | config USB_MUSB_TUSB6010 |
74 | tristate "TUSB6010" | 74 | tristate "TUSB6010" |
75 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | ||
76 | depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules | ||
75 | 77 | ||
76 | config USB_MUSB_OMAP2PLUS | 78 | config USB_MUSB_OMAP2PLUS |
77 | tristate "OMAP2430 and onwards" | 79 | tristate "OMAP2430 and onwards" |
@@ -85,6 +87,7 @@ config USB_MUSB_AM35X | |||
85 | config USB_MUSB_DSPS | 87 | config USB_MUSB_DSPS |
86 | tristate "TI DSPS platforms" | 88 | tristate "TI DSPS platforms" |
87 | select USB_MUSB_AM335X_CHILD | 89 | select USB_MUSB_AM335X_CHILD |
90 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | ||
88 | depends on OF_IRQ | 91 | depends on OF_IRQ |
89 | 92 | ||
90 | config USB_MUSB_BLACKFIN | 93 | config USB_MUSB_BLACKFIN |
@@ -93,6 +96,7 @@ config USB_MUSB_BLACKFIN | |||
93 | 96 | ||
94 | config USB_MUSB_UX500 | 97 | config USB_MUSB_UX500 |
95 | tristate "Ux500 platforms" | 98 | tristate "Ux500 platforms" |
99 | depends on ARCH_U8500 || COMPILE_TEST | ||
96 | 100 | ||
97 | config USB_MUSB_JZ4740 | 101 | config USB_MUSB_JZ4740 |
98 | tristate "JZ4740" | 102 | tristate "JZ4740" |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index a441a2de8619..178250145613 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -63,7 +63,7 @@ static void bfin_writew(void __iomem *addr, unsigned offset, u16 data) | |||
63 | bfin_write16(addr + offset, data); | 63 | bfin_write16(addr + offset, data); |
64 | } | 64 | } |
65 | 65 | ||
66 | static void binf_writel(void __iomem *addr, unsigned offset, u32 data) | 66 | static void bfin_writel(void __iomem *addr, unsigned offset, u32 data) |
67 | { | 67 | { |
68 | bfin_write16(addr + offset, (u16)data); | 68 | bfin_write16(addr + offset, (u16)data); |
69 | } | 69 | } |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index f64fd964dc6d..c39a16ad7832 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -628,9 +628,9 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) | |||
628 | ret = of_property_read_string_index(np, "dma-names", i, &str); | 628 | ret = of_property_read_string_index(np, "dma-names", i, &str); |
629 | if (ret) | 629 | if (ret) |
630 | goto err; | 630 | goto err; |
631 | if (!strncmp(str, "tx", 2)) | 631 | if (strstarts(str, "tx")) |
632 | is_tx = 1; | 632 | is_tx = 1; |
633 | else if (!strncmp(str, "rx", 2)) | 633 | else if (strstarts(str, "rx")) |
634 | is_tx = 0; | 634 | is_tx = 0; |
635 | else { | 635 | else { |
636 | dev_err(dev, "Wrong dmatype %s\n", str); | 636 | dev_err(dev, "Wrong dmatype %s\n", str); |
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index ad3701a97389..48131aa8472c 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c | |||
@@ -59,20 +59,12 @@ static const struct musb_register_map musb_regmap[] = { | |||
59 | { "RxMaxPp", MUSB_RXMAXP, 16 }, | 59 | { "RxMaxPp", MUSB_RXMAXP, 16 }, |
60 | { "RxCSR", MUSB_RXCSR, 16 }, | 60 | { "RxCSR", MUSB_RXCSR, 16 }, |
61 | { "RxCount", MUSB_RXCOUNT, 16 }, | 61 | { "RxCount", MUSB_RXCOUNT, 16 }, |
62 | { "ConfigData", MUSB_CONFIGDATA,8 }, | ||
63 | { "IntrRxE", MUSB_INTRRXE, 16 }, | 62 | { "IntrRxE", MUSB_INTRRXE, 16 }, |
64 | { "IntrTxE", MUSB_INTRTXE, 16 }, | 63 | { "IntrTxE", MUSB_INTRTXE, 16 }, |
65 | { "IntrUsbE", MUSB_INTRUSBE, 8 }, | 64 | { "IntrUsbE", MUSB_INTRUSBE, 8 }, |
66 | { "DevCtl", MUSB_DEVCTL, 8 }, | 65 | { "DevCtl", MUSB_DEVCTL, 8 }, |
67 | { "BabbleCtl", MUSB_BABBLE_CTL,8 }, | ||
68 | { "TxFIFOsz", MUSB_TXFIFOSZ, 8 }, | ||
69 | { "RxFIFOsz", MUSB_RXFIFOSZ, 8 }, | ||
70 | { "TxFIFOadd", MUSB_TXFIFOADD, 16 }, | ||
71 | { "RxFIFOadd", MUSB_RXFIFOADD, 16 }, | ||
72 | { "VControl", 0x68, 32 }, | 66 | { "VControl", 0x68, 32 }, |
73 | { "HWVers", 0x69, 16 }, | 67 | { "HWVers", 0x69, 16 }, |
74 | { "EPInfo", MUSB_EPINFO, 8 }, | ||
75 | { "RAMInfo", MUSB_RAMINFO, 8 }, | ||
76 | { "LinkInfo", MUSB_LINKINFO, 8 }, | 68 | { "LinkInfo", MUSB_LINKINFO, 8 }, |
77 | { "VPLen", MUSB_VPLEN, 8 }, | 69 | { "VPLen", MUSB_VPLEN, 8 }, |
78 | { "HS_EOF1", MUSB_HS_EOF1, 8 }, | 70 | { "HS_EOF1", MUSB_HS_EOF1, 8 }, |
@@ -103,6 +95,16 @@ static const struct musb_register_map musb_regmap[] = { | |||
103 | { "DMA_CNTLch7", 0x274, 16 }, | 95 | { "DMA_CNTLch7", 0x274, 16 }, |
104 | { "DMA_ADDRch7", 0x278, 32 }, | 96 | { "DMA_ADDRch7", 0x278, 32 }, |
105 | { "DMA_COUNTch7", 0x27C, 32 }, | 97 | { "DMA_COUNTch7", 0x27C, 32 }, |
98 | #ifndef CONFIG_BLACKFIN | ||
99 | { "ConfigData", MUSB_CONFIGDATA,8 }, | ||
100 | { "BabbleCtl", MUSB_BABBLE_CTL,8 }, | ||
101 | { "TxFIFOsz", MUSB_TXFIFOSZ, 8 }, | ||
102 | { "RxFIFOsz", MUSB_RXFIFOSZ, 8 }, | ||
103 | { "TxFIFOadd", MUSB_TXFIFOADD, 16 }, | ||
104 | { "RxFIFOadd", MUSB_RXFIFOADD, 16 }, | ||
105 | { "EPInfo", MUSB_EPINFO, 8 }, | ||
106 | { "RAMInfo", MUSB_RAMINFO, 8 }, | ||
107 | #endif | ||
106 | { } /* Terminating Entry */ | 108 | { } /* Terminating Entry */ |
107 | }; | 109 | }; |
108 | 110 | ||
@@ -197,30 +199,30 @@ static ssize_t musb_test_mode_write(struct file *file, | |||
197 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) | 199 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
198 | return -EFAULT; | 200 | return -EFAULT; |
199 | 201 | ||
200 | if (!strncmp(buf, "force host", 9)) | 202 | if (strstarts(buf, "force host")) |
201 | test = MUSB_TEST_FORCE_HOST; | 203 | test = MUSB_TEST_FORCE_HOST; |
202 | 204 | ||
203 | if (!strncmp(buf, "fifo access", 11)) | 205 | if (strstarts(buf, "fifo access")) |
204 | test = MUSB_TEST_FIFO_ACCESS; | 206 | test = MUSB_TEST_FIFO_ACCESS; |
205 | 207 | ||
206 | if (!strncmp(buf, "force full-speed", 15)) | 208 | if (strstarts(buf, "force full-speed")) |
207 | test = MUSB_TEST_FORCE_FS; | 209 | test = MUSB_TEST_FORCE_FS; |
208 | 210 | ||
209 | if (!strncmp(buf, "force high-speed", 15)) | 211 | if (strstarts(buf, "force high-speed")) |
210 | test = MUSB_TEST_FORCE_HS; | 212 | test = MUSB_TEST_FORCE_HS; |
211 | 213 | ||
212 | if (!strncmp(buf, "test packet", 10)) { | 214 | if (strstarts(buf, "test packet")) { |
213 | test = MUSB_TEST_PACKET; | 215 | test = MUSB_TEST_PACKET; |
214 | musb_load_testpacket(musb); | 216 | musb_load_testpacket(musb); |
215 | } | 217 | } |
216 | 218 | ||
217 | if (!strncmp(buf, "test K", 6)) | 219 | if (strstarts(buf, "test K")) |
218 | test = MUSB_TEST_K; | 220 | test = MUSB_TEST_K; |
219 | 221 | ||
220 | if (!strncmp(buf, "test J", 6)) | 222 | if (strstarts(buf, "test J")) |
221 | test = MUSB_TEST_J; | 223 | test = MUSB_TEST_J; |
222 | 224 | ||
223 | if (!strncmp(buf, "test SE0 NAK", 12)) | 225 | if (strstarts(buf, "test SE0 NAK")) |
224 | test = MUSB_TEST_SE0_NAK; | 226 | test = MUSB_TEST_SE0_NAK; |
225 | 227 | ||
226 | musb_writeb(musb->mregs, MUSB_TESTMODE, test); | 228 | musb_writeb(musb->mregs, MUSB_TESTMODE, test); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 23d474d3d7f4..883a9adfdfff 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2663,7 +2663,6 @@ void musb_host_cleanup(struct musb *musb) | |||
2663 | if (musb->port_mode == MUSB_PORT_MODE_GADGET) | 2663 | if (musb->port_mode == MUSB_PORT_MODE_GADGET) |
2664 | return; | 2664 | return; |
2665 | usb_remove_hcd(musb->hcd); | 2665 | usb_remove_hcd(musb->hcd); |
2666 | musb->hcd = NULL; | ||
2667 | } | 2666 | } |
2668 | 2667 | ||
2669 | void musb_host_free(struct musb *musb) | 2668 | void musb_host_free(struct musb *musb) |
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c index 699e38c73d82..697a741a0cb1 100644 --- a/drivers/usb/phy/phy-mv-usb.c +++ b/drivers/usb/phy/phy-mv-usb.c | |||
@@ -338,7 +338,6 @@ static void mv_otg_update_inputs(struct mv_otg *mvotg) | |||
338 | static void mv_otg_update_state(struct mv_otg *mvotg) | 338 | static void mv_otg_update_state(struct mv_otg *mvotg) |
339 | { | 339 | { |
340 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; | 340 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; |
341 | struct usb_phy *phy = &mvotg->phy; | ||
342 | int old_state = mvotg->phy.otg->state; | 341 | int old_state = mvotg->phy.otg->state; |
343 | 342 | ||
344 | switch (old_state) { | 343 | switch (old_state) { |
@@ -858,10 +857,10 @@ static int mv_otg_suspend(struct platform_device *pdev, pm_message_t state) | |||
858 | { | 857 | { |
859 | struct mv_otg *mvotg = platform_get_drvdata(pdev); | 858 | struct mv_otg *mvotg = platform_get_drvdata(pdev); |
860 | 859 | ||
861 | if (mvotg->phy.state != OTG_STATE_B_IDLE) { | 860 | if (mvotg->phy.otg->state != OTG_STATE_B_IDLE) { |
862 | dev_info(&pdev->dev, | 861 | dev_info(&pdev->dev, |
863 | "OTG state is not B_IDLE, it is %d!\n", | 862 | "OTG state is not B_IDLE, it is %d!\n", |
864 | mvotg->phy.state); | 863 | mvotg->phy.otg->state); |
865 | return -EAGAIN; | 864 | return -EAGAIN; |
866 | } | 865 | } |
867 | 866 | ||
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index b4066a001ba0..ccfdfb24b240 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c | |||
@@ -34,7 +34,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list, | |||
34 | return phy; | 34 | return phy; |
35 | } | 35 | } |
36 | 36 | ||
37 | return ERR_PTR(-ENODEV); | 37 | return ERR_PTR(-EPROBE_DEFER); |
38 | } | 38 | } |
39 | 39 | ||
40 | static struct usb_phy *__usb_find_phy_dev(struct device *dev, | 40 | static struct usb_phy *__usb_find_phy_dev(struct device *dev, |
@@ -59,6 +59,9 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) | |||
59 | { | 59 | { |
60 | struct usb_phy *phy; | 60 | struct usb_phy *phy; |
61 | 61 | ||
62 | if (!of_device_is_available(node)) | ||
63 | return ERR_PTR(-ENODEV); | ||
64 | |||
62 | list_for_each_entry(phy, &phy_list, head) { | 65 | list_for_each_entry(phy, &phy_list, head) { |
63 | if (node != phy->dev->of_node) | 66 | if (node != phy->dev->of_node) |
64 | continue; | 67 | continue; |
@@ -66,7 +69,7 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) | |||
66 | return phy; | 69 | return phy; |
67 | } | 70 | } |
68 | 71 | ||
69 | return ERR_PTR(-ENODEV); | 72 | return ERR_PTR(-EPROBE_DEFER); |
70 | } | 73 | } |
71 | 74 | ||
72 | static void devm_usb_phy_release(struct device *dev, void *res) | 75 | static void devm_usb_phy_release(struct device *dev, void *res) |
@@ -190,10 +193,13 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | |||
190 | spin_lock_irqsave(&phy_lock, flags); | 193 | spin_lock_irqsave(&phy_lock, flags); |
191 | 194 | ||
192 | phy = __of_usb_find_phy(node); | 195 | phy = __of_usb_find_phy(node); |
193 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { | 196 | if (IS_ERR(phy)) { |
194 | if (!IS_ERR(phy)) | 197 | devres_free(ptr); |
195 | phy = ERR_PTR(-EPROBE_DEFER); | 198 | goto err1; |
199 | } | ||
196 | 200 | ||
201 | if (!try_module_get(phy->dev->driver->owner)) { | ||
202 | phy = ERR_PTR(-ENODEV); | ||
197 | devres_free(ptr); | 203 | devres_free(ptr); |
198 | goto err1; | 204 | goto err1; |
199 | } | 205 | } |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 8d7fc48b1f30..29fa1c3d0089 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -46,6 +46,8 @@ static struct console usbcons; | |||
46 | * ------------------------------------------------------------ | 46 | * ------------------------------------------------------------ |
47 | */ | 47 | */ |
48 | 48 | ||
49 | static const struct tty_operations usb_console_fake_tty_ops = { | ||
50 | }; | ||
49 | 51 | ||
50 | /* | 52 | /* |
51 | * The parsing of the command line works exactly like the | 53 | * The parsing of the command line works exactly like the |
@@ -137,13 +139,17 @@ static int usb_console_setup(struct console *co, char *options) | |||
137 | goto reset_open_count; | 139 | goto reset_open_count; |
138 | } | 140 | } |
139 | kref_init(&tty->kref); | 141 | kref_init(&tty->kref); |
140 | tty_port_tty_set(&port->port, tty); | ||
141 | tty->driver = usb_serial_tty_driver; | 142 | tty->driver = usb_serial_tty_driver; |
142 | tty->index = co->index; | 143 | tty->index = co->index; |
144 | init_ldsem(&tty->ldisc_sem); | ||
145 | INIT_LIST_HEAD(&tty->tty_files); | ||
146 | kref_get(&tty->driver->kref); | ||
147 | tty->ops = &usb_console_fake_tty_ops; | ||
143 | if (tty_init_termios(tty)) { | 148 | if (tty_init_termios(tty)) { |
144 | retval = -ENOMEM; | 149 | retval = -ENOMEM; |
145 | goto free_tty; | 150 | goto put_tty; |
146 | } | 151 | } |
152 | tty_port_tty_set(&port->port, tty); | ||
147 | } | 153 | } |
148 | 154 | ||
149 | /* only call the device specific open if this | 155 | /* only call the device specific open if this |
@@ -161,7 +167,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
161 | serial->type->set_termios(tty, port, &dummy); | 167 | serial->type->set_termios(tty, port, &dummy); |
162 | 168 | ||
163 | tty_port_tty_set(&port->port, NULL); | 169 | tty_port_tty_set(&port->port, NULL); |
164 | kfree(tty); | 170 | tty_kref_put(tty); |
165 | } | 171 | } |
166 | set_bit(ASYNCB_INITIALIZED, &port->port.flags); | 172 | set_bit(ASYNCB_INITIALIZED, &port->port.flags); |
167 | } | 173 | } |
@@ -177,8 +183,8 @@ static int usb_console_setup(struct console *co, char *options) | |||
177 | 183 | ||
178 | fail: | 184 | fail: |
179 | tty_port_tty_set(&port->port, NULL); | 185 | tty_port_tty_set(&port->port, NULL); |
180 | free_tty: | 186 | put_tty: |
181 | kfree(tty); | 187 | tty_kref_put(tty); |
182 | reset_open_count: | 188 | reset_open_count: |
183 | port->port.count = 0; | 189 | port->port.count = 0; |
184 | usb_autopm_put_interface(serial->interface); | 190 | usb_autopm_put_interface(serial->interface); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 6c4eb3cf5efd..f4c56fc1a9f6 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -120,10 +120,12 @@ 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, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */ |
124 | { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ | ||
124 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ | 125 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
125 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 126 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
126 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 127 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
128 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ | ||
127 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 129 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
128 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ | 130 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
129 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ | 131 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 1bd192290b08..ccf1df7c4b80 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -286,7 +286,7 @@ static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | |||
286 | 286 | ||
287 | res = usb_submit_urb(port->read_urbs[index], mem_flags); | 287 | res = usb_submit_urb(port->read_urbs[index], mem_flags); |
288 | if (res) { | 288 | if (res) { |
289 | if (res != -EPERM) { | 289 | if (res != -EPERM && res != -ENODEV) { |
290 | dev_err(&port->dev, | 290 | dev_err(&port->dev, |
291 | "%s - usb_submit_urb failed: %d\n", | 291 | "%s - usb_submit_urb failed: %d\n", |
292 | __func__, res); | 292 | __func__, res); |
@@ -373,7 +373,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) | |||
373 | __func__, urb->status); | 373 | __func__, urb->status); |
374 | return; | 374 | return; |
375 | default: | 375 | default: |
376 | dev_err(&port->dev, "%s - nonzero urb status: %d\n", | 376 | dev_dbg(&port->dev, "%s - nonzero urb status: %d\n", |
377 | __func__, urb->status); | 377 | __func__, urb->status); |
378 | goto resubmit; | 378 | goto resubmit; |
379 | } | 379 | } |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 077c714f1285..e07b15ed5814 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -410,6 +410,8 @@ static void usa26_instat_callback(struct urb *urb) | |||
410 | } | 410 | } |
411 | port = serial->port[msg->port]; | 411 | port = serial->port[msg->port]; |
412 | p_priv = usb_get_serial_port_data(port); | 412 | p_priv = usb_get_serial_port_data(port); |
413 | if (!p_priv) | ||
414 | goto resubmit; | ||
413 | 415 | ||
414 | /* Update handshaking pin state information */ | 416 | /* Update handshaking pin state information */ |
415 | old_dcd_state = p_priv->dcd_state; | 417 | old_dcd_state = p_priv->dcd_state; |
@@ -420,7 +422,7 @@ static void usa26_instat_callback(struct urb *urb) | |||
420 | 422 | ||
421 | if (old_dcd_state != p_priv->dcd_state) | 423 | if (old_dcd_state != p_priv->dcd_state) |
422 | tty_port_tty_hangup(&port->port, true); | 424 | tty_port_tty_hangup(&port->port, true); |
423 | 425 | resubmit: | |
424 | /* Resubmit urb so we continue receiving */ | 426 | /* Resubmit urb so we continue receiving */ |
425 | err = usb_submit_urb(urb, GFP_ATOMIC); | 427 | err = usb_submit_urb(urb, GFP_ATOMIC); |
426 | if (err != 0) | 428 | if (err != 0) |
@@ -527,6 +529,8 @@ static void usa28_instat_callback(struct urb *urb) | |||
527 | } | 529 | } |
528 | port = serial->port[msg->port]; | 530 | port = serial->port[msg->port]; |
529 | p_priv = usb_get_serial_port_data(port); | 531 | p_priv = usb_get_serial_port_data(port); |
532 | if (!p_priv) | ||
533 | goto resubmit; | ||
530 | 534 | ||
531 | /* Update handshaking pin state information */ | 535 | /* Update handshaking pin state information */ |
532 | old_dcd_state = p_priv->dcd_state; | 536 | old_dcd_state = p_priv->dcd_state; |
@@ -537,7 +541,7 @@ static void usa28_instat_callback(struct urb *urb) | |||
537 | 541 | ||
538 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 542 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
539 | tty_port_tty_hangup(&port->port, true); | 543 | tty_port_tty_hangup(&port->port, true); |
540 | 544 | resubmit: | |
541 | /* Resubmit urb so we continue receiving */ | 545 | /* Resubmit urb so we continue receiving */ |
542 | err = usb_submit_urb(urb, GFP_ATOMIC); | 546 | err = usb_submit_urb(urb, GFP_ATOMIC); |
543 | if (err != 0) | 547 | if (err != 0) |
@@ -607,6 +611,8 @@ static void usa49_instat_callback(struct urb *urb) | |||
607 | } | 611 | } |
608 | port = serial->port[msg->portNumber]; | 612 | port = serial->port[msg->portNumber]; |
609 | p_priv = usb_get_serial_port_data(port); | 613 | p_priv = usb_get_serial_port_data(port); |
614 | if (!p_priv) | ||
615 | goto resubmit; | ||
610 | 616 | ||
611 | /* Update handshaking pin state information */ | 617 | /* Update handshaking pin state information */ |
612 | old_dcd_state = p_priv->dcd_state; | 618 | old_dcd_state = p_priv->dcd_state; |
@@ -617,7 +623,7 @@ static void usa49_instat_callback(struct urb *urb) | |||
617 | 623 | ||
618 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 624 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
619 | tty_port_tty_hangup(&port->port, true); | 625 | tty_port_tty_hangup(&port->port, true); |
620 | 626 | resubmit: | |
621 | /* Resubmit urb so we continue receiving */ | 627 | /* Resubmit urb so we continue receiving */ |
622 | err = usb_submit_urb(urb, GFP_ATOMIC); | 628 | err = usb_submit_urb(urb, GFP_ATOMIC); |
623 | if (err != 0) | 629 | if (err != 0) |
@@ -855,6 +861,8 @@ static void usa90_instat_callback(struct urb *urb) | |||
855 | 861 | ||
856 | port = serial->port[0]; | 862 | port = serial->port[0]; |
857 | p_priv = usb_get_serial_port_data(port); | 863 | p_priv = usb_get_serial_port_data(port); |
864 | if (!p_priv) | ||
865 | goto resubmit; | ||
858 | 866 | ||
859 | /* Update handshaking pin state information */ | 867 | /* Update handshaking pin state information */ |
860 | old_dcd_state = p_priv->dcd_state; | 868 | old_dcd_state = p_priv->dcd_state; |
@@ -865,7 +873,7 @@ static void usa90_instat_callback(struct urb *urb) | |||
865 | 873 | ||
866 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 874 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
867 | tty_port_tty_hangup(&port->port, true); | 875 | tty_port_tty_hangup(&port->port, true); |
868 | 876 | resubmit: | |
869 | /* Resubmit urb so we continue receiving */ | 877 | /* Resubmit urb so we continue receiving */ |
870 | err = usb_submit_urb(urb, GFP_ATOMIC); | 878 | err = usb_submit_urb(urb, GFP_ATOMIC); |
871 | if (err != 0) | 879 | if (err != 0) |
@@ -926,6 +934,8 @@ static void usa67_instat_callback(struct urb *urb) | |||
926 | 934 | ||
927 | port = serial->port[msg->port]; | 935 | port = serial->port[msg->port]; |
928 | p_priv = usb_get_serial_port_data(port); | 936 | p_priv = usb_get_serial_port_data(port); |
937 | if (!p_priv) | ||
938 | goto resubmit; | ||
929 | 939 | ||
930 | /* Update handshaking pin state information */ | 940 | /* Update handshaking pin state information */ |
931 | old_dcd_state = p_priv->dcd_state; | 941 | old_dcd_state = p_priv->dcd_state; |
@@ -934,7 +944,7 @@ static void usa67_instat_callback(struct urb *urb) | |||
934 | 944 | ||
935 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 945 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
936 | tty_port_tty_hangup(&port->port, true); | 946 | tty_port_tty_hangup(&port->port, true); |
937 | 947 | resubmit: | |
938 | /* Resubmit urb so we continue receiving */ | 948 | /* Resubmit urb so we continue receiving */ |
939 | err = usb_submit_urb(urb, GFP_ATOMIC); | 949 | err = usb_submit_urb(urb, GFP_ATOMIC); |
940 | if (err != 0) | 950 | if (err != 0) |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 7a4c21b4f676..efdcee15b520 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -234,6 +234,8 @@ static void option_instat_callback(struct urb *urb); | |||
234 | 234 | ||
235 | #define QUALCOMM_VENDOR_ID 0x05C6 | 235 | #define QUALCOMM_VENDOR_ID 0x05C6 |
236 | 236 | ||
237 | #define SIERRA_VENDOR_ID 0x1199 | ||
238 | |||
237 | #define CMOTECH_VENDOR_ID 0x16d8 | 239 | #define CMOTECH_VENDOR_ID 0x16d8 |
238 | #define CMOTECH_PRODUCT_6001 0x6001 | 240 | #define CMOTECH_PRODUCT_6001 0x6001 |
239 | #define CMOTECH_PRODUCT_CMU_300 0x6002 | 241 | #define CMOTECH_PRODUCT_CMU_300 0x6002 |
@@ -512,7 +514,7 @@ enum option_blacklist_reason { | |||
512 | OPTION_BLACKLIST_RESERVED_IF = 2 | 514 | OPTION_BLACKLIST_RESERVED_IF = 2 |
513 | }; | 515 | }; |
514 | 516 | ||
515 | #define MAX_BL_NUM 8 | 517 | #define MAX_BL_NUM 11 |
516 | struct option_blacklist_info { | 518 | struct option_blacklist_info { |
517 | /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */ | 519 | /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */ |
518 | const unsigned long sendsetup; | 520 | const unsigned long sendsetup; |
@@ -601,6 +603,11 @@ static const struct option_blacklist_info telit_le920_blacklist = { | |||
601 | .reserved = BIT(1) | BIT(5), | 603 | .reserved = BIT(1) | BIT(5), |
602 | }; | 604 | }; |
603 | 605 | ||
606 | static const struct option_blacklist_info sierra_mc73xx_blacklist = { | ||
607 | .sendsetup = BIT(0) | BIT(2), | ||
608 | .reserved = BIT(8) | BIT(10) | BIT(11), | ||
609 | }; | ||
610 | |||
604 | static const struct usb_device_id option_ids[] = { | 611 | static const struct usb_device_id option_ids[] = { |
605 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 612 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
606 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 613 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -1098,6 +1105,8 @@ static const struct usb_device_id option_ids[] = { | |||
1098 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 1105 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
1099 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ | 1106 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ |
1100 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | 1107 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
1108 | { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), | ||
1109 | .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ | ||
1101 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, | 1110 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
1102 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, | 1111 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
1103 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), | 1112 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index cb3e14780a7e..9c63897b3a56 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -142,7 +142,6 @@ static const struct usb_device_id id_table[] = { | |||
142 | {DEVICE_SWI(0x0f3d, 0x68a2)}, /* Sierra Wireless MC7700 */ | 142 | {DEVICE_SWI(0x0f3d, 0x68a2)}, /* Sierra Wireless MC7700 */ |
143 | {DEVICE_SWI(0x114f, 0x68a2)}, /* Sierra Wireless MC7750 */ | 143 | {DEVICE_SWI(0x114f, 0x68a2)}, /* Sierra Wireless MC7750 */ |
144 | {DEVICE_SWI(0x1199, 0x68a2)}, /* Sierra Wireless MC7710 */ | 144 | {DEVICE_SWI(0x1199, 0x68a2)}, /* Sierra Wireless MC7710 */ |
145 | {DEVICE_SWI(0x1199, 0x68c0)}, /* Sierra Wireless MC73xx */ | ||
146 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ | 145 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ |
147 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ | 146 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ |
148 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ | 147 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ |
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h index 8a6f371ed6e7..9893d696fc97 100644 --- a/drivers/usb/storage/uas-detect.h +++ b/drivers/usb/storage/uas-detect.h | |||
@@ -69,16 +69,39 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
69 | return 0; | 69 | return 0; |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * ASM1051 and older ASM1053 devices have the same usb-id, and UAS is | 72 | * ASMedia has a number of usb3 to sata bridge chips, at the time of |
73 | * broken on the ASM1051, use the number of streams to differentiate. | 73 | * this writing the following versions exist: |
74 | * New ASM1053-s also support 32 streams, but have a different prod-id. | 74 | * ASM1051 - no uas support version |
75 | * ASM1051 - with broken (*) uas support | ||
76 | * ASM1053 - with working uas support | ||
77 | * ASM1153 - with working uas support | ||
78 | * | ||
79 | * Devices with these chips re-use a number of device-ids over the | ||
80 | * entire line, so the device-id is useless to determine if we're | ||
81 | * dealing with an ASM1051 (which we want to avoid). | ||
82 | * | ||
83 | * The ASM1153 can be identified by config.MaxPower == 0, | ||
84 | * where as the ASM105x models have config.MaxPower == 36. | ||
85 | * | ||
86 | * Differentiating between the ASM1053 and ASM1051 is trickier, when | ||
87 | * connected over USB-3 we can look at the number of streams supported, | ||
88 | * ASM1051 supports 32 streams, where as early ASM1053 versions support | ||
89 | * 16 streams, newer ASM1053-s also support 32 streams, but have a | ||
90 | * different prod-id. | ||
91 | * | ||
92 | * (*) ASM1051 chips do work with UAS with some disks (with the | ||
93 | * US_FL_NO_REPORT_OPCODES quirk), but are broken with other disks | ||
75 | */ | 94 | */ |
76 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && | 95 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && |
77 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa) { | 96 | (le16_to_cpu(udev->descriptor.idProduct) == 0x5106 || |
78 | if (udev->speed < USB_SPEED_SUPER) { | 97 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa)) { |
98 | if (udev->actconfig->desc.bMaxPower == 0) { | ||
99 | /* ASM1153, do nothing */ | ||
100 | } else if (udev->speed < USB_SPEED_SUPER) { | ||
79 | /* No streams info, assume ASM1051 */ | 101 | /* No streams info, assume ASM1051 */ |
80 | flags |= US_FL_IGNORE_UAS; | 102 | flags |= US_FL_IGNORE_UAS; |
81 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { | 103 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { |
104 | /* Possibly an ASM1051, disable uas */ | ||
82 | flags |= US_FL_IGNORE_UAS; | 105 | flags |= US_FL_IGNORE_UAS; |
83 | } | 106 | } |
84 | } | 107 | } |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 18a283d6de1c..6df4357d9ee3 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -40,6 +40,16 @@ | |||
40 | * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org> | 40 | * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org> |
41 | */ | 41 | */ |
42 | 42 | ||
43 | /* | ||
44 | * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI | ||
45 | * commands in UAS mode. Observed with the 1.28 firmware; are there others? | ||
46 | */ | ||
47 | UNUSUAL_DEV(0x0984, 0x0301, 0x0128, 0x0128, | ||
48 | "Apricorn", | ||
49 | "", | ||
50 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
51 | US_FL_IGNORE_UAS), | ||
52 | |||
43 | /* https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ | 53 | /* https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ |
44 | UNUSUAL_DEV(0x0bc2, 0x2312, 0x0000, 0x9999, | 54 | UNUSUAL_DEV(0x0bc2, 0x2312, 0x0000, 0x9999, |
45 | "Seagate", | 55 | "Seagate", |
@@ -68,6 +78,20 @@ UNUSUAL_DEV(0x0bc2, 0xa003, 0x0000, 0x9999, | |||
68 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 78 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
69 | US_FL_NO_ATA_1X), | 79 | US_FL_NO_ATA_1X), |
70 | 80 | ||
81 | /* Reported-by: Marcin ZajÄ…czkowski <mszpak@wp.pl> */ | ||
82 | UNUSUAL_DEV(0x0bc2, 0xa013, 0x0000, 0x9999, | ||
83 | "Seagate", | ||
84 | "Backup Plus", | ||
85 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
86 | US_FL_NO_ATA_1X), | ||
87 | |||
88 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
89 | UNUSUAL_DEV(0x0bc2, 0xa0a4, 0x0000, 0x9999, | ||
90 | "Seagate", | ||
91 | "Backup Plus Desk", | ||
92 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
93 | US_FL_NO_ATA_1X), | ||
94 | |||
71 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | 95 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ |
72 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | 96 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, |
73 | "Seagate", | 97 | "Seagate", |
@@ -82,6 +106,13 @@ UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x9999, | |||
82 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 106 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
83 | US_FL_NO_ATA_1X), | 107 | US_FL_NO_ATA_1X), |
84 | 108 | ||
109 | /* Reported-by: G. Richard Bellamy <rbellamy@pteradigm.com> */ | ||
110 | UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x9999, | ||
111 | "Seagate", | ||
112 | "BUP Fast HDD", | ||
113 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
114 | US_FL_NO_ATA_1X), | ||
115 | |||
85 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ | 116 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ |
86 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | 117 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, |
87 | "JMicron", | 118 | "JMicron", |
@@ -89,14 +120,6 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | |||
89 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 120 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
90 | US_FL_NO_REPORT_OPCODES), | 121 | US_FL_NO_REPORT_OPCODES), |
91 | 122 | ||
92 | /* Most ASM1051 based devices have issues with uas, blacklist them all */ | ||
93 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
94 | UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999, | ||
95 | "ASMedia", | ||
96 | "ASM1051", | ||
97 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
98 | US_FL_IGNORE_UAS), | ||
99 | |||
100 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 123 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
101 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | 124 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, |
102 | "VIA", | 125 | "VIA", |
@@ -104,6 +127,13 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | |||
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 127 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
105 | US_FL_NO_ATA_1X), | 128 | US_FL_NO_ATA_1X), |
106 | 129 | ||
130 | /* Reported-by: Takeo Nakayama <javhera@gmx.com> */ | ||
131 | UNUSUAL_DEV(0x357d, 0x7788, 0x0000, 0x9999, | ||
132 | "JMicron", | ||
133 | "JMS566", | ||
134 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
135 | US_FL_NO_REPORT_OPCODES), | ||
136 | |||
107 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 137 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
108 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, | 138 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, |
109 | "Hitachi", | 139 | "Hitachi", |
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index 1c29bd19e3d5..0e5fde1d3ffb 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c | |||
@@ -636,7 +636,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par, | |||
636 | err = broadsheet_spiflash_read_range(par, start_sector_addr, | 636 | err = broadsheet_spiflash_read_range(par, start_sector_addr, |
637 | data_start_addr, sector_buffer); | 637 | data_start_addr, sector_buffer); |
638 | if (err) | 638 | if (err) |
639 | return err; | 639 | goto out; |
640 | } | 640 | } |
641 | 641 | ||
642 | /* now we copy our data into the right place in the sector buffer */ | 642 | /* now we copy our data into the right place in the sector buffer */ |
@@ -657,7 +657,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par, | |||
657 | err = broadsheet_spiflash_read_range(par, tail_start_addr, | 657 | err = broadsheet_spiflash_read_range(par, tail_start_addr, |
658 | tail_len, sector_buffer + tail_start_addr); | 658 | tail_len, sector_buffer + tail_start_addr); |
659 | if (err) | 659 | if (err) |
660 | return err; | 660 | goto out; |
661 | } | 661 | } |
662 | 662 | ||
663 | /* if we got here we have the full sector that we want to rewrite. */ | 663 | /* if we got here we have the full sector that we want to rewrite. */ |
@@ -665,11 +665,13 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par, | |||
665 | /* first erase the sector */ | 665 | /* first erase the sector */ |
666 | err = broadsheet_spiflash_erase_sector(par, start_sector_addr); | 666 | err = broadsheet_spiflash_erase_sector(par, start_sector_addr); |
667 | if (err) | 667 | if (err) |
668 | return err; | 668 | goto out; |
669 | 669 | ||
670 | /* now write it */ | 670 | /* now write it */ |
671 | err = broadsheet_spiflash_write_sector(par, start_sector_addr, | 671 | err = broadsheet_spiflash_write_sector(par, start_sector_addr, |
672 | sector_buffer, sector_size); | 672 | sector_buffer, sector_size); |
673 | out: | ||
674 | kfree(sector_buffer); | ||
673 | return err; | 675 | return err; |
674 | } | 676 | } |
675 | 677 | ||
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 92cac803dee3..1085c0432158 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c | |||
@@ -402,7 +402,7 @@ static int __init simplefb_init(void) | |||
402 | if (ret) | 402 | if (ret) |
403 | return ret; | 403 | return ret; |
404 | 404 | ||
405 | if (IS_ENABLED(CONFIG_OF) && of_chosen) { | 405 | if (IS_ENABLED(CONFIG_OF_ADDRESS) && of_chosen) { |
406 | for_each_child_of_node(of_chosen, np) { | 406 | for_each_child_of_node(of_chosen, np) { |
407 | if (of_device_is_compatible(np, "simple-framebuffer")) | 407 | if (of_device_is_compatible(np, "simple-framebuffer")) |
408 | of_platform_device_create(np, NULL, NULL); | 408 | of_platform_device_create(np, NULL, NULL); |
diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c index 5927c0a98a74..bcfd2a22208f 100644 --- a/drivers/watchdog/cadence_wdt.c +++ b/drivers/watchdog/cadence_wdt.c | |||
@@ -503,7 +503,6 @@ static struct platform_driver cdns_wdt_driver = { | |||
503 | .shutdown = cdns_wdt_shutdown, | 503 | .shutdown = cdns_wdt_shutdown, |
504 | .driver = { | 504 | .driver = { |
505 | .name = "cdns-wdt", | 505 | .name = "cdns-wdt", |
506 | .owner = THIS_MODULE, | ||
507 | .of_match_table = cdns_wdt_of_match, | 506 | .of_match_table = cdns_wdt_of_match, |
508 | .pm = &cdns_wdt_pm_ops, | 507 | .pm = &cdns_wdt_pm_ops, |
509 | }, | 508 | }, |
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index d6add516a7a7..5142bbabe027 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c | |||
@@ -52,6 +52,8 @@ | |||
52 | #define IMX2_WDT_WRSR 0x04 /* Reset Status Register */ | 52 | #define IMX2_WDT_WRSR 0x04 /* Reset Status Register */ |
53 | #define IMX2_WDT_WRSR_TOUT (1 << 1) /* -> Reset due to Timeout */ | 53 | #define IMX2_WDT_WRSR_TOUT (1 << 1) /* -> Reset due to Timeout */ |
54 | 54 | ||
55 | #define IMX2_WDT_WMCR 0x08 /* Misc Register */ | ||
56 | |||
55 | #define IMX2_WDT_MAX_TIME 128 | 57 | #define IMX2_WDT_MAX_TIME 128 |
56 | #define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */ | 58 | #define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */ |
57 | 59 | ||
@@ -274,6 +276,13 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) | |||
274 | 276 | ||
275 | imx2_wdt_ping_if_active(wdog); | 277 | imx2_wdt_ping_if_active(wdog); |
276 | 278 | ||
279 | /* | ||
280 | * Disable the watchdog power down counter at boot. Otherwise the power | ||
281 | * down counter will pull down the #WDOG interrupt line for one clock | ||
282 | * cycle. | ||
283 | */ | ||
284 | regmap_write(wdev->regmap, IMX2_WDT_WMCR, 0); | ||
285 | |||
277 | ret = watchdog_register_device(wdog); | 286 | ret = watchdog_register_device(wdog); |
278 | if (ret) { | 287 | if (ret) { |
279 | dev_err(&pdev->dev, "cannot register watchdog device\n"); | 288 | dev_err(&pdev->dev, "cannot register watchdog device\n"); |
@@ -327,18 +336,21 @@ static void imx2_wdt_shutdown(struct platform_device *pdev) | |||
327 | } | 336 | } |
328 | 337 | ||
329 | #ifdef CONFIG_PM_SLEEP | 338 | #ifdef CONFIG_PM_SLEEP |
330 | /* Disable watchdog if it is active during suspend */ | 339 | /* Disable watchdog if it is active or non-active but still running */ |
331 | static int imx2_wdt_suspend(struct device *dev) | 340 | static int imx2_wdt_suspend(struct device *dev) |
332 | { | 341 | { |
333 | struct watchdog_device *wdog = dev_get_drvdata(dev); | 342 | struct watchdog_device *wdog = dev_get_drvdata(dev); |
334 | struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); | 343 | struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog); |
335 | 344 | ||
336 | imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); | 345 | /* The watchdog IP block is running */ |
337 | imx2_wdt_ping(wdog); | 346 | if (imx2_wdt_is_running(wdev)) { |
347 | imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); | ||
348 | imx2_wdt_ping(wdog); | ||
338 | 349 | ||
339 | /* Watchdog has been stopped but IP block is still running */ | 350 | /* The watchdog is not active */ |
340 | if (!watchdog_active(wdog) && imx2_wdt_is_running(wdev)) | 351 | if (!watchdog_active(wdog)) |
341 | del_timer_sync(&wdev->timer); | 352 | del_timer_sync(&wdev->timer); |
353 | } | ||
342 | 354 | ||
343 | clk_disable_unprepare(wdev->clk); | 355 | clk_disable_unprepare(wdev->clk); |
344 | 356 | ||
@@ -354,15 +366,25 @@ static int imx2_wdt_resume(struct device *dev) | |||
354 | clk_prepare_enable(wdev->clk); | 366 | clk_prepare_enable(wdev->clk); |
355 | 367 | ||
356 | if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { | 368 | if (watchdog_active(wdog) && !imx2_wdt_is_running(wdev)) { |
357 | /* Resumes from deep sleep we need restart | 369 | /* |
358 | * the watchdog again. | 370 | * If the watchdog is still active and resumes |
371 | * from deep sleep state, need to restart the | ||
372 | * watchdog again. | ||
359 | */ | 373 | */ |
360 | imx2_wdt_setup(wdog); | 374 | imx2_wdt_setup(wdog); |
361 | imx2_wdt_set_timeout(wdog, wdog->timeout); | 375 | imx2_wdt_set_timeout(wdog, wdog->timeout); |
362 | imx2_wdt_ping(wdog); | 376 | imx2_wdt_ping(wdog); |
363 | } else if (imx2_wdt_is_running(wdev)) { | 377 | } else if (imx2_wdt_is_running(wdev)) { |
378 | /* Resuming from non-deep sleep state. */ | ||
379 | imx2_wdt_set_timeout(wdog, wdog->timeout); | ||
364 | imx2_wdt_ping(wdog); | 380 | imx2_wdt_ping(wdog); |
365 | mod_timer(&wdev->timer, jiffies + wdog->timeout * HZ / 2); | 381 | /* |
382 | * But the watchdog is not active, then start | ||
383 | * the timer again. | ||
384 | */ | ||
385 | if (!watchdog_active(wdog)) | ||
386 | mod_timer(&wdev->timer, | ||
387 | jiffies + wdog->timeout * HZ / 2); | ||
366 | } | 388 | } |
367 | 389 | ||
368 | return 0; | 390 | return 0; |
diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c index ef6a298e8c45..1f4155ee3404 100644 --- a/drivers/watchdog/meson_wdt.c +++ b/drivers/watchdog/meson_wdt.c | |||
@@ -215,7 +215,6 @@ static struct platform_driver meson_wdt_driver = { | |||
215 | .remove = meson_wdt_remove, | 215 | .remove = meson_wdt_remove, |
216 | .shutdown = meson_wdt_shutdown, | 216 | .shutdown = meson_wdt_shutdown, |
217 | .driver = { | 217 | .driver = { |
218 | .owner = THIS_MODULE, | ||
219 | .name = DRV_NAME, | 218 | .name = DRV_NAME, |
220 | .of_match_table = meson_wdt_dt_ids, | 219 | .of_match_table = meson_wdt_dt_ids, |
221 | }, | 220 | }, |