aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/pci_root.c4
-rw-r--r--drivers/base/bus.c1
-rw-r--r--drivers/base/core.c6
-rw-r--r--drivers/bcma/scan.c2
-rw-r--r--drivers/char/lp.c3
-rw-r--r--drivers/char/ttyprintk.c2
-rw-r--r--drivers/cpufreq/loongson2_cpufreq.c2
-rw-r--r--drivers/crypto/nx/nx-aes-cbc.c1
-rw-r--r--drivers/crypto/nx/nx-aes-ecb.c1
-rw-r--r--drivers/crypto/nx/nx-aes-gcm.c2
-rw-r--r--drivers/crypto/nx/nx-sha256.c8
-rw-r--r--drivers/crypto/nx/nx-sha512.c7
-rw-r--r--drivers/crypto/nx/nx.c38
-rw-r--r--drivers/gpio/Kconfig2
-rw-r--r--drivers/gpio/gpio-langwell.c17
-rw-r--r--drivers/gpio/gpio-ml-ioh.c3
-rw-r--r--drivers/gpio/gpio-mxs.c3
-rw-r--r--drivers/gpio/gpio-omap.c48
-rw-r--r--drivers/gpio/gpio-pch.c3
-rw-r--r--drivers/gpio/gpio-sch.c6
-rw-r--r--drivers/gpio/gpio-viperboard.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/device/nvc0.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c17
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c25
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c31
-rw-r--r--drivers/gpu/drm/radeon/evergreen_hdmi.c7
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c22
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c28
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_family.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_crtc.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c2
-rw-r--r--drivers/gpu/drm/radeon/si.c370
-rw-r--r--drivers/gpu/drm/radeon/sid.h1
-rw-r--r--drivers/hv/channel_mgmt.c2
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c14
-rw-r--r--drivers/i2c/busses/i2c-designware-core.h2
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c1
-rw-r--r--drivers/i2c/busses/i2c-i801.c6
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c8
-rw-r--r--drivers/i2c/i2c-core.c3
-rw-r--r--drivers/iio/adc/exynos_adc.c8
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c2
-rw-r--r--drivers/iio/dac/Kconfig6
-rw-r--r--drivers/input/tablet/wacom_wac.c89
-rw-r--r--drivers/input/tablet/wacom_wac.h1
-rw-r--r--drivers/input/touchscreen/egalax_ts.c2
-rw-r--r--drivers/isdn/capi/kcapi.c6
-rw-r--r--drivers/leds/leds-gpio.c9
-rw-r--r--drivers/mfd/Kconfig3
-rw-r--r--drivers/mfd/ab8500-core.c24
-rw-r--r--drivers/mfd/ab8500-debugfs.c16
-rw-r--r--drivers/mfd/ab8500-gpadc.c7
-rw-r--r--drivers/mfd/ab8500-sysctrl.c15
-rw-r--r--drivers/mfd/abx500-core.c2
-rw-r--r--drivers/mfd/cros_ec_spi.c6
-rw-r--r--drivers/mfd/db8500-prcmu.c3
-rw-r--r--drivers/mfd/si476x-cmd.c152
-rw-r--r--drivers/misc/dummy-irq.c6
-rw-r--r--drivers/misc/mei/bus.c2
-rw-r--r--drivers/misc/mei/main.c17
-rw-r--r--drivers/misc/vmw_vmci/Kconfig2
-rw-r--r--drivers/misc/vmw_vmci/vmci_queue_pair.c2
-rw-r--r--drivers/net/bonding/bond_3ad.c21
-rw-r--r--drivers/net/bonding/bond_3ad.h2
-rw-r--r--drivers/net/bonding/bond_main.c26
-rw-r--r--drivers/net/bonding/bond_procfs.c2
-rw-r--r--drivers/net/bonding/bond_sysfs.c13
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c9
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c61
-rw-r--r--drivers/net/ethernet/cadence/macb.c18
-rw-r--r--drivers/net/ethernet/cadence/macb.h7
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c13
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c18
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c14
-rw-r--r--drivers/net/ethernet/freescale/gianfar_ptp.c1
-rw-r--r--drivers/net/ethernet/icplus/ipg.h86
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c6
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic.h6
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c49
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c65
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c1
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c3
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c1
-rw-r--r--drivers/net/ethernet/realtek/r8169.c41
-rw-r--r--drivers/net/ethernet/sfc/efx.c8
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h31
-rw-r--r--drivers/net/ethernet/sfc/rx.c8
-rw-r--r--drivers/net/usb/qmi_wwan.c1
-rw-r--r--drivers/net/usb/rtl8150.c100
-rw-r--r--drivers/net/usb/usbnet.c2
-rw-r--r--drivers/net/virtio_net.c9
-rw-r--r--drivers/net/vxlan.c17
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9485_initvals.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c74
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c7
-rw-r--r--drivers/net/wireless/iwlegacy/common.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api.h27
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c12
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c17
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c1
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c13
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.h2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c48
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/trx.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c1
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c14
-rw-r--r--drivers/s390/block/xpram.c1
-rw-r--r--drivers/s390/cio/chp.c36
-rw-r--r--drivers/s390/cio/chsc.h4
-rw-r--r--drivers/staging/Kconfig4
-rw-r--r--drivers/staging/android/logger.c4
-rw-r--r--drivers/staging/android/logger.h2
-rw-r--r--drivers/staging/comedi/Kconfig9
-rw-r--r--drivers/staging/comedi/comedi_buf.c12
-rw-r--r--drivers/staging/comedi/comedi_fops.c3
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c8
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.h1
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c20
-rw-r--r--drivers/staging/dwc2/Kconfig2
-rw-r--r--drivers/staging/dwc2/hcd_intr.c2
-rw-r--r--drivers/staging/dwc2/platform.c8
-rw-r--r--drivers/staging/gdm72xx/Kconfig2
-rw-r--r--drivers/staging/iio/adc/mxs-lradc.c5
-rw-r--r--drivers/staging/iio/light/tsl2x7x_core.c9
-rw-r--r--drivers/staging/imx-drm/Kconfig5
-rw-r--r--drivers/staging/imx-drm/imx-tve.c4
-rw-r--r--drivers/staging/media/solo6x10/Kconfig1
-rw-r--r--drivers/staging/nvec/nvec.c21
-rw-r--r--drivers/staging/nvec/nvec.h5
-rw-r--r--drivers/staging/nvec/nvec_kbd.c10
-rw-r--r--drivers/staging/nvec/nvec_power.c1
-rw-r--r--drivers/staging/nvec/nvec_ps2.c8
-rw-r--r--drivers/staging/sep/Kconfig2
-rw-r--r--drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c6
-rw-r--r--drivers/staging/vt6656/hostap.c2
-rw-r--r--drivers/staging/vt6656/iwctl.c6
-rw-r--r--drivers/staging/zcache/ramster/ramster-howto.txt366
-rw-r--r--drivers/staging/zcache/zcache-main.c8
-rw-r--r--drivers/tty/ehv_bytechan.c1
-rw-r--r--drivers/tty/mxser.c11
-rw-r--r--drivers/tty/n_tty.c8
-rw-r--r--drivers/tty/rocket.c288
-rw-r--r--drivers/tty/serial/8250/8250_dw.c7
-rw-r--r--drivers/tty/serial/amba-pl011.c2
-rw-r--r--drivers/tty/serial/mcf.c4
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c11
-rw-r--r--drivers/tty/serial/nwpserial.c2
-rw-r--r--drivers/tty/serial/samsung.c1
-rw-r--r--drivers/tty/vt/vt.c14
-rw-r--r--drivers/tty/vt/vt_ioctl.c67
-rw-r--r--drivers/uio/Kconfig1
-rw-r--r--drivers/usb/atm/cxacru.c3
-rw-r--r--drivers/usb/chipidea/Kconfig2
-rw-r--r--drivers/usb/chipidea/ci13xxx_imx.c15
-rw-r--r--drivers/usb/core/Kconfig2
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/dwc3/Kconfig6
-rw-r--r--drivers/usb/dwc3/dwc3-exynos.c6
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/bcm63xx_udc.c1
-rw-r--r--drivers/usb/gadget/configfs.c8
-rw-r--r--drivers/usb/gadget/dummy_hcd.c5
-rw-r--r--drivers/usb/gadget/f_ecm.c1
-rw-r--r--drivers/usb/gadget/f_subset.c1
-rw-r--r--drivers/usb/gadget/f_uac2.c2
-rw-r--r--drivers/usb/gadget/fusb300_udc.c4
-rw-r--r--drivers/usb/gadget/imx_udc.c2
-rw-r--r--drivers/usb/gadget/m66592-udc.c4
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c1
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c3
-rw-r--r--drivers/usb/gadget/zero.c8
-rw-r--r--drivers/usb/host/Kconfig17
-rw-r--r--drivers/usb/host/ehci-atmel.c6
-rw-r--r--drivers/usb/host/ehci-hcd.c17
-rw-r--r--drivers/usb/host/ehci-omap.c8
-rw-r--r--drivers/usb/host/ehci-orion.c6
-rw-r--r--drivers/usb/host/ehci-s5p.c5
-rw-r--r--drivers/usb/host/ehci-spear.c6
-rw-r--r--drivers/usb/host/ehci-tegra.c6
-rw-r--r--drivers/usb/host/isp1760-hcd.c2
-rw-r--r--drivers/usb/host/isp1760-if.c4
-rw-r--r--drivers/usb/host/ohci-at91.c6
-rw-r--r--drivers/usb/host/ohci-exynos.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c34
-rw-r--r--drivers/usb/host/ohci-nxp.c44
-rw-r--r--drivers/usb/host/ohci-omap3.c8
-rw-r--r--drivers/usb/host/ohci-pxa27x.c6
-rw-r--r--drivers/usb/host/ohci-spear.c6
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/host/uhci-hub.c3
-rw-r--r--drivers/usb/host/uhci-platform.c6
-rw-r--r--drivers/usb/host/uhci-q.c2
-rw-r--r--drivers/usb/host/xhci-mem.c17
-rw-r--r--drivers/usb/musb/musb_dsps.c1
-rw-r--r--drivers/usb/musb/omap2430.c3
-rw-r--r--drivers/usb/phy/Kconfig5
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c2
-rw-r--r--drivers/usb/phy/phy-fsl-usb.c1
-rw-r--r--drivers/usb/phy/phy-gpio-vbus-usb.c3
-rw-r--r--drivers/usb/phy/phy-isp1301.c1
-rw-r--r--drivers/usb/phy/phy-mv-usb.c3
-rw-r--r--drivers/usb/phy/phy-mxs-usb.c3
-rw-r--r--drivers/usb/phy/phy-nop.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c30
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h2
-rw-r--r--drivers/usb/serial/generic.c31
-rw-r--r--drivers/usb/serial/io_ti.c22
-rw-r--r--drivers/usb/serial/option.c13
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c23
-rw-r--r--drivers/usb/serial/usb-serial.c30
-rw-r--r--drivers/usb/storage/realtek_cr.c8
-rw-r--r--drivers/video/console/Makefile2
235 files changed, 2387 insertions, 1148 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 1dd6f6c85874..e427dc516c76 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -641,7 +641,9 @@ static void _handle_hotplug_event_root(struct work_struct *work)
641 /* bus enumerate */ 641 /* bus enumerate */
642 printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, 642 printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__,
643 (char *)buffer.pointer); 643 (char *)buffer.pointer);
644 if (!root) 644 if (root)
645 acpiphp_check_host_bridge(handle);
646 else
645 handle_root_bridge_insertion(handle); 647 handle_root_bridge_insertion(handle);
646 648
647 break; 649 break;
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 1a68f947ded8..d414331b480e 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -1295,6 +1295,7 @@ int subsys_virtual_register(struct bus_type *subsys,
1295 1295
1296 return subsys_register(subsys, groups, virtual_dir); 1296 return subsys_register(subsys, groups, virtual_dir);
1297} 1297}
1298EXPORT_SYMBOL_GPL(subsys_virtual_register);
1298 1299
1299int __init buses_init(void) 1300int __init buses_init(void)
1300{ 1301{
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 016312437577..2499cefdcdf2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -572,9 +572,11 @@ int device_create_file(struct device *dev,
572 572
573 if (dev) { 573 if (dev) {
574 WARN(((attr->attr.mode & S_IWUGO) && !attr->store), 574 WARN(((attr->attr.mode & S_IWUGO) && !attr->store),
575 "Write permission without 'store'\n"); 575 "Attribute %s: write permission without 'store'\n",
576 attr->attr.name);
576 WARN(((attr->attr.mode & S_IRUGO) && !attr->show), 577 WARN(((attr->attr.mode & S_IRUGO) && !attr->show),
577 "Read permission without 'show'\n"); 578 "Attribute %s: read permission without 'show'\n",
579 attr->attr.name);
578 error = sysfs_create_file(&dev->kobj, &attr->attr); 580 error = sysfs_create_file(&dev->kobj, &attr->attr);
579 } 581 }
580 582
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index bca9c80056fe..8bffa5c9818c 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -84,6 +84,8 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = {
84 { BCMA_CORE_I2S, "I2S" }, 84 { BCMA_CORE_I2S, "I2S" },
85 { BCMA_CORE_SDR_DDR1_MEM_CTL, "SDR/DDR1 Memory Controller" }, 85 { BCMA_CORE_SDR_DDR1_MEM_CTL, "SDR/DDR1 Memory Controller" },
86 { BCMA_CORE_SHIM, "SHIM" }, 86 { BCMA_CORE_SHIM, "SHIM" },
87 { BCMA_CORE_PCIE2, "PCIe Gen2" },
88 { BCMA_CORE_ARM_CR4, "ARM CR4" },
87 { BCMA_CORE_DEFAULT, "Default" }, 89 { BCMA_CORE_DEFAULT, "Default" },
88}; 90};
89 91
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index dafd9ac6428f..0913d79424d3 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -622,9 +622,12 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
622 return -EFAULT; 622 return -EFAULT;
623 break; 623 break;
624 case LPGETSTATUS: 624 case LPGETSTATUS:
625 if (mutex_lock_interruptible(&lp_table[minor].port_mutex))
626 return -EINTR;
625 lp_claim_parport_or_block (&lp_table[minor]); 627 lp_claim_parport_or_block (&lp_table[minor]);
626 status = r_str(minor); 628 status = r_str(minor);
627 lp_release_parport (&lp_table[minor]); 629 lp_release_parport (&lp_table[minor]);
630 mutex_unlock(&lp_table[minor].port_mutex);
628 631
629 if (copy_to_user(argp, &status, sizeof(int))) 632 if (copy_to_user(argp, &status, sizeof(int)))
630 return -EFAULT; 633 return -EFAULT;
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
index 4945bd3d18d0..d5d2e4a985aa 100644
--- a/drivers/char/ttyprintk.c
+++ b/drivers/char/ttyprintk.c
@@ -179,7 +179,6 @@ static int __init ttyprintk_init(void)
179{ 179{
180 int ret = -ENOMEM; 180 int ret = -ENOMEM;
181 181
182 tpk_port.port.ops = &null_ops;
183 mutex_init(&tpk_port.port_write_mutex); 182 mutex_init(&tpk_port.port_write_mutex);
184 183
185 ttyprintk_driver = tty_alloc_driver(1, 184 ttyprintk_driver = tty_alloc_driver(1,
@@ -190,6 +189,7 @@ static int __init ttyprintk_init(void)
190 return PTR_ERR(ttyprintk_driver); 189 return PTR_ERR(ttyprintk_driver);
191 190
192 tty_port_init(&tpk_port.port); 191 tty_port_init(&tpk_port.port);
192 tpk_port.port.ops = &null_ops;
193 193
194 ttyprintk_driver->driver_name = "ttyprintk"; 194 ttyprintk_driver->driver_name = "ttyprintk";
195 ttyprintk_driver->name = "ttyprintk"; 195 ttyprintk_driver->name = "ttyprintk";
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index 84889573b566..d53912768946 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -18,6 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/clock.h> 20#include <asm/clock.h>
21#include <asm/idle.h>
21 22
22#include <asm/mach-loongson/loongson.h> 23#include <asm/mach-loongson/loongson.h>
23 24
@@ -200,6 +201,7 @@ static void loongson2_cpu_wait(void)
200 LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */ 201 LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */
201 LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */ 202 LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */
202 spin_unlock_irqrestore(&loongson2_wait_lock, flags); 203 spin_unlock_irqrestore(&loongson2_wait_lock, flags);
204 local_irq_enable();
203} 205}
204 206
205static int __init cpufreq_init(void) 207static int __init cpufreq_init(void)
diff --git a/drivers/crypto/nx/nx-aes-cbc.c b/drivers/crypto/nx/nx-aes-cbc.c
index a76d4c4f29f5..35d483f8db66 100644
--- a/drivers/crypto/nx/nx-aes-cbc.c
+++ b/drivers/crypto/nx/nx-aes-cbc.c
@@ -126,6 +126,7 @@ struct crypto_alg nx_cbc_aes_alg = {
126 .cra_blocksize = AES_BLOCK_SIZE, 126 .cra_blocksize = AES_BLOCK_SIZE,
127 .cra_ctxsize = sizeof(struct nx_crypto_ctx), 127 .cra_ctxsize = sizeof(struct nx_crypto_ctx),
128 .cra_type = &crypto_blkcipher_type, 128 .cra_type = &crypto_blkcipher_type,
129 .cra_alignmask = 0xf,
129 .cra_module = THIS_MODULE, 130 .cra_module = THIS_MODULE,
130 .cra_init = nx_crypto_ctx_aes_cbc_init, 131 .cra_init = nx_crypto_ctx_aes_cbc_init,
131 .cra_exit = nx_crypto_ctx_exit, 132 .cra_exit = nx_crypto_ctx_exit,
diff --git a/drivers/crypto/nx/nx-aes-ecb.c b/drivers/crypto/nx/nx-aes-ecb.c
index ba5f1611336f..7bbc9a81da21 100644
--- a/drivers/crypto/nx/nx-aes-ecb.c
+++ b/drivers/crypto/nx/nx-aes-ecb.c
@@ -123,6 +123,7 @@ struct crypto_alg nx_ecb_aes_alg = {
123 .cra_priority = 300, 123 .cra_priority = 300,
124 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 124 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
125 .cra_blocksize = AES_BLOCK_SIZE, 125 .cra_blocksize = AES_BLOCK_SIZE,
126 .cra_alignmask = 0xf,
126 .cra_ctxsize = sizeof(struct nx_crypto_ctx), 127 .cra_ctxsize = sizeof(struct nx_crypto_ctx),
127 .cra_type = &crypto_blkcipher_type, 128 .cra_type = &crypto_blkcipher_type,
128 .cra_module = THIS_MODULE, 129 .cra_module = THIS_MODULE,
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c
index c8109edc5cfb..6cca6c392b00 100644
--- a/drivers/crypto/nx/nx-aes-gcm.c
+++ b/drivers/crypto/nx/nx-aes-gcm.c
@@ -219,7 +219,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc)
219 if (enc) 219 if (enc)
220 NX_CPB_FDM(csbcpb) |= NX_FDM_ENDE_ENCRYPT; 220 NX_CPB_FDM(csbcpb) |= NX_FDM_ENDE_ENCRYPT;
221 else 221 else
222 nbytes -= AES_BLOCK_SIZE; 222 nbytes -= crypto_aead_authsize(crypto_aead_reqtfm(req));
223 223
224 csbcpb->cpb.aes_gcm.bit_length_data = nbytes * 8; 224 csbcpb->cpb.aes_gcm.bit_length_data = nbytes * 8;
225 225
diff --git a/drivers/crypto/nx/nx-sha256.c b/drivers/crypto/nx/nx-sha256.c
index 9767315f8c0b..67024f2f0b78 100644
--- a/drivers/crypto/nx/nx-sha256.c
+++ b/drivers/crypto/nx/nx-sha256.c
@@ -69,7 +69,7 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
69 * 1: <= SHA256_BLOCK_SIZE: copy into state, return 0 69 * 1: <= SHA256_BLOCK_SIZE: copy into state, return 0
70 * 2: > SHA256_BLOCK_SIZE: process X blocks, copy in leftover 70 * 2: > SHA256_BLOCK_SIZE: process X blocks, copy in leftover
71 */ 71 */
72 if (len + sctx->count <= SHA256_BLOCK_SIZE) { 72 if (len + sctx->count < SHA256_BLOCK_SIZE) {
73 memcpy(sctx->buf + sctx->count, data, len); 73 memcpy(sctx->buf + sctx->count, data, len);
74 sctx->count += len; 74 sctx->count += len;
75 goto out; 75 goto out;
@@ -110,7 +110,8 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
110 atomic_inc(&(nx_ctx->stats->sha256_ops)); 110 atomic_inc(&(nx_ctx->stats->sha256_ops));
111 111
112 /* copy the leftover back into the state struct */ 112 /* copy the leftover back into the state struct */
113 memcpy(sctx->buf, data + len - leftover, leftover); 113 if (leftover)
114 memcpy(sctx->buf, data + len - leftover, leftover);
114 sctx->count = leftover; 115 sctx->count = leftover;
115 116
116 csbcpb->cpb.sha256.message_bit_length += (u64) 117 csbcpb->cpb.sha256.message_bit_length += (u64)
@@ -130,6 +131,7 @@ static int nx_sha256_final(struct shash_desc *desc, u8 *out)
130 struct nx_sg *in_sg, *out_sg; 131 struct nx_sg *in_sg, *out_sg;
131 int rc; 132 int rc;
132 133
134
133 if (NX_CPB_FDM(csbcpb) & NX_FDM_CONTINUATION) { 135 if (NX_CPB_FDM(csbcpb) & NX_FDM_CONTINUATION) {
134 /* we've hit the nx chip previously, now we're finalizing, 136 /* we've hit the nx chip previously, now we're finalizing,
135 * so copy over the partial digest */ 137 * so copy over the partial digest */
@@ -162,7 +164,7 @@ static int nx_sha256_final(struct shash_desc *desc, u8 *out)
162 164
163 atomic_inc(&(nx_ctx->stats->sha256_ops)); 165 atomic_inc(&(nx_ctx->stats->sha256_ops));
164 166
165 atomic64_add(csbcpb->cpb.sha256.message_bit_length, 167 atomic64_add(csbcpb->cpb.sha256.message_bit_length / 8,
166 &(nx_ctx->stats->sha256_bytes)); 168 &(nx_ctx->stats->sha256_bytes));
167 memcpy(out, csbcpb->cpb.sha256.message_digest, SHA256_DIGEST_SIZE); 169 memcpy(out, csbcpb->cpb.sha256.message_digest, SHA256_DIGEST_SIZE);
168out: 170out:
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c
index 3177b8c3d5f1..08eee1122349 100644
--- a/drivers/crypto/nx/nx-sha512.c
+++ b/drivers/crypto/nx/nx-sha512.c
@@ -69,7 +69,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
69 * 1: <= SHA512_BLOCK_SIZE: copy into state, return 0 69 * 1: <= SHA512_BLOCK_SIZE: copy into state, return 0
70 * 2: > SHA512_BLOCK_SIZE: process X blocks, copy in leftover 70 * 2: > SHA512_BLOCK_SIZE: process X blocks, copy in leftover
71 */ 71 */
72 if ((u64)len + sctx->count[0] <= SHA512_BLOCK_SIZE) { 72 if ((u64)len + sctx->count[0] < SHA512_BLOCK_SIZE) {
73 memcpy(sctx->buf + sctx->count[0], data, len); 73 memcpy(sctx->buf + sctx->count[0], data, len);
74 sctx->count[0] += len; 74 sctx->count[0] += len;
75 goto out; 75 goto out;
@@ -110,7 +110,8 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
110 atomic_inc(&(nx_ctx->stats->sha512_ops)); 110 atomic_inc(&(nx_ctx->stats->sha512_ops));
111 111
112 /* copy the leftover back into the state struct */ 112 /* copy the leftover back into the state struct */
113 memcpy(sctx->buf, data + len - leftover, leftover); 113 if (leftover)
114 memcpy(sctx->buf, data + len - leftover, leftover);
114 sctx->count[0] = leftover; 115 sctx->count[0] = leftover;
115 116
116 spbc_bits = csbcpb->cpb.sha512.spbc * 8; 117 spbc_bits = csbcpb->cpb.sha512.spbc * 8;
@@ -168,7 +169,7 @@ static int nx_sha512_final(struct shash_desc *desc, u8 *out)
168 goto out; 169 goto out;
169 170
170 atomic_inc(&(nx_ctx->stats->sha512_ops)); 171 atomic_inc(&(nx_ctx->stats->sha512_ops));
171 atomic64_add(csbcpb->cpb.sha512.message_bit_length_lo, 172 atomic64_add(csbcpb->cpb.sha512.message_bit_length_lo / 8,
172 &(nx_ctx->stats->sha512_bytes)); 173 &(nx_ctx->stats->sha512_bytes));
173 174
174 memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE); 175 memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE);
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index c767f232e693..bbdab6e5ccf0 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -211,44 +211,20 @@ int nx_build_sg_lists(struct nx_crypto_ctx *nx_ctx,
211{ 211{
212 struct nx_sg *nx_insg = nx_ctx->in_sg; 212 struct nx_sg *nx_insg = nx_ctx->in_sg;
213 struct nx_sg *nx_outsg = nx_ctx->out_sg; 213 struct nx_sg *nx_outsg = nx_ctx->out_sg;
214 struct blkcipher_walk walk;
215 int rc;
216
217 blkcipher_walk_init(&walk, dst, src, nbytes);
218 rc = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE);
219 if (rc)
220 goto out;
221 214
222 if (iv) 215 if (iv)
223 memcpy(iv, walk.iv, AES_BLOCK_SIZE); 216 memcpy(iv, desc->info, AES_BLOCK_SIZE);
224 217
225 while (walk.nbytes) { 218 nx_insg = nx_walk_and_build(nx_insg, nx_ctx->ap->sglen, src, 0, nbytes);
226 nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr, 219 nx_outsg = nx_walk_and_build(nx_outsg, nx_ctx->ap->sglen, dst, 0, nbytes);
227 walk.nbytes, nx_ctx->ap->sglen);
228 nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr,
229 walk.nbytes, nx_ctx->ap->sglen);
230
231 rc = blkcipher_walk_done(desc, &walk, 0);
232 if (rc)
233 break;
234 }
235
236 if (walk.nbytes) {
237 nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr,
238 walk.nbytes, nx_ctx->ap->sglen);
239 nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr,
240 walk.nbytes, nx_ctx->ap->sglen);
241
242 rc = 0;
243 }
244 220
245 /* these lengths should be negative, which will indicate to phyp that 221 /* these lengths should be negative, which will indicate to phyp that
246 * the input and output parameters are scatterlists, not linear 222 * the input and output parameters are scatterlists, not linear
247 * buffers */ 223 * buffers */
248 nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg); 224 nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg);
249 nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg); 225 nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg);
250out: 226
251 return rc; 227 return 0;
252} 228}
253 229
254/** 230/**
@@ -454,6 +430,8 @@ static int nx_register_algs(void)
454 if (rc) 430 if (rc)
455 goto out; 431 goto out;
456 432
433 nx_driver.of.status = NX_OKAY;
434
457 rc = crypto_register_alg(&nx_ecb_aes_alg); 435 rc = crypto_register_alg(&nx_ecb_aes_alg);
458 if (rc) 436 if (rc)
459 goto out; 437 goto out;
@@ -498,8 +476,6 @@ static int nx_register_algs(void)
498 if (rc) 476 if (rc)
499 goto out_unreg_s512; 477 goto out_unreg_s512;
500 478
501 nx_driver.of.status = NX_OKAY;
502
503 goto out; 479 goto out;
504 480
505out_unreg_s512: 481out_unreg_s512:
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 87d567089f13..573c449c49b9 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -636,7 +636,7 @@ config GPIO_MAX7301
636 636
637config GPIO_MCP23S08 637config GPIO_MCP23S08
638 tristate "Microchip MCP23xxx I/O expander" 638 tristate "Microchip MCP23xxx I/O expander"
639 depends on SPI_MASTER || I2C 639 depends on (SPI_MASTER && !I2C) || I2C
640 help 640 help
641 SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 641 SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017
642 I/O expanders. 642 I/O expanders.
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 634c3d37f7b5..62ef10a641c4 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -324,6 +324,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
324 resource_size_t start, len; 324 resource_size_t start, len;
325 struct lnw_gpio *lnw; 325 struct lnw_gpio *lnw;
326 u32 gpio_base; 326 u32 gpio_base;
327 u32 irq_base;
327 int retval; 328 int retval;
328 int ngpio = id->driver_data; 329 int ngpio = id->driver_data;
329 330
@@ -345,6 +346,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
345 retval = -EFAULT; 346 retval = -EFAULT;
346 goto err_ioremap; 347 goto err_ioremap;
347 } 348 }
349 irq_base = *(u32 *)base;
348 gpio_base = *((u32 *)base + 1); 350 gpio_base = *((u32 *)base + 1);
349 /* release the IO mapping, since we already get the info from bar1 */ 351 /* release the IO mapping, since we already get the info from bar1 */
350 iounmap(base); 352 iounmap(base);
@@ -365,13 +367,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
365 goto err_ioremap; 367 goto err_ioremap;
366 } 368 }
367 369
368 lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
369 &lnw_gpio_irq_ops, lnw);
370 if (!lnw->domain) {
371 retval = -ENOMEM;
372 goto err_ioremap;
373 }
374
375 lnw->reg_base = base; 370 lnw->reg_base = base;
376 lnw->chip.label = dev_name(&pdev->dev); 371 lnw->chip.label = dev_name(&pdev->dev);
377 lnw->chip.request = lnw_gpio_request; 372 lnw->chip.request = lnw_gpio_request;
@@ -384,6 +379,14 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
384 lnw->chip.ngpio = ngpio; 379 lnw->chip.ngpio = ngpio;
385 lnw->chip.can_sleep = 0; 380 lnw->chip.can_sleep = 0;
386 lnw->pdev = pdev; 381 lnw->pdev = pdev;
382
383 lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base,
384 &lnw_gpio_irq_ops, lnw);
385 if (!lnw->domain) {
386 retval = -ENOMEM;
387 goto err_ioremap;
388 }
389
387 pci_set_drvdata(pdev, lnw); 390 pci_set_drvdata(pdev, lnw);
388 retval = gpiochip_add(&lnw->chip); 391 retval = gpiochip_add(&lnw->chip);
389 if (retval) { 392 if (retval) {
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
index b73366523fae..0966f2637ad2 100644
--- a/drivers/gpio/gpio-ml-ioh.c
+++ b/drivers/gpio/gpio-ml-ioh.c
@@ -496,8 +496,7 @@ err_irq_alloc_descs:
496err_gpiochip_add: 496err_gpiochip_add:
497 while (--i >= 0) { 497 while (--i >= 0) {
498 chip--; 498 chip--;
499 ret = gpiochip_remove(&chip->gpio); 499 if (gpiochip_remove(&chip->gpio))
500 if (ret)
501 dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i); 500 dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i);
502 } 501 }
503 kfree(chip_save); 502 kfree(chip_save);
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 25000b0f8453..f8e6af20dfbf 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -326,7 +326,8 @@ static int mxs_gpio_probe(struct platform_device *pdev)
326 326
327 err = bgpio_init(&port->bgc, &pdev->dev, 4, 327 err = bgpio_init(&port->bgc, &pdev->dev, 4,
328 port->base + PINCTRL_DIN(port), 328 port->base + PINCTRL_DIN(port),
329 port->base + PINCTRL_DOUT(port), NULL, 329 port->base + PINCTRL_DOUT(port) + MXS_SET,
330 port->base + PINCTRL_DOUT(port) + MXS_CLR,
330 port->base + PINCTRL_DOE(port), NULL, 0); 331 port->base + PINCTRL_DOE(port), NULL, 0);
331 if (err) 332 if (err)
332 goto out_irqdesc_free; 333 goto out_irqdesc_free;
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 2050891d9c65..d3f7d2db870f 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -69,6 +69,7 @@ struct gpio_bank {
69 bool is_mpuio; 69 bool is_mpuio;
70 bool dbck_flag; 70 bool dbck_flag;
71 bool loses_context; 71 bool loses_context;
72 bool context_valid;
72 int stride; 73 int stride;
73 u32 width; 74 u32 width;
74 int context_loss_count; 75 int context_loss_count;
@@ -1128,6 +1129,10 @@ static int omap_gpio_probe(struct platform_device *pdev)
1128 bank->loses_context = true; 1129 bank->loses_context = true;
1129 } else { 1130 } else {
1130 bank->loses_context = pdata->loses_context; 1131 bank->loses_context = pdata->loses_context;
1132
1133 if (bank->loses_context)
1134 bank->get_context_loss_count =
1135 pdata->get_context_loss_count;
1131 } 1136 }
1132 1137
1133 1138
@@ -1178,9 +1183,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
1178 omap_gpio_chip_init(bank); 1183 omap_gpio_chip_init(bank);
1179 omap_gpio_show_rev(bank); 1184 omap_gpio_show_rev(bank);
1180 1185
1181 if (bank->loses_context)
1182 bank->get_context_loss_count = pdata->get_context_loss_count;
1183
1184 pm_runtime_put(bank->dev); 1186 pm_runtime_put(bank->dev);
1185 1187
1186 list_add_tail(&bank->node, &omap_gpio_list); 1188 list_add_tail(&bank->node, &omap_gpio_list);
@@ -1259,6 +1261,8 @@ update_gpio_context_count:
1259 return 0; 1261 return 0;
1260} 1262}
1261 1263
1264static void omap_gpio_init_context(struct gpio_bank *p);
1265
1262static int omap_gpio_runtime_resume(struct device *dev) 1266static int omap_gpio_runtime_resume(struct device *dev)
1263{ 1267{
1264 struct platform_device *pdev = to_platform_device(dev); 1268 struct platform_device *pdev = to_platform_device(dev);
@@ -1268,6 +1272,20 @@ static int omap_gpio_runtime_resume(struct device *dev)
1268 int c; 1272 int c;
1269 1273
1270 spin_lock_irqsave(&bank->lock, flags); 1274 spin_lock_irqsave(&bank->lock, flags);
1275
1276 /*
1277 * On the first resume during the probe, the context has not
1278 * been initialised and so initialise it now. Also initialise
1279 * the context loss count.
1280 */
1281 if (bank->loses_context && !bank->context_valid) {
1282 omap_gpio_init_context(bank);
1283
1284 if (bank->get_context_loss_count)
1285 bank->context_loss_count =
1286 bank->get_context_loss_count(bank->dev);
1287 }
1288
1271 _gpio_dbck_enable(bank); 1289 _gpio_dbck_enable(bank);
1272 1290
1273 /* 1291 /*
@@ -1384,6 +1402,29 @@ void omap2_gpio_resume_after_idle(void)
1384} 1402}
1385 1403
1386#if defined(CONFIG_PM_RUNTIME) 1404#if defined(CONFIG_PM_RUNTIME)
1405static void omap_gpio_init_context(struct gpio_bank *p)
1406{
1407 struct omap_gpio_reg_offs *regs = p->regs;
1408 void __iomem *base = p->base;
1409
1410 p->context.ctrl = __raw_readl(base + regs->ctrl);
1411 p->context.oe = __raw_readl(base + regs->direction);
1412 p->context.wake_en = __raw_readl(base + regs->wkup_en);
1413 p->context.leveldetect0 = __raw_readl(base + regs->leveldetect0);
1414 p->context.leveldetect1 = __raw_readl(base + regs->leveldetect1);
1415 p->context.risingdetect = __raw_readl(base + regs->risingdetect);
1416 p->context.fallingdetect = __raw_readl(base + regs->fallingdetect);
1417 p->context.irqenable1 = __raw_readl(base + regs->irqenable);
1418 p->context.irqenable2 = __raw_readl(base + regs->irqenable2);
1419
1420 if (regs->set_dataout && p->regs->clr_dataout)
1421 p->context.dataout = __raw_readl(base + regs->set_dataout);
1422 else
1423 p->context.dataout = __raw_readl(base + regs->dataout);
1424
1425 p->context_valid = true;
1426}
1427
1387static void omap_gpio_restore_context(struct gpio_bank *bank) 1428static void omap_gpio_restore_context(struct gpio_bank *bank)
1388{ 1429{
1389 __raw_writel(bank->context.wake_en, 1430 __raw_writel(bank->context.wake_en,
@@ -1421,6 +1462,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank)
1421#else 1462#else
1422#define omap_gpio_runtime_suspend NULL 1463#define omap_gpio_runtime_suspend NULL
1423#define omap_gpio_runtime_resume NULL 1464#define omap_gpio_runtime_resume NULL
1465static void omap_gpio_init_context(struct gpio_bank *p) {}
1424#endif 1466#endif
1425 1467
1426static const struct dev_pm_ops gpio_pm_ops = { 1468static const struct dev_pm_ops gpio_pm_ops = {
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index cdf599687cf7..0fec097e838d 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -424,8 +424,7 @@ end:
424err_request_irq: 424err_request_irq:
425 irq_free_descs(irq_base, gpio_pins[chip->ioh]); 425 irq_free_descs(irq_base, gpio_pins[chip->ioh]);
426 426
427 ret = gpiochip_remove(&chip->gpio); 427 if (gpiochip_remove(&chip->gpio))
428 if (ret)
429 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); 428 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
430 429
431err_gpiochip_add: 430err_gpiochip_add:
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 1e4de16ceb41..5af65719b95d 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -272,10 +272,8 @@ static int sch_gpio_probe(struct platform_device *pdev)
272 return 0; 272 return 0;
273 273
274err_sch_gpio_resume: 274err_sch_gpio_resume:
275 err = gpiochip_remove(&sch_gpio_core); 275 if (gpiochip_remove(&sch_gpio_core))
276 if (err) 276 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
277 dev_err(&pdev->dev, "%s failed, %d\n",
278 "gpiochip_remove()", err);
279 277
280err_sch_gpio_core: 278err_sch_gpio_core:
281 release_region(res->start, resource_size(res)); 279 release_region(res->start, resource_size(res));
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
index 095ab14cea4d..5ac2919197fe 100644
--- a/drivers/gpio/gpio-viperboard.c
+++ b/drivers/gpio/gpio-viperboard.c
@@ -446,7 +446,8 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
446 return ret; 446 return ret;
447 447
448err_gpiob: 448err_gpiob:
449 ret = gpiochip_remove(&vb_gpio->gpioa); 449 if (gpiochip_remove(&vb_gpio->gpioa))
450 dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
450 451
451err_gpioa: 452err_gpioa:
452 return ret; 453 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
index 955af122c3a6..a36e64e98ef3 100644
--- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
@@ -138,7 +138,6 @@ nvc0_identify(struct nouveau_device *device)
138 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 138 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
139 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 139 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
140 device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; 140 device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass;
141 device->oclass[NVDEV_ENGINE_COPY1 ] = &nvc0_copy1_oclass;
142 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; 141 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass;
143 break; 142 break;
144 case 0xce: 143 case 0xce:
@@ -225,7 +224,6 @@ nvc0_identify(struct nouveau_device *device)
225 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; 224 device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass;
226 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 225 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
227 device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; 226 device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass;
228 device->oclass[NVDEV_ENGINE_COPY1 ] = &nvc0_copy1_oclass;
229 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; 227 device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass;
230 break; 228 break;
231 case 0xc8: 229 case 0xc8:
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c
index ddaeb5572903..89bf459d584b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c
@@ -47,6 +47,7 @@ nv50_fifo_playlist_update(struct nv50_fifo_priv *priv)
47 struct nouveau_gpuobj *cur; 47 struct nouveau_gpuobj *cur;
48 int i, p; 48 int i, p;
49 49
50 mutex_lock(&nv_subdev(priv)->mutex);
50 cur = priv->playlist[priv->cur_playlist]; 51 cur = priv->playlist[priv->cur_playlist];
51 priv->cur_playlist = !priv->cur_playlist; 52 priv->cur_playlist = !priv->cur_playlist;
52 53
@@ -60,6 +61,7 @@ nv50_fifo_playlist_update(struct nv50_fifo_priv *priv)
60 nv_wr32(priv, 0x0032f4, cur->addr >> 12); 61 nv_wr32(priv, 0x0032f4, cur->addr >> 12);
61 nv_wr32(priv, 0x0032ec, p); 62 nv_wr32(priv, 0x0032ec, p);
62 nv_wr32(priv, 0x002500, 0x00000101); 63 nv_wr32(priv, 0x002500, 0x00000101);
64 mutex_unlock(&nv_subdev(priv)->mutex);
63} 65}
64 66
65static int 67static int
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
index 4d4a6b905370..46dfa68c47bb 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
@@ -71,6 +71,7 @@ nvc0_fifo_playlist_update(struct nvc0_fifo_priv *priv)
71 struct nouveau_gpuobj *cur; 71 struct nouveau_gpuobj *cur;
72 int i, p; 72 int i, p;
73 73
74 mutex_lock(&nv_subdev(priv)->mutex);
74 cur = priv->playlist[priv->cur_playlist]; 75 cur = priv->playlist[priv->cur_playlist];
75 priv->cur_playlist = !priv->cur_playlist; 76 priv->cur_playlist = !priv->cur_playlist;
76 77
@@ -87,6 +88,7 @@ nvc0_fifo_playlist_update(struct nvc0_fifo_priv *priv)
87 nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3)); 88 nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3));
88 if (!nv_wait(priv, 0x00227c, 0x00100000, 0x00000000)) 89 if (!nv_wait(priv, 0x00227c, 0x00100000, 0x00000000))
89 nv_error(priv, "playlist update failed\n"); 90 nv_error(priv, "playlist update failed\n");
91 mutex_unlock(&nv_subdev(priv)->mutex);
90} 92}
91 93
92static int 94static int
@@ -248,9 +250,17 @@ nvc0_fifo_chan_fini(struct nouveau_object *object, bool suspend)
248 struct nvc0_fifo_priv *priv = (void *)object->engine; 250 struct nvc0_fifo_priv *priv = (void *)object->engine;
249 struct nvc0_fifo_chan *chan = (void *)object; 251 struct nvc0_fifo_chan *chan = (void *)object;
250 u32 chid = chan->base.chid; 252 u32 chid = chan->base.chid;
253 u32 mask, engine;
251 254
252 nv_mask(priv, 0x003004 + (chid * 8), 0x00000001, 0x00000000); 255 nv_mask(priv, 0x003004 + (chid * 8), 0x00000001, 0x00000000);
253 nvc0_fifo_playlist_update(priv); 256 nvc0_fifo_playlist_update(priv);
257 mask = nv_rd32(priv, 0x0025a4);
258 for (engine = 0; mask && engine < 16; engine++) {
259 if (!(mask & (1 << engine)))
260 continue;
261 nv_mask(priv, 0x0025a8 + (engine * 4), 0x00000000, 0x00000000);
262 mask &= ~(1 << engine);
263 }
254 nv_wr32(priv, 0x003000 + (chid * 8), 0x00000000); 264 nv_wr32(priv, 0x003000 + (chid * 8), 0x00000000);
255 265
256 return nouveau_fifo_channel_fini(&chan->base, suspend); 266 return nouveau_fifo_channel_fini(&chan->base, suspend);
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
index 9151919fb831..56192a7242ae 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
@@ -94,11 +94,13 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine)
94 u32 match = (engine << 16) | 0x00000001; 94 u32 match = (engine << 16) | 0x00000001;
95 int i, p; 95 int i, p;
96 96
97 mutex_lock(&nv_subdev(priv)->mutex);
97 cur = engn->playlist[engn->cur_playlist]; 98 cur = engn->playlist[engn->cur_playlist];
98 if (unlikely(cur == NULL)) { 99 if (unlikely(cur == NULL)) {
99 int ret = nouveau_gpuobj_new(nv_object(priv), NULL, 100 int ret = nouveau_gpuobj_new(nv_object(priv), NULL,
100 0x8000, 0x1000, 0, &cur); 101 0x8000, 0x1000, 0, &cur);
101 if (ret) { 102 if (ret) {
103 mutex_unlock(&nv_subdev(priv)->mutex);
102 nv_error(priv, "playlist alloc failed\n"); 104 nv_error(priv, "playlist alloc failed\n");
103 return; 105 return;
104 } 106 }
@@ -122,6 +124,7 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine)
122 nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); 124 nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3));
123 if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000)) 125 if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000))
124 nv_error(priv, "playlist %d update timeout\n", engine); 126 nv_error(priv, "playlist %d update timeout\n", engine);
127 mutex_unlock(&nv_subdev(priv)->mutex);
125} 128}
126 129
127static int 130static int
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index c300b5e7b670..c434d398d16f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -1940,8 +1940,8 @@ init_zm_mask_add(struct nvbios_init *init)
1940 trace("ZM_MASK_ADD\tR[0x%06x] &= 0x%08x += 0x%08x\n", addr, mask, add); 1940 trace("ZM_MASK_ADD\tR[0x%06x] &= 0x%08x += 0x%08x\n", addr, mask, add);
1941 init->offset += 13; 1941 init->offset += 13;
1942 1942
1943 data = init_rd32(init, addr) & mask; 1943 data = init_rd32(init, addr);
1944 data |= ((data + add) & ~mask); 1944 data = (data & mask) | ((data + add) & ~mask);
1945 init_wr32(init, addr, data); 1945 init_wr32(init, addr, data);
1946} 1946}
1947 1947
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
index e4940fb166e8..fb794e997fbc 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
@@ -29,7 +29,6 @@
29struct nvc0_ltcg_priv { 29struct nvc0_ltcg_priv {
30 struct nouveau_ltcg base; 30 struct nouveau_ltcg base;
31 u32 part_nr; 31 u32 part_nr;
32 u32 part_mask;
33 u32 subp_nr; 32 u32 subp_nr;
34 struct nouveau_mm tags; 33 struct nouveau_mm tags;
35 u32 num_tags; 34 u32 num_tags;
@@ -105,8 +104,6 @@ nvc0_ltcg_tags_clear(struct nouveau_ltcg *ltcg, u32 first, u32 count)
105 104
106 /* wait until it's finished with clearing */ 105 /* wait until it's finished with clearing */
107 for (p = 0; p < priv->part_nr; ++p) { 106 for (p = 0; p < priv->part_nr; ++p) {
108 if (!(priv->part_mask & (1 << p)))
109 continue;
110 for (i = 0; i < priv->subp_nr; ++i) 107 for (i = 0; i < priv->subp_nr; ++i)
111 nv_wait(priv, 0x1410c8 + p * 0x2000 + i * 0x400, ~0, 0); 108 nv_wait(priv, 0x1410c8 + p * 0x2000 + i * 0x400, ~0, 0);
112 } 109 }
@@ -121,6 +118,8 @@ nvc0_ltcg_init_tag_ram(struct nouveau_fb *pfb, struct nvc0_ltcg_priv *priv)
121 int ret; 118 int ret;
122 119
123 nv_wr32(priv, 0x17e8d8, priv->part_nr); 120 nv_wr32(priv, 0x17e8d8, priv->part_nr);
121 if (nv_device(pfb)->card_type >= NV_E0)
122 nv_wr32(priv, 0x17e000, priv->part_nr);
124 123
125 /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */ 124 /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */
126 priv->num_tags = (pfb->ram.size >> 17) / 4; 125 priv->num_tags = (pfb->ram.size >> 17) / 4;
@@ -167,16 +166,20 @@ nvc0_ltcg_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
167{ 166{
168 struct nvc0_ltcg_priv *priv; 167 struct nvc0_ltcg_priv *priv;
169 struct nouveau_fb *pfb = nouveau_fb(parent); 168 struct nouveau_fb *pfb = nouveau_fb(parent);
170 int ret; 169 u32 parts, mask;
170 int ret, i;
171 171
172 ret = nouveau_ltcg_create(parent, engine, oclass, &priv); 172 ret = nouveau_ltcg_create(parent, engine, oclass, &priv);
173 *pobject = nv_object(priv); 173 *pobject = nv_object(priv);
174 if (ret) 174 if (ret)
175 return ret; 175 return ret;
176 176
177 priv->part_nr = nv_rd32(priv, 0x022438); 177 parts = nv_rd32(priv, 0x022438);
178 priv->part_mask = nv_rd32(priv, 0x022554); 178 mask = nv_rd32(priv, 0x022554);
179 179 for (i = 0; i < parts; i++) {
180 if (!(mask & (1 << i)))
181 priv->part_nr++;
182 }
180 priv->subp_nr = nv_rd32(priv, 0x17e8dc) >> 28; 183 priv->subp_nr = nv_rd32(priv, 0x17e8dc) >> 28;
181 184
182 nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ 185 nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 46c152ff0a80..383f4e6ea9d1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -453,18 +453,32 @@ nouveau_do_suspend(struct drm_device *dev)
453 NV_INFO(drm, "evicting buffers...\n"); 453 NV_INFO(drm, "evicting buffers...\n");
454 ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); 454 ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM);
455 455
456 NV_INFO(drm, "waiting for kernel channels to go idle...\n");
457 if (drm->cechan) {
458 ret = nouveau_channel_idle(drm->cechan);
459 if (ret)
460 return ret;
461 }
462
463 if (drm->channel) {
464 ret = nouveau_channel_idle(drm->channel);
465 if (ret)
466 return ret;
467 }
468
469 NV_INFO(drm, "suspending client object trees...\n");
456 if (drm->fence && nouveau_fence(drm)->suspend) { 470 if (drm->fence && nouveau_fence(drm)->suspend) {
457 if (!nouveau_fence(drm)->suspend(drm)) 471 if (!nouveau_fence(drm)->suspend(drm))
458 return -ENOMEM; 472 return -ENOMEM;
459 } 473 }
460 474
461 NV_INFO(drm, "suspending client object trees...\n");
462 list_for_each_entry(cli, &drm->clients, head) { 475 list_for_each_entry(cli, &drm->clients, head) {
463 ret = nouveau_client_fini(&cli->base, true); 476 ret = nouveau_client_fini(&cli->base, true);
464 if (ret) 477 if (ret)
465 goto fail_client; 478 goto fail_client;
466 } 479 }
467 480
481 NV_INFO(drm, "suspending kernel object tree...\n");
468 ret = nouveau_client_fini(&drm->client.base, true); 482 ret = nouveau_client_fini(&drm->client.base, true);
469 if (ret) 483 if (ret)
470 goto fail_client; 484 goto fail_client;
@@ -514,17 +528,18 @@ nouveau_do_resume(struct drm_device *dev)
514 528
515 nouveau_agp_reset(drm); 529 nouveau_agp_reset(drm);
516 530
517 NV_INFO(drm, "resuming client object trees...\n"); 531 NV_INFO(drm, "resuming kernel object tree...\n");
518 nouveau_client_init(&drm->client.base); 532 nouveau_client_init(&drm->client.base);
519 nouveau_agp_init(drm); 533 nouveau_agp_init(drm);
520 534
535 NV_INFO(drm, "resuming client object trees...\n");
536 if (drm->fence && nouveau_fence(drm)->resume)
537 nouveau_fence(drm)->resume(drm);
538
521 list_for_each_entry(cli, &drm->clients, head) { 539 list_for_each_entry(cli, &drm->clients, head) {
522 nouveau_client_init(&cli->base); 540 nouveau_client_init(&cli->base);
523 } 541 }
524 542
525 if (drm->fence && nouveau_fence(drm)->resume)
526 nouveau_fence(drm)->resume(drm);
527
528 nouveau_run_vbios_init(dev); 543 nouveau_run_vbios_init(dev);
529 nouveau_pm_resume(dev); 544 nouveau_pm_resume(dev);
530 545
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 6d6fdb3ba0d0..d5df8fd10217 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1811,12 +1811,9 @@ static bool atombios_crtc_mode_fixup(struct drm_crtc *crtc,
1811 1811
1812static void atombios_crtc_prepare(struct drm_crtc *crtc) 1812static void atombios_crtc_prepare(struct drm_crtc *crtc)
1813{ 1813{
1814 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1815 struct drm_device *dev = crtc->dev; 1814 struct drm_device *dev = crtc->dev;
1816 struct radeon_device *rdev = dev->dev_private; 1815 struct radeon_device *rdev = dev->dev_private;
1817 1816
1818 radeon_crtc->in_mode_set = true;
1819
1820 /* disable crtc pair power gating before programming */ 1817 /* disable crtc pair power gating before programming */
1821 if (ASIC_IS_DCE6(rdev)) 1818 if (ASIC_IS_DCE6(rdev))
1822 atombios_powergate_crtc(crtc, ATOM_DISABLE); 1819 atombios_powergate_crtc(crtc, ATOM_DISABLE);
@@ -1827,11 +1824,8 @@ static void atombios_crtc_prepare(struct drm_crtc *crtc)
1827 1824
1828static void atombios_crtc_commit(struct drm_crtc *crtc) 1825static void atombios_crtc_commit(struct drm_crtc *crtc)
1829{ 1826{
1830 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1831
1832 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON); 1827 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
1833 atombios_lock_crtc(crtc, ATOM_DISABLE); 1828 atombios_lock_crtc(crtc, ATOM_DISABLE);
1834 radeon_crtc->in_mode_set = false;
1835} 1829}
1836 1830
1837static void atombios_crtc_disable(struct drm_crtc *crtc) 1831static void atombios_crtc_disable(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 105bafb6c29d..8f9e2d31b255 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2343,11 +2343,13 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav
2343 u32 crtc_enabled, tmp, frame_count, blackout; 2343 u32 crtc_enabled, tmp, frame_count, blackout;
2344 int i, j; 2344 int i, j;
2345 2345
2346 save->vga_render_control = RREG32(VGA_RENDER_CONTROL); 2346 if (!ASIC_IS_NODCE(rdev)) {
2347 save->vga_hdp_control = RREG32(VGA_HDP_CONTROL); 2347 save->vga_render_control = RREG32(VGA_RENDER_CONTROL);
2348 save->vga_hdp_control = RREG32(VGA_HDP_CONTROL);
2348 2349
2349 /* disable VGA render */ 2350 /* disable VGA render */
2350 WREG32(VGA_RENDER_CONTROL, 0); 2351 WREG32(VGA_RENDER_CONTROL, 0);
2352 }
2351 /* blank the display controllers */ 2353 /* blank the display controllers */
2352 for (i = 0; i < rdev->num_crtc; i++) { 2354 for (i = 0; i < rdev->num_crtc; i++) {
2353 crtc_enabled = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]) & EVERGREEN_CRTC_MASTER_EN; 2355 crtc_enabled = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]) & EVERGREEN_CRTC_MASTER_EN;
@@ -2438,8 +2440,11 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
2438 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + crtc_offsets[i], 2440 WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + crtc_offsets[i],
2439 (u32)rdev->mc.vram_start); 2441 (u32)rdev->mc.vram_start);
2440 } 2442 }
2441 WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH, upper_32_bits(rdev->mc.vram_start)); 2443
2442 WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS, (u32)rdev->mc.vram_start); 2444 if (!ASIC_IS_NODCE(rdev)) {
2445 WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH, upper_32_bits(rdev->mc.vram_start));
2446 WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS, (u32)rdev->mc.vram_start);
2447 }
2443 2448
2444 /* unlock regs and wait for update */ 2449 /* unlock regs and wait for update */
2445 for (i = 0; i < rdev->num_crtc; i++) { 2450 for (i = 0; i < rdev->num_crtc; i++) {
@@ -2499,10 +2504,12 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s
2499 } 2504 }
2500 } 2505 }
2501 } 2506 }
2502 /* Unlock vga access */ 2507 if (!ASIC_IS_NODCE(rdev)) {
2503 WREG32(VGA_HDP_CONTROL, save->vga_hdp_control); 2508 /* Unlock vga access */
2504 mdelay(1); 2509 WREG32(VGA_HDP_CONTROL, save->vga_hdp_control);
2505 WREG32(VGA_RENDER_CONTROL, save->vga_render_control); 2510 mdelay(1);
2511 WREG32(VGA_RENDER_CONTROL, save->vga_render_control);
2512 }
2506} 2513}
2507 2514
2508void evergreen_mc_program(struct radeon_device *rdev) 2515void evergreen_mc_program(struct radeon_device *rdev)
@@ -3405,8 +3412,8 @@ int evergreen_mc_init(struct radeon_device *rdev)
3405 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 3412 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
3406 } else { 3413 } else {
3407 /* size in MB on evergreen/cayman/tn */ 3414 /* size in MB on evergreen/cayman/tn */
3408 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 3415 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
3409 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 3416 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
3410 } 3417 }
3411 rdev->mc.visible_vram_size = rdev->mc.aper_size; 3418 rdev->mc.visible_vram_size = rdev->mc.aper_size;
3412 r700_vram_gtt_location(rdev, &rdev->mc); 3419 r700_vram_gtt_location(rdev, &rdev->mc);
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index b4ab8ceb1654..ed7c8a768092 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -154,19 +154,18 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock)
154 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 154 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
155 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 155 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
156 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); 156 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
157 u32 base_rate = 48000; 157 u32 base_rate = 24000;
158 158
159 if (!dig || !dig->afmt) 159 if (!dig || !dig->afmt)
160 return; 160 return;
161 161
162 /* XXX: properly calculate this */
163 /* XXX two dtos; generally use dto0 for hdmi */ 162 /* XXX two dtos; generally use dto0 for hdmi */
164 /* Express [24MHz / target pixel clock] as an exact rational 163 /* Express [24MHz / target pixel clock] as an exact rational
165 * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE 164 * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE
166 * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator 165 * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator
167 */ 166 */
168 WREG32(DCCG_AUDIO_DTO0_PHASE, (base_rate*50) & 0xffffff); 167 WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100);
169 WREG32(DCCG_AUDIO_DTO0_MODULE, (clock*100) & 0xffffff); 168 WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100);
170 WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); 169 WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id));
171} 170}
172 171
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index 47f180a79352..456750a0daa5 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -232,7 +232,7 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
232 struct radeon_device *rdev = dev->dev_private; 232 struct radeon_device *rdev = dev->dev_private;
233 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 233 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
234 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 234 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
235 u32 base_rate = 48000; 235 u32 base_rate = 24000;
236 236
237 if (!dig || !dig->afmt) 237 if (!dig || !dig->afmt)
238 return; 238 return;
@@ -240,7 +240,6 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
240 /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. 240 /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT.
241 * doesn't matter which one you use. Just use the first one. 241 * doesn't matter which one you use. Just use the first one.
242 */ 242 */
243 /* XXX: properly calculate this */
244 /* XXX two dtos; generally use dto0 for hdmi */ 243 /* XXX two dtos; generally use dto0 for hdmi */
245 /* Express [24MHz / target pixel clock] as an exact rational 244 /* Express [24MHz / target pixel clock] as an exact rational
246 * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE 245 * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE
@@ -250,13 +249,13 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
250 /* according to the reg specs, this should DCE3.2 only, but in 249 /* according to the reg specs, this should DCE3.2 only, but in
251 * practice it seems to cover DCE3.0 as well. 250 * practice it seems to cover DCE3.0 as well.
252 */ 251 */
253 WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 50); 252 WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100);
254 WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); 253 WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100);
255 WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ 254 WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */
256 } else { 255 } else {
257 /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ 256 /* according to the reg specs, this should be DCE2.0 and DCE3.0 */
258 WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate * 50) | 257 WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) |
259 AUDIO_DTO_MODULE(clock * 100)); 258 AUDIO_DTO_MODULE(clock / 10));
260 } 259 }
261} 260}
262 261
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 1442ce765d48..142ce6cc69f5 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1694,6 +1694,7 @@ struct radeon_device {
1694 int num_crtc; /* number of crtcs */ 1694 int num_crtc; /* number of crtcs */
1695 struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */ 1695 struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
1696 bool audio_enabled; 1696 bool audio_enabled;
1697 bool has_uvd;
1697 struct r600_audio audio_status; /* audio stuff */ 1698 struct r600_audio audio_status; /* audio stuff */
1698 struct notifier_block acpi_nb; 1699 struct notifier_block acpi_nb;
1699 /* only one userspace can use Hyperz features or CMASK at a time */ 1700 /* only one userspace can use Hyperz features or CMASK at a time */
@@ -1838,6 +1839,7 @@ void r100_pll_errata_after_index(struct radeon_device *rdev);
1838#define ASIC_IS_DCE61(rdev) ((rdev->family >= CHIP_ARUBA) && \ 1839#define ASIC_IS_DCE61(rdev) ((rdev->family >= CHIP_ARUBA) && \
1839 (rdev->flags & RADEON_IS_IGP)) 1840 (rdev->flags & RADEON_IS_IGP))
1840#define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) 1841#define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND))
1842#define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN))
1841 1843
1842/* 1844/*
1843 * BIOS helpers. 1845 * BIOS helpers.
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 6417132c50cf..06b8c19ab19e 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -1935,6 +1935,8 @@ int radeon_asic_init(struct radeon_device *rdev)
1935 else 1935 else
1936 rdev->num_crtc = 2; 1936 rdev->num_crtc = 2;
1937 1937
1938 rdev->has_uvd = false;
1939
1938 switch (rdev->family) { 1940 switch (rdev->family) {
1939 case CHIP_R100: 1941 case CHIP_R100:
1940 case CHIP_RV100: 1942 case CHIP_RV100:
@@ -1999,16 +2001,22 @@ int radeon_asic_init(struct radeon_device *rdev)
1999 case CHIP_RV635: 2001 case CHIP_RV635:
2000 case CHIP_RV670: 2002 case CHIP_RV670:
2001 rdev->asic = &r600_asic; 2003 rdev->asic = &r600_asic;
2004 if (rdev->family == CHIP_R600)
2005 rdev->has_uvd = false;
2006 else
2007 rdev->has_uvd = true;
2002 break; 2008 break;
2003 case CHIP_RS780: 2009 case CHIP_RS780:
2004 case CHIP_RS880: 2010 case CHIP_RS880:
2005 rdev->asic = &rs780_asic; 2011 rdev->asic = &rs780_asic;
2012 rdev->has_uvd = true;
2006 break; 2013 break;
2007 case CHIP_RV770: 2014 case CHIP_RV770:
2008 case CHIP_RV730: 2015 case CHIP_RV730:
2009 case CHIP_RV710: 2016 case CHIP_RV710:
2010 case CHIP_RV740: 2017 case CHIP_RV740:
2011 rdev->asic = &rv770_asic; 2018 rdev->asic = &rv770_asic;
2019 rdev->has_uvd = true;
2012 break; 2020 break;
2013 case CHIP_CEDAR: 2021 case CHIP_CEDAR:
2014 case CHIP_REDWOOD: 2022 case CHIP_REDWOOD:
@@ -2021,11 +2029,13 @@ int radeon_asic_init(struct radeon_device *rdev)
2021 else 2029 else
2022 rdev->num_crtc = 6; 2030 rdev->num_crtc = 6;
2023 rdev->asic = &evergreen_asic; 2031 rdev->asic = &evergreen_asic;
2032 rdev->has_uvd = true;
2024 break; 2033 break;
2025 case CHIP_PALM: 2034 case CHIP_PALM:
2026 case CHIP_SUMO: 2035 case CHIP_SUMO:
2027 case CHIP_SUMO2: 2036 case CHIP_SUMO2:
2028 rdev->asic = &sumo_asic; 2037 rdev->asic = &sumo_asic;
2038 rdev->has_uvd = true;
2029 break; 2039 break;
2030 case CHIP_BARTS: 2040 case CHIP_BARTS:
2031 case CHIP_TURKS: 2041 case CHIP_TURKS:
@@ -2036,27 +2046,37 @@ int radeon_asic_init(struct radeon_device *rdev)
2036 else 2046 else
2037 rdev->num_crtc = 6; 2047 rdev->num_crtc = 6;
2038 rdev->asic = &btc_asic; 2048 rdev->asic = &btc_asic;
2049 rdev->has_uvd = true;
2039 break; 2050 break;
2040 case CHIP_CAYMAN: 2051 case CHIP_CAYMAN:
2041 rdev->asic = &cayman_asic; 2052 rdev->asic = &cayman_asic;
2042 /* set num crtcs */ 2053 /* set num crtcs */
2043 rdev->num_crtc = 6; 2054 rdev->num_crtc = 6;
2055 rdev->has_uvd = true;
2044 break; 2056 break;
2045 case CHIP_ARUBA: 2057 case CHIP_ARUBA:
2046 rdev->asic = &trinity_asic; 2058 rdev->asic = &trinity_asic;
2047 /* set num crtcs */ 2059 /* set num crtcs */
2048 rdev->num_crtc = 4; 2060 rdev->num_crtc = 4;
2061 rdev->has_uvd = true;
2049 break; 2062 break;
2050 case CHIP_TAHITI: 2063 case CHIP_TAHITI:
2051 case CHIP_PITCAIRN: 2064 case CHIP_PITCAIRN:
2052 case CHIP_VERDE: 2065 case CHIP_VERDE:
2053 case CHIP_OLAND: 2066 case CHIP_OLAND:
2067 case CHIP_HAINAN:
2054 rdev->asic = &si_asic; 2068 rdev->asic = &si_asic;
2055 /* set num crtcs */ 2069 /* set num crtcs */
2056 if (rdev->family == CHIP_OLAND) 2070 if (rdev->family == CHIP_HAINAN)
2071 rdev->num_crtc = 0;
2072 else if (rdev->family == CHIP_OLAND)
2057 rdev->num_crtc = 2; 2073 rdev->num_crtc = 2;
2058 else 2074 else
2059 rdev->num_crtc = 6; 2075 rdev->num_crtc = 6;
2076 if (rdev->family == CHIP_HAINAN)
2077 rdev->has_uvd = false;
2078 else
2079 rdev->has_uvd = true;
2060 break; 2080 break;
2061 default: 2081 default:
2062 /* FIXME: not supported yet */ 2082 /* FIXME: not supported yet */
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index fa3c56fba294..061b227dae0c 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -244,24 +244,28 @@ static bool ni_read_disabled_bios(struct radeon_device *rdev)
244 244
245 /* enable the rom */ 245 /* enable the rom */
246 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); 246 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
247 /* Disable VGA mode */ 247 if (!ASIC_IS_NODCE(rdev)) {
248 WREG32(AVIVO_D1VGA_CONTROL, 248 /* Disable VGA mode */
249 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 249 WREG32(AVIVO_D1VGA_CONTROL,
250 AVIVO_DVGA_CONTROL_TIMING_SELECT))); 250 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
251 WREG32(AVIVO_D2VGA_CONTROL, 251 AVIVO_DVGA_CONTROL_TIMING_SELECT)));
252 (d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 252 WREG32(AVIVO_D2VGA_CONTROL,
253 AVIVO_DVGA_CONTROL_TIMING_SELECT))); 253 (d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
254 WREG32(AVIVO_VGA_RENDER_CONTROL, 254 AVIVO_DVGA_CONTROL_TIMING_SELECT)));
255 (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK)); 255 WREG32(AVIVO_VGA_RENDER_CONTROL,
256 (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK));
257 }
256 WREG32(R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); 258 WREG32(R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE);
257 259
258 r = radeon_read_bios(rdev); 260 r = radeon_read_bios(rdev);
259 261
260 /* restore regs */ 262 /* restore regs */
261 WREG32(R600_BUS_CNTL, bus_cntl); 263 WREG32(R600_BUS_CNTL, bus_cntl);
262 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 264 if (!ASIC_IS_NODCE(rdev)) {
263 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 265 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
264 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 266 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
267 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
268 }
265 WREG32(R600_ROM_CNTL, rom_cntl); 269 WREG32(R600_ROM_CNTL, rom_cntl);
266 return r; 270 return r;
267} 271}
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index a8f608903989..c2c59fb1ea01 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -94,6 +94,7 @@ static const char radeon_family_name[][16] = {
94 "PITCAIRN", 94 "PITCAIRN",
95 "VERDE", 95 "VERDE",
96 "OLAND", 96 "OLAND",
97 "HAINAN",
97 "LAST", 98 "LAST",
98}; 99};
99 100
diff --git a/drivers/gpu/drm/radeon/radeon_family.h b/drivers/gpu/drm/radeon/radeon_family.h
index 2d91123f2759..36e9803b077d 100644
--- a/drivers/gpu/drm/radeon/radeon_family.h
+++ b/drivers/gpu/drm/radeon/radeon_family.h
@@ -92,6 +92,7 @@ enum radeon_family {
92 CHIP_PITCAIRN, 92 CHIP_PITCAIRN,
93 CHIP_VERDE, 93 CHIP_VERDE,
94 CHIP_OLAND, 94 CHIP_OLAND,
95 CHIP_HAINAN,
95 CHIP_LAST, 96 CHIP_LAST,
96}; 97};
97 98
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 6857cb4efb76..7cb178a34a0f 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1031,11 +1031,9 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc,
1031 1031
1032static void radeon_crtc_prepare(struct drm_crtc *crtc) 1032static void radeon_crtc_prepare(struct drm_crtc *crtc)
1033{ 1033{
1034 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1035 struct drm_device *dev = crtc->dev; 1034 struct drm_device *dev = crtc->dev;
1036 struct drm_crtc *crtci; 1035 struct drm_crtc *crtci;
1037 1036
1038 radeon_crtc->in_mode_set = true;
1039 /* 1037 /*
1040 * The hardware wedges sometimes if you reconfigure one CRTC 1038 * The hardware wedges sometimes if you reconfigure one CRTC
1041 * whilst another is running (see fdo bug #24611). 1039 * whilst another is running (see fdo bug #24611).
@@ -1046,7 +1044,6 @@ static void radeon_crtc_prepare(struct drm_crtc *crtc)
1046 1044
1047static void radeon_crtc_commit(struct drm_crtc *crtc) 1045static void radeon_crtc_commit(struct drm_crtc *crtc)
1048{ 1046{
1049 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
1050 struct drm_device *dev = crtc->dev; 1047 struct drm_device *dev = crtc->dev;
1051 struct drm_crtc *crtci; 1048 struct drm_crtc *crtci;
1052 1049
@@ -1057,7 +1054,6 @@ static void radeon_crtc_commit(struct drm_crtc *crtc)
1057 if (crtci->enabled) 1054 if (crtci->enabled)
1058 radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON); 1055 radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON);
1059 } 1056 }
1060 radeon_crtc->in_mode_set = false;
1061} 1057}
1062 1058
1063static const struct drm_crtc_helper_funcs legacy_helper_funcs = { 1059static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 44e579e75fd0..69ad4fe224c1 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -302,7 +302,6 @@ struct radeon_crtc {
302 u16 lut_r[256], lut_g[256], lut_b[256]; 302 u16 lut_r[256], lut_g[256], lut_b[256];
303 bool enabled; 303 bool enabled;
304 bool can_tile; 304 bool can_tile;
305 bool in_mode_set;
306 uint32_t crtc_offset; 305 uint32_t crtc_offset;
307 struct drm_gem_object *cursor_bo; 306 struct drm_gem_object *cursor_bo;
308 uint64_t cursor_addr; 307 uint64_t cursor_addr;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 93f760e27a92..6c0ce8915fac 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -726,7 +726,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
726 return r; 726 return r;
727 } 727 }
728 DRM_INFO("radeon: %uM of VRAM memory ready\n", 728 DRM_INFO("radeon: %uM of VRAM memory ready\n",
729 (unsigned)rdev->mc.real_vram_size / (1024 * 1024)); 729 (unsigned) (rdev->mc.real_vram_size / (1024 * 1024)));
730 r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT, 730 r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT,
731 rdev->mc.gtt_size >> PAGE_SHIFT); 731 rdev->mc.gtt_size >> PAGE_SHIFT);
732 if (r) { 732 if (r) {
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index f0b6c2f87c4d..5ffade69af25 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -60,6 +60,11 @@ MODULE_FIRMWARE("radeon/OLAND_me.bin");
60MODULE_FIRMWARE("radeon/OLAND_ce.bin"); 60MODULE_FIRMWARE("radeon/OLAND_ce.bin");
61MODULE_FIRMWARE("radeon/OLAND_mc.bin"); 61MODULE_FIRMWARE("radeon/OLAND_mc.bin");
62MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); 62MODULE_FIRMWARE("radeon/OLAND_rlc.bin");
63MODULE_FIRMWARE("radeon/HAINAN_pfp.bin");
64MODULE_FIRMWARE("radeon/HAINAN_me.bin");
65MODULE_FIRMWARE("radeon/HAINAN_ce.bin");
66MODULE_FIRMWARE("radeon/HAINAN_mc.bin");
67MODULE_FIRMWARE("radeon/HAINAN_rlc.bin");
63 68
64extern int r600_ih_ring_alloc(struct radeon_device *rdev); 69extern int r600_ih_ring_alloc(struct radeon_device *rdev);
65extern void r600_ih_ring_fini(struct radeon_device *rdev); 70extern void r600_ih_ring_fini(struct radeon_device *rdev);
@@ -265,6 +270,40 @@ static const u32 oland_golden_registers[] =
265 0x15c0, 0x000c0fc0, 0x000c0400 270 0x15c0, 0x000c0fc0, 0x000c0400
266}; 271};
267 272
273static const u32 hainan_golden_registers[] =
274{
275 0x9a10, 0x00010000, 0x00018208,
276 0x9830, 0xffffffff, 0x00000000,
277 0x9834, 0xf00fffff, 0x00000400,
278 0x9838, 0x0002021c, 0x00020200,
279 0xd0c0, 0xff000fff, 0x00000100,
280 0xd030, 0x000300c0, 0x00800040,
281 0xd8c0, 0xff000fff, 0x00000100,
282 0xd830, 0x000300c0, 0x00800040,
283 0x2ae4, 0x00073ffe, 0x000022a2,
284 0x240c, 0x000007ff, 0x00000000,
285 0x8a14, 0xf000001f, 0x00000007,
286 0x8b24, 0xffffffff, 0x00ffffff,
287 0x8b10, 0x0000ff0f, 0x00000000,
288 0x28a4c, 0x07ffffff, 0x4e000000,
289 0x28350, 0x3f3f3fff, 0x00000000,
290 0x30, 0x000000ff, 0x0040,
291 0x34, 0x00000040, 0x00004040,
292 0x9100, 0x03e00000, 0x03600000,
293 0x9060, 0x0000007f, 0x00000020,
294 0x9508, 0x00010000, 0x00010000,
295 0xac14, 0x000003ff, 0x000000f1,
296 0xac10, 0xffffffff, 0x00000000,
297 0xac0c, 0xffffffff, 0x00003210,
298 0x88d4, 0x0000001f, 0x00000010,
299 0x15c0, 0x000c0fc0, 0x000c0400
300};
301
302static const u32 hainan_golden_registers2[] =
303{
304 0x98f8, 0xffffffff, 0x02010001
305};
306
268static const u32 tahiti_mgcg_cgcg_init[] = 307static const u32 tahiti_mgcg_cgcg_init[] =
269{ 308{
270 0xc400, 0xffffffff, 0xfffffffc, 309 0xc400, 0xffffffff, 0xfffffffc,
@@ -673,6 +712,83 @@ static const u32 oland_mgcg_cgcg_init[] =
673 0xd8c0, 0xfffffff0, 0x00000100 712 0xd8c0, 0xfffffff0, 0x00000100
674}; 713};
675 714
715static const u32 hainan_mgcg_cgcg_init[] =
716{
717 0xc400, 0xffffffff, 0xfffffffc,
718 0x802c, 0xffffffff, 0xe0000000,
719 0x9a60, 0xffffffff, 0x00000100,
720 0x92a4, 0xffffffff, 0x00000100,
721 0xc164, 0xffffffff, 0x00000100,
722 0x9774, 0xffffffff, 0x00000100,
723 0x8984, 0xffffffff, 0x06000100,
724 0x8a18, 0xffffffff, 0x00000100,
725 0x92a0, 0xffffffff, 0x00000100,
726 0xc380, 0xffffffff, 0x00000100,
727 0x8b28, 0xffffffff, 0x00000100,
728 0x9144, 0xffffffff, 0x00000100,
729 0x8d88, 0xffffffff, 0x00000100,
730 0x8d8c, 0xffffffff, 0x00000100,
731 0x9030, 0xffffffff, 0x00000100,
732 0x9034, 0xffffffff, 0x00000100,
733 0x9038, 0xffffffff, 0x00000100,
734 0x903c, 0xffffffff, 0x00000100,
735 0xad80, 0xffffffff, 0x00000100,
736 0xac54, 0xffffffff, 0x00000100,
737 0x897c, 0xffffffff, 0x06000100,
738 0x9868, 0xffffffff, 0x00000100,
739 0x9510, 0xffffffff, 0x00000100,
740 0xaf04, 0xffffffff, 0x00000100,
741 0xae04, 0xffffffff, 0x00000100,
742 0x949c, 0xffffffff, 0x00000100,
743 0x802c, 0xffffffff, 0xe0000000,
744 0x9160, 0xffffffff, 0x00010000,
745 0x9164, 0xffffffff, 0x00030002,
746 0x9168, 0xffffffff, 0x00040007,
747 0x916c, 0xffffffff, 0x00060005,
748 0x9170, 0xffffffff, 0x00090008,
749 0x9174, 0xffffffff, 0x00020001,
750 0x9178, 0xffffffff, 0x00040003,
751 0x917c, 0xffffffff, 0x00000007,
752 0x9180, 0xffffffff, 0x00060005,
753 0x9184, 0xffffffff, 0x00090008,
754 0x9188, 0xffffffff, 0x00030002,
755 0x918c, 0xffffffff, 0x00050004,
756 0x9190, 0xffffffff, 0x00000008,
757 0x9194, 0xffffffff, 0x00070006,
758 0x9198, 0xffffffff, 0x000a0009,
759 0x919c, 0xffffffff, 0x00040003,
760 0x91a0, 0xffffffff, 0x00060005,
761 0x91a4, 0xffffffff, 0x00000009,
762 0x91a8, 0xffffffff, 0x00080007,
763 0x91ac, 0xffffffff, 0x000b000a,
764 0x91b0, 0xffffffff, 0x00050004,
765 0x91b4, 0xffffffff, 0x00070006,
766 0x91b8, 0xffffffff, 0x0008000b,
767 0x91bc, 0xffffffff, 0x000a0009,
768 0x91c0, 0xffffffff, 0x000d000c,
769 0x91c4, 0xffffffff, 0x00060005,
770 0x91c8, 0xffffffff, 0x00080007,
771 0x91cc, 0xffffffff, 0x0000000b,
772 0x91d0, 0xffffffff, 0x000a0009,
773 0x91d4, 0xffffffff, 0x000d000c,
774 0x9150, 0xffffffff, 0x96940200,
775 0x8708, 0xffffffff, 0x00900100,
776 0xc478, 0xffffffff, 0x00000080,
777 0xc404, 0xffffffff, 0x0020003f,
778 0x30, 0xffffffff, 0x0000001c,
779 0x34, 0x000f0000, 0x000f0000,
780 0x160c, 0xffffffff, 0x00000100,
781 0x1024, 0xffffffff, 0x00000100,
782 0x20a8, 0xffffffff, 0x00000104,
783 0x264c, 0x000c0000, 0x000c0000,
784 0x2648, 0x000c0000, 0x000c0000,
785 0x2f50, 0x00000001, 0x00000001,
786 0x30cc, 0xc0000fff, 0x00000104,
787 0xc1e4, 0x00000001, 0x00000001,
788 0xd0c0, 0xfffffff0, 0x00000100,
789 0xd8c0, 0xfffffff0, 0x00000100
790};
791
676static u32 verde_pg_init[] = 792static u32 verde_pg_init[] =
677{ 793{
678 0x353c, 0xffffffff, 0x40000, 794 0x353c, 0xffffffff, 0x40000,
@@ -853,6 +969,17 @@ static void si_init_golden_registers(struct radeon_device *rdev)
853 oland_mgcg_cgcg_init, 969 oland_mgcg_cgcg_init,
854 (const u32)ARRAY_SIZE(oland_mgcg_cgcg_init)); 970 (const u32)ARRAY_SIZE(oland_mgcg_cgcg_init));
855 break; 971 break;
972 case CHIP_HAINAN:
973 radeon_program_register_sequence(rdev,
974 hainan_golden_registers,
975 (const u32)ARRAY_SIZE(hainan_golden_registers));
976 radeon_program_register_sequence(rdev,
977 hainan_golden_registers2,
978 (const u32)ARRAY_SIZE(hainan_golden_registers2));
979 radeon_program_register_sequence(rdev,
980 hainan_mgcg_cgcg_init,
981 (const u32)ARRAY_SIZE(hainan_mgcg_cgcg_init));
982 break;
856 default: 983 default:
857 break; 984 break;
858 } 985 }
@@ -1062,6 +1189,45 @@ static const u32 oland_io_mc_regs[TAHITI_IO_MC_REGS_SIZE][2] = {
1062 {0x0000009f, 0x00a17730} 1189 {0x0000009f, 0x00a17730}
1063}; 1190};
1064 1191
1192static const u32 hainan_io_mc_regs[TAHITI_IO_MC_REGS_SIZE][2] = {
1193 {0x0000006f, 0x03044000},
1194 {0x00000070, 0x0480c018},
1195 {0x00000071, 0x00000040},
1196 {0x00000072, 0x01000000},
1197 {0x00000074, 0x000000ff},
1198 {0x00000075, 0x00143400},
1199 {0x00000076, 0x08ec0800},
1200 {0x00000077, 0x040000cc},
1201 {0x00000079, 0x00000000},
1202 {0x0000007a, 0x21000409},
1203 {0x0000007c, 0x00000000},
1204 {0x0000007d, 0xe8000000},
1205 {0x0000007e, 0x044408a8},
1206 {0x0000007f, 0x00000003},
1207 {0x00000080, 0x00000000},
1208 {0x00000081, 0x01000000},
1209 {0x00000082, 0x02000000},
1210 {0x00000083, 0x00000000},
1211 {0x00000084, 0xe3f3e4f4},
1212 {0x00000085, 0x00052024},
1213 {0x00000087, 0x00000000},
1214 {0x00000088, 0x66036603},
1215 {0x00000089, 0x01000000},
1216 {0x0000008b, 0x1c0a0000},
1217 {0x0000008c, 0xff010000},
1218 {0x0000008e, 0xffffefff},
1219 {0x0000008f, 0xfff3efff},
1220 {0x00000090, 0xfff3efbf},
1221 {0x00000094, 0x00101101},
1222 {0x00000095, 0x00000fff},
1223 {0x00000096, 0x00116fff},
1224 {0x00000097, 0x60010000},
1225 {0x00000098, 0x10010000},
1226 {0x00000099, 0x00006000},
1227 {0x0000009a, 0x00001000},
1228 {0x0000009f, 0x00a07730}
1229};
1230
1065/* ucode loading */ 1231/* ucode loading */
1066static int si_mc_load_microcode(struct radeon_device *rdev) 1232static int si_mc_load_microcode(struct radeon_device *rdev)
1067{ 1233{
@@ -1095,6 +1261,11 @@ static int si_mc_load_microcode(struct radeon_device *rdev)
1095 ucode_size = OLAND_MC_UCODE_SIZE; 1261 ucode_size = OLAND_MC_UCODE_SIZE;
1096 regs_size = TAHITI_IO_MC_REGS_SIZE; 1262 regs_size = TAHITI_IO_MC_REGS_SIZE;
1097 break; 1263 break;
1264 case CHIP_HAINAN:
1265 io_mc_regs = (u32 *)&hainan_io_mc_regs;
1266 ucode_size = OLAND_MC_UCODE_SIZE;
1267 regs_size = TAHITI_IO_MC_REGS_SIZE;
1268 break;
1098 } 1269 }
1099 1270
1100 running = RREG32(MC_SEQ_SUP_CNTL) & RUN_MASK; 1271 running = RREG32(MC_SEQ_SUP_CNTL) & RUN_MASK;
@@ -1198,6 +1369,15 @@ static int si_init_microcode(struct radeon_device *rdev)
1198 rlc_req_size = SI_RLC_UCODE_SIZE * 4; 1369 rlc_req_size = SI_RLC_UCODE_SIZE * 4;
1199 mc_req_size = OLAND_MC_UCODE_SIZE * 4; 1370 mc_req_size = OLAND_MC_UCODE_SIZE * 4;
1200 break; 1371 break;
1372 case CHIP_HAINAN:
1373 chip_name = "HAINAN";
1374 rlc_chip_name = "HAINAN";
1375 pfp_req_size = SI_PFP_UCODE_SIZE * 4;
1376 me_req_size = SI_PM4_UCODE_SIZE * 4;
1377 ce_req_size = SI_CE_UCODE_SIZE * 4;
1378 rlc_req_size = SI_RLC_UCODE_SIZE * 4;
1379 mc_req_size = OLAND_MC_UCODE_SIZE * 4;
1380 break;
1201 default: BUG(); 1381 default: BUG();
1202 } 1382 }
1203 1383
@@ -2003,7 +2183,8 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev)
2003 WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); 2183 WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden);
2004 } 2184 }
2005 } else if ((rdev->family == CHIP_VERDE) || 2185 } else if ((rdev->family == CHIP_VERDE) ||
2006 (rdev->family == CHIP_OLAND)) { 2186 (rdev->family == CHIP_OLAND) ||
2187 (rdev->family == CHIP_HAINAN)) {
2007 for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { 2188 for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) {
2008 switch (reg_offset) { 2189 switch (reg_offset) {
2009 case 0: /* non-AA compressed depth or any compressed stencil */ 2190 case 0: /* non-AA compressed depth or any compressed stencil */
@@ -2466,6 +2647,23 @@ static void si_gpu_init(struct radeon_device *rdev)
2466 rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; 2647 rdev->config.si.sc_earlyz_tile_fifo_size = 0x130;
2467 gb_addr_config = VERDE_GB_ADDR_CONFIG_GOLDEN; 2648 gb_addr_config = VERDE_GB_ADDR_CONFIG_GOLDEN;
2468 break; 2649 break;
2650 case CHIP_HAINAN:
2651 rdev->config.si.max_shader_engines = 1;
2652 rdev->config.si.max_tile_pipes = 4;
2653 rdev->config.si.max_cu_per_sh = 5;
2654 rdev->config.si.max_sh_per_se = 1;
2655 rdev->config.si.max_backends_per_se = 1;
2656 rdev->config.si.max_texture_channel_caches = 2;
2657 rdev->config.si.max_gprs = 256;
2658 rdev->config.si.max_gs_threads = 16;
2659 rdev->config.si.max_hw_contexts = 8;
2660
2661 rdev->config.si.sc_prim_fifo_size_frontend = 0x20;
2662 rdev->config.si.sc_prim_fifo_size_backend = 0x40;
2663 rdev->config.si.sc_hiz_tile_fifo_size = 0x30;
2664 rdev->config.si.sc_earlyz_tile_fifo_size = 0x130;
2665 gb_addr_config = HAINAN_GB_ADDR_CONFIG_GOLDEN;
2666 break;
2469 } 2667 }
2470 2668
2471 /* Initialize HDP */ 2669 /* Initialize HDP */
@@ -2559,9 +2757,11 @@ static void si_gpu_init(struct radeon_device *rdev)
2559 WREG32(HDP_ADDR_CONFIG, gb_addr_config); 2757 WREG32(HDP_ADDR_CONFIG, gb_addr_config);
2560 WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); 2758 WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config);
2561 WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); 2759 WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config);
2562 WREG32(UVD_UDEC_ADDR_CONFIG, gb_addr_config); 2760 if (rdev->has_uvd) {
2563 WREG32(UVD_UDEC_DB_ADDR_CONFIG, gb_addr_config); 2761 WREG32(UVD_UDEC_ADDR_CONFIG, gb_addr_config);
2564 WREG32(UVD_UDEC_DBW_ADDR_CONFIG, gb_addr_config); 2762 WREG32(UVD_UDEC_DB_ADDR_CONFIG, gb_addr_config);
2763 WREG32(UVD_UDEC_DBW_ADDR_CONFIG, gb_addr_config);
2764 }
2565 2765
2566 si_tiling_mode_table_init(rdev); 2766 si_tiling_mode_table_init(rdev);
2567 2767
@@ -3304,8 +3504,9 @@ static void si_mc_program(struct radeon_device *rdev)
3304 if (radeon_mc_wait_for_idle(rdev)) { 3504 if (radeon_mc_wait_for_idle(rdev)) {
3305 dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); 3505 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
3306 } 3506 }
3307 /* Lockout access through VGA aperture*/ 3507 if (!ASIC_IS_NODCE(rdev))
3308 WREG32(VGA_HDP_CONTROL, VGA_MEMORY_DISABLE); 3508 /* Lockout access through VGA aperture*/
3509 WREG32(VGA_HDP_CONTROL, VGA_MEMORY_DISABLE);
3309 /* Update configuration */ 3510 /* Update configuration */
3310 WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR, 3511 WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR,
3311 rdev->mc.vram_start >> 12); 3512 rdev->mc.vram_start >> 12);
@@ -3327,9 +3528,11 @@ static void si_mc_program(struct radeon_device *rdev)
3327 dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); 3528 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
3328 } 3529 }
3329 evergreen_mc_resume(rdev, &save); 3530 evergreen_mc_resume(rdev, &save);
3330 /* we need to own VRAM, so turn off the VGA renderer here 3531 if (!ASIC_IS_NODCE(rdev)) {
3331 * to stop it overwriting our objects */ 3532 /* we need to own VRAM, so turn off the VGA renderer here
3332 rv515_vga_render_disable(rdev); 3533 * to stop it overwriting our objects */
3534 rv515_vga_render_disable(rdev);
3535 }
3333} 3536}
3334 3537
3335static void si_vram_gtt_location(struct radeon_device *rdev, 3538static void si_vram_gtt_location(struct radeon_device *rdev,
@@ -3397,8 +3600,8 @@ static int si_mc_init(struct radeon_device *rdev)
3397 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); 3600 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0);
3398 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); 3601 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0);
3399 /* size in MB on si */ 3602 /* size in MB on si */
3400 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 3603 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
3401 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 3604 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
3402 rdev->mc.visible_vram_size = rdev->mc.aper_size; 3605 rdev->mc.visible_vram_size = rdev->mc.aper_size;
3403 si_vram_gtt_location(rdev, &rdev->mc); 3606 si_vram_gtt_location(rdev, &rdev->mc);
3404 radeon_update_bandwidth_info(rdev); 3607 radeon_update_bandwidth_info(rdev);
@@ -4251,8 +4454,10 @@ static void si_disable_interrupt_state(struct radeon_device *rdev)
4251 tmp = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; 4454 tmp = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE;
4252 WREG32(DMA_CNTL + DMA1_REGISTER_OFFSET, tmp); 4455 WREG32(DMA_CNTL + DMA1_REGISTER_OFFSET, tmp);
4253 WREG32(GRBM_INT_CNTL, 0); 4456 WREG32(GRBM_INT_CNTL, 0);
4254 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 4457 if (rdev->num_crtc >= 2) {
4255 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 4458 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
4459 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
4460 }
4256 if (rdev->num_crtc >= 4) { 4461 if (rdev->num_crtc >= 4) {
4257 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 4462 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
4258 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 4463 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
@@ -4262,8 +4467,10 @@ static void si_disable_interrupt_state(struct radeon_device *rdev)
4262 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 4467 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
4263 } 4468 }
4264 4469
4265 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 4470 if (rdev->num_crtc >= 2) {
4266 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 4471 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
4472 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
4473 }
4267 if (rdev->num_crtc >= 4) { 4474 if (rdev->num_crtc >= 4) {
4268 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); 4475 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
4269 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); 4476 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
@@ -4273,21 +4480,22 @@ static void si_disable_interrupt_state(struct radeon_device *rdev)
4273 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); 4480 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
4274 } 4481 }
4275 4482
4276 WREG32(DACA_AUTODETECT_INT_CONTROL, 0); 4483 if (!ASIC_IS_NODCE(rdev)) {
4277 4484 WREG32(DACA_AUTODETECT_INT_CONTROL, 0);
4278 tmp = RREG32(DC_HPD1_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4279 WREG32(DC_HPD1_INT_CONTROL, tmp);
4280 tmp = RREG32(DC_HPD2_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4281 WREG32(DC_HPD2_INT_CONTROL, tmp);
4282 tmp = RREG32(DC_HPD3_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4283 WREG32(DC_HPD3_INT_CONTROL, tmp);
4284 tmp = RREG32(DC_HPD4_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4285 WREG32(DC_HPD4_INT_CONTROL, tmp);
4286 tmp = RREG32(DC_HPD5_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4287 WREG32(DC_HPD5_INT_CONTROL, tmp);
4288 tmp = RREG32(DC_HPD6_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4289 WREG32(DC_HPD6_INT_CONTROL, tmp);
4290 4485
4486 tmp = RREG32(DC_HPD1_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4487 WREG32(DC_HPD1_INT_CONTROL, tmp);
4488 tmp = RREG32(DC_HPD2_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4489 WREG32(DC_HPD2_INT_CONTROL, tmp);
4490 tmp = RREG32(DC_HPD3_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4491 WREG32(DC_HPD3_INT_CONTROL, tmp);
4492 tmp = RREG32(DC_HPD4_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4493 WREG32(DC_HPD4_INT_CONTROL, tmp);
4494 tmp = RREG32(DC_HPD5_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4495 WREG32(DC_HPD5_INT_CONTROL, tmp);
4496 tmp = RREG32(DC_HPD6_INT_CONTROL) & DC_HPDx_INT_POLARITY;
4497 WREG32(DC_HPD6_INT_CONTROL, tmp);
4498 }
4291} 4499}
4292 4500
4293static int si_irq_init(struct radeon_device *rdev) 4501static int si_irq_init(struct radeon_device *rdev)
@@ -4366,7 +4574,7 @@ int si_irq_set(struct radeon_device *rdev)
4366 u32 cp_int_cntl = CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE; 4574 u32 cp_int_cntl = CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE;
4367 u32 cp_int_cntl1 = 0, cp_int_cntl2 = 0; 4575 u32 cp_int_cntl1 = 0, cp_int_cntl2 = 0;
4368 u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; 4576 u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0;
4369 u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; 4577 u32 hpd1 = 0, hpd2 = 0, hpd3 = 0, hpd4 = 0, hpd5 = 0, hpd6 = 0;
4370 u32 grbm_int_cntl = 0; 4578 u32 grbm_int_cntl = 0;
4371 u32 grph1 = 0, grph2 = 0, grph3 = 0, grph4 = 0, grph5 = 0, grph6 = 0; 4579 u32 grph1 = 0, grph2 = 0, grph3 = 0, grph4 = 0, grph5 = 0, grph6 = 0;
4372 u32 dma_cntl, dma_cntl1; 4580 u32 dma_cntl, dma_cntl1;
@@ -4383,12 +4591,14 @@ int si_irq_set(struct radeon_device *rdev)
4383 return 0; 4591 return 0;
4384 } 4592 }
4385 4593
4386 hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; 4594 if (!ASIC_IS_NODCE(rdev)) {
4387 hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; 4595 hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN;
4388 hpd3 = RREG32(DC_HPD3_INT_CONTROL) & ~DC_HPDx_INT_EN; 4596 hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN;
4389 hpd4 = RREG32(DC_HPD4_INT_CONTROL) & ~DC_HPDx_INT_EN; 4597 hpd3 = RREG32(DC_HPD3_INT_CONTROL) & ~DC_HPDx_INT_EN;
4390 hpd5 = RREG32(DC_HPD5_INT_CONTROL) & ~DC_HPDx_INT_EN; 4598 hpd4 = RREG32(DC_HPD4_INT_CONTROL) & ~DC_HPDx_INT_EN;
4391 hpd6 = RREG32(DC_HPD6_INT_CONTROL) & ~DC_HPDx_INT_EN; 4599 hpd5 = RREG32(DC_HPD5_INT_CONTROL) & ~DC_HPDx_INT_EN;
4600 hpd6 = RREG32(DC_HPD6_INT_CONTROL) & ~DC_HPDx_INT_EN;
4601 }
4392 4602
4393 dma_cntl = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; 4603 dma_cntl = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET) & ~TRAP_ENABLE;
4394 dma_cntl1 = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; 4604 dma_cntl1 = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE;
@@ -4479,8 +4689,10 @@ int si_irq_set(struct radeon_device *rdev)
4479 4689
4480 WREG32(GRBM_INT_CNTL, grbm_int_cntl); 4690 WREG32(GRBM_INT_CNTL, grbm_int_cntl);
4481 4691
4482 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, crtc1); 4692 if (rdev->num_crtc >= 2) {
4483 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, crtc2); 4693 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, crtc1);
4694 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, crtc2);
4695 }
4484 if (rdev->num_crtc >= 4) { 4696 if (rdev->num_crtc >= 4) {
4485 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, crtc3); 4697 WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, crtc3);
4486 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, crtc4); 4698 WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, crtc4);
@@ -4490,8 +4702,10 @@ int si_irq_set(struct radeon_device *rdev)
4490 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); 4702 WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6);
4491 } 4703 }
4492 4704
4493 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1); 4705 if (rdev->num_crtc >= 2) {
4494 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2); 4706 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1);
4707 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2);
4708 }
4495 if (rdev->num_crtc >= 4) { 4709 if (rdev->num_crtc >= 4) {
4496 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3); 4710 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3);
4497 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4); 4711 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4);
@@ -4501,12 +4715,14 @@ int si_irq_set(struct radeon_device *rdev)
4501 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6); 4715 WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6);
4502 } 4716 }
4503 4717
4504 WREG32(DC_HPD1_INT_CONTROL, hpd1); 4718 if (!ASIC_IS_NODCE(rdev)) {
4505 WREG32(DC_HPD2_INT_CONTROL, hpd2); 4719 WREG32(DC_HPD1_INT_CONTROL, hpd1);
4506 WREG32(DC_HPD3_INT_CONTROL, hpd3); 4720 WREG32(DC_HPD2_INT_CONTROL, hpd2);
4507 WREG32(DC_HPD4_INT_CONTROL, hpd4); 4721 WREG32(DC_HPD3_INT_CONTROL, hpd3);
4508 WREG32(DC_HPD5_INT_CONTROL, hpd5); 4722 WREG32(DC_HPD4_INT_CONTROL, hpd4);
4509 WREG32(DC_HPD6_INT_CONTROL, hpd6); 4723 WREG32(DC_HPD5_INT_CONTROL, hpd5);
4724 WREG32(DC_HPD6_INT_CONTROL, hpd6);
4725 }
4510 4726
4511 return 0; 4727 return 0;
4512} 4728}
@@ -4515,6 +4731,9 @@ static inline void si_irq_ack(struct radeon_device *rdev)
4515{ 4731{
4516 u32 tmp; 4732 u32 tmp;
4517 4733
4734 if (ASIC_IS_NODCE(rdev))
4735 return;
4736
4518 rdev->irq.stat_regs.evergreen.disp_int = RREG32(DISP_INTERRUPT_STATUS); 4737 rdev->irq.stat_regs.evergreen.disp_int = RREG32(DISP_INTERRUPT_STATUS);
4519 rdev->irq.stat_regs.evergreen.disp_int_cont = RREG32(DISP_INTERRUPT_STATUS_CONTINUE); 4738 rdev->irq.stat_regs.evergreen.disp_int_cont = RREG32(DISP_INTERRUPT_STATUS_CONTINUE);
4520 rdev->irq.stat_regs.evergreen.disp_int_cont2 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE2); 4739 rdev->irq.stat_regs.evergreen.disp_int_cont2 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE2);
@@ -5118,15 +5337,17 @@ static int si_startup(struct radeon_device *rdev)
5118 return r; 5337 return r;
5119 } 5338 }
5120 5339
5121 r = rv770_uvd_resume(rdev); 5340 if (rdev->has_uvd) {
5122 if (!r) { 5341 r = rv770_uvd_resume(rdev);
5123 r = radeon_fence_driver_start_ring(rdev, 5342 if (!r) {
5124 R600_RING_TYPE_UVD_INDEX); 5343 r = radeon_fence_driver_start_ring(rdev,
5344 R600_RING_TYPE_UVD_INDEX);
5345 if (r)
5346 dev_err(rdev->dev, "UVD fences init error (%d).\n", r);
5347 }
5125 if (r) 5348 if (r)
5126 dev_err(rdev->dev, "UVD fences init error (%d).\n", r); 5349 rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0;
5127 } 5350 }
5128 if (r)
5129 rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0;
5130 5351
5131 /* Enable IRQ */ 5352 /* Enable IRQ */
5132 r = si_irq_init(rdev); 5353 r = si_irq_init(rdev);
@@ -5185,16 +5406,18 @@ static int si_startup(struct radeon_device *rdev)
5185 if (r) 5406 if (r)
5186 return r; 5407 return r;
5187 5408
5188 ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; 5409 if (rdev->has_uvd) {
5189 if (ring->ring_size) { 5410 ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX];
5190 r = radeon_ring_init(rdev, ring, ring->ring_size, 5411 if (ring->ring_size) {
5191 R600_WB_UVD_RPTR_OFFSET, 5412 r = radeon_ring_init(rdev, ring, ring->ring_size,
5192 UVD_RBC_RB_RPTR, UVD_RBC_RB_WPTR, 5413 R600_WB_UVD_RPTR_OFFSET,
5193 0, 0xfffff, RADEON_CP_PACKET2); 5414 UVD_RBC_RB_RPTR, UVD_RBC_RB_WPTR,
5194 if (!r) 5415 0, 0xfffff, RADEON_CP_PACKET2);
5195 r = r600_uvd_init(rdev); 5416 if (!r)
5196 if (r) 5417 r = r600_uvd_init(rdev);
5197 DRM_ERROR("radeon: failed initializing UVD (%d).\n", r); 5418 if (r)
5419 DRM_ERROR("radeon: failed initializing UVD (%d).\n", r);
5420 }
5198 } 5421 }
5199 5422
5200 r = radeon_ib_pool_init(rdev); 5423 r = radeon_ib_pool_init(rdev);
@@ -5243,8 +5466,10 @@ int si_suspend(struct radeon_device *rdev)
5243 radeon_vm_manager_fini(rdev); 5466 radeon_vm_manager_fini(rdev);
5244 si_cp_enable(rdev, false); 5467 si_cp_enable(rdev, false);
5245 cayman_dma_stop(rdev); 5468 cayman_dma_stop(rdev);
5246 r600_uvd_rbc_stop(rdev); 5469 if (rdev->has_uvd) {
5247 radeon_uvd_suspend(rdev); 5470 r600_uvd_rbc_stop(rdev);
5471 radeon_uvd_suspend(rdev);
5472 }
5248 si_irq_suspend(rdev); 5473 si_irq_suspend(rdev);
5249 radeon_wb_disable(rdev); 5474 radeon_wb_disable(rdev);
5250 si_pcie_gart_disable(rdev); 5475 si_pcie_gart_disable(rdev);
@@ -5332,11 +5557,13 @@ int si_init(struct radeon_device *rdev)
5332 ring->ring_obj = NULL; 5557 ring->ring_obj = NULL;
5333 r600_ring_init(rdev, ring, 64 * 1024); 5558 r600_ring_init(rdev, ring, 64 * 1024);
5334 5559
5335 r = radeon_uvd_init(rdev); 5560 if (rdev->has_uvd) {
5336 if (!r) { 5561 r = radeon_uvd_init(rdev);
5337 ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; 5562 if (!r) {
5338 ring->ring_obj = NULL; 5563 ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX];
5339 r600_ring_init(rdev, ring, 4096); 5564 ring->ring_obj = NULL;
5565 r600_ring_init(rdev, ring, 4096);
5566 }
5340 } 5567 }
5341 5568
5342 rdev->ih.ring_obj = NULL; 5569 rdev->ih.ring_obj = NULL;
@@ -5384,7 +5611,8 @@ void si_fini(struct radeon_device *rdev)
5384 radeon_vm_manager_fini(rdev); 5611 radeon_vm_manager_fini(rdev);
5385 radeon_ib_pool_fini(rdev); 5612 radeon_ib_pool_fini(rdev);
5386 radeon_irq_kms_fini(rdev); 5613 radeon_irq_kms_fini(rdev);
5387 radeon_uvd_fini(rdev); 5614 if (rdev->has_uvd)
5615 radeon_uvd_fini(rdev);
5388 si_pcie_gart_fini(rdev); 5616 si_pcie_gart_fini(rdev);
5389 r600_vram_scratch_fini(rdev); 5617 r600_vram_scratch_fini(rdev);
5390 radeon_gem_fini(rdev); 5618 radeon_gem_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h
index 222877ba6cf5..8f2d7d4f9b28 100644
--- a/drivers/gpu/drm/radeon/sid.h
+++ b/drivers/gpu/drm/radeon/sid.h
@@ -28,6 +28,7 @@
28 28
29#define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003 29#define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003
30#define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002 30#define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002
31#define HAINAN_GB_ADDR_CONFIG_GOLDEN 0x02010001
31 32
32/* discrete uvd clocks */ 33/* discrete uvd clocks */
33#define CG_UPLL_FUNC_CNTL 0x634 34#define CG_UPLL_FUNC_CNTL 0x634
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index bad8128b283a..21ef68934a20 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -329,7 +329,7 @@ static u32 get_vp_index(uuid_le *type_guid)
329 return 0; 329 return 0;
330 } 330 }
331 cur_cpu = (++next_vp % max_cpus); 331 cur_cpu = (++next_vp % max_cpus);
332 return cur_cpu; 332 return hv_context.vp_index[cur_cpu];
333} 333}
334 334
335/* 335/*
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 21fbb340ad66..c41ca6354fc5 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -383,7 +383,8 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
383 /* Enable the adapter */ 383 /* Enable the adapter */
384 __i2c_dw_enable(dev, true); 384 __i2c_dw_enable(dev, true);
385 385
386 /* Enable interrupts */ 386 /* Clear and enable interrupts */
387 i2c_dw_clear_int(dev);
387 dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK); 388 dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK);
388} 389}
389 390
@@ -448,8 +449,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev)
448 cmd |= BIT(9); 449 cmd |= BIT(9);
449 450
450 if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { 451 if (msgs[dev->msg_write_idx].flags & I2C_M_RD) {
452
453 /* avoid rx buffer overrun */
454 if (rx_limit - dev->rx_outstanding <= 0)
455 break;
456
451 dw_writel(dev, cmd | 0x100, DW_IC_DATA_CMD); 457 dw_writel(dev, cmd | 0x100, DW_IC_DATA_CMD);
452 rx_limit--; 458 rx_limit--;
459 dev->rx_outstanding++;
453 } else 460 } else
454 dw_writel(dev, cmd | *buf++, DW_IC_DATA_CMD); 461 dw_writel(dev, cmd | *buf++, DW_IC_DATA_CMD);
455 tx_limit--; buf_len--; 462 tx_limit--; buf_len--;
@@ -502,8 +509,10 @@ i2c_dw_read(struct dw_i2c_dev *dev)
502 509
503 rx_valid = dw_readl(dev, DW_IC_RXFLR); 510 rx_valid = dw_readl(dev, DW_IC_RXFLR);
504 511
505 for (; len > 0 && rx_valid > 0; len--, rx_valid--) 512 for (; len > 0 && rx_valid > 0; len--, rx_valid--) {
506 *buf++ = dw_readl(dev, DW_IC_DATA_CMD); 513 *buf++ = dw_readl(dev, DW_IC_DATA_CMD);
514 dev->rx_outstanding--;
515 }
507 516
508 if (len > 0) { 517 if (len > 0) {
509 dev->status |= STATUS_READ_IN_PROGRESS; 518 dev->status |= STATUS_READ_IN_PROGRESS;
@@ -561,6 +570,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
561 dev->msg_err = 0; 570 dev->msg_err = 0;
562 dev->status = STATUS_IDLE; 571 dev->status = STATUS_IDLE;
563 dev->abort_source = 0; 572 dev->abort_source = 0;
573 dev->rx_outstanding = 0;
564 574
565 ret = i2c_dw_wait_bus_not_busy(dev); 575 ret = i2c_dw_wait_bus_not_busy(dev);
566 if (ret < 0) 576 if (ret < 0)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 9c1840ee09c7..e761ad18dd61 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -60,6 +60,7 @@
60 * @adapter: i2c subsystem adapter node 60 * @adapter: i2c subsystem adapter node
61 * @tx_fifo_depth: depth of the hardware tx fifo 61 * @tx_fifo_depth: depth of the hardware tx fifo
62 * @rx_fifo_depth: depth of the hardware rx fifo 62 * @rx_fifo_depth: depth of the hardware rx fifo
63 * @rx_outstanding: current master-rx elements in tx fifo
63 */ 64 */
64struct dw_i2c_dev { 65struct dw_i2c_dev {
65 struct device *dev; 66 struct device *dev;
@@ -88,6 +89,7 @@ struct dw_i2c_dev {
88 u32 master_cfg; 89 u32 master_cfg;
89 unsigned int tx_fifo_depth; 90 unsigned int tx_fifo_depth;
90 unsigned int rx_fifo_depth; 91 unsigned int rx_fifo_depth;
92 int rx_outstanding;
91}; 93};
92 94
93#define ACCESS_SWAP 0x00000001 95#define ACCESS_SWAP 0x00000001
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 8ec91335d95a..35b70a1edf57 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -69,6 +69,7 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
69static const struct acpi_device_id dw_i2c_acpi_match[] = { 69static const struct acpi_device_id dw_i2c_acpi_match[] = {
70 { "INT33C2", 0 }, 70 { "INT33C2", 0 },
71 { "INT33C3", 0 }, 71 { "INT33C3", 0 },
72 { "80860F41", 0 },
72 { } 73 { }
73}; 74};
74MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); 75MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match);
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index e1cf2e0e1f23..3a6903f63913 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -231,7 +231,11 @@ static const char *i801_feature_names[] = {
231 231
232static unsigned int disable_features; 232static unsigned int disable_features;
233module_param(disable_features, uint, S_IRUGO | S_IWUSR); 233module_param(disable_features, uint, S_IRUGO | S_IWUSR);
234MODULE_PARM_DESC(disable_features, "Disable selected driver features"); 234MODULE_PARM_DESC(disable_features, "Disable selected driver features:\n"
235 "\t\t 0x01 disable SMBus PEC\n"
236 "\t\t 0x02 disable the block buffer\n"
237 "\t\t 0x08 disable the I2C block read functionality\n"
238 "\t\t 0x10 don't use interrupts ");
235 239
236/* Make sure the SMBus host is ready to start transmitting. 240/* Make sure the SMBus host is ready to start transmitting.
237 Return 0 if it is, -EBUSY if it is not. */ 241 Return 0 if it is, -EBUSY if it is not. */
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 3bbd65d35a5e..1a3abd6a0bfc 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -252,7 +252,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
252 writel(drv_data->cntl_bits, 252 writel(drv_data->cntl_bits,
253 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); 253 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
254 drv_data->block = 0; 254 drv_data->block = 0;
255 wake_up_interruptible(&drv_data->waitq); 255 wake_up(&drv_data->waitq);
256 break; 256 break;
257 257
258 case MV64XXX_I2C_ACTION_CONTINUE: 258 case MV64XXX_I2C_ACTION_CONTINUE:
@@ -300,7 +300,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
300 writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, 300 writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP,
301 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); 301 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
302 drv_data->block = 0; 302 drv_data->block = 0;
303 wake_up_interruptible(&drv_data->waitq); 303 wake_up(&drv_data->waitq);
304 break; 304 break;
305 305
306 case MV64XXX_I2C_ACTION_INVALID: 306 case MV64XXX_I2C_ACTION_INVALID:
@@ -315,7 +315,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
315 writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, 315 writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP,
316 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); 316 drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
317 drv_data->block = 0; 317 drv_data->block = 0;
318 wake_up_interruptible(&drv_data->waitq); 318 wake_up(&drv_data->waitq);
319 break; 319 break;
320 } 320 }
321} 321}
@@ -381,7 +381,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
381 unsigned long flags; 381 unsigned long flags;
382 char abort = 0; 382 char abort = 0;
383 383
384 time_left = wait_event_interruptible_timeout(drv_data->waitq, 384 time_left = wait_event_timeout(drv_data->waitq,
385 !drv_data->block, drv_data->adapter.timeout); 385 !drv_data->block, drv_data->adapter.timeout);
386 386
387 spin_lock_irqsave(&drv_data->lock, flags); 387 spin_lock_irqsave(&drv_data->lock, flags);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6b63cc7eb71e..48e31ed69dbf 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -892,7 +892,8 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr,
892} 892}
893 893
894static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device); 894static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device);
895static DEVICE_ATTR(delete_device, S_IWUSR, NULL, i2c_sysfs_delete_device); 895static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL,
896 i2c_sysfs_delete_device);
896 897
897static struct attribute *i2c_adapter_attrs[] = { 898static struct attribute *i2c_adapter_attrs[] = {
898 &dev_attr_name.attr, 899 &dev_attr_name.attr,
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 9f3a8ef1fb3e..b3d03d335948 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -390,8 +390,8 @@ static int exynos_adc_remove(struct platform_device *pdev)
390#ifdef CONFIG_PM_SLEEP 390#ifdef CONFIG_PM_SLEEP
391static int exynos_adc_suspend(struct device *dev) 391static int exynos_adc_suspend(struct device *dev)
392{ 392{
393 struct platform_device *pdev = to_platform_device(dev); 393 struct iio_dev *indio_dev = dev_get_drvdata(dev);
394 struct exynos_adc *info = platform_get_drvdata(pdev); 394 struct exynos_adc *info = iio_priv(indio_dev);
395 u32 con; 395 u32 con;
396 396
397 if (info->version == ADC_V2) { 397 if (info->version == ADC_V2) {
@@ -413,8 +413,8 @@ static int exynos_adc_suspend(struct device *dev)
413 413
414static int exynos_adc_resume(struct device *dev) 414static int exynos_adc_resume(struct device *dev)
415{ 415{
416 struct platform_device *pdev = to_platform_device(dev); 416 struct iio_dev *indio_dev = dev_get_drvdata(dev);
417 struct exynos_adc *info = platform_get_drvdata(pdev); 417 struct exynos_adc *info = iio_priv(indio_dev);
418 int ret; 418 int ret;
419 419
420 ret = regulator_enable(info->vdd); 420 ret = regulator_enable(info->vdd);
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index bd33473f8e38..ed9bc8ae9330 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -312,6 +312,8 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
312 goto read_error; 312 goto read_error;
313 313
314 *val = *val >> ch->scan_type.shift; 314 *val = *val >> ch->scan_type.shift;
315
316 err = st_sensors_set_enable(indio_dev, false);
315 } 317 }
316 mutex_unlock(&indio_dev->mlock); 318 mutex_unlock(&indio_dev->mlock);
317 319
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index f4a6f0838327..b61160bd935e 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -5,7 +5,7 @@ menu "Digital to analog converters"
5 5
6config AD5064 6config AD5064
7 tristate "Analog Devices AD5064 and similar multi-channel DAC driver" 7 tristate "Analog Devices AD5064 and similar multi-channel DAC driver"
8 depends on (SPI_MASTER || I2C) 8 depends on (SPI_MASTER && I2C!=m) || I2C
9 help 9 help
10 Say yes here to build support for Analog Devices AD5024, AD5025, AD5044, 10 Say yes here to build support for Analog Devices AD5024, AD5025, AD5044,
11 AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668, 11 AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668,
@@ -27,7 +27,7 @@ config AD5360
27 27
28config AD5380 28config AD5380
29 tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver" 29 tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver"
30 depends on (SPI_MASTER || I2C) 30 depends on (SPI_MASTER && I2C!=m) || I2C
31 select REGMAP_I2C if I2C 31 select REGMAP_I2C if I2C
32 select REGMAP_SPI if SPI_MASTER 32 select REGMAP_SPI if SPI_MASTER
33 help 33 help
@@ -57,7 +57,7 @@ config AD5624R_SPI
57 57
58config AD5446 58config AD5446
59 tristate "Analog Devices AD5446 and similar single channel DACs driver" 59 tristate "Analog Devices AD5446 and similar single channel DACs driver"
60 depends on (SPI_MASTER || I2C) 60 depends on (SPI_MASTER && I2C!=m) || I2C
61 help 61 help
62 Say yes here to build support for Analog Devices AD5300, AD5301, AD5310, 62 Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
63 AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453, 63 AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 0bfd8cf25200..5c68e4486845 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -342,10 +342,10 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
342 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | 342 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) |
343 ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12); 343 ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12);
344 344
345 switch (wacom->id[idx] & 0xfffff) { 345 switch (wacom->id[idx]) {
346 case 0x812: /* Inking pen */ 346 case 0x812: /* Inking pen */
347 case 0x801: /* Intuos3 Inking pen */ 347 case 0x801: /* Intuos3 Inking pen */
348 case 0x20802: /* Intuos4 Inking Pen */ 348 case 0x120802: /* Intuos4/5 Inking Pen */
349 case 0x012: 349 case 0x012:
350 wacom->tool[idx] = BTN_TOOL_PENCIL; 350 wacom->tool[idx] = BTN_TOOL_PENCIL;
351 break; 351 break;
@@ -356,11 +356,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
356 case 0x823: /* Intuos3 Grip Pen */ 356 case 0x823: /* Intuos3 Grip Pen */
357 case 0x813: /* Intuos3 Classic Pen */ 357 case 0x813: /* Intuos3 Classic Pen */
358 case 0x885: /* Intuos3 Marker Pen */ 358 case 0x885: /* Intuos3 Marker Pen */
359 case 0x802: /* Intuos4 General Pen */ 359 case 0x802: /* Intuos4/5 13HD/24HD General Pen */
360 case 0x804: /* Intuos4 Marker Pen */ 360 case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */
361 case 0x40802: /* Intuos4 Classic Pen */
362 case 0x18802: /* DTH2242 Grip Pen */
363 case 0x022: 361 case 0x022:
362 case 0x100804: /* Intuos4/5 13HD/24HD Art Pen */
363 case 0x140802: /* Intuos4/5 13HD/24HD Classic Pen */
364 case 0x160802: /* Cintiq 13HD Pro Pen */
365 case 0x180802: /* DTH2242 Pen */
364 wacom->tool[idx] = BTN_TOOL_PEN; 366 wacom->tool[idx] = BTN_TOOL_PEN;
365 break; 367 break;
366 368
@@ -391,10 +393,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
391 case 0x82b: /* Intuos3 Grip Pen Eraser */ 393 case 0x82b: /* Intuos3 Grip Pen Eraser */
392 case 0x81b: /* Intuos3 Classic Pen Eraser */ 394 case 0x81b: /* Intuos3 Classic Pen Eraser */
393 case 0x91b: /* Intuos3 Airbrush Eraser */ 395 case 0x91b: /* Intuos3 Airbrush Eraser */
394 case 0x80c: /* Intuos4 Marker Pen Eraser */ 396 case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */
395 case 0x80a: /* Intuos4 General Pen Eraser */ 397 case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */
396 case 0x4080a: /* Intuos4 Classic Pen Eraser */ 398 case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
397 case 0x90a: /* Intuos4 Airbrush Eraser */ 399 case 0x14080a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */
400 case 0x10090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */
401 case 0x10080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */
402 case 0x16080a: /* Cintiq 13HD Pro Pen Eraser */
403 case 0x18080a: /* DTH2242 Eraser */
398 wacom->tool[idx] = BTN_TOOL_RUBBER; 404 wacom->tool[idx] = BTN_TOOL_RUBBER;
399 break; 405 break;
400 406
@@ -402,7 +408,8 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
402 case 0x912: 408 case 0x912:
403 case 0x112: 409 case 0x112:
404 case 0x913: /* Intuos3 Airbrush */ 410 case 0x913: /* Intuos3 Airbrush */
405 case 0x902: /* Intuos4 Airbrush */ 411 case 0x902: /* Intuos4/5 13HD/24HD Airbrush */
412 case 0x100902: /* Intuos4/5 13HD/24HD Airbrush */
406 wacom->tool[idx] = BTN_TOOL_AIRBRUSH; 413 wacom->tool[idx] = BTN_TOOL_AIRBRUSH;
407 break; 414 break;
408 415
@@ -533,10 +540,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
533 input_report_key(input, BTN_8, (data[3] & 0x80)); 540 input_report_key(input, BTN_8, (data[3] & 0x80));
534 } 541 }
535 if (data[1] | (data[2] & 0x01) | data[3]) { 542 if (data[1] | (data[2] & 0x01) | data[3]) {
536 input_report_key(input, wacom->tool[1], 1);
537 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 543 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
538 } else { 544 } else {
539 input_report_key(input, wacom->tool[1], 0);
540 input_report_abs(input, ABS_MISC, 0); 545 input_report_abs(input, ABS_MISC, 0);
541 } 546 }
542 } else if (features->type == DTK) { 547 } else if (features->type == DTK) {
@@ -546,6 +551,26 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
546 input_report_key(input, BTN_3, (data[6] & 0x08)); 551 input_report_key(input, BTN_3, (data[6] & 0x08));
547 input_report_key(input, BTN_4, (data[6] & 0x10)); 552 input_report_key(input, BTN_4, (data[6] & 0x10));
548 input_report_key(input, BTN_5, (data[6] & 0x20)); 553 input_report_key(input, BTN_5, (data[6] & 0x20));
554 if (data[6] & 0x3f) {
555 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
556 } else {
557 input_report_abs(input, ABS_MISC, 0);
558 }
559 } else if (features->type == WACOM_13HD) {
560 input_report_key(input, BTN_0, (data[3] & 0x01));
561 input_report_key(input, BTN_1, (data[4] & 0x01));
562 input_report_key(input, BTN_2, (data[4] & 0x02));
563 input_report_key(input, BTN_3, (data[4] & 0x04));
564 input_report_key(input, BTN_4, (data[4] & 0x08));
565 input_report_key(input, BTN_5, (data[4] & 0x10));
566 input_report_key(input, BTN_6, (data[4] & 0x20));
567 input_report_key(input, BTN_7, (data[4] & 0x40));
568 input_report_key(input, BTN_8, (data[4] & 0x80));
569 if ((data[3] & 0x01) | data[4]) {
570 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
571 } else {
572 input_report_abs(input, ABS_MISC, 0);
573 }
549 } else if (features->type == WACOM_24HD) { 574 } else if (features->type == WACOM_24HD) {
550 input_report_key(input, BTN_0, (data[6] & 0x01)); 575 input_report_key(input, BTN_0, (data[6] & 0x01));
551 input_report_key(input, BTN_1, (data[6] & 0x02)); 576 input_report_key(input, BTN_1, (data[6] & 0x02));
@@ -590,10 +615,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
590 } 615 }
591 616
592 if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) { 617 if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) {
593 input_report_key(input, wacom->tool[1], 1);
594 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 618 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
595 } else { 619 } else {
596 input_report_key(input, wacom->tool[1], 0);
597 input_report_abs(input, ABS_MISC, 0); 620 input_report_abs(input, ABS_MISC, 0);
598 } 621 }
599 } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { 622 } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
@@ -618,10 +641,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
618 } 641 }
619 642
620 if (data[2] | (data[3] & 0x01) | data[4] | data[5]) { 643 if (data[2] | (data[3] & 0x01) | data[4] | data[5]) {
621 input_report_key(input, wacom->tool[1], 1);
622 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 644 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
623 } else { 645 } else {
624 input_report_key(input, wacom->tool[1], 0);
625 input_report_abs(input, ABS_MISC, 0); 646 input_report_abs(input, ABS_MISC, 0);
626 } 647 }
627 } else { 648 } else {
@@ -668,10 +689,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
668 if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) | 689 if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) |
669 data[2] | (data[3] & 0x1f) | data[4] | data[8] | 690 data[2] | (data[3] & 0x1f) | data[4] | data[8] |
670 (data[7] & 0x01)) { 691 (data[7] & 0x01)) {
671 input_report_key(input, wacom->tool[1], 1);
672 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 692 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
673 } else { 693 } else {
674 input_report_key(input, wacom->tool[1], 0);
675 input_report_abs(input, ABS_MISC, 0); 694 input_report_abs(input, ABS_MISC, 0);
676 } 695 }
677 } 696 }
@@ -1301,6 +1320,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
1301 case INTUOS4L: 1320 case INTUOS4L:
1302 case CINTIQ: 1321 case CINTIQ:
1303 case WACOM_BEE: 1322 case WACOM_BEE:
1323 case WACOM_13HD:
1304 case WACOM_21UX2: 1324 case WACOM_21UX2:
1305 case WACOM_22HD: 1325 case WACOM_22HD:
1306 case WACOM_24HD: 1326 case WACOM_24HD:
@@ -1530,15 +1550,15 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
1530 __set_bit(KEY_PROG1, input_dev->keybit); 1550 __set_bit(KEY_PROG1, input_dev->keybit);
1531 __set_bit(KEY_PROG2, input_dev->keybit); 1551 __set_bit(KEY_PROG2, input_dev->keybit);
1532 __set_bit(KEY_PROG3, input_dev->keybit); 1552 __set_bit(KEY_PROG3, input_dev->keybit);
1553
1554 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1555 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
1533 /* fall through */ 1556 /* fall through */
1534 1557
1535 case DTK: 1558 case DTK:
1536 for (i = 0; i < 6; i++) 1559 for (i = 0; i < 6; i++)
1537 __set_bit(BTN_0 + i, input_dev->keybit); 1560 __set_bit(BTN_0 + i, input_dev->keybit);
1538 1561
1539 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1540 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
1541
1542 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); 1562 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1543 1563
1544 wacom_setup_cintiq(wacom_wac); 1564 wacom_setup_cintiq(wacom_wac);
@@ -1579,6 +1599,15 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
1579 wacom_setup_cintiq(wacom_wac); 1599 wacom_setup_cintiq(wacom_wac);
1580 break; 1600 break;
1581 1601
1602 case WACOM_13HD:
1603 for (i = 0; i < 9; i++)
1604 __set_bit(BTN_0 + i, input_dev->keybit);
1605
1606 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1607 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1608 wacom_setup_cintiq(wacom_wac);
1609 break;
1610
1582 case INTUOS3: 1611 case INTUOS3:
1583 case INTUOS3L: 1612 case INTUOS3L:
1584 __set_bit(BTN_4, input_dev->keybit); 1613 __set_bit(BTN_4, input_dev->keybit);
@@ -1950,6 +1979,9 @@ static const struct wacom_features wacom_features_0xC5 =
1950static const struct wacom_features wacom_features_0xC6 = 1979static const struct wacom_features wacom_features_0xC6 =
1951 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 1980 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023,
1952 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 1981 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1982static const struct wacom_features wacom_features_0x304 =
1983 { "Wacom Cintiq 13HD", WACOM_PKGLEN_INTUOS, 59552, 33848, 1023,
1984 63, WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1953static const struct wacom_features wacom_features_0xC7 = 1985static const struct wacom_features wacom_features_0xC7 =
1954 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 1986 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511,
1955 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1987 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1959,6 +1991,9 @@ static const struct wacom_features wacom_features_0xCE =
1959static const struct wacom_features wacom_features_0xF0 = 1991static const struct wacom_features wacom_features_0xF0 =
1960 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, 1992 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511,
1961 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1993 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1994static const struct wacom_features wacom_features_0x57 =
1995 { "Wacom DTK2241", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047,
1996 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES};
1962static const struct wacom_features wacom_features_0x59 = /* Pen */ 1997static const struct wacom_features wacom_features_0x59 = /* Pen */
1963 { "Wacom DTH2242", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, 1998 { "Wacom DTH2242", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047,
1964 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 1999 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
@@ -1972,6 +2007,12 @@ static const struct wacom_features wacom_features_0xCC =
1972static const struct wacom_features wacom_features_0xFA = 2007static const struct wacom_features wacom_features_0xFA =
1973 { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, 2008 { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047,
1974 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2009 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2010static const struct wacom_features wacom_features_0x5B =
2011 { "Wacom Cintiq 22HDT", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047,
2012 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e };
2013static const struct wacom_features wacom_features_0x5E =
2014 { "Wacom Cintiq 22HDT", .type = WACOM_24HDT,
2015 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10 };
1975static const struct wacom_features wacom_features_0x90 = 2016static const struct wacom_features wacom_features_0x90 =
1976 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 2017 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1977 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 2018 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2143,8 +2184,11 @@ const struct usb_device_id wacom_ids[] = {
2143 { USB_DEVICE_WACOM(0x43) }, 2184 { USB_DEVICE_WACOM(0x43) },
2144 { USB_DEVICE_WACOM(0x44) }, 2185 { USB_DEVICE_WACOM(0x44) },
2145 { USB_DEVICE_WACOM(0x45) }, 2186 { USB_DEVICE_WACOM(0x45) },
2187 { USB_DEVICE_WACOM(0x57) },
2146 { USB_DEVICE_WACOM(0x59) }, 2188 { USB_DEVICE_WACOM(0x59) },
2147 { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) }, 2189 { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) },
2190 { USB_DEVICE_WACOM(0x5B) },
2191 { USB_DEVICE_DETAILED(0x5E, USB_CLASS_HID, 0, 0) },
2148 { USB_DEVICE_WACOM(0xB0) }, 2192 { USB_DEVICE_WACOM(0xB0) },
2149 { USB_DEVICE_WACOM(0xB1) }, 2193 { USB_DEVICE_WACOM(0xB1) },
2150 { USB_DEVICE_WACOM(0xB2) }, 2194 { USB_DEVICE_WACOM(0xB2) },
@@ -2205,6 +2249,7 @@ const struct usb_device_id wacom_ids[] = {
2205 { USB_DEVICE_WACOM(0x100) }, 2249 { USB_DEVICE_WACOM(0x100) },
2206 { USB_DEVICE_WACOM(0x101) }, 2250 { USB_DEVICE_WACOM(0x101) },
2207 { USB_DEVICE_WACOM(0x10D) }, 2251 { USB_DEVICE_WACOM(0x10D) },
2252 { USB_DEVICE_WACOM(0x304) },
2208 { USB_DEVICE_WACOM(0x4001) }, 2253 { USB_DEVICE_WACOM(0x4001) },
2209 { USB_DEVICE_WACOM(0x47) }, 2254 { USB_DEVICE_WACOM(0x47) },
2210 { USB_DEVICE_WACOM(0xF4) }, 2255 { USB_DEVICE_WACOM(0xF4) },
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 5f9a7721e16c..dfc9e08e7f70 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -82,6 +82,7 @@ enum {
82 WACOM_24HD, 82 WACOM_24HD,
83 CINTIQ, 83 CINTIQ,
84 WACOM_BEE, 84 WACOM_BEE,
85 WACOM_13HD,
85 WACOM_MO, 86 WACOM_MO,
86 WIRELESS, 87 WIRELESS,
87 BAMBOO_PT, 88 BAMBOO_PT,
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index 17c9097f3b5d..39f3df8670c3 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -216,7 +216,7 @@ static int egalax_ts_probe(struct i2c_client *client,
216 input_set_abs_params(input_dev, 216 input_set_abs_params(input_dev,
217 ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0); 217 ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0);
218 input_set_abs_params(input_dev, 218 input_set_abs_params(input_dev,
219 ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0); 219 ABS_MT_POSITION_Y, 0, EGALAX_MAX_Y, 0, 0);
220 input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0); 220 input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0);
221 221
222 input_set_drvdata(input_dev, ts); 222 input_set_drvdata(input_dev, ts);
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 9b1b274c7d25..c123709acf82 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -93,7 +93,7 @@ capi_ctr_put(struct capi_ctr *ctr)
93 93
94static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr) 94static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr)
95{ 95{
96 if (contr - 1 >= CAPI_MAXCONTR) 96 if (contr < 1 || contr - 1 >= CAPI_MAXCONTR)
97 return NULL; 97 return NULL;
98 98
99 return capi_controller[contr - 1]; 99 return capi_controller[contr - 1];
@@ -103,7 +103,7 @@ static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid)
103{ 103{
104 lockdep_assert_held(&capi_controller_lock); 104 lockdep_assert_held(&capi_controller_lock);
105 105
106 if (applid - 1 >= CAPI_MAXAPPL) 106 if (applid < 1 || applid - 1 >= CAPI_MAXAPPL)
107 return NULL; 107 return NULL;
108 108
109 return capi_applications[applid - 1]; 109 return capi_applications[applid - 1];
@@ -111,7 +111,7 @@ static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid)
111 111
112static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) 112static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
113{ 113{
114 if (applid - 1 >= CAPI_MAXAPPL) 114 if (applid < 1 || applid - 1 >= CAPI_MAXAPPL)
115 return NULL; 115 return NULL;
116 116
117 return rcu_dereference(capi_applications[applid - 1]); 117 return rcu_dereference(capi_applications[applid - 1]);
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index a0d931bcb37c..b02b679abf31 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -107,6 +107,10 @@ static int create_gpio_led(const struct gpio_led *template,
107 return 0; 107 return 0;
108 } 108 }
109 109
110 ret = devm_gpio_request(parent, template->gpio, template->name);
111 if (ret < 0)
112 return ret;
113
110 led_dat->cdev.name = template->name; 114 led_dat->cdev.name = template->name;
111 led_dat->cdev.default_trigger = template->default_trigger; 115 led_dat->cdev.default_trigger = template->default_trigger;
112 led_dat->gpio = template->gpio; 116 led_dat->gpio = template->gpio;
@@ -126,10 +130,7 @@ static int create_gpio_led(const struct gpio_led *template,
126 if (!template->retain_state_suspended) 130 if (!template->retain_state_suspended)
127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 131 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
128 132
129 ret = devm_gpio_request_one(parent, template->gpio, 133 ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state);
130 (led_dat->active_low ^ state) ?
131 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
132 template->name);
133 if (ret < 0) 134 if (ret < 0)
134 return ret; 135 return ret;
135 136
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d9aed1593e5d..d54e985748b7 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -579,7 +579,7 @@ config AB8500_CORE
579 579
580config AB8500_DEBUG 580config AB8500_DEBUG
581 bool "Enable debug info via debugfs" 581 bool "Enable debug info via debugfs"
582 depends on AB8500_CORE && DEBUG_FS 582 depends on AB8500_GPADC && DEBUG_FS
583 default y if DEBUG_FS 583 default y if DEBUG_FS
584 help 584 help
585 Select this option if you want debug information using the debug 585 Select this option if you want debug information using the debug
@@ -818,6 +818,7 @@ config MFD_TPS65910
818config MFD_TPS65912 818config MFD_TPS65912
819 bool "TI TPS65912 Power Management chip" 819 bool "TI TPS65912 Power Management chip"
820 depends on GPIOLIB 820 depends on GPIOLIB
821 select MFD_CORE
821 help 822 help
822 If you say yes here you get support for the TPS65912 series of 823 If you say yes here you get support for the TPS65912 series of
823 PM chips. 824 PM chips.
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index 8e8a016effe9..258b367e3989 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -868,6 +868,15 @@ static struct resource ab8500_chargalg_resources[] = {};
868#ifdef CONFIG_DEBUG_FS 868#ifdef CONFIG_DEBUG_FS
869static struct resource ab8500_debug_resources[] = { 869static struct resource ab8500_debug_resources[] = {
870 { 870 {
871 .name = "IRQ_AB8500",
872 /*
873 * Number will be filled in. NOTE: this is deliberately
874 * not flagged as an IRQ in ordet to avoid remapping using
875 * the irqdomain in the MFD core, so that this IRQ passes
876 * unremapped to the debug code.
877 */
878 },
879 {
871 .name = "IRQ_FIRST", 880 .name = "IRQ_FIRST",
872 .start = AB8500_INT_MAIN_EXT_CH_NOT_OK, 881 .start = AB8500_INT_MAIN_EXT_CH_NOT_OK,
873 .end = AB8500_INT_MAIN_EXT_CH_NOT_OK, 882 .end = AB8500_INT_MAIN_EXT_CH_NOT_OK,
@@ -1051,6 +1060,7 @@ static struct mfd_cell ab8500_devs[] = {
1051 }, 1060 },
1052 { 1061 {
1053 .name = "ab8500-gpadc", 1062 .name = "ab8500-gpadc",
1063 .of_compatible = "stericsson,ab8500-gpadc",
1054 .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), 1064 .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
1055 .resources = ab8500_gpadc_resources, 1065 .resources = ab8500_gpadc_resources,
1056 }, 1066 },
@@ -1097,7 +1107,7 @@ static struct mfd_cell ab8500_devs[] = {
1097 .of_compatible = "stericsson,ab8500-denc", 1107 .of_compatible = "stericsson,ab8500-denc",
1098 }, 1108 },
1099 { 1109 {
1100 .name = "ab8500-gpio", 1110 .name = "pinctrl-ab8500",
1101 .of_compatible = "stericsson,ab8500-gpio", 1111 .of_compatible = "stericsson,ab8500-gpio",
1102 }, 1112 },
1103 { 1113 {
@@ -1208,6 +1218,7 @@ static struct mfd_cell ab8505_devs[] = {
1208 }, 1218 },
1209 { 1219 {
1210 .name = "ab8500-gpadc", 1220 .name = "ab8500-gpadc",
1221 .of_compatible = "stericsson,ab8500-gpadc",
1211 .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), 1222 .num_resources = ARRAY_SIZE(ab8505_gpadc_resources),
1212 .resources = ab8505_gpadc_resources, 1223 .resources = ab8505_gpadc_resources,
1213 }, 1224 },
@@ -1234,7 +1245,7 @@ static struct mfd_cell ab8505_devs[] = {
1234 .name = "ab8500-leds", 1245 .name = "ab8500-leds",
1235 }, 1246 },
1236 { 1247 {
1237 .name = "ab8500-gpio", 1248 .name = "pinctrl-ab8505",
1238 }, 1249 },
1239 { 1250 {
1240 .name = "ab8500-usb", 1251 .name = "ab8500-usb",
@@ -1271,6 +1282,7 @@ static struct mfd_cell ab8540_devs[] = {
1271 }, 1282 },
1272 { 1283 {
1273 .name = "ab8500-gpadc", 1284 .name = "ab8500-gpadc",
1285 .of_compatible = "stericsson,ab8500-gpadc",
1274 .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), 1286 .num_resources = ARRAY_SIZE(ab8505_gpadc_resources),
1275 .resources = ab8505_gpadc_resources, 1287 .resources = ab8505_gpadc_resources,
1276 }, 1288 },
@@ -1302,7 +1314,7 @@ static struct mfd_cell ab8540_devs[] = {
1302 .resources = ab8500_temp_resources, 1314 .resources = ab8500_temp_resources,
1303 }, 1315 },
1304 { 1316 {
1305 .name = "ab8500-gpio", 1317 .name = "pinctrl-ab8540",
1306 }, 1318 },
1307 { 1319 {
1308 .name = "ab8540-usb", 1320 .name = "ab8540-usb",
@@ -1712,6 +1724,12 @@ static int ab8500_probe(struct platform_device *pdev)
1712 if (ret) 1724 if (ret)
1713 return ret; 1725 return ret;
1714 1726
1727#if CONFIG_DEBUG_FS
1728 /* Pass to debugfs */
1729 ab8500_debug_resources[0].start = ab8500->irq;
1730 ab8500_debug_resources[0].end = ab8500->irq;
1731#endif
1732
1715 if (is_ab9540(ab8500)) 1733 if (is_ab9540(ab8500))
1716 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, 1734 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
1717 ARRAY_SIZE(ab9540_devs), NULL, 1735 ARRAY_SIZE(ab9540_devs), NULL,
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index b88bbbc15f1e..37b7ce4c7c3b 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -91,12 +91,10 @@
91#include <linux/ctype.h> 91#include <linux/ctype.h>
92#endif 92#endif
93 93
94/* TODO: this file should not reference IRQ_DB8500_AB8500! */
95#include <mach/irqs.h>
96
97static u32 debug_bank; 94static u32 debug_bank;
98static u32 debug_address; 95static u32 debug_address;
99 96
97static int irq_ab8500;
100static int irq_first; 98static int irq_first;
101static int irq_last; 99static int irq_last;
102static u32 *irq_count; 100static u32 *irq_count;
@@ -1589,7 +1587,7 @@ void ab8500_debug_register_interrupt(int line)
1589{ 1587{
1590 if (line < num_interrupt_lines) { 1588 if (line < num_interrupt_lines) {
1591 num_interrupts[line]++; 1589 num_interrupts[line]++;
1592 if (suspend_test_wake_cause_interrupt_is_mine(IRQ_DB8500_AB8500)) 1590 if (suspend_test_wake_cause_interrupt_is_mine(irq_ab8500))
1593 num_wake_interrupts[line]++; 1591 num_wake_interrupts[line]++;
1594 } 1592 }
1595} 1593}
@@ -2941,6 +2939,7 @@ static int ab8500_debug_probe(struct platform_device *plf)
2941 struct dentry *file; 2939 struct dentry *file;
2942 int ret = -ENOMEM; 2940 int ret = -ENOMEM;
2943 struct ab8500 *ab8500; 2941 struct ab8500 *ab8500;
2942 struct resource *res;
2944 debug_bank = AB8500_MISC; 2943 debug_bank = AB8500_MISC;
2945 debug_address = AB8500_REV_REG & 0x00FF; 2944 debug_address = AB8500_REV_REG & 0x00FF;
2946 2945
@@ -2959,6 +2958,15 @@ static int ab8500_debug_probe(struct platform_device *plf)
2959 if (!event_name) 2958 if (!event_name)
2960 goto out_freedev_attr; 2959 goto out_freedev_attr;
2961 2960
2961 res = platform_get_resource_byname(plf, 0, "IRQ_AB8500");
2962 if (!res) {
2963 dev_err(&plf->dev, "AB8500 irq not found, err %d\n",
2964 irq_first);
2965 ret = -ENXIO;
2966 goto out_freeevent_name;
2967 }
2968 irq_ab8500 = res->start;
2969
2962 irq_first = platform_get_irq_byname(plf, "IRQ_FIRST"); 2970 irq_first = platform_get_irq_byname(plf, "IRQ_FIRST");
2963 if (irq_first < 0) { 2971 if (irq_first < 0) {
2964 dev_err(&plf->dev, "First irq not found, err %d\n", 2972 dev_err(&plf->dev, "First irq not found, err %d\n",
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index 5e65b28a5d09..13f7866de46e 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -907,14 +907,17 @@ static int ab8500_gpadc_suspend(struct device *dev)
907static int ab8500_gpadc_resume(struct device *dev) 907static int ab8500_gpadc_resume(struct device *dev)
908{ 908{
909 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); 909 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
910 int ret;
910 911
911 regulator_enable(gpadc->regu); 912 ret = regulator_enable(gpadc->regu);
913 if (ret)
914 dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret);
912 915
913 pm_runtime_mark_last_busy(gpadc->dev); 916 pm_runtime_mark_last_busy(gpadc->dev);
914 pm_runtime_put_autosuspend(gpadc->dev); 917 pm_runtime_put_autosuspend(gpadc->dev);
915 918
916 mutex_unlock(&gpadc->ab8500_gpadc_lock); 919 mutex_unlock(&gpadc->ab8500_gpadc_lock);
917 return 0; 920 return ret;
918} 921}
919 922
920static int ab8500_gpadc_probe(struct platform_device *pdev) 923static int ab8500_gpadc_probe(struct platform_device *pdev)
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index fbca1ced49fa..8e0dae59844d 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -23,7 +23,7 @@
23 23
24static struct device *sysctrl_dev; 24static struct device *sysctrl_dev;
25 25
26void ab8500_power_off(void) 26static void ab8500_power_off(void)
27{ 27{
28 sigset_t old; 28 sigset_t old;
29 sigset_t all; 29 sigset_t all;
@@ -104,7 +104,7 @@ void ab8500_restart(char mode, const char *cmd)
104 104
105 plat = dev_get_platdata(sysctrl_dev->parent); 105 plat = dev_get_platdata(sysctrl_dev->parent);
106 pdata = plat->sysctrl; 106 pdata = plat->sysctrl;
107 if (pdata->reboot_reason_code) 107 if (pdata && pdata->reboot_reason_code)
108 reason = pdata->reboot_reason_code(cmd); 108 reason = pdata->reboot_reason_code(cmd);
109 else 109 else
110 pr_warn("[%s] No reboot reason set. Default reason %d\n", 110 pr_warn("[%s] No reboot reason set. Default reason %d\n",
@@ -188,14 +188,15 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev)
188 188
189 plat = dev_get_platdata(pdev->dev.parent); 189 plat = dev_get_platdata(pdev->dev.parent);
190 190
191 if (!(plat && plat->sysctrl)) 191 if (!plat)
192 return -EINVAL; 192 return -EINVAL;
193 193
194 if (plat->pm_power_off) 194 sysctrl_dev = &pdev->dev;
195
196 if (!pm_power_off)
195 pm_power_off = ab8500_power_off; 197 pm_power_off = ab8500_power_off;
196 198
197 pdata = plat->sysctrl; 199 pdata = plat->sysctrl;
198
199 if (pdata) { 200 if (pdata) {
200 int last, ret, i, j; 201 int last, ret, i, j;
201 202
@@ -226,6 +227,10 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev)
226static int ab8500_sysctrl_remove(struct platform_device *pdev) 227static int ab8500_sysctrl_remove(struct platform_device *pdev)
227{ 228{
228 sysctrl_dev = NULL; 229 sysctrl_dev = NULL;
230
231 if (pm_power_off == ab8500_power_off)
232 pm_power_off = NULL;
233
229 return 0; 234 return 0;
230} 235}
231 236
diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
index 9818afba2515..3714acb61458 100644
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(abx500_startup_irq_enabled);
156void abx500_dump_all_banks(void) 156void abx500_dump_all_banks(void)
157{ 157{
158 struct abx500_ops *ops; 158 struct abx500_ops *ops;
159 struct device dummy_child = {0}; 159 struct device dummy_child = {NULL};
160 struct abx500_device_entry *dev_entry; 160 struct abx500_device_entry *dev_entry;
161 161
162 list_for_each_entry(dev_entry, &abx500_list, list) { 162 list_for_each_entry(dev_entry, &abx500_list, list) {
diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
index 19193cf1e7a1..367ccb58ecb1 100644
--- a/drivers/mfd/cros_ec_spi.c
+++ b/drivers/mfd/cros_ec_spi.c
@@ -120,7 +120,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev,
120 120
121 for (end = ptr + EC_MSG_PREAMBLE_COUNT; ptr != end; ptr++) { 121 for (end = ptr + EC_MSG_PREAMBLE_COUNT; ptr != end; ptr++) {
122 if (*ptr == EC_MSG_HEADER) { 122 if (*ptr == EC_MSG_HEADER) {
123 dev_dbg(ec_dev->dev, "msg found at %ld\n", 123 dev_dbg(ec_dev->dev, "msg found at %zd\n",
124 ptr - ec_dev->din); 124 ptr - ec_dev->din);
125 break; 125 break;
126 } 126 }
@@ -154,7 +154,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev,
154 * maximum-supported transfer size. 154 * maximum-supported transfer size.
155 */ 155 */
156 todo = min(need_len, 256); 156 todo = min(need_len, 256);
157 dev_dbg(ec_dev->dev, "loop, todo=%d, need_len=%d, ptr=%ld\n", 157 dev_dbg(ec_dev->dev, "loop, todo=%d, need_len=%d, ptr=%zd\n",
158 todo, need_len, ptr - ec_dev->din); 158 todo, need_len, ptr - ec_dev->din);
159 159
160 memset(&trans, '\0', sizeof(trans)); 160 memset(&trans, '\0', sizeof(trans));
@@ -178,7 +178,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev,
178 need_len -= todo; 178 need_len -= todo;
179 } 179 }
180 180
181 dev_dbg(ec_dev->dev, "loop done, ptr=%ld\n", ptr - ec_dev->din); 181 dev_dbg(ec_dev->dev, "loop done, ptr=%zd\n", ptr - ec_dev->din);
182 182
183 return 0; 183 return 0;
184} 184}
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 319b8abe742b..66f80973596b 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -1613,6 +1613,8 @@ static unsigned long dsiclk_rate(u8 n)
1613 1613
1614 if (divsel == PRCM_DSI_PLLOUT_SEL_OFF) 1614 if (divsel == PRCM_DSI_PLLOUT_SEL_OFF)
1615 divsel = dsiclk[n].divsel; 1615 divsel = dsiclk[n].divsel;
1616 else
1617 dsiclk[n].divsel = divsel;
1616 1618
1617 switch (divsel) { 1619 switch (divsel) {
1618 case PRCM_DSI_PLLOUT_SEL_PHI_4: 1620 case PRCM_DSI_PLLOUT_SEL_PHI_4:
@@ -3095,6 +3097,7 @@ static struct mfd_cell db8500_prcmu_devs[] = {
3095 .num_resources = ARRAY_SIZE(db8500_thsens_resources), 3097 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
3096 .resources = db8500_thsens_resources, 3098 .resources = db8500_thsens_resources,
3097 .platform_data = &db8500_thsens_data, 3099 .platform_data = &db8500_thsens_data,
3100 .pdata_size = sizeof(db8500_thsens_data),
3098 }, 3101 },
3099}; 3102};
3100 3103
diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c
index de48b4e88450..6f1ef63086c9 100644
--- a/drivers/mfd/si476x-cmd.c
+++ b/drivers/mfd/si476x-cmd.c
@@ -29,6 +29,8 @@
29 29
30#include <linux/mfd/si476x-core.h> 30#include <linux/mfd/si476x-core.h>
31 31
32#include <asm/unaligned.h>
33
32#define msb(x) ((u8)((u16) x >> 8)) 34#define msb(x) ((u8)((u16) x >> 8))
33#define lsb(x) ((u8)((u16) x & 0x00FF)) 35#define lsb(x) ((u8)((u16) x & 0x00FF))
34 36
@@ -150,7 +152,7 @@ enum si476x_acf_status_report_bits {
150 SI476X_ACF_SOFTMUTE_INT = (1 << 0), 152 SI476X_ACF_SOFTMUTE_INT = (1 << 0),
151 153
152 SI476X_ACF_SMUTE = (1 << 0), 154 SI476X_ACF_SMUTE = (1 << 0),
153 SI476X_ACF_SMATTN = 0b11111, 155 SI476X_ACF_SMATTN = 0x1f,
154 SI476X_ACF_PILOT = (1 << 7), 156 SI476X_ACF_PILOT = (1 << 7),
155 SI476X_ACF_STBLEND = ~SI476X_ACF_PILOT, 157 SI476X_ACF_STBLEND = ~SI476X_ACF_PILOT,
156}; 158};
@@ -483,7 +485,7 @@ int si476x_core_cmd_get_property(struct si476x_core *core, u16 property)
483 if (err < 0) 485 if (err < 0)
484 return err; 486 return err;
485 else 487 else
486 return be16_to_cpup((__be16 *)(resp + 2)); 488 return get_unaligned_be16(resp + 2);
487} 489}
488EXPORT_SYMBOL_GPL(si476x_core_cmd_get_property); 490EXPORT_SYMBOL_GPL(si476x_core_cmd_get_property);
489 491
@@ -772,18 +774,18 @@ int si476x_core_cmd_am_rsq_status(struct si476x_core *core,
772 if (!report) 774 if (!report)
773 return err; 775 return err;
774 776
775 report->snrhint = 0b00001000 & resp[1]; 777 report->snrhint = 0x08 & resp[1];
776 report->snrlint = 0b00000100 & resp[1]; 778 report->snrlint = 0x04 & resp[1];
777 report->rssihint = 0b00000010 & resp[1]; 779 report->rssihint = 0x02 & resp[1];
778 report->rssilint = 0b00000001 & resp[1]; 780 report->rssilint = 0x01 & resp[1];
779 781
780 report->bltf = 0b10000000 & resp[2]; 782 report->bltf = 0x80 & resp[2];
781 report->snr_ready = 0b00100000 & resp[2]; 783 report->snr_ready = 0x20 & resp[2];
782 report->rssiready = 0b00001000 & resp[2]; 784 report->rssiready = 0x08 & resp[2];
783 report->afcrl = 0b00000010 & resp[2]; 785 report->afcrl = 0x02 & resp[2];
784 report->valid = 0b00000001 & resp[2]; 786 report->valid = 0x01 & resp[2];
785 787
786 report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); 788 report->readfreq = get_unaligned_be16(resp + 3);
787 report->freqoff = resp[5]; 789 report->freqoff = resp[5];
788 report->rssi = resp[6]; 790 report->rssi = resp[6];
789 report->snr = resp[7]; 791 report->snr = resp[7];
@@ -931,26 +933,26 @@ int si476x_core_cmd_fm_rds_status(struct si476x_core *core,
931 if (err < 0 || report == NULL) 933 if (err < 0 || report == NULL)
932 return err; 934 return err;
933 935
934 report->rdstpptyint = 0b00010000 & resp[1]; 936 report->rdstpptyint = 0x10 & resp[1];
935 report->rdspiint = 0b00001000 & resp[1]; 937 report->rdspiint = 0x08 & resp[1];
936 report->rdssyncint = 0b00000010 & resp[1]; 938 report->rdssyncint = 0x02 & resp[1];
937 report->rdsfifoint = 0b00000001 & resp[1]; 939 report->rdsfifoint = 0x01 & resp[1];
938 940
939 report->tpptyvalid = 0b00010000 & resp[2]; 941 report->tpptyvalid = 0x10 & resp[2];
940 report->pivalid = 0b00001000 & resp[2]; 942 report->pivalid = 0x08 & resp[2];
941 report->rdssync = 0b00000010 & resp[2]; 943 report->rdssync = 0x02 & resp[2];
942 report->rdsfifolost = 0b00000001 & resp[2]; 944 report->rdsfifolost = 0x01 & resp[2];
943 945
944 report->tp = 0b00100000 & resp[3]; 946 report->tp = 0x20 & resp[3];
945 report->pty = 0b00011111 & resp[3]; 947 report->pty = 0x1f & resp[3];
946 948
947 report->pi = be16_to_cpup((__be16 *)(resp + 4)); 949 report->pi = get_unaligned_be16(resp + 4);
948 report->rdsfifoused = resp[6]; 950 report->rdsfifoused = resp[6];
949 951
950 report->ble[V4L2_RDS_BLOCK_A] = 0b11000000 & resp[7]; 952 report->ble[V4L2_RDS_BLOCK_A] = 0xc0 & resp[7];
951 report->ble[V4L2_RDS_BLOCK_B] = 0b00110000 & resp[7]; 953 report->ble[V4L2_RDS_BLOCK_B] = 0x30 & resp[7];
952 report->ble[V4L2_RDS_BLOCK_C] = 0b00001100 & resp[7]; 954 report->ble[V4L2_RDS_BLOCK_C] = 0x0c & resp[7];
953 report->ble[V4L2_RDS_BLOCK_D] = 0b00000011 & resp[7]; 955 report->ble[V4L2_RDS_BLOCK_D] = 0x03 & resp[7];
954 956
955 report->rds[V4L2_RDS_BLOCK_A].block = V4L2_RDS_BLOCK_A; 957 report->rds[V4L2_RDS_BLOCK_A].block = V4L2_RDS_BLOCK_A;
956 report->rds[V4L2_RDS_BLOCK_A].msb = resp[8]; 958 report->rds[V4L2_RDS_BLOCK_A].msb = resp[8];
@@ -991,9 +993,9 @@ int si476x_core_cmd_fm_rds_blockcount(struct si476x_core *core,
991 SI476X_DEFAULT_TIMEOUT); 993 SI476X_DEFAULT_TIMEOUT);
992 994
993 if (!err) { 995 if (!err) {
994 report->expected = be16_to_cpup((__be16 *)(resp + 2)); 996 report->expected = get_unaligned_be16(resp + 2);
995 report->received = be16_to_cpup((__be16 *)(resp + 4)); 997 report->received = get_unaligned_be16(resp + 4);
996 report->uncorrectable = be16_to_cpup((__be16 *)(resp + 6)); 998 report->uncorrectable = get_unaligned_be16(resp + 6);
997 } 999 }
998 1000
999 return err; 1001 return err;
@@ -1005,7 +1007,7 @@ int si476x_core_cmd_fm_phase_diversity(struct si476x_core *core,
1005{ 1007{
1006 u8 resp[CMD_FM_PHASE_DIVERSITY_NRESP]; 1008 u8 resp[CMD_FM_PHASE_DIVERSITY_NRESP];
1007 const u8 args[CMD_FM_PHASE_DIVERSITY_NARGS] = { 1009 const u8 args[CMD_FM_PHASE_DIVERSITY_NARGS] = {
1008 mode & 0b111, 1010 mode & 0x07,
1009 }; 1011 };
1010 1012
1011 return si476x_core_send_command(core, CMD_FM_PHASE_DIVERSITY, 1013 return si476x_core_send_command(core, CMD_FM_PHASE_DIVERSITY,
@@ -1162,7 +1164,7 @@ static int si476x_core_cmd_am_tune_freq_a20(struct si476x_core *core,
1162 const int am_freq = tuneargs->freq; 1164 const int am_freq = tuneargs->freq;
1163 u8 resp[CMD_AM_TUNE_FREQ_NRESP]; 1165 u8 resp[CMD_AM_TUNE_FREQ_NRESP];
1164 const u8 args[CMD_AM_TUNE_FREQ_NARGS] = { 1166 const u8 args[CMD_AM_TUNE_FREQ_NARGS] = {
1165 (tuneargs->zifsr << 6) | (tuneargs->injside & 0b11), 1167 (tuneargs->zifsr << 6) | (tuneargs->injside & 0x03),
1166 msb(am_freq), 1168 msb(am_freq),
1167 lsb(am_freq), 1169 lsb(am_freq),
1168 }; 1170 };
@@ -1197,20 +1199,20 @@ static int si476x_core_cmd_fm_rsq_status_a10(struct si476x_core *core,
1197 if (err < 0 || report == NULL) 1199 if (err < 0 || report == NULL)
1198 return err; 1200 return err;
1199 1201
1200 report->multhint = 0b10000000 & resp[1]; 1202 report->multhint = 0x80 & resp[1];
1201 report->multlint = 0b01000000 & resp[1]; 1203 report->multlint = 0x40 & resp[1];
1202 report->snrhint = 0b00001000 & resp[1]; 1204 report->snrhint = 0x08 & resp[1];
1203 report->snrlint = 0b00000100 & resp[1]; 1205 report->snrlint = 0x04 & resp[1];
1204 report->rssihint = 0b00000010 & resp[1]; 1206 report->rssihint = 0x02 & resp[1];
1205 report->rssilint = 0b00000001 & resp[1]; 1207 report->rssilint = 0x01 & resp[1];
1206 1208
1207 report->bltf = 0b10000000 & resp[2]; 1209 report->bltf = 0x80 & resp[2];
1208 report->snr_ready = 0b00100000 & resp[2]; 1210 report->snr_ready = 0x20 & resp[2];
1209 report->rssiready = 0b00001000 & resp[2]; 1211 report->rssiready = 0x08 & resp[2];
1210 report->afcrl = 0b00000010 & resp[2]; 1212 report->afcrl = 0x02 & resp[2];
1211 report->valid = 0b00000001 & resp[2]; 1213 report->valid = 0x01 & resp[2];
1212 1214
1213 report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); 1215 report->readfreq = get_unaligned_be16(resp + 3);
1214 report->freqoff = resp[5]; 1216 report->freqoff = resp[5];
1215 report->rssi = resp[6]; 1217 report->rssi = resp[6];
1216 report->snr = resp[7]; 1218 report->snr = resp[7];
@@ -1218,7 +1220,7 @@ static int si476x_core_cmd_fm_rsq_status_a10(struct si476x_core *core,
1218 report->hassi = resp[10]; 1220 report->hassi = resp[10];
1219 report->mult = resp[11]; 1221 report->mult = resp[11];
1220 report->dev = resp[12]; 1222 report->dev = resp[12];
1221 report->readantcap = be16_to_cpup((__be16 *)(resp + 13)); 1223 report->readantcap = get_unaligned_be16(resp + 13);
1222 report->assi = resp[15]; 1224 report->assi = resp[15];
1223 report->usn = resp[16]; 1225 report->usn = resp[16];
1224 1226
@@ -1251,20 +1253,20 @@ static int si476x_core_cmd_fm_rsq_status_a20(struct si476x_core *core,
1251 if (err < 0 || report == NULL) 1253 if (err < 0 || report == NULL)
1252 return err; 1254 return err;
1253 1255
1254 report->multhint = 0b10000000 & resp[1]; 1256 report->multhint = 0x80 & resp[1];
1255 report->multlint = 0b01000000 & resp[1]; 1257 report->multlint = 0x40 & resp[1];
1256 report->snrhint = 0b00001000 & resp[1]; 1258 report->snrhint = 0x08 & resp[1];
1257 report->snrlint = 0b00000100 & resp[1]; 1259 report->snrlint = 0x04 & resp[1];
1258 report->rssihint = 0b00000010 & resp[1]; 1260 report->rssihint = 0x02 & resp[1];
1259 report->rssilint = 0b00000001 & resp[1]; 1261 report->rssilint = 0x01 & resp[1];
1260 1262
1261 report->bltf = 0b10000000 & resp[2]; 1263 report->bltf = 0x80 & resp[2];
1262 report->snr_ready = 0b00100000 & resp[2]; 1264 report->snr_ready = 0x20 & resp[2];
1263 report->rssiready = 0b00001000 & resp[2]; 1265 report->rssiready = 0x08 & resp[2];
1264 report->afcrl = 0b00000010 & resp[2]; 1266 report->afcrl = 0x02 & resp[2];
1265 report->valid = 0b00000001 & resp[2]; 1267 report->valid = 0x01 & resp[2];
1266 1268
1267 report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); 1269 report->readfreq = get_unaligned_be16(resp + 3);
1268 report->freqoff = resp[5]; 1270 report->freqoff = resp[5];
1269 report->rssi = resp[6]; 1271 report->rssi = resp[6];
1270 report->snr = resp[7]; 1272 report->snr = resp[7];
@@ -1272,7 +1274,7 @@ static int si476x_core_cmd_fm_rsq_status_a20(struct si476x_core *core,
1272 report->hassi = resp[10]; 1274 report->hassi = resp[10];
1273 report->mult = resp[11]; 1275 report->mult = resp[11];
1274 report->dev = resp[12]; 1276 report->dev = resp[12];
1275 report->readantcap = be16_to_cpup((__be16 *)(resp + 13)); 1277 report->readantcap = get_unaligned_be16(resp + 13);
1276 report->assi = resp[15]; 1278 report->assi = resp[15];
1277 report->usn = resp[16]; 1279 report->usn = resp[16];
1278 1280
@@ -1306,21 +1308,21 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core,
1306 if (err < 0 || report == NULL) 1308 if (err < 0 || report == NULL)
1307 return err; 1309 return err;
1308 1310
1309 report->multhint = 0b10000000 & resp[1]; 1311 report->multhint = 0x80 & resp[1];
1310 report->multlint = 0b01000000 & resp[1]; 1312 report->multlint = 0x40 & resp[1];
1311 report->snrhint = 0b00001000 & resp[1]; 1313 report->snrhint = 0x08 & resp[1];
1312 report->snrlint = 0b00000100 & resp[1]; 1314 report->snrlint = 0x04 & resp[1];
1313 report->rssihint = 0b00000010 & resp[1]; 1315 report->rssihint = 0x02 & resp[1];
1314 report->rssilint = 0b00000001 & resp[1]; 1316 report->rssilint = 0x01 & resp[1];
1315 1317
1316 report->bltf = 0b10000000 & resp[2]; 1318 report->bltf = 0x80 & resp[2];
1317 report->snr_ready = 0b00100000 & resp[2]; 1319 report->snr_ready = 0x20 & resp[2];
1318 report->rssiready = 0b00001000 & resp[2]; 1320 report->rssiready = 0x08 & resp[2];
1319 report->injside = 0b00000100 & resp[2]; 1321 report->injside = 0x04 & resp[2];
1320 report->afcrl = 0b00000010 & resp[2]; 1322 report->afcrl = 0x02 & resp[2];
1321 report->valid = 0b00000001 & resp[2]; 1323 report->valid = 0x01 & resp[2];
1322 1324
1323 report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); 1325 report->readfreq = get_unaligned_be16(resp + 3);
1324 report->freqoff = resp[5]; 1326 report->freqoff = resp[5];
1325 report->rssi = resp[6]; 1327 report->rssi = resp[6];
1326 report->snr = resp[7]; 1328 report->snr = resp[7];
@@ -1329,7 +1331,7 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core,
1329 report->hassi = resp[10]; 1331 report->hassi = resp[10];
1330 report->mult = resp[11]; 1332 report->mult = resp[11];
1331 report->dev = resp[12]; 1333 report->dev = resp[12];
1332 report->readantcap = be16_to_cpup((__be16 *)(resp + 13)); 1334 report->readantcap = get_unaligned_be16(resp + 13);
1333 report->assi = resp[15]; 1335 report->assi = resp[15];
1334 report->usn = resp[16]; 1336 report->usn = resp[16];
1335 1337
@@ -1337,7 +1339,7 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core,
1337 report->rdsdev = resp[18]; 1339 report->rdsdev = resp[18];
1338 report->assidev = resp[19]; 1340 report->assidev = resp[19];
1339 report->strongdev = resp[20]; 1341 report->strongdev = resp[20];
1340 report->rdspi = be16_to_cpup((__be16 *)(resp + 21)); 1342 report->rdspi = get_unaligned_be16(resp + 21);
1341 1343
1342 return err; 1344 return err;
1343} 1345}
diff --git a/drivers/misc/dummy-irq.c b/drivers/misc/dummy-irq.c
index 7014167e2c61..c37eeedfe215 100644
--- a/drivers/misc/dummy-irq.c
+++ b/drivers/misc/dummy-irq.c
@@ -19,7 +19,7 @@
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21 21
22static int irq; 22static int irq = -1;
23 23
24static irqreturn_t dummy_interrupt(int irq, void *dev_id) 24static irqreturn_t dummy_interrupt(int irq, void *dev_id)
25{ 25{
@@ -36,6 +36,10 @@ static irqreturn_t dummy_interrupt(int irq, void *dev_id)
36 36
37static int __init dummy_irq_init(void) 37static int __init dummy_irq_init(void)
38{ 38{
39 if (irq < 0) {
40 printk(KERN_ERR "dummy-irq: no IRQ given. Use irq=N\n");
41 return -EIO;
42 }
39 if (request_irq(irq, &dummy_interrupt, IRQF_SHARED, "dummy_irq", &irq)) { 43 if (request_irq(irq, &dummy_interrupt, IRQF_SHARED, "dummy_irq", &irq)) {
40 printk(KERN_ERR "dummy-irq: cannot register IRQ %d\n", irq); 44 printk(KERN_ERR "dummy-irq: cannot register IRQ %d\n", irq);
41 return -EIO; 45 return -EIO;
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 1e935eacaa7f..9ecd49a7be1b 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -496,6 +496,8 @@ int mei_cl_disable_device(struct mei_cl_device *device)
496 } 496 }
497 } 497 }
498 498
499 device->event_cb = NULL;
500
499 mutex_unlock(&dev->device_lock); 501 mutex_unlock(&dev->device_lock);
500 502
501 if (!device->ops || !device->ops->disable) 503 if (!device->ops || !device->ops->disable)
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 7c44c8dbae42..053139f61086 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -489,11 +489,16 @@ static int mei_ioctl_connect_client(struct file *file,
489 489
490 /* find ME client we're trying to connect to */ 490 /* find ME client we're trying to connect to */
491 i = mei_me_cl_by_uuid(dev, &data->in_client_uuid); 491 i = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
492 if (i >= 0 && !dev->me_clients[i].props.fixed_address) { 492 if (i < 0 || dev->me_clients[i].props.fixed_address) {
493 cl->me_client_id = dev->me_clients[i].client_id; 493 dev_dbg(&dev->pdev->dev, "Cannot connect to FW Client UUID = %pUl\n",
494 cl->state = MEI_FILE_CONNECTING; 494 &data->in_client_uuid);
495 rets = -ENODEV;
496 goto end;
495 } 497 }
496 498
499 cl->me_client_id = dev->me_clients[i].client_id;
500 cl->state = MEI_FILE_CONNECTING;
501
497 dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n", 502 dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n",
498 cl->me_client_id); 503 cl->me_client_id);
499 dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n", 504 dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n",
@@ -527,11 +532,6 @@ static int mei_ioctl_connect_client(struct file *file,
527 goto end; 532 goto end;
528 } 533 }
529 534
530 if (cl->state != MEI_FILE_CONNECTING) {
531 rets = -ENODEV;
532 goto end;
533 }
534
535 535
536 /* prepare the output buffer */ 536 /* prepare the output buffer */
537 client = &data->out_client_properties; 537 client = &data->out_client_properties;
@@ -543,7 +543,6 @@ static int mei_ioctl_connect_client(struct file *file,
543 rets = mei_cl_connect(cl, file); 543 rets = mei_cl_connect(cl, file);
544 544
545end: 545end:
546 dev_dbg(&dev->pdev->dev, "free connect cb memory.");
547 return rets; 546 return rets;
548} 547}
549 548
diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig
index ea98f7e9ccd1..39c2ecadb273 100644
--- a/drivers/misc/vmw_vmci/Kconfig
+++ b/drivers/misc/vmw_vmci/Kconfig
@@ -4,7 +4,7 @@
4 4
5config VMWARE_VMCI 5config VMWARE_VMCI
6 tristate "VMware VMCI Driver" 6 tristate "VMware VMCI Driver"
7 depends on X86 && PCI && NET 7 depends on X86 && PCI
8 help 8 help
9 This is VMware's Virtual Machine Communication Interface. It enables 9 This is VMware's Virtual Machine Communication Interface. It enables
10 high-speed communication between host and guest in a virtual 10 high-speed communication between host and guest in a virtual
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index d94245dbd765..8ff2e5ee8fb8 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -23,7 +23,7 @@
23#include <linux/pagemap.h> 23#include <linux/pagemap.h>
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/socket.h> 26#include <linux/uio.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29 29
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index fc58d118d844..390061d09693 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2360,14 +2360,15 @@ int bond_3ad_set_carrier(struct bonding *bond)
2360} 2360}
2361 2361
2362/** 2362/**
2363 * bond_3ad_get_active_agg_info - get information of the active aggregator 2363 * __bond_3ad_get_active_agg_info - get information of the active aggregator
2364 * @bond: bonding struct to work on 2364 * @bond: bonding struct to work on
2365 * @ad_info: ad_info struct to fill with the bond's info 2365 * @ad_info: ad_info struct to fill with the bond's info
2366 * 2366 *
2367 * Returns: 0 on success 2367 * Returns: 0 on success
2368 * < 0 on error 2368 * < 0 on error
2369 */ 2369 */
2370int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) 2370int __bond_3ad_get_active_agg_info(struct bonding *bond,
2371 struct ad_info *ad_info)
2371{ 2372{
2372 struct aggregator *aggregator = NULL; 2373 struct aggregator *aggregator = NULL;
2373 struct port *port; 2374 struct port *port;
@@ -2391,6 +2392,18 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
2391 return -1; 2392 return -1;
2392} 2393}
2393 2394
2395/* Wrapper used to hold bond->lock so no slave manipulation can occur */
2396int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
2397{
2398 int ret;
2399
2400 read_lock(&bond->lock);
2401 ret = __bond_3ad_get_active_agg_info(bond, ad_info);
2402 read_unlock(&bond->lock);
2403
2404 return ret;
2405}
2406
2394int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) 2407int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2395{ 2408{
2396 struct slave *slave, *start_at; 2409 struct slave *slave, *start_at;
@@ -2402,8 +2415,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
2402 struct ad_info ad_info; 2415 struct ad_info ad_info;
2403 int res = 1; 2416 int res = 1;
2404 2417
2405 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { 2418 if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
2406 pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", 2419 pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n",
2407 dev->name); 2420 dev->name);
2408 goto out; 2421 goto out;
2409 } 2422 }
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index 0cfaa4afdece..5d91ad0cc041 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -273,6 +273,8 @@ void bond_3ad_adapter_speed_changed(struct slave *slave);
273void bond_3ad_adapter_duplex_changed(struct slave *slave); 273void bond_3ad_adapter_duplex_changed(struct slave *slave);
274void bond_3ad_handle_link_change(struct slave *slave, char link); 274void bond_3ad_handle_link_change(struct slave *slave, char link);
275int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); 275int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
276int __bond_3ad_get_active_agg_info(struct bonding *bond,
277 struct ad_info *ad_info);
276int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); 278int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
277int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, 279int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
278 struct slave *slave); 280 struct slave *slave);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d0aade04e49a..29b846cbfb48 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1362,6 +1362,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
1362 slave->dev->features, 1362 slave->dev->features,
1363 mask); 1363 mask);
1364 } 1364 }
1365 features = netdev_add_tso_features(features, mask);
1365 1366
1366out: 1367out:
1367 read_unlock(&bond->lock); 1368 read_unlock(&bond->lock);
@@ -2555,8 +2556,8 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_
2555{ 2556{
2556 struct sk_buff *skb; 2557 struct sk_buff *skb;
2557 2558
2558 pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, 2559 pr_debug("arp %d on slave %s: dst %pI4 src %pI4 vid %d\n", arp_op,
2559 slave_dev->name, dest_ip, src_ip, vlan_id); 2560 slave_dev->name, &dest_ip, &src_ip, vlan_id);
2560 2561
2561 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, 2562 skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip,
2562 NULL, slave_dev->dev_addr, NULL); 2563 NULL, slave_dev->dev_addr, NULL);
@@ -2588,7 +2589,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2588 __be32 addr; 2589 __be32 addr;
2589 if (!targets[i]) 2590 if (!targets[i])
2590 break; 2591 break;
2591 pr_debug("basa: target %x\n", targets[i]); 2592 pr_debug("basa: target %pI4\n", &targets[i]);
2592 if (!bond_vlan_used(bond)) { 2593 if (!bond_vlan_used(bond)) {
2593 pr_debug("basa: empty vlan: arp_send\n"); 2594 pr_debug("basa: empty vlan: arp_send\n");
2594 addr = bond_confirm_addr(bond->dev, targets[i], 0); 2595 addr = bond_confirm_addr(bond->dev, targets[i], 0);
@@ -4470,7 +4471,7 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
4470 4471
4471static int bond_check_params(struct bond_params *params) 4472static int bond_check_params(struct bond_params *params)
4472{ 4473{
4473 int arp_validate_value, fail_over_mac_value, primary_reselect_value; 4474 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
4474 4475
4475 /* 4476 /*
4476 * Convert string parameters. 4477 * Convert string parameters.
@@ -4650,19 +4651,18 @@ static int bond_check_params(struct bond_params *params)
4650 arp_interval = BOND_LINK_ARP_INTERV; 4651 arp_interval = BOND_LINK_ARP_INTERV;
4651 } 4652 }
4652 4653
4653 for (arp_ip_count = 0; 4654 for (arp_ip_count = 0, i = 0;
4654 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[arp_ip_count]; 4655 (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
4655 arp_ip_count++) {
4656 /* not complete check, but should be good enough to 4656 /* not complete check, but should be good enough to
4657 catch mistakes */ 4657 catch mistakes */
4658 __be32 ip = in_aton(arp_ip_target[arp_ip_count]); 4658 __be32 ip = in_aton(arp_ip_target[i]);
4659 if (!isdigit(arp_ip_target[arp_ip_count][0]) || 4659 if (!isdigit(arp_ip_target[i][0]) || ip == 0 ||
4660 ip == 0 || ip == htonl(INADDR_BROADCAST)) { 4660 ip == htonl(INADDR_BROADCAST)) {
4661 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", 4661 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
4662 arp_ip_target[arp_ip_count]); 4662 arp_ip_target[i]);
4663 arp_interval = 0; 4663 arp_interval = 0;
4664 } else { 4664 } else {
4665 arp_target[arp_ip_count] = ip; 4665 arp_target[arp_ip_count++] = ip;
4666 } 4666 }
4667 } 4667 }
4668 4668
@@ -4696,8 +4696,6 @@ static int bond_check_params(struct bond_params *params)
4696 if (miimon) { 4696 if (miimon) {
4697 pr_info("MII link monitoring set to %d ms\n", miimon); 4697 pr_info("MII link monitoring set to %d ms\n", miimon);
4698 } else if (arp_interval) { 4698 } else if (arp_interval) {
4699 int i;
4700
4701 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", 4699 pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):",
4702 arp_interval, 4700 arp_interval,
4703 arp_validate_tbl[arp_validate_value].modename, 4701 arp_validate_tbl[arp_validate_value].modename,
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 94d06f1307b8..4060d41f0ee7 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -130,7 +130,7 @@ static void bond_info_show_master(struct seq_file *seq)
130 seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", 130 seq_printf(seq, "Aggregator selection policy (ad_select): %s\n",
131 ad_select_tbl[bond->params.ad_select].modename); 131 ad_select_tbl[bond->params.ad_select].modename);
132 132
133 if (bond_3ad_get_active_agg_info(bond, &ad_info)) { 133 if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
134 seq_printf(seq, "bond %s has no active aggregator\n", 134 seq_printf(seq, "bond %s has no active aggregator\n",
135 bond->dev->name); 135 bond->dev->name);
136 } else { 136 } else {
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ea7a388f4843..d7434e0a610e 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -316,6 +316,9 @@ static ssize_t bonding_store_mode(struct device *d,
316 int new_value, ret = count; 316 int new_value, ret = count;
317 struct bonding *bond = to_bond(d); 317 struct bonding *bond = to_bond(d);
318 318
319 if (!rtnl_trylock())
320 return restart_syscall();
321
319 if (bond->dev->flags & IFF_UP) { 322 if (bond->dev->flags & IFF_UP) {
320 pr_err("unable to update mode of %s because interface is up.\n", 323 pr_err("unable to update mode of %s because interface is up.\n",
321 bond->dev->name); 324 bond->dev->name);
@@ -352,6 +355,7 @@ static ssize_t bonding_store_mode(struct device *d,
352 bond->dev->name, bond_mode_tbl[new_value].modename, 355 bond->dev->name, bond_mode_tbl[new_value].modename,
353 new_value); 356 new_value);
354out: 357out:
358 rtnl_unlock();
355 return ret; 359 return ret;
356} 360}
357static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, 361static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
@@ -1315,7 +1319,6 @@ static ssize_t bonding_show_mii_status(struct device *d,
1315} 1319}
1316static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); 1320static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL);
1317 1321
1318
1319/* 1322/*
1320 * Show current 802.3ad aggregator ID. 1323 * Show current 802.3ad aggregator ID.
1321 */ 1324 */
@@ -1329,7 +1332,7 @@ static ssize_t bonding_show_ad_aggregator(struct device *d,
1329 if (bond->params.mode == BOND_MODE_8023AD) { 1332 if (bond->params.mode == BOND_MODE_8023AD) {
1330 struct ad_info ad_info; 1333 struct ad_info ad_info;
1331 count = sprintf(buf, "%d\n", 1334 count = sprintf(buf, "%d\n",
1332 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1335 bond_3ad_get_active_agg_info(bond, &ad_info)
1333 ? 0 : ad_info.aggregator_id); 1336 ? 0 : ad_info.aggregator_id);
1334 } 1337 }
1335 1338
@@ -1351,7 +1354,7 @@ static ssize_t bonding_show_ad_num_ports(struct device *d,
1351 if (bond->params.mode == BOND_MODE_8023AD) { 1354 if (bond->params.mode == BOND_MODE_8023AD) {
1352 struct ad_info ad_info; 1355 struct ad_info ad_info;
1353 count = sprintf(buf, "%d\n", 1356 count = sprintf(buf, "%d\n",
1354 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1357 bond_3ad_get_active_agg_info(bond, &ad_info)
1355 ? 0 : ad_info.ports); 1358 ? 0 : ad_info.ports);
1356 } 1359 }
1357 1360
@@ -1373,7 +1376,7 @@ static ssize_t bonding_show_ad_actor_key(struct device *d,
1373 if (bond->params.mode == BOND_MODE_8023AD) { 1376 if (bond->params.mode == BOND_MODE_8023AD) {
1374 struct ad_info ad_info; 1377 struct ad_info ad_info;
1375 count = sprintf(buf, "%d\n", 1378 count = sprintf(buf, "%d\n",
1376 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1379 bond_3ad_get_active_agg_info(bond, &ad_info)
1377 ? 0 : ad_info.actor_key); 1380 ? 0 : ad_info.actor_key);
1378 } 1381 }
1379 1382
@@ -1395,7 +1398,7 @@ static ssize_t bonding_show_ad_partner_key(struct device *d,
1395 if (bond->params.mode == BOND_MODE_8023AD) { 1398 if (bond->params.mode == BOND_MODE_8023AD) {
1396 struct ad_info ad_info; 1399 struct ad_info ad_info;
1397 count = sprintf(buf, "%d\n", 1400 count = sprintf(buf, "%d\n",
1398 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1401 bond_3ad_get_active_agg_info(bond, &ad_info)
1399 ? 0 : ad_info.partner_key); 1402 ? 0 : ad_info.partner_key);
1400 } 1403 }
1401 1404
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index b8fbe266ab68..be59ec4b2c30 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3313,6 +3313,7 @@ static void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data,
3313 */ 3313 */
3314static void bnx2x_set_pbd_gso(struct sk_buff *skb, 3314static void bnx2x_set_pbd_gso(struct sk_buff *skb,
3315 struct eth_tx_parse_bd_e1x *pbd, 3315 struct eth_tx_parse_bd_e1x *pbd,
3316 struct eth_tx_start_bd *tx_start_bd,
3316 u32 xmit_type) 3317 u32 xmit_type)
3317{ 3318{
3318 pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 3319 pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
@@ -3326,11 +3327,14 @@ static void bnx2x_set_pbd_gso(struct sk_buff *skb,
3326 ip_hdr(skb)->daddr, 3327 ip_hdr(skb)->daddr,
3327 0, IPPROTO_TCP, 0)); 3328 0, IPPROTO_TCP, 0));
3328 3329
3329 } else 3330 /* GSO on 57710/57711 needs FW to calculate IP checksum */
3331 tx_start_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_IP_CSUM;
3332 } else {
3330 pbd->tcp_pseudo_csum = 3333 pbd->tcp_pseudo_csum =
3331 bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, 3334 bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
3332 &ipv6_hdr(skb)->daddr, 3335 &ipv6_hdr(skb)->daddr,
3333 0, IPPROTO_TCP, 0)); 3336 0, IPPROTO_TCP, 0));
3337 }
3334 3338
3335 pbd->global_data |= 3339 pbd->global_data |=
3336 cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN); 3340 cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN);
@@ -3814,7 +3818,8 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
3814 bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, 3818 bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data,
3815 xmit_type); 3819 xmit_type);
3816 else 3820 else
3817 bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); 3821 bnx2x_set_pbd_gso(skb, pbd_e1x, tx_start_bd,
3822 xmit_type);
3818 } 3823 }
3819 3824
3820 /* Set the PBD's parsing_data field if not zero 3825 /* Set the PBD's parsing_data field if not zero
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 728d42ab2a76..1f2dd928888a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
94 94
95#define DRV_MODULE_NAME "tg3" 95#define DRV_MODULE_NAME "tg3"
96#define TG3_MAJ_NUM 3 96#define TG3_MAJ_NUM 3
97#define TG3_MIN_NUM 131 97#define TG3_MIN_NUM 132
98#define DRV_MODULE_VERSION \ 98#define DRV_MODULE_VERSION \
99 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) 99 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
100#define DRV_MODULE_RELDATE "April 09, 2013" 100#define DRV_MODULE_RELDATE "May 21, 2013"
101 101
102#define RESET_KIND_SHUTDOWN 0 102#define RESET_KIND_SHUTDOWN 0
103#define RESET_KIND_INIT 1 103#define RESET_KIND_INIT 1
@@ -2957,6 +2957,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)
2957 return 0; 2957 return 0;
2958} 2958}
2959 2959
2960static bool tg3_phy_power_bug(struct tg3 *tp)
2961{
2962 switch (tg3_asic_rev(tp)) {
2963 case ASIC_REV_5700:
2964 case ASIC_REV_5704:
2965 return true;
2966 case ASIC_REV_5780:
2967 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
2968 return true;
2969 return false;
2970 case ASIC_REV_5717:
2971 if (!tp->pci_fn)
2972 return true;
2973 return false;
2974 case ASIC_REV_5719:
2975 case ASIC_REV_5720:
2976 if ((tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
2977 !tp->pci_fn)
2978 return true;
2979 return false;
2980 }
2981
2982 return false;
2983}
2984
2960static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) 2985static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
2961{ 2986{
2962 u32 val; 2987 u32 val;
@@ -3016,12 +3041,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
3016 /* The PHY should not be powered down on some chips because 3041 /* The PHY should not be powered down on some chips because
3017 * of bugs. 3042 * of bugs.
3018 */ 3043 */
3019 if (tg3_asic_rev(tp) == ASIC_REV_5700 || 3044 if (tg3_phy_power_bug(tp))
3020 tg3_asic_rev(tp) == ASIC_REV_5704 ||
3021 (tg3_asic_rev(tp) == ASIC_REV_5780 &&
3022 (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) ||
3023 (tg3_asic_rev(tp) == ASIC_REV_5717 &&
3024 !tp->pci_fn))
3025 return; 3045 return;
3026 3046
3027 if (tg3_chip_rev(tp) == CHIPREV_5784_AX || 3047 if (tg3_chip_rev(tp) == CHIPREV_5784_AX ||
@@ -7428,6 +7448,20 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
7428 return (base > 0xffffdcc0) && (base + len + 8 < base); 7448 return (base > 0xffffdcc0) && (base + len + 8 < base);
7429} 7449}
7430 7450
7451/* Test for TSO DMA buffers that cross into regions which are within MSS bytes
7452 * of any 4GB boundaries: 4G, 8G, etc
7453 */
7454static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping,
7455 u32 len, u32 mss)
7456{
7457 if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) {
7458 u32 base = (u32) mapping & 0xffffffff;
7459
7460 return ((base + len + (mss & 0x3fff)) < base);
7461 }
7462 return 0;
7463}
7464
7431/* Test for DMA addresses > 40-bit */ 7465/* Test for DMA addresses > 40-bit */
7432static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, 7466static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping,
7433 int len) 7467 int len)
@@ -7464,6 +7498,9 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
7464 if (tg3_4g_overflow_test(map, len)) 7498 if (tg3_4g_overflow_test(map, len))
7465 hwbug = true; 7499 hwbug = true;
7466 7500
7501 if (tg3_4g_tso_overflow_test(tp, map, len, mss))
7502 hwbug = true;
7503
7467 if (tg3_40bit_overflow_test(tp, map, len)) 7504 if (tg3_40bit_overflow_test(tp, map, len))
7468 hwbug = true; 7505 hwbug = true;
7469 7506
@@ -8874,6 +8911,10 @@ static int tg3_chip_reset(struct tg3 *tp)
8874 tg3_halt_cpu(tp, RX_CPU_BASE); 8911 tg3_halt_cpu(tp, RX_CPU_BASE);
8875 } 8912 }
8876 8913
8914 err = tg3_poll_fw(tp);
8915 if (err)
8916 return err;
8917
8877 tw32(GRC_MODE, tp->grc_mode); 8918 tw32(GRC_MODE, tp->grc_mode);
8878 8919
8879 if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { 8920 if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) {
@@ -8904,10 +8945,6 @@ static int tg3_chip_reset(struct tg3 *tp)
8904 8945
8905 tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); 8946 tg3_ape_unlock(tp, TG3_APE_LOCK_GRC);
8906 8947
8907 err = tg3_poll_fw(tp);
8908 if (err)
8909 return err;
8910
8911 tg3_mdio_start(tp); 8948 tg3_mdio_start(tp);
8912 8949
8913 if (tg3_flag(tp, PCI_EXPRESS) && 8950 if (tg3_flag(tp, PCI_EXPRESS) &&
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 6be513deb17f..c89aa41dd448 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -485,7 +485,8 @@ static void macb_tx_interrupt(struct macb *bp)
485 status = macb_readl(bp, TSR); 485 status = macb_readl(bp, TSR);
486 macb_writel(bp, TSR, status); 486 macb_writel(bp, TSR, status);
487 487
488 macb_writel(bp, ISR, MACB_BIT(TCOMP)); 488 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
489 macb_writel(bp, ISR, MACB_BIT(TCOMP));
489 490
490 netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n", 491 netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n",
491 (unsigned long)status); 492 (unsigned long)status);
@@ -738,7 +739,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
738 * now. 739 * now.
739 */ 740 */
740 macb_writel(bp, IDR, MACB_RX_INT_FLAGS); 741 macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
741 macb_writel(bp, ISR, MACB_BIT(RCOMP)); 742 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
743 macb_writel(bp, ISR, MACB_BIT(RCOMP));
742 744
743 if (napi_schedule_prep(&bp->napi)) { 745 if (napi_schedule_prep(&bp->napi)) {
744 netdev_vdbg(bp->dev, "scheduling RX softirq\n"); 746 netdev_vdbg(bp->dev, "scheduling RX softirq\n");
@@ -1062,6 +1064,17 @@ static void macb_configure_dma(struct macb *bp)
1062 } 1064 }
1063} 1065}
1064 1066
1067/*
1068 * Configure peripheral capacities according to integration options used
1069 */
1070static void macb_configure_caps(struct macb *bp)
1071{
1072 if (macb_is_gem(bp)) {
1073 if (GEM_BF(IRQCOR, gem_readl(bp, DCFG1)) == 0)
1074 bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE;
1075 }
1076}
1077
1065static void macb_init_hw(struct macb *bp) 1078static void macb_init_hw(struct macb *bp)
1066{ 1079{
1067 u32 config; 1080 u32 config;
@@ -1084,6 +1097,7 @@ static void macb_init_hw(struct macb *bp)
1084 bp->duplex = DUPLEX_HALF; 1097 bp->duplex = DUPLEX_HALF;
1085 1098
1086 macb_configure_dma(bp); 1099 macb_configure_dma(bp);
1100 macb_configure_caps(bp);
1087 1101
1088 /* Initialize TX and RX buffers */ 1102 /* Initialize TX and RX buffers */
1089 macb_writel(bp, RBQP, bp->rx_ring_dma); 1103 macb_writel(bp, RBQP, bp->rx_ring_dma);
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 993d70380688..548c0ecae869 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -300,6 +300,8 @@
300#define MACB_REV_SIZE 16 300#define MACB_REV_SIZE 16
301 301
302/* Bitfields in DCFG1. */ 302/* Bitfields in DCFG1. */
303#define GEM_IRQCOR_OFFSET 23
304#define GEM_IRQCOR_SIZE 1
303#define GEM_DBWDEF_OFFSET 25 305#define GEM_DBWDEF_OFFSET 25
304#define GEM_DBWDEF_SIZE 3 306#define GEM_DBWDEF_SIZE 3
305 307
@@ -323,6 +325,9 @@
323#define MACB_MAN_READ 2 325#define MACB_MAN_READ 2
324#define MACB_MAN_CODE 2 326#define MACB_MAN_CODE 2
325 327
328/* Capability mask bits */
329#define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x1
330
326/* Bit manipulation macros */ 331/* Bit manipulation macros */
327#define MACB_BIT(name) \ 332#define MACB_BIT(name) \
328 (1 << MACB_##name##_OFFSET) 333 (1 << MACB_##name##_OFFSET)
@@ -574,6 +579,8 @@ struct macb {
574 unsigned int speed; 579 unsigned int speed;
575 unsigned int duplex; 580 unsigned int duplex;
576 581
582 u32 caps;
583
577 phy_interface_t phy_interface; 584 phy_interface_t phy_interface;
578 585
579 /* AT91RM9200 transmit */ 586 /* AT91RM9200 transmit */
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index fd7b547698ab..a236ecd27cf3 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2976,22 +2976,17 @@ static struct be_nic_resource_desc *be_get_nic_desc(u8 *buf, u32 desc_count,
2976 for (i = 0; i < desc_count; i++) { 2976 for (i = 0; i < desc_count; i++) {
2977 desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE; 2977 desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE;
2978 if (((void *)desc + desc->desc_len) > 2978 if (((void *)desc + desc->desc_len) >
2979 (void *)(buf + max_buf_size)) { 2979 (void *)(buf + max_buf_size))
2980 desc = NULL; 2980 return NULL;
2981 break;
2982 }
2983 2981
2984 if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || 2982 if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 ||
2985 desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1) 2983 desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1)
2986 break; 2984 return desc;
2987 2985
2988 desc = (void *)desc + desc->desc_len; 2986 desc = (void *)desc + desc->desc_len;
2989 } 2987 }
2990 2988
2991 if (!desc || i == MAX_RESOURCE_DESC) 2989 return NULL;
2992 return NULL;
2993
2994 return desc;
2995} 2990}
2996 2991
2997/* Uses Mbox */ 2992/* Uses Mbox */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index a444110b060f..ca2967b0f18b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -780,26 +780,18 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
780 if (unlikely(!skb)) 780 if (unlikely(!skb))
781 return skb; 781 return skb;
782 782
783 if (vlan_tx_tag_present(skb)) { 783 if (vlan_tx_tag_present(skb))
784 vlan_tag = be_get_tx_vlan_tag(adapter, skb); 784 vlan_tag = be_get_tx_vlan_tag(adapter, skb);
785 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 785 else if (qnq_async_evt_rcvd(adapter) && adapter->pvid)
786 if (skb) 786 vlan_tag = adapter->pvid;
787 skb->vlan_tci = 0;
788 }
789
790 if (qnq_async_evt_rcvd(adapter) && adapter->pvid) {
791 if (!vlan_tag)
792 vlan_tag = adapter->pvid;
793 if (skip_hw_vlan)
794 *skip_hw_vlan = true;
795 }
796 787
797 if (vlan_tag) { 788 if (vlan_tag) {
798 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 789 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
799 if (unlikely(!skb)) 790 if (unlikely(!skb))
800 return skb; 791 return skb;
801
802 skb->vlan_tci = 0; 792 skb->vlan_tci = 0;
793 if (skip_hw_vlan)
794 *skip_hw_vlan = true;
803 } 795 }
804 796
805 /* Insert the outer VLAN, if any */ 797 /* Insert the outer VLAN, if any */
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ca9825ca88c9..85a06037b242 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -109,7 +109,7 @@ static struct platform_device_id fec_devtype[] = {
109 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | 109 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
110 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM, 110 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM,
111 }, { 111 }, {
112 .name = "mvf-fec", 112 .name = "mvf600-fec",
113 .driver_data = FEC_QUIRK_ENET_MAC, 113 .driver_data = FEC_QUIRK_ENET_MAC,
114 }, { 114 }, {
115 /* sentinel */ 115 /* sentinel */
@@ -122,7 +122,7 @@ enum imx_fec_type {
122 IMX27_FEC, /* runs on i.mx27/35/51 */ 122 IMX27_FEC, /* runs on i.mx27/35/51 */
123 IMX28_FEC, 123 IMX28_FEC,
124 IMX6Q_FEC, 124 IMX6Q_FEC,
125 MVF_FEC, 125 MVF600_FEC,
126}; 126};
127 127
128static const struct of_device_id fec_dt_ids[] = { 128static const struct of_device_id fec_dt_ids[] = {
@@ -130,7 +130,7 @@ static const struct of_device_id fec_dt_ids[] = {
130 { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, 130 { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], },
131 { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, 131 { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], },
132 { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, 132 { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], },
133 { .compatible = "fsl,mvf-fec", .data = &fec_devtype[MVF_FEC], }, 133 { .compatible = "fsl,mvf600-fec", .data = &fec_devtype[MVF600_FEC], },
134 { /* sentinel */ } 134 { /* sentinel */ }
135}; 135};
136MODULE_DEVICE_TABLE(of, fec_dt_ids); 136MODULE_DEVICE_TABLE(of, fec_dt_ids);
@@ -451,7 +451,7 @@ fec_restart(struct net_device *ndev, int duplex)
451 netif_device_detach(ndev); 451 netif_device_detach(ndev);
452 napi_disable(&fep->napi); 452 napi_disable(&fep->napi);
453 netif_stop_queue(ndev); 453 netif_stop_queue(ndev);
454 netif_tx_lock(ndev); 454 netif_tx_lock_bh(ndev);
455 } 455 }
456 456
457 /* Whack a reset. We should wait for this. */ 457 /* Whack a reset. We should wait for this. */
@@ -616,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex)
616 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); 616 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
617 617
618 if (netif_running(ndev)) { 618 if (netif_running(ndev)) {
619 netif_device_attach(ndev); 619 netif_tx_unlock_bh(ndev);
620 napi_enable(&fep->napi);
621 netif_wake_queue(ndev); 620 netif_wake_queue(ndev);
622 netif_tx_unlock(ndev); 621 napi_enable(&fep->napi);
622 netif_device_attach(ndev);
623 } 623 }
624} 624}
625 625
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index 576e4b858fce..083ea2b4d20a 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -524,6 +524,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)
524 return 0; 524 return 0;
525 525
526no_clock: 526no_clock:
527 iounmap(etsects->regs);
527no_ioremap: 528no_ioremap:
528 release_resource(etsects->rsrc); 529 release_resource(etsects->rsrc);
529no_resource: 530no_resource:
diff --git a/drivers/net/ethernet/icplus/ipg.h b/drivers/net/ethernet/icplus/ipg.h
index 6ce027355fcf..abb300a31912 100644
--- a/drivers/net/ethernet/icplus/ipg.h
+++ b/drivers/net/ethernet/icplus/ipg.h
@@ -195,57 +195,57 @@ enum ipg_regs {
195/* TFD data structure masks. */ 195/* TFD data structure masks. */
196 196
197/* TFDList, TFC */ 197/* TFDList, TFC */
198#define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFF 198#define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFFULL
199#define IPG_TFC_FRAMEID 0x000000000000FFFF 199#define IPG_TFC_FRAMEID 0x000000000000FFFFULL
200#define IPG_TFC_WORDALIGN 0x0000000000030000 200#define IPG_TFC_WORDALIGN 0x0000000000030000ULL
201#define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000 201#define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000ULL
202#define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000 202#define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000ULL
203#define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000 203#define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000ULL
204#define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000 204#define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000ULL
205#define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000 205#define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000ULL
206#define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000 206#define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000ULL
207#define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000 207#define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000ULL
208#define IPG_TFC_TXINDICATE 0x0000000000400000 208#define IPG_TFC_TXINDICATE 0x0000000000400000ULL
209#define IPG_TFC_TXDMAINDICATE 0x0000000000800000 209#define IPG_TFC_TXDMAINDICATE 0x0000000000800000ULL
210#define IPG_TFC_FRAGCOUNT 0x000000000F000000 210#define IPG_TFC_FRAGCOUNT 0x000000000F000000ULL
211#define IPG_TFC_VLANTAGINSERT 0x0000000010000000 211#define IPG_TFC_VLANTAGINSERT 0x0000000010000000ULL
212#define IPG_TFC_TFDDONE 0x0000000080000000 212#define IPG_TFC_TFDDONE 0x0000000080000000ULL
213#define IPG_TFC_VID 0x00000FFF00000000 213#define IPG_TFC_VID 0x00000FFF00000000ULL
214#define IPG_TFC_CFI 0x0000100000000000 214#define IPG_TFC_CFI 0x0000100000000000ULL
215#define IPG_TFC_USERPRIORITY 0x0000E00000000000 215#define IPG_TFC_USERPRIORITY 0x0000E00000000000ULL
216 216
217/* TFDList, FragInfo */ 217/* TFDList, FragInfo */
218#define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFF 218#define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL
219#define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFF 219#define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFFULL
220#define IPG_TFI_FRAGLEN 0xFFFF000000000000LL 220#define IPG_TFI_FRAGLEN 0xFFFF000000000000ULL
221 221
222/* RFD data structure masks. */ 222/* RFD data structure masks. */
223 223
224/* RFDList, RFS */ 224/* RFDList, RFS */
225#define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFF 225#define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFFULL
226#define IPG_RFS_RXFRAMELEN 0x000000000000FFFF 226#define IPG_RFS_RXFRAMELEN 0x000000000000FFFFULL
227#define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000 227#define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000ULL
228#define IPG_RFS_RXRUNTFRAME 0x0000000000020000 228#define IPG_RFS_RXRUNTFRAME 0x0000000000020000ULL
229#define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000 229#define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000ULL
230#define IPG_RFS_RXFCSERROR 0x0000000000080000 230#define IPG_RFS_RXFCSERROR 0x0000000000080000ULL
231#define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000 231#define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000ULL
232#define IPG_RFS_RXLENGTHERROR 0x0000000000200000 232#define IPG_RFS_RXLENGTHERROR 0x0000000000200000ULL
233#define IPG_RFS_VLANDETECTED 0x0000000000400000 233#define IPG_RFS_VLANDETECTED 0x0000000000400000ULL
234#define IPG_RFS_TCPDETECTED 0x0000000000800000 234#define IPG_RFS_TCPDETECTED 0x0000000000800000ULL
235#define IPG_RFS_TCPERROR 0x0000000001000000 235#define IPG_RFS_TCPERROR 0x0000000001000000ULL
236#define IPG_RFS_UDPDETECTED 0x0000000002000000 236#define IPG_RFS_UDPDETECTED 0x0000000002000000ULL
237#define IPG_RFS_UDPERROR 0x0000000004000000 237#define IPG_RFS_UDPERROR 0x0000000004000000ULL
238#define IPG_RFS_IPDETECTED 0x0000000008000000 238#define IPG_RFS_IPDETECTED 0x0000000008000000ULL
239#define IPG_RFS_IPERROR 0x0000000010000000 239#define IPG_RFS_IPERROR 0x0000000010000000ULL
240#define IPG_RFS_FRAMESTART 0x0000000020000000 240#define IPG_RFS_FRAMESTART 0x0000000020000000ULL
241#define IPG_RFS_FRAMEEND 0x0000000040000000 241#define IPG_RFS_FRAMEEND 0x0000000040000000ULL
242#define IPG_RFS_RFDDONE 0x0000000080000000 242#define IPG_RFS_RFDDONE 0x0000000080000000ULL
243#define IPG_RFS_TCI 0x0000FFFF00000000 243#define IPG_RFS_TCI 0x0000FFFF00000000ULL
244 244
245/* RFDList, FragInfo */ 245/* RFDList, FragInfo */
246#define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFF 246#define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL
247#define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFF 247#define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFFULL
248#define IPG_RFI_FRAGLEN 0xFFFF000000000000LL 248#define IPG_RFI_FRAGLEN 0xFFFF000000000000ULL
249 249
250/* I/O Register masks. */ 250/* I/O Register masks. */
251 251
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index d0afeea181fb..2ad1494efbb3 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -867,7 +867,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
867 struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index); 867 struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index);
868 int reclaimed; 868 int reclaimed;
869 869
870 __netif_tx_lock(nq, smp_processor_id()); 870 __netif_tx_lock_bh(nq);
871 871
872 reclaimed = 0; 872 reclaimed = 0;
873 while (reclaimed < budget && txq->tx_desc_count > 0) { 873 while (reclaimed < budget && txq->tx_desc_count > 0) {
@@ -913,7 +913,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
913 dev_kfree_skb(skb); 913 dev_kfree_skb(skb);
914 } 914 }
915 915
916 __netif_tx_unlock(nq); 916 __netif_tx_unlock_bh(nq);
917 917
918 if (reclaimed < budget) 918 if (reclaimed < budget)
919 mp->work_tx &= ~(1 << txq->index); 919 mp->work_tx &= ~(1 << txq->index);
@@ -2745,7 +2745,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2745 2745
2746 INIT_WORK(&mp->tx_timeout_task, tx_timeout_task); 2746 INIT_WORK(&mp->tx_timeout_task, tx_timeout_task);
2747 2747
2748 netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, 128); 2748 netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, NAPI_POLL_WEIGHT);
2749 2749
2750 init_timer(&mp->rx_oom); 2750 init_timer(&mp->rx_oom);
2751 mp->rx_oom.data = (unsigned long)mp; 2751 mp->rx_oom.data = (unsigned long)mp;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 019c5f78732e..c1b693cb3df3 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -907,8 +907,11 @@ struct qlcnic_ipaddr {
907#define QLCNIC_FW_HANG 0x4000 907#define QLCNIC_FW_HANG 0x4000
908#define QLCNIC_FW_LRO_MSS_CAP 0x8000 908#define QLCNIC_FW_LRO_MSS_CAP 0x8000
909#define QLCNIC_TX_INTR_SHARED 0x10000 909#define QLCNIC_TX_INTR_SHARED 0x10000
910#define QLCNIC_APP_CHANGED_FLAGS 0x20000
910#define QLCNIC_IS_MSI_FAMILY(adapter) \ 911#define QLCNIC_IS_MSI_FAMILY(adapter) \
911 ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) 912 ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
913#define QLCNIC_IS_TSO_CAPABLE(adapter) \
914 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
912 915
913#define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 916#define QLCNIC_DEF_NUM_STS_DESC_RINGS 4
914#define QLCNIC_MSIX_TBL_SPACE 8192 917#define QLCNIC_MSIX_TBL_SPACE 8192
@@ -1034,6 +1037,7 @@ struct qlcnic_adapter {
1034 spinlock_t rx_mac_learn_lock; 1037 spinlock_t rx_mac_learn_lock;
1035 u32 file_prd_off; /*File fw product offset*/ 1038 u32 file_prd_off; /*File fw product offset*/
1036 u32 fw_version; 1039 u32 fw_version;
1040 u32 offload_flags;
1037 const struct firmware *fw; 1041 const struct firmware *fw;
1038}; 1042};
1039 1043
@@ -1542,6 +1546,8 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, u16);
1542int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); 1546int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
1543int qlcnic_read_mac_addr(struct qlcnic_adapter *); 1547int qlcnic_read_mac_addr(struct qlcnic_adapter *);
1544int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); 1548int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int);
1549void qlcnic_set_netdev_features(struct qlcnic_adapter *,
1550 struct qlcnic_esw_func_cfg *);
1545void qlcnic_sriov_vf_schedule_multi(struct net_device *); 1551void qlcnic_sriov_vf_schedule_multi(struct net_device *);
1546void qlcnic_vf_add_mc_list(struct net_device *, u16); 1552void qlcnic_vf_add_mc_list(struct net_device *, u16);
1547 1553
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index c67d1eb35e8f..5e7fb1dfb97b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -382,8 +382,6 @@ static int qlcnic_83xx_idc_tx_soft_reset(struct qlcnic_adapter *adapter)
382 clear_bit(__QLCNIC_RESETTING, &adapter->state); 382 clear_bit(__QLCNIC_RESETTING, &adapter->state);
383 dev_err(&adapter->pdev->dev, "%s:\n", __func__); 383 dev_err(&adapter->pdev->dev, "%s:\n", __func__);
384 384
385 adapter->netdev->trans_start = jiffies;
386
387 return 0; 385 return 0;
388} 386}
389 387
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 6a6512ba9f38..106a12f2a02f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -973,16 +973,57 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu)
973 return rc; 973 return rc;
974} 974}
975 975
976static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter,
977 netdev_features_t features)
978{
979 u32 offload_flags = adapter->offload_flags;
980
981 if (offload_flags & BIT_0) {
982 features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM |
983 NETIF_F_IPV6_CSUM;
984 adapter->rx_csum = 1;
985 if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
986 if (!(offload_flags & BIT_1))
987 features &= ~NETIF_F_TSO;
988 else
989 features |= NETIF_F_TSO;
990
991 if (!(offload_flags & BIT_2))
992 features &= ~NETIF_F_TSO6;
993 else
994 features |= NETIF_F_TSO6;
995 }
996 } else {
997 features &= ~(NETIF_F_RXCSUM |
998 NETIF_F_IP_CSUM |
999 NETIF_F_IPV6_CSUM);
1000
1001 if (QLCNIC_IS_TSO_CAPABLE(adapter))
1002 features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
1003 adapter->rx_csum = 0;
1004 }
1005
1006 return features;
1007}
976 1008
977netdev_features_t qlcnic_fix_features(struct net_device *netdev, 1009netdev_features_t qlcnic_fix_features(struct net_device *netdev,
978 netdev_features_t features) 1010 netdev_features_t features)
979{ 1011{
980 struct qlcnic_adapter *adapter = netdev_priv(netdev); 1012 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1013 netdev_features_t changed;
981 1014
982 if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) && 1015 if (qlcnic_82xx_check(adapter) &&
983 qlcnic_82xx_check(adapter)) { 1016 (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
984 netdev_features_t changed = features ^ netdev->features; 1017 if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) {
985 features ^= changed & (NETIF_F_ALL_CSUM | NETIF_F_RXCSUM); 1018 features = qlcnic_process_flags(adapter, features);
1019 } else {
1020 changed = features ^ netdev->features;
1021 features ^= changed & (NETIF_F_RXCSUM |
1022 NETIF_F_IP_CSUM |
1023 NETIF_F_IPV6_CSUM |
1024 NETIF_F_TSO |
1025 NETIF_F_TSO6);
1026 }
986 } 1027 }
987 1028
988 if (!(features & NETIF_F_RXCSUM)) 1029 if (!(features & NETIF_F_RXCSUM))
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 8fb836d4129f..aeb26a850679 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -84,14 +84,9 @@ static int qlcnic_start_firmware(struct qlcnic_adapter *);
84static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); 84static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter);
85static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); 85static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
86static int qlcnicvf_start_firmware(struct qlcnic_adapter *); 86static int qlcnicvf_start_firmware(struct qlcnic_adapter *);
87static void qlcnic_set_netdev_features(struct qlcnic_adapter *,
88 struct qlcnic_esw_func_cfg *);
89static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); 87static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16);
90static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); 88static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16);
91 89
92#define QLCNIC_IS_TSO_CAPABLE(adapter) \
93 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
94
95static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) 90static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter)
96{ 91{
97 struct qlcnic_hardware_context *ahw = adapter->ahw; 92 struct qlcnic_hardware_context *ahw = adapter->ahw;
@@ -1074,8 +1069,6 @@ void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter,
1074 1069
1075 if (!esw_cfg->promisc_mode) 1070 if (!esw_cfg->promisc_mode)
1076 adapter->flags |= QLCNIC_PROMISC_DISABLED; 1071 adapter->flags |= QLCNIC_PROMISC_DISABLED;
1077
1078 qlcnic_set_netdev_features(adapter, esw_cfg);
1079} 1072}
1080 1073
1081int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) 1074int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
@@ -1090,51 +1083,23 @@ int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
1090 return -EIO; 1083 return -EIO;
1091 qlcnic_set_vlan_config(adapter, &esw_cfg); 1084 qlcnic_set_vlan_config(adapter, &esw_cfg);
1092 qlcnic_set_eswitch_port_features(adapter, &esw_cfg); 1085 qlcnic_set_eswitch_port_features(adapter, &esw_cfg);
1086 qlcnic_set_netdev_features(adapter, &esw_cfg);
1093 1087
1094 return 0; 1088 return 0;
1095} 1089}
1096 1090
1097static void 1091void qlcnic_set_netdev_features(struct qlcnic_adapter *adapter,
1098qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, 1092 struct qlcnic_esw_func_cfg *esw_cfg)
1099 struct qlcnic_esw_func_cfg *esw_cfg)
1100{ 1093{
1101 struct net_device *netdev = adapter->netdev; 1094 struct net_device *netdev = adapter->netdev;
1102 unsigned long features, vlan_features;
1103 1095
1104 if (qlcnic_83xx_check(adapter)) 1096 if (qlcnic_83xx_check(adapter))
1105 return; 1097 return;
1106 1098
1107 features = (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 1099 adapter->offload_flags = esw_cfg->offload_flags;
1108 NETIF_F_IPV6_CSUM | NETIF_F_GRO); 1100 adapter->flags |= QLCNIC_APP_CHANGED_FLAGS;
1109 vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | 1101 netdev_update_features(netdev);
1110 NETIF_F_IPV6_CSUM); 1102 adapter->flags &= ~QLCNIC_APP_CHANGED_FLAGS;
1111
1112 if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
1113 features |= (NETIF_F_TSO | NETIF_F_TSO6);
1114 vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
1115 }
1116
1117 if (netdev->features & NETIF_F_LRO)
1118 features |= NETIF_F_LRO;
1119
1120 if (esw_cfg->offload_flags & BIT_0) {
1121 netdev->features |= features;
1122 adapter->rx_csum = 1;
1123 if (!(esw_cfg->offload_flags & BIT_1)) {
1124 netdev->features &= ~NETIF_F_TSO;
1125 features &= ~NETIF_F_TSO;
1126 }
1127 if (!(esw_cfg->offload_flags & BIT_2)) {
1128 netdev->features &= ~NETIF_F_TSO6;
1129 features &= ~NETIF_F_TSO6;
1130 }
1131 } else {
1132 netdev->features &= ~features;
1133 features &= ~features;
1134 adapter->rx_csum = 0;
1135 }
1136
1137 netdev->vlan_features = (features & vlan_features);
1138} 1103}
1139 1104
1140static int 1105static int
@@ -2016,8 +1981,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2016 pci_enable_pcie_error_reporting(pdev); 1981 pci_enable_pcie_error_reporting(pdev);
2017 1982
2018 ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); 1983 ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL);
2019 if (!ahw) 1984 if (!ahw) {
1985 err = -ENOMEM;
2020 goto err_out_free_res; 1986 goto err_out_free_res;
1987 }
2021 1988
2022 switch (ent->device) { 1989 switch (ent->device) {
2023 case PCI_DEVICE_ID_QLOGIC_QLE824X: 1990 case PCI_DEVICE_ID_QLOGIC_QLE824X:
@@ -2053,6 +2020,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2053 2020
2054 adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); 2021 adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic");
2055 if (adapter->qlcnic_wq == NULL) { 2022 if (adapter->qlcnic_wq == NULL) {
2023 err = -ENOMEM;
2056 dev_err(&pdev->dev, "Failed to create workqueue\n"); 2024 dev_err(&pdev->dev, "Failed to create workqueue\n");
2057 goto err_out_free_netdev; 2025 goto err_out_free_netdev;
2058 } 2026 }
@@ -2133,6 +2101,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2133 goto err_out_disable_msi; 2101 goto err_out_disable_msi;
2134 } 2102 }
2135 2103
2104 err = qlcnic_get_act_pci_func(adapter);
2105 if (err)
2106 goto err_out_disable_mbx_intr;
2107
2136 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); 2108 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac);
2137 if (err) 2109 if (err)
2138 goto err_out_disable_mbx_intr; 2110 goto err_out_disable_mbx_intr;
@@ -2162,9 +2134,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2162 break; 2134 break;
2163 } 2135 }
2164 2136
2165 if (qlcnic_get_act_pci_func(adapter))
2166 goto err_out_disable_mbx_intr;
2167
2168 if (adapter->drv_mac_learn) 2137 if (adapter->drv_mac_learn)
2169 qlcnic_alloc_lb_filters_mem(adapter); 2138 qlcnic_alloc_lb_filters_mem(adapter);
2170 2139
@@ -3149,10 +3118,8 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
3149 if (adapter->need_fw_reset) 3118 if (adapter->need_fw_reset)
3150 goto detach; 3119 goto detach;
3151 3120
3152 if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) { 3121 if (adapter->ahw->reset_context && qlcnic_auto_fw_reset)
3153 qlcnic_reset_hw_context(adapter); 3122 qlcnic_reset_hw_context(adapter);
3154 adapter->netdev->trans_start = jiffies;
3155 }
3156 3123
3157 return 0; 3124 return 0;
3158 } 3125 }
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index 3869c3864deb..196b2d100407 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -1734,7 +1734,6 @@ static int qlcnic_sriov_vf_handle_context_reset(struct qlcnic_adapter *adapter)
1734 1734
1735 if (!qlcnic_sriov_vf_reinit_driver(adapter)) { 1735 if (!qlcnic_sriov_vf_reinit_driver(adapter)) {
1736 qlcnic_sriov_vf_attach(adapter); 1736 qlcnic_sriov_vf_attach(adapter);
1737 adapter->netdev->trans_start = jiffies;
1738 adapter->tx_timeo_cnt = 0; 1737 adapter->tx_timeo_cnt = 0;
1739 adapter->reset_ctx_cnt = 0; 1738 adapter->reset_ctx_cnt = 0;
1740 adapter->fw_fail_cnt = 0; 1739 adapter->fw_fail_cnt = 0;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index 4e22e794a186..e7a2fe21b649 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -544,6 +544,9 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
544 switch (esw_cfg[i].op_mode) { 544 switch (esw_cfg[i].op_mode) {
545 case QLCNIC_PORT_DEFAULTS: 545 case QLCNIC_PORT_DEFAULTS:
546 qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]); 546 qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]);
547 rtnl_lock();
548 qlcnic_set_netdev_features(adapter, &esw_cfg[i]);
549 rtnl_unlock();
547 break; 550 break;
548 case QLCNIC_ADD_VLAN: 551 case QLCNIC_ADD_VLAN:
549 qlcnic_set_vlan_config(adapter, &esw_cfg[i]); 552 qlcnic_set_vlan_config(adapter, &esw_cfg[i]);
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 7d1fb9ad1296..03523459c406 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -1136,6 +1136,7 @@ static void cp_clean_rings (struct cp_private *cp)
1136 cp->dev->stats.tx_dropped++; 1136 cp->dev->stats.tx_dropped++;
1137 } 1137 }
1138 } 1138 }
1139 netdev_reset_queue(cp->dev);
1139 1140
1140 memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); 1141 memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE);
1141 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); 1142 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 79c520b64fdd..393f961a013c 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5856,7 +5856,20 @@ err_out:
5856 return -EIO; 5856 return -EIO;
5857} 5857}
5858 5858
5859static inline void rtl8169_tso_csum(struct rtl8169_private *tp, 5859static bool rtl_skb_pad(struct sk_buff *skb)
5860{
5861 if (skb_padto(skb, ETH_ZLEN))
5862 return false;
5863 skb_put(skb, ETH_ZLEN - skb->len);
5864 return true;
5865}
5866
5867static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb)
5868{
5869 return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34;
5870}
5871
5872static inline bool rtl8169_tso_csum(struct rtl8169_private *tp,
5860 struct sk_buff *skb, u32 *opts) 5873 struct sk_buff *skb, u32 *opts)
5861{ 5874{
5862 const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version; 5875 const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version;
@@ -5869,13 +5882,20 @@ static inline void rtl8169_tso_csum(struct rtl8169_private *tp,
5869 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 5882 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
5870 const struct iphdr *ip = ip_hdr(skb); 5883 const struct iphdr *ip = ip_hdr(skb);
5871 5884
5885 if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
5886 return skb_checksum_help(skb) == 0 && rtl_skb_pad(skb);
5887
5872 if (ip->protocol == IPPROTO_TCP) 5888 if (ip->protocol == IPPROTO_TCP)
5873 opts[offset] |= info->checksum.tcp; 5889 opts[offset] |= info->checksum.tcp;
5874 else if (ip->protocol == IPPROTO_UDP) 5890 else if (ip->protocol == IPPROTO_UDP)
5875 opts[offset] |= info->checksum.udp; 5891 opts[offset] |= info->checksum.udp;
5876 else 5892 else
5877 WARN_ON_ONCE(1); 5893 WARN_ON_ONCE(1);
5894 } else {
5895 if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
5896 return rtl_skb_pad(skb);
5878 } 5897 }
5898 return true;
5879} 5899}
5880 5900
5881static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, 5901static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
@@ -5896,17 +5916,15 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5896 goto err_stop_0; 5916 goto err_stop_0;
5897 } 5917 }
5898 5918
5899 /* 8168evl does not automatically pad to minimum length. */
5900 if (unlikely(tp->mac_version == RTL_GIGA_MAC_VER_34 &&
5901 skb->len < ETH_ZLEN)) {
5902 if (skb_padto(skb, ETH_ZLEN))
5903 goto err_update_stats;
5904 skb_put(skb, ETH_ZLEN - skb->len);
5905 }
5906
5907 if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) 5919 if (unlikely(le32_to_cpu(txd->opts1) & DescOwn))
5908 goto err_stop_0; 5920 goto err_stop_0;
5909 5921
5922 opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb));
5923 opts[0] = DescOwn;
5924
5925 if (!rtl8169_tso_csum(tp, skb, opts))
5926 goto err_update_stats;
5927
5910 len = skb_headlen(skb); 5928 len = skb_headlen(skb);
5911 mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE); 5929 mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE);
5912 if (unlikely(dma_mapping_error(d, mapping))) { 5930 if (unlikely(dma_mapping_error(d, mapping))) {
@@ -5918,11 +5936,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
5918 tp->tx_skb[entry].len = len; 5936 tp->tx_skb[entry].len = len;
5919 txd->addr = cpu_to_le64(mapping); 5937 txd->addr = cpu_to_le64(mapping);
5920 5938
5921 opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb));
5922 opts[0] = DescOwn;
5923
5924 rtl8169_tso_csum(tp, skb, opts);
5925
5926 frags = rtl8169_xmit_frags(tp, skb, opts); 5939 frags = rtl8169_xmit_frags(tp, skb, opts);
5927 if (frags < 0) 5940 if (frags < 0)
5928 goto err_dma_1; 5941 goto err_dma_1;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 01b99206139a..39e4cb39de29 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -638,14 +638,16 @@ static void efx_start_datapath(struct efx_nic *efx)
638 EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + 638 EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
639 efx->type->rx_buffer_padding); 639 efx->type->rx_buffer_padding);
640 rx_buf_len = (sizeof(struct efx_rx_page_state) + 640 rx_buf_len = (sizeof(struct efx_rx_page_state) +
641 EFX_PAGE_IP_ALIGN + efx->rx_dma_len); 641 NET_IP_ALIGN + efx->rx_dma_len);
642 if (rx_buf_len <= PAGE_SIZE) { 642 if (rx_buf_len <= PAGE_SIZE) {
643 efx->rx_scatter = false; 643 efx->rx_scatter = false;
644 efx->rx_buffer_order = 0; 644 efx->rx_buffer_order = 0;
645 } else if (efx->type->can_rx_scatter) { 645 } else if (efx->type->can_rx_scatter) {
646 BUILD_BUG_ON(EFX_RX_USR_BUF_SIZE % L1_CACHE_BYTES);
646 BUILD_BUG_ON(sizeof(struct efx_rx_page_state) + 647 BUILD_BUG_ON(sizeof(struct efx_rx_page_state) +
647 EFX_PAGE_IP_ALIGN + EFX_RX_USR_BUF_SIZE > 648 2 * ALIGN(NET_IP_ALIGN + EFX_RX_USR_BUF_SIZE,
648 PAGE_SIZE / 2); 649 EFX_RX_BUF_ALIGNMENT) >
650 PAGE_SIZE);
649 efx->rx_scatter = true; 651 efx->rx_scatter = true;
650 efx->rx_dma_len = EFX_RX_USR_BUF_SIZE; 652 efx->rx_dma_len = EFX_RX_USR_BUF_SIZE;
651 efx->rx_buffer_order = 0; 653 efx->rx_buffer_order = 0;
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 9bd433a095c5..39d6bd77f015 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -72,8 +72,20 @@
72/* Maximum possible MTU the driver supports */ 72/* Maximum possible MTU the driver supports */
73#define EFX_MAX_MTU (9 * 1024) 73#define EFX_MAX_MTU (9 * 1024)
74 74
75/* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page. */ 75/* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page,
76#define EFX_RX_USR_BUF_SIZE 1824 76 * and should be a multiple of the cache line size.
77 */
78#define EFX_RX_USR_BUF_SIZE (2048 - 256)
79
80/* If possible, we should ensure cache line alignment at start and end
81 * of every buffer. Otherwise, we just need to ensure 4-byte
82 * alignment of the network header.
83 */
84#if NET_IP_ALIGN == 0
85#define EFX_RX_BUF_ALIGNMENT L1_CACHE_BYTES
86#else
87#define EFX_RX_BUF_ALIGNMENT 4
88#endif
77 89
78/* Forward declare Precision Time Protocol (PTP) support structure. */ 90/* Forward declare Precision Time Protocol (PTP) support structure. */
79struct efx_ptp_data; 91struct efx_ptp_data;
@@ -468,24 +480,11 @@ enum nic_state {
468}; 480};
469 481
470/* 482/*
471 * Alignment of page-allocated RX buffers
472 *
473 * Controls the number of bytes inserted at the start of an RX buffer.
474 * This is the equivalent of NET_IP_ALIGN [which controls the alignment
475 * of the skb->head for hardware DMA].
476 */
477#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
478#define EFX_PAGE_IP_ALIGN 0
479#else
480#define EFX_PAGE_IP_ALIGN NET_IP_ALIGN
481#endif
482
483/*
484 * Alignment of the skb->head which wraps a page-allocated RX buffer 483 * Alignment of the skb->head which wraps a page-allocated RX buffer
485 * 484 *
486 * The skb allocated to wrap an rx_buffer can have this alignment. Since 485 * The skb allocated to wrap an rx_buffer can have this alignment. Since
487 * the data is memcpy'd from the rx_buf, it does not need to be equal to 486 * the data is memcpy'd from the rx_buf, it does not need to be equal to
488 * EFX_PAGE_IP_ALIGN. 487 * NET_IP_ALIGN.
489 */ 488 */
490#define EFX_PAGE_SKB_ALIGN 2 489#define EFX_PAGE_SKB_ALIGN 2
491 490
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index e73e30bac10e..a7dfe36cabf4 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -93,8 +93,8 @@ static inline void efx_sync_rx_buffer(struct efx_nic *efx,
93 93
94void efx_rx_config_page_split(struct efx_nic *efx) 94void efx_rx_config_page_split(struct efx_nic *efx)
95{ 95{
96 efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + EFX_PAGE_IP_ALIGN, 96 efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + NET_IP_ALIGN,
97 L1_CACHE_BYTES); 97 EFX_RX_BUF_ALIGNMENT);
98 efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : 98 efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 :
99 ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / 99 ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) /
100 efx->rx_page_buf_step); 100 efx->rx_page_buf_step);
@@ -188,9 +188,9 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue)
188 do { 188 do {
189 index = rx_queue->added_count & rx_queue->ptr_mask; 189 index = rx_queue->added_count & rx_queue->ptr_mask;
190 rx_buf = efx_rx_buffer(rx_queue, index); 190 rx_buf = efx_rx_buffer(rx_queue, index);
191 rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; 191 rx_buf->dma_addr = dma_addr + NET_IP_ALIGN;
192 rx_buf->page = page; 192 rx_buf->page = page;
193 rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; 193 rx_buf->page_offset = page_offset + NET_IP_ALIGN;
194 rx_buf->len = efx->rx_dma_len; 194 rx_buf->len = efx->rx_dma_len;
195 rx_buf->flags = 0; 195 rx_buf->flags = 0;
196 ++rx_queue->added_count; 196 ++rx_queue->added_count;
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index cf887c2384e9..86adfa0a912e 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -582,6 +582,7 @@ static const struct usb_device_id products[] = {
582 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ 582 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
583 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ 583 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
584 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ 584 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
585 {QMI_FIXED_INTF(0x1e2d, 0x12d1, 4)}, /* Cinterion PLxx */
585 586
586 /* 4. Gobi 1000 devices */ 587 /* 4. Gobi 1000 devices */
587 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 588 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index a491d3a95393..6cbdac67f3a0 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -130,19 +130,23 @@ struct rtl8150 {
130 struct usb_device *udev; 130 struct usb_device *udev;
131 struct tasklet_struct tl; 131 struct tasklet_struct tl;
132 struct net_device *netdev; 132 struct net_device *netdev;
133 struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb; 133 struct urb *rx_urb, *tx_urb, *intr_urb;
134 struct sk_buff *tx_skb, *rx_skb; 134 struct sk_buff *tx_skb, *rx_skb;
135 struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE]; 135 struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
136 spinlock_t rx_pool_lock; 136 spinlock_t rx_pool_lock;
137 struct usb_ctrlrequest dr; 137 struct usb_ctrlrequest dr;
138 int intr_interval; 138 int intr_interval;
139 __le16 rx_creg;
140 u8 *intr_buff; 139 u8 *intr_buff;
141 u8 phy; 140 u8 phy;
142}; 141};
143 142
144typedef struct rtl8150 rtl8150_t; 143typedef struct rtl8150 rtl8150_t;
145 144
145struct async_req {
146 struct usb_ctrlrequest dr;
147 u16 rx_creg;
148};
149
146static const char driver_name [] = "rtl8150"; 150static const char driver_name [] = "rtl8150";
147 151
148/* 152/*
@@ -164,51 +168,47 @@ static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
164 indx, 0, data, size, 500); 168 indx, 0, data, size, 500);
165} 169}
166 170
167static void ctrl_callback(struct urb *urb) 171static void async_set_reg_cb(struct urb *urb)
168{ 172{
169 rtl8150_t *dev; 173 struct async_req *req = (struct async_req *)urb->context;
170 int status = urb->status; 174 int status = urb->status;
171 175
172 switch (status) { 176 if (status < 0)
173 case 0: 177 dev_dbg(&urb->dev->dev, "%s failed with %d", __func__, status);
174 break; 178 kfree(req);
175 case -EINPROGRESS: 179 usb_free_urb(urb);
176 break;
177 case -ENOENT:
178 break;
179 default:
180 if (printk_ratelimit())
181 dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status);
182 }
183 dev = urb->context;
184 clear_bit(RX_REG_SET, &dev->flags);
185} 180}
186 181
187static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size) 182static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)
188{ 183{
189 int ret; 184 int res = -ENOMEM;
190 185 struct urb *async_urb;
191 if (test_bit(RX_REG_SET, &dev->flags)) 186 struct async_req *req;
192 return -EAGAIN;
193 187
194 dev->dr.bRequestType = RTL8150_REQT_WRITE; 188 req = kmalloc(sizeof(struct async_req), GFP_ATOMIC);
195 dev->dr.bRequest = RTL8150_REQ_SET_REGS; 189 if (req == NULL)
196 dev->dr.wValue = cpu_to_le16(indx); 190 return res;
197 dev->dr.wIndex = 0; 191 async_urb = usb_alloc_urb(0, GFP_ATOMIC);
198 dev->dr.wLength = cpu_to_le16(size); 192 if (async_urb == NULL) {
199 dev->ctrl_urb->transfer_buffer_length = size; 193 kfree(req);
200 usb_fill_control_urb(dev->ctrl_urb, dev->udev, 194 return res;
201 usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, 195 }
202 &dev->rx_creg, size, ctrl_callback, dev); 196 req->rx_creg = cpu_to_le16(reg);
203 if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) { 197 req->dr.bRequestType = RTL8150_REQT_WRITE;
204 if (ret == -ENODEV) 198 req->dr.bRequest = RTL8150_REQ_SET_REGS;
199 req->dr.wIndex = 0;
200 req->dr.wValue = cpu_to_le16(indx);
201 req->dr.wLength = cpu_to_le16(size);
202 usb_fill_control_urb(async_urb, dev->udev,
203 usb_sndctrlpipe(dev->udev, 0), (void *)&req->dr,
204 &req->rx_creg, size, async_set_reg_cb, req);
205 res = usb_submit_urb(async_urb, GFP_ATOMIC);
206 if (res) {
207 if (res == -ENODEV)
205 netif_device_detach(dev->netdev); 208 netif_device_detach(dev->netdev);
206 dev_err(&dev->udev->dev, 209 dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res);
207 "control request submission failed: %d\n", ret); 210 }
208 } else 211 return res;
209 set_bit(RX_REG_SET, &dev->flags);
210
211 return ret;
212} 212}
213 213
214static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) 214static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
@@ -330,13 +330,6 @@ static int alloc_all_urbs(rtl8150_t * dev)
330 usb_free_urb(dev->tx_urb); 330 usb_free_urb(dev->tx_urb);
331 return 0; 331 return 0;
332 } 332 }
333 dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
334 if (!dev->ctrl_urb) {
335 usb_free_urb(dev->rx_urb);
336 usb_free_urb(dev->tx_urb);
337 usb_free_urb(dev->intr_urb);
338 return 0;
339 }
340 333
341 return 1; 334 return 1;
342} 335}
@@ -346,7 +339,6 @@ static void free_all_urbs(rtl8150_t * dev)
346 usb_free_urb(dev->rx_urb); 339 usb_free_urb(dev->rx_urb);
347 usb_free_urb(dev->tx_urb); 340 usb_free_urb(dev->tx_urb);
348 usb_free_urb(dev->intr_urb); 341 usb_free_urb(dev->intr_urb);
349 usb_free_urb(dev->ctrl_urb);
350} 342}
351 343
352static void unlink_all_urbs(rtl8150_t * dev) 344static void unlink_all_urbs(rtl8150_t * dev)
@@ -354,7 +346,6 @@ static void unlink_all_urbs(rtl8150_t * dev)
354 usb_kill_urb(dev->rx_urb); 346 usb_kill_urb(dev->rx_urb);
355 usb_kill_urb(dev->tx_urb); 347 usb_kill_urb(dev->tx_urb);
356 usb_kill_urb(dev->intr_urb); 348 usb_kill_urb(dev->intr_urb);
357 usb_kill_urb(dev->ctrl_urb);
358} 349}
359 350
360static inline struct sk_buff *pull_skb(rtl8150_t *dev) 351static inline struct sk_buff *pull_skb(rtl8150_t *dev)
@@ -629,7 +620,6 @@ static int enable_net_traffic(rtl8150_t * dev)
629 } 620 }
630 /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ 621 /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */
631 rcr = 0x9e; 622 rcr = 0x9e;
632 dev->rx_creg = cpu_to_le16(rcr);
633 tcr = 0xd8; 623 tcr = 0xd8;
634 cr = 0x0c; 624 cr = 0x0c;
635 if (!(rcr & 0x80)) 625 if (!(rcr & 0x80))
@@ -662,20 +652,22 @@ static void rtl8150_tx_timeout(struct net_device *netdev)
662static void rtl8150_set_multicast(struct net_device *netdev) 652static void rtl8150_set_multicast(struct net_device *netdev)
663{ 653{
664 rtl8150_t *dev = netdev_priv(netdev); 654 rtl8150_t *dev = netdev_priv(netdev);
655 u16 rx_creg = 0x9e;
656
665 netif_stop_queue(netdev); 657 netif_stop_queue(netdev);
666 if (netdev->flags & IFF_PROMISC) { 658 if (netdev->flags & IFF_PROMISC) {
667 dev->rx_creg |= cpu_to_le16(0x0001); 659 rx_creg |= 0x0001;
668 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); 660 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name);
669 } else if (!netdev_mc_empty(netdev) || 661 } else if (!netdev_mc_empty(netdev) ||
670 (netdev->flags & IFF_ALLMULTI)) { 662 (netdev->flags & IFF_ALLMULTI)) {
671 dev->rx_creg &= cpu_to_le16(0xfffe); 663 rx_creg &= 0xfffe;
672 dev->rx_creg |= cpu_to_le16(0x0002); 664 rx_creg |= 0x0002;
673 dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name); 665 dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name);
674 } else { 666 } else {
675 /* ~RX_MULTICAST, ~RX_PROMISCUOUS */ 667 /* ~RX_MULTICAST, ~RX_PROMISCUOUS */
676 dev->rx_creg &= cpu_to_le16(0x00fc); 668 rx_creg &= 0x00fc;
677 } 669 }
678 async_set_registers(dev, RCR, 2); 670 async_set_registers(dev, RCR, sizeof(rx_creg), rx_creg);
679 netif_wake_queue(netdev); 671 netif_wake_queue(netdev);
680} 672}
681 673
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index f95cb032394b..06ee82f557d4 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1477,7 +1477,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1477 1477
1478 /* usbnet already took usb runtime pm, so have to enable the feature 1478 /* usbnet already took usb runtime pm, so have to enable the feature
1479 * for usb interface, otherwise usb_autopm_get_interface may return 1479 * for usb interface, otherwise usb_autopm_get_interface may return
1480 * failure if USB_SUSPEND(RUNTIME_PM) is enabled. 1480 * failure if RUNTIME_PM is enabled.
1481 */ 1481 */
1482 if (!driver->supports_autosuspend) { 1482 if (!driver->supports_autosuspend) {
1483 driver->supports_autosuspend = 1; 1483 driver->supports_autosuspend = 1;
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 655bb25eed2b..c9e00387d999 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev)
636 struct virtnet_info *vi = netdev_priv(dev); 636 struct virtnet_info *vi = netdev_priv(dev);
637 int i; 637 int i;
638 638
639 for (i = 0; i < vi->curr_queue_pairs; i++) { 639 for (i = 0; i < vi->max_queue_pairs; i++) {
640 /* Make sure we have some buffers: if oom use wq. */ 640 if (i < vi->curr_queue_pairs)
641 if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) 641 /* Make sure we have some buffers: if oom use wq. */
642 schedule_delayed_work(&vi->refill, 0); 642 if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
643 schedule_delayed_work(&vi->refill, 0);
643 virtnet_napi_enable(&vi->rq[i]); 644 virtnet_napi_enable(&vi->rq[i]);
644 } 645 }
645 646
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ba81f3c39a83..3b1d2ee7156b 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -301,7 +301,7 @@ static inline struct hlist_head *vxlan_fdb_head(struct vxlan_dev *vxlan,
301} 301}
302 302
303/* Look up Ethernet address in forwarding table */ 303/* Look up Ethernet address in forwarding table */
304static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, 304static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan,
305 const u8 *mac) 305 const u8 *mac)
306 306
307{ 307{
@@ -316,6 +316,18 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
316 return NULL; 316 return NULL;
317} 317}
318 318
319static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
320 const u8 *mac)
321{
322 struct vxlan_fdb *f;
323
324 f = __vxlan_find_mac(vxlan, mac);
325 if (f)
326 f->used = jiffies;
327
328 return f;
329}
330
319/* Add/update destinations for multicast */ 331/* Add/update destinations for multicast */
320static int vxlan_fdb_append(struct vxlan_fdb *f, 332static int vxlan_fdb_append(struct vxlan_fdb *f,
321 __be32 ip, __be16 port, __u32 vni, __u32 ifindex) 333 __be32 ip, __be16 port, __u32 vni, __u32 ifindex)
@@ -353,7 +365,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
353 struct vxlan_fdb *f; 365 struct vxlan_fdb *f;
354 int notify = 0; 366 int notify = 0;
355 367
356 f = vxlan_find_mac(vxlan, mac); 368 f = __vxlan_find_mac(vxlan, mac);
357 if (f) { 369 if (f) {
358 if (flags & NLM_F_EXCL) { 370 if (flags & NLM_F_EXCL) {
359 netdev_dbg(vxlan->dev, 371 netdev_dbg(vxlan->dev,
@@ -563,7 +575,6 @@ static void vxlan_snoop(struct net_device *dev,
563 575
564 f = vxlan_find_mac(vxlan, src_mac); 576 f = vxlan_find_mac(vxlan, src_mac);
565 if (likely(f)) { 577 if (likely(f)) {
566 f->used = jiffies;
567 if (likely(f->remote.remote_ip == src_ip)) 578 if (likely(f->remote.remote_ip == src_ip))
568 return; 579 return;
569 580
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 639ba7d18ea4..6988e1d081f2 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -965,7 +965,7 @@ static void ar9003_hw_do_manual_peak_cal(struct ath_hw *ah,
965{ 965{
966 int i; 966 int i;
967 967
968 if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah)) 968 if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah) && !AR_SREV_9485(ah))
969 return; 969 return;
970 970
971 for (i = 0; i < AR9300_MAX_CHAINS; i++) { 971 for (i = 0; i < AR9300_MAX_CHAINS; i++) {
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
index 712f415b8c08..88ff1d7b53ab 100644
--- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h
@@ -1020,7 +1020,7 @@ static const u32 ar9485_1_1_baseband_postamble[][5] = {
1020 {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, 1020 {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0},
1021 {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1021 {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1022 {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1022 {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1023 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, 1023 {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00058d18, 0x00058d18},
1024 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, 1024 {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982},
1025 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, 1025 {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a},
1026 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 1026 {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 8a1888d02070..366002f266f8 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -254,6 +254,7 @@ struct ath_atx_tid {
254 int sched; 254 int sched;
255 int paused; 255 int paused;
256 u8 state; 256 u8 state;
257 bool stop_cb;
257}; 258};
258 259
259struct ath_node { 260struct ath_node {
@@ -351,7 +352,8 @@ void ath_tx_tasklet(struct ath_softc *sc);
351void ath_tx_edma_tasklet(struct ath_softc *sc); 352void ath_tx_edma_tasklet(struct ath_softc *sc);
352int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 353int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
353 u16 tid, u16 *ssn); 354 u16 tid, u16 *ssn);
354void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 355bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
356 bool flush);
355void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 357void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
356 358
357void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); 359void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index e6307b86363a..b37eb8d38811 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -2008,6 +2008,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
2008 WARN_ON(i != ATH9K_SSTATS_LEN); 2008 WARN_ON(i != ATH9K_SSTATS_LEN);
2009} 2009}
2010 2010
2011void ath9k_deinit_debug(struct ath_softc *sc)
2012{
2013 if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
2014 relay_close(sc->rfs_chan_spec_scan);
2015 sc->rfs_chan_spec_scan = NULL;
2016 }
2017}
2018
2011int ath9k_init_debug(struct ath_hw *ah) 2019int ath9k_init_debug(struct ath_hw *ah)
2012{ 2020{
2013 struct ath_common *common = ath9k_hw_common(ah); 2021 struct ath_common *common = ath9k_hw_common(ah);
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 794a7ec83a24..9d49aab8b989 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -304,6 +304,7 @@ struct ath9k_debug {
304}; 304};
305 305
306int ath9k_init_debug(struct ath_hw *ah); 306int ath9k_init_debug(struct ath_hw *ah);
307void ath9k_deinit_debug(struct ath_softc *sc);
307 308
308void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); 309void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
309void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, 310void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
@@ -339,6 +340,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
339 return 0; 340 return 0;
340} 341}
341 342
343static inline void ath9k_deinit_debug(struct ath_softc *sc)
344{
345}
346
342static inline void ath_debug_stat_interrupt(struct ath_softc *sc, 347static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
343 enum ath9k_int status) 348 enum ath9k_int status)
344{ 349{
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 0237b2868961..aba415103f94 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -906,7 +906,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc,
906 if (!ath_is_world_regd(reg)) { 906 if (!ath_is_world_regd(reg)) {
907 error = regulatory_hint(hw->wiphy, reg->alpha2); 907 error = regulatory_hint(hw->wiphy, reg->alpha2);
908 if (error) 908 if (error)
909 goto unregister; 909 goto debug_cleanup;
910 } 910 }
911 911
912 ath_init_leds(sc); 912 ath_init_leds(sc);
@@ -914,6 +914,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc,
914 914
915 return 0; 915 return 0;
916 916
917debug_cleanup:
918 ath9k_deinit_debug(sc);
917unregister: 919unregister:
918 ieee80211_unregister_hw(hw); 920 ieee80211_unregister_hw(hw);
919rx_cleanup: 921rx_cleanup:
@@ -942,11 +944,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
942 sc->dfs_detector->exit(sc->dfs_detector); 944 sc->dfs_detector->exit(sc->dfs_detector);
943 945
944 ath9k_eeprom_release(sc); 946 ath9k_eeprom_release(sc);
945
946 if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
947 relay_close(sc->rfs_chan_spec_scan);
948 sc->rfs_chan_spec_scan = NULL;
949 }
950} 947}
951 948
952void ath9k_deinit_device(struct ath_softc *sc) 949void ath9k_deinit_device(struct ath_softc *sc)
@@ -960,6 +957,7 @@ void ath9k_deinit_device(struct ath_softc *sc)
960 957
961 ath9k_ps_restore(sc); 958 ath9k_ps_restore(sc);
962 959
960 ath9k_deinit_debug(sc);
963 ieee80211_unregister_hw(hw); 961 ieee80211_unregister_hw(hw);
964 ath_rx_cleanup(sc); 962 ath_rx_cleanup(sc);
965 ath9k_deinit_softc(sc); 963 ath9k_deinit_softc(sc);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a18414b5948b..2382d1262e7f 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1687,6 +1687,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1687 u16 tid, u16 *ssn, u8 buf_size) 1687 u16 tid, u16 *ssn, u8 buf_size)
1688{ 1688{
1689 struct ath_softc *sc = hw->priv; 1689 struct ath_softc *sc = hw->priv;
1690 bool flush = false;
1690 int ret = 0; 1691 int ret = 0;
1691 1692
1692 local_bh_disable(); 1693 local_bh_disable();
@@ -1703,12 +1704,13 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1703 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1704 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1704 ath9k_ps_restore(sc); 1705 ath9k_ps_restore(sc);
1705 break; 1706 break;
1706 case IEEE80211_AMPDU_TX_STOP_CONT:
1707 case IEEE80211_AMPDU_TX_STOP_FLUSH: 1707 case IEEE80211_AMPDU_TX_STOP_FLUSH:
1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: 1708 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
1709 flush = true;
1710 case IEEE80211_AMPDU_TX_STOP_CONT:
1709 ath9k_ps_wakeup(sc); 1711 ath9k_ps_wakeup(sc);
1710 ath_tx_aggr_stop(sc, sta, tid); 1712 if (ath_tx_aggr_stop(sc, sta, tid, flush))
1711 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 1713 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
1712 ath9k_ps_restore(sc); 1714 ath9k_ps_restore(sc);
1713 break; 1715 break;
1714 case IEEE80211_AMPDU_TX_OPERATIONAL: 1716 case IEEE80211_AMPDU_TX_OPERATIONAL:
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index eab0fcb7ded6..14bb3354ea64 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -164,7 +164,20 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
164 ARRAY_SIZE(bf->rates)); 164 ARRAY_SIZE(bf->rates));
165} 165}
166 166
167static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 167static void ath_tx_clear_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
168{
169 tid->state &= ~AGGR_ADDBA_COMPLETE;
170 tid->state &= ~AGGR_CLEANUP;
171 if (!tid->stop_cb)
172 return;
173
174 ieee80211_start_tx_ba_cb_irqsafe(tid->an->vif, tid->an->sta->addr,
175 tid->tidno);
176 tid->stop_cb = false;
177}
178
179static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid,
180 bool flush_packets)
168{ 181{
169 struct ath_txq *txq = tid->ac->txq; 182 struct ath_txq *txq = tid->ac->txq;
170 struct sk_buff *skb; 183 struct sk_buff *skb;
@@ -181,16 +194,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
181 while ((skb = __skb_dequeue(&tid->buf_q))) { 194 while ((skb = __skb_dequeue(&tid->buf_q))) {
182 fi = get_frame_info(skb); 195 fi = get_frame_info(skb);
183 bf = fi->bf; 196 bf = fi->bf;
197 if (!bf && !flush_packets)
198 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
184 199
185 if (!bf) { 200 if (!bf) {
186 bf = ath_tx_setup_buffer(sc, txq, tid, skb); 201 ieee80211_free_txskb(sc->hw, skb);
187 if (!bf) { 202 continue;
188 ieee80211_free_txskb(sc->hw, skb);
189 continue;
190 }
191 } 203 }
192 204
193 if (fi->retries) { 205 if (fi->retries || flush_packets) {
194 list_add_tail(&bf->list, &bf_head); 206 list_add_tail(&bf->list, &bf_head);
195 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); 207 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
196 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 208 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -201,12 +213,10 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
201 } 213 }
202 } 214 }
203 215
204 if (tid->baw_head == tid->baw_tail) { 216 if (tid->baw_head == tid->baw_tail)
205 tid->state &= ~AGGR_ADDBA_COMPLETE; 217 ath_tx_clear_tid(sc, tid);
206 tid->state &= ~AGGR_CLEANUP;
207 }
208 218
209 if (sendbar) { 219 if (sendbar && !flush_packets) {
210 ath_txq_unlock(sc, txq); 220 ath_txq_unlock(sc, txq);
211 ath_send_bar(tid, tid->seq_start); 221 ath_send_bar(tid, tid->seq_start);
212 ath_txq_lock(sc, txq); 222 ath_txq_lock(sc, txq);
@@ -277,9 +287,7 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
277 287
278 list_add_tail(&bf->list, &bf_head); 288 list_add_tail(&bf->list, &bf_head);
279 289
280 if (fi->retries) 290 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
281 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
282
283 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 291 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
284 } 292 }
285 293
@@ -602,7 +610,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
602 } 610 }
603 611
604 if (tid->state & AGGR_CLEANUP) 612 if (tid->state & AGGR_CLEANUP)
605 ath_tx_flush_tid(sc, tid); 613 ath_tx_flush_tid(sc, tid, false);
606 614
607 rcu_read_unlock(); 615 rcu_read_unlock();
608 616
@@ -620,6 +628,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
620 struct ath_tx_status *ts, struct ath_buf *bf, 628 struct ath_tx_status *ts, struct ath_buf *bf,
621 struct list_head *bf_head) 629 struct list_head *bf_head)
622{ 630{
631 struct ieee80211_tx_info *info;
623 bool txok, flush; 632 bool txok, flush;
624 633
625 txok = !(ts->ts_status & ATH9K_TXERR_MASK); 634 txok = !(ts->ts_status & ATH9K_TXERR_MASK);
@@ -631,8 +640,12 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
631 txq->axq_ampdu_depth--; 640 txq->axq_ampdu_depth--;
632 641
633 if (!bf_isampdu(bf)) { 642 if (!bf_isampdu(bf)) {
634 if (!flush) 643 if (!flush) {
644 info = IEEE80211_SKB_CB(bf->bf_mpdu);
645 memcpy(info->control.rates, bf->rates,
646 sizeof(info->control.rates));
635 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); 647 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
648 }
636 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); 649 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
637 } else 650 } else
638 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); 651 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
@@ -676,7 +689,7 @@ static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
676 689
677 skb = bf->bf_mpdu; 690 skb = bf->bf_mpdu;
678 tx_info = IEEE80211_SKB_CB(skb); 691 tx_info = IEEE80211_SKB_CB(skb);
679 rates = tx_info->control.rates; 692 rates = bf->rates;
680 693
681 /* 694 /*
682 * Find the lowest frame length among the rate series that will have a 695 * Find the lowest frame length among the rate series that will have a
@@ -1256,18 +1269,23 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
1256 return 0; 1269 return 0;
1257} 1270}
1258 1271
1259void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) 1272bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
1273 bool flush)
1260{ 1274{
1261 struct ath_node *an = (struct ath_node *)sta->drv_priv; 1275 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1262 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); 1276 struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
1263 struct ath_txq *txq = txtid->ac->txq; 1277 struct ath_txq *txq = txtid->ac->txq;
1278 bool ret = !flush;
1279
1280 if (flush)
1281 txtid->stop_cb = false;
1264 1282
1265 if (txtid->state & AGGR_CLEANUP) 1283 if (txtid->state & AGGR_CLEANUP)
1266 return; 1284 return false;
1267 1285
1268 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { 1286 if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
1269 txtid->state &= ~AGGR_ADDBA_PROGRESS; 1287 txtid->state &= ~AGGR_ADDBA_PROGRESS;
1270 return; 1288 return ret;
1271 } 1289 }
1272 1290
1273 ath_txq_lock(sc, txq); 1291 ath_txq_lock(sc, txq);
@@ -1279,13 +1297,17 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
1279 * TID can only be reused after all in-progress subframes have been 1297 * TID can only be reused after all in-progress subframes have been
1280 * completed. 1298 * completed.
1281 */ 1299 */
1282 if (txtid->baw_head != txtid->baw_tail) 1300 if (txtid->baw_head != txtid->baw_tail) {
1283 txtid->state |= AGGR_CLEANUP; 1301 txtid->state |= AGGR_CLEANUP;
1284 else 1302 ret = false;
1303 txtid->stop_cb = !flush;
1304 } else {
1285 txtid->state &= ~AGGR_ADDBA_COMPLETE; 1305 txtid->state &= ~AGGR_ADDBA_COMPLETE;
1306 }
1286 1307
1287 ath_tx_flush_tid(sc, txtid); 1308 ath_tx_flush_tid(sc, txtid, flush);
1288 ath_txq_unlock_complete(sc, txq); 1309 ath_txq_unlock_complete(sc, txq);
1310 return ret;
1289} 1311}
1290 1312
1291void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, 1313void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
@@ -2415,6 +2437,7 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2415 tid->ac = &an->ac[acno]; 2437 tid->ac = &an->ac[acno];
2416 tid->state &= ~AGGR_ADDBA_COMPLETE; 2438 tid->state &= ~AGGR_ADDBA_COMPLETE;
2417 tid->state &= ~AGGR_ADDBA_PROGRESS; 2439 tid->state &= ~AGGR_ADDBA_PROGRESS;
2440 tid->stop_cb = false;
2418 } 2441 }
2419 2442
2420 for (acno = 0, ac = &an->ac[acno]; 2443 for (acno = 0, ac = &an->ac[acno];
@@ -2451,8 +2474,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2451 } 2474 }
2452 2475
2453 ath_tid_drain(sc, txq, tid); 2476 ath_tid_drain(sc, txq, tid);
2454 tid->state &= ~AGGR_ADDBA_COMPLETE; 2477 ath_tx_clear_tid(sc, tid);
2455 tid->state &= ~AGGR_CLEANUP;
2456 2478
2457 ath_txq_unlock(sc, txq); 2479 ath_txq_unlock(sc, txq);
2458 } 2480 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 6d758f285352..761f501959a9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -4140,6 +4140,10 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = {
4140 .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | 4140 .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
4141 BIT(NL80211_IFTYPE_P2P_GO) 4141 BIT(NL80211_IFTYPE_P2P_GO)
4142 }, 4142 },
4143 {
4144 .max = 1,
4145 .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
4146 }
4143}; 4147};
4144static const struct ieee80211_iface_combination brcmf_iface_combos[] = { 4148static const struct ieee80211_iface_combination brcmf_iface_combos[] = {
4145 { 4149 {
@@ -4197,7 +4201,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)
4197 BIT(NL80211_IFTYPE_ADHOC) | 4201 BIT(NL80211_IFTYPE_ADHOC) |
4198 BIT(NL80211_IFTYPE_AP) | 4202 BIT(NL80211_IFTYPE_AP) |
4199 BIT(NL80211_IFTYPE_P2P_CLIENT) | 4203 BIT(NL80211_IFTYPE_P2P_CLIENT) |
4200 BIT(NL80211_IFTYPE_P2P_GO); 4204 BIT(NL80211_IFTYPE_P2P_GO) |
4205 BIT(NL80211_IFTYPE_P2P_DEVICE);
4201 wiphy->iface_combinations = brcmf_iface_combos; 4206 wiphy->iface_combinations = brcmf_iface_combos;
4202 wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); 4207 wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
4203 wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; 4208 wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 592d0aa634a8..e9a3cbc409ae 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -1423,7 +1423,7 @@ il_setup_rx_scan_handlers(struct il_priv *il)
1423} 1423}
1424EXPORT_SYMBOL(il_setup_rx_scan_handlers); 1424EXPORT_SYMBOL(il_setup_rx_scan_handlers);
1425 1425
1426inline u16 1426u16
1427il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, 1427il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band,
1428 u8 n_probes) 1428 u8 n_probes)
1429{ 1429{
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
index 191dcae8ba47..c6384555aab4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
@@ -173,6 +173,8 @@ enum {
173 REPLY_DEBUG_CMD = 0xf0, 173 REPLY_DEBUG_CMD = 0xf0,
174 DEBUG_LOG_MSG = 0xf7, 174 DEBUG_LOG_MSG = 0xf7,
175 175
176 MCAST_FILTER_CMD = 0xd0,
177
176 /* D3 commands/notifications */ 178 /* D3 commands/notifications */
177 D3_CONFIG_CMD = 0xd3, 179 D3_CONFIG_CMD = 0xd3,
178 PROT_OFFLOAD_CONFIG_CMD = 0xd4, 180 PROT_OFFLOAD_CONFIG_CMD = 0xd4,
@@ -948,4 +950,29 @@ struct iwl_set_calib_default_cmd {
948 u8 data[0]; 950 u8 data[0];
949} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ 951} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
950 952
953#define MAX_PORT_ID_NUM 2
954
955/**
956 * struct iwl_mcast_filter_cmd - configure multicast filter.
957 * @filter_own: Set 1 to filter out multicast packets sent by station itself
958 * @port_id: Multicast MAC addresses array specifier. This is a strange way
959 * to identify network interface adopted in host-device IF.
960 * It is used by FW as index in array of addresses. This array has
961 * MAX_PORT_ID_NUM members.
962 * @count: Number of MAC addresses in the array
963 * @pass_all: Set 1 to pass all multicast packets.
964 * @bssid: current association BSSID.
965 * @addr_list: Place holder for array of MAC addresses.
966 * IMPORTANT: add padding if necessary to ensure DWORD alignment.
967 */
968struct iwl_mcast_filter_cmd {
969 u8 filter_own;
970 u8 port_id;
971 u8 count;
972 u8 pass_all;
973 u8 bssid[6];
974 u8 reserved[2];
975 u8 addr_list[0];
976} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
977
951#endif /* __fw_api_h__ */ 978#endif /* __fw_api_h__ */
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index e6eca4d66f6c..b2cc3d98e0f7 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -586,10 +586,12 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
586 */ 586 */
587static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, 587static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm,
588 struct ieee80211_vif *vif, 588 struct ieee80211_vif *vif,
589 struct iwl_mac_data_sta *ctxt_sta) 589 struct iwl_mac_data_sta *ctxt_sta,
590 bool force_assoc_off)
590{ 591{
591 /* We need the dtim_period to set the MAC as associated */ 592 /* We need the dtim_period to set the MAC as associated */
592 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) { 593 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period &&
594 !force_assoc_off) {
593 u32 dtim_offs; 595 u32 dtim_offs;
594 596
595 /* 597 /*
@@ -659,7 +661,8 @@ static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm,
659 cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); 661 cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON);
660 662
661 /* Fill the data specific for station mode */ 663 /* Fill the data specific for station mode */
662 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta); 664 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta,
665 action == FW_CTXT_ACTION_ADD);
663 666
664 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 667 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
665} 668}
@@ -677,7 +680,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm,
677 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); 680 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
678 681
679 /* Fill the data specific for station mode */ 682 /* Fill the data specific for station mode */
680 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); 683 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta,
684 action == FW_CTXT_ACTION_ADD);
681 685
682 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & 686 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow &
683 IEEE80211_P2P_OPPPS_CTWINDOW_MASK); 687 IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index dd158ec571fb..a5eb8c82f16a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -701,6 +701,20 @@ static void iwl_mvm_configure_filter(struct ieee80211_hw *hw,
701 *total_flags = 0; 701 *total_flags = 0;
702} 702}
703 703
704static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm,
705 struct ieee80211_vif *vif)
706{
707 struct iwl_mcast_filter_cmd mcast_filter_cmd = {
708 .pass_all = 1,
709 };
710
711 memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN);
712
713 return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC,
714 sizeof(mcast_filter_cmd),
715 &mcast_filter_cmd);
716}
717
704static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, 718static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
705 struct ieee80211_vif *vif, 719 struct ieee80211_vif *vif,
706 struct ieee80211_bss_conf *bss_conf, 720 struct ieee80211_bss_conf *bss_conf,
@@ -722,6 +736,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
722 return; 736 return;
723 } 737 }
724 iwl_mvm_bt_coex_vif_assoc(mvm, vif); 738 iwl_mvm_bt_coex_vif_assoc(mvm, vif);
739 iwl_mvm_configure_mcast_filter(mvm, vif);
725 } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { 740 } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
726 /* remove AP station now that the MAC is unassoc */ 741 /* remove AP station now that the MAC is unassoc */
727 ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); 742 ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id);
@@ -931,7 +946,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
931 946
932 switch (cmd) { 947 switch (cmd) {
933 case STA_NOTIFY_SLEEP: 948 case STA_NOTIFY_SLEEP:
934 if (atomic_read(&mvmsta->pending_frames) > 0) 949 if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0)
935 ieee80211_sta_block_awake(hw, sta, true); 950 ieee80211_sta_block_awake(hw, sta, true);
936 /* 951 /*
937 * The fw updates the STA to be asleep. Tx packets on the Tx 952 * The fw updates the STA to be asleep. Tx packets on the Tx
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 8269bc562951..9f46b23801bc 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -292,6 +292,7 @@ struct iwl_mvm {
292 struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; 292 struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT];
293 struct work_struct sta_drained_wk; 293 struct work_struct sta_drained_wk;
294 unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; 294 unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)];
295 atomic_t pending_frames[IWL_MVM_STATION_COUNT];
295 296
296 /* configured by mac80211 */ 297 /* configured by mac80211 */
297 u32 rts_threshold; 298 u32 rts_threshold;
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index fe031d304d1e..b29c31a41594 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -292,6 +292,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = {
292 CMD(BT_COEX_PROT_ENV), 292 CMD(BT_COEX_PROT_ENV),
293 CMD(BT_PROFILE_NOTIFICATION), 293 CMD(BT_PROFILE_NOTIFICATION),
294 CMD(BT_CONFIG), 294 CMD(BT_CONFIG),
295 CMD(MCAST_FILTER_CMD),
295}; 296};
296#undef CMD 297#undef CMD
297 298
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 2157b0f8ced5..2476e43799d5 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -298,6 +298,12 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
298 else 298 else
299 cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); 299 cmd->type = cpu_to_le32(SCAN_TYPE_FORCED);
300 300
301 /*
302 * TODO: This is a WA due to a bug in the FW AUX framework that does not
303 * properly handle time events that fail to be scheduled
304 */
305 cmd->type = cpu_to_le32(SCAN_TYPE_FORCED);
306
301 cmd->repeats = cpu_to_le32(1); 307 cmd->repeats = cpu_to_le32(1);
302 308
303 /* 309 /*
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 0fd96e4da461..5c664ed54400 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -219,7 +219,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
219 mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 219 mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
220 220
221 /* HW restart, don't assume the memory has been zeroed */ 221 /* HW restart, don't assume the memory has been zeroed */
222 atomic_set(&mvm_sta->pending_frames, 0); 222 atomic_set(&mvm->pending_frames[sta_id], 0);
223 mvm_sta->tid_disable_agg = 0; 223 mvm_sta->tid_disable_agg = 0;
224 mvm_sta->tfd_queue_msk = 0; 224 mvm_sta->tfd_queue_msk = 0;
225 for (i = 0; i < IEEE80211_NUM_ACS; i++) 225 for (i = 0; i < IEEE80211_NUM_ACS; i++)
@@ -407,14 +407,21 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
407 } 407 }
408 408
409 /* 409 /*
410 * Make sure that the tx response code sees the station as -EBUSY and
411 * calls the drain worker.
412 */
413 spin_lock_bh(&mvm_sta->lock);
414 /*
410 * There are frames pending on the AC queues for this station. 415 * There are frames pending on the AC queues for this station.
411 * We need to wait until all the frames are drained... 416 * We need to wait until all the frames are drained...
412 */ 417 */
413 if (atomic_read(&mvm_sta->pending_frames)) { 418 if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) {
414 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
415 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], 419 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id],
416 ERR_PTR(-EBUSY)); 420 ERR_PTR(-EBUSY));
421 spin_unlock_bh(&mvm_sta->lock);
422 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
417 } else { 423 } else {
424 spin_unlock_bh(&mvm_sta->lock);
418 ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); 425 ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id);
419 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); 426 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL);
420 } 427 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h
index 12abd2d71835..a4ddce77aaae 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.h
@@ -274,7 +274,6 @@ struct iwl_mvm_tid_data {
274 * @bt_reduced_txpower: is reduced tx power enabled for this station 274 * @bt_reduced_txpower: is reduced tx power enabled for this station
275 * @lock: lock to protect the whole struct. Since %tid_data is access from Tx 275 * @lock: lock to protect the whole struct. Since %tid_data is access from Tx
276 * and from Tx response flow, it needs a spinlock. 276 * and from Tx response flow, it needs a spinlock.
277 * @pending_frames: number of frames for this STA on the shared Tx queues.
278 * @tid_data: per tid data. Look at %iwl_mvm_tid_data. 277 * @tid_data: per tid data. Look at %iwl_mvm_tid_data.
279 * 278 *
280 * When mac80211 creates a station it reserves some space (hw->sta_data_size) 279 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
@@ -290,7 +289,6 @@ struct iwl_mvm_sta {
290 u8 max_agg_bufsize; 289 u8 max_agg_bufsize;
291 bool bt_reduced_txpower; 290 bool bt_reduced_txpower;
292 spinlock_t lock; 291 spinlock_t lock;
293 atomic_t pending_frames;
294 struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; 292 struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT];
295 struct iwl_lq_sta lq_sta; 293 struct iwl_lq_sta lq_sta;
296 struct ieee80211_vif *vif; 294 struct ieee80211_vif *vif;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 479074303bd7..f212f16502ff 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -416,9 +416,8 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
416 416
417 spin_unlock(&mvmsta->lock); 417 spin_unlock(&mvmsta->lock);
418 418
419 if (mvmsta->vif->type == NL80211_IFTYPE_AP && 419 if (txq_id < IWL_MVM_FIRST_AGG_QUEUE)
420 txq_id < IWL_MVM_FIRST_AGG_QUEUE) 420 atomic_inc(&mvm->pending_frames[mvmsta->sta_id]);
421 atomic_inc(&mvmsta->pending_frames);
422 421
423 return 0; 422 return 0;
424 423
@@ -680,16 +679,41 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
680 /* 679 /*
681 * If the txq is not an AMPDU queue, there is no chance we freed 680 * If the txq is not an AMPDU queue, there is no chance we freed
682 * several skbs. Check that out... 681 * several skbs. Check that out...
683 * If there are no pending frames for this STA, notify mac80211 that
684 * this station can go to sleep in its STA table.
685 */ 682 */
686 if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && mvmsta && 683 if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && !WARN_ON(skb_freed > 1) &&
687 !WARN_ON(skb_freed > 1) && 684 atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) {
688 mvmsta->vif->type == NL80211_IFTYPE_AP && 685 if (mvmsta) {
689 atomic_sub_and_test(skb_freed, &mvmsta->pending_frames)) { 686 /*
690 ieee80211_sta_block_awake(mvm->hw, sta, false); 687 * If there are no pending frames for this STA, notify
691 set_bit(sta_id, mvm->sta_drained); 688 * mac80211 that this station can go to sleep in its
692 schedule_work(&mvm->sta_drained_wk); 689 * STA table.
690 */
691 if (mvmsta->vif->type == NL80211_IFTYPE_AP)
692 ieee80211_sta_block_awake(mvm->hw, sta, false);
693 /*
694 * We might very well have taken mvmsta pointer while
695 * the station was being removed. The remove flow might
696 * have seen a pending_frame (because we didn't take
697 * the lock) even if now the queues are drained. So make
698 * really sure now that this the station is not being
699 * removed. If it is, run the drain worker to remove it.
700 */
701 spin_lock_bh(&mvmsta->lock);
702 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
703 if (IS_ERR_OR_NULL(sta)) {
704 /*
705 * Station disappeared in the meantime:
706 * so we are draining.
707 */
708 set_bit(sta_id, mvm->sta_drained);
709 schedule_work(&mvm->sta_drained_wk);
710 }
711 spin_unlock_bh(&mvmsta->lock);
712 } else if (!mvmsta) {
713 /* Tx response without STA, so we are draining */
714 set_bit(sta_id, mvm->sta_drained);
715 schedule_work(&mvm->sta_drained_wk);
716 }
693 } 717 }
694 718
695 rcu_read_unlock(); 719 rcu_read_unlock();
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index b878a32e7a98..cb34c7895f2a 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1723,11 +1723,11 @@ static void mac80211_hwsim_free(void)
1723 class_destroy(hwsim_class); 1723 class_destroy(hwsim_class);
1724} 1724}
1725 1725
1726 1726static struct platform_driver mac80211_hwsim_driver = {
1727static struct device_driver mac80211_hwsim_driver = { 1727 .driver = {
1728 .name = "mac80211_hwsim", 1728 .name = "mac80211_hwsim",
1729 .bus = &platform_bus_type, 1729 .owner = THIS_MODULE,
1730 .owner = THIS_MODULE, 1730 },
1731}; 1731};
1732 1732
1733static const struct net_device_ops hwsim_netdev_ops = { 1733static const struct net_device_ops hwsim_netdev_ops = {
@@ -2219,7 +2219,7 @@ static int __init init_mac80211_hwsim(void)
2219 spin_lock_init(&hwsim_radio_lock); 2219 spin_lock_init(&hwsim_radio_lock);
2220 INIT_LIST_HEAD(&hwsim_radios); 2220 INIT_LIST_HEAD(&hwsim_radios);
2221 2221
2222 err = driver_register(&mac80211_hwsim_driver); 2222 err = platform_driver_register(&mac80211_hwsim_driver);
2223 if (err) 2223 if (err)
2224 return err; 2224 return err;
2225 2225
@@ -2254,7 +2254,7 @@ static int __init init_mac80211_hwsim(void)
2254 err = -ENOMEM; 2254 err = -ENOMEM;
2255 goto failed_drvdata; 2255 goto failed_drvdata;
2256 } 2256 }
2257 data->dev->driver = &mac80211_hwsim_driver; 2257 data->dev->driver = &mac80211_hwsim_driver.driver;
2258 err = device_bind_driver(data->dev); 2258 err = device_bind_driver(data->dev);
2259 if (err != 0) { 2259 if (err != 0) {
2260 printk(KERN_DEBUG 2260 printk(KERN_DEBUG
@@ -2564,7 +2564,7 @@ failed_drvdata:
2564failed: 2564failed:
2565 mac80211_hwsim_free(); 2565 mac80211_hwsim_free();
2566failed_unregister_driver: 2566failed_unregister_driver:
2567 driver_unregister(&mac80211_hwsim_driver); 2567 platform_driver_unregister(&mac80211_hwsim_driver);
2568 return err; 2568 return err;
2569} 2569}
2570module_init(init_mac80211_hwsim); 2570module_init(init_mac80211_hwsim);
@@ -2577,6 +2577,6 @@ static void __exit exit_mac80211_hwsim(void)
2577 2577
2578 mac80211_hwsim_free(); 2578 mac80211_hwsim_free();
2579 unregister_netdev(hwsim_mon); 2579 unregister_netdev(hwsim_mon);
2580 driver_unregister(&mac80211_hwsim_driver); 2580 platform_driver_unregister(&mac80211_hwsim_driver);
2581} 2581}
2582module_exit(exit_mac80211_hwsim); 2582module_exit(exit_mac80211_hwsim);
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
index d3a02e73f53a..21ca33a7c770 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h
@@ -550,7 +550,7 @@ do { \
550 rxmcs == DESC92C_RATE11M) 550 rxmcs == DESC92C_RATE11M)
551 551
552struct phy_rx_agc_info_t { 552struct phy_rx_agc_info_t {
553 #if __LITTLE_ENDIAN 553 #ifdef __LITTLE_ENDIAN
554 u8 gain:7, trsw:1; 554 u8 gain:7, trsw:1;
555 #else 555 #else
556 u8 trsw:1, gain:7; 556 u8 trsw:1, gain:7;
@@ -574,7 +574,7 @@ struct phy_status_rpt {
574 u8 stream_target_csi[2]; 574 u8 stream_target_csi[2];
575 u8 sig_evm; 575 u8 sig_evm;
576 u8 rsvd_3; 576 u8 rsvd_3;
577#if __LITTLE_ENDIAN 577#ifdef __LITTLE_ENDIAN
578 u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ 578 u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/
579 u8 sgi_en:1; 579 u8 sgi_en:1;
580 u8 rxsc:2; 580 u8 rxsc:2;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23d640a4debd..938b1e670b93 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -349,6 +349,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
349 {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ 349 {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/
350 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ 350 {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
351 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ 351 {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
352 {RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/
352 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ 353 {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
353 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ 354 {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
354 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ 355 {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 96fed19c6d90..716aa93fff76 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -950,6 +950,20 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
950 return AE_OK ; 950 return AE_OK ;
951} 951}
952 952
953void acpiphp_check_host_bridge(acpi_handle handle)
954{
955 struct acpiphp_bridge *bridge;
956
957 bridge = acpiphp_handle_to_bridge(handle);
958 if (bridge) {
959 acpiphp_check_bridge(bridge);
960 put_bridge(bridge);
961 }
962
963 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
964 ACPI_UINT32_MAX, check_sub_bridges, NULL, NULL, NULL);
965}
966
953static void _handle_hotplug_event_bridge(struct work_struct *work) 967static void _handle_hotplug_event_bridge(struct work_struct *work)
954{ 968{
955 struct acpiphp_bridge *bridge; 969 struct acpiphp_bridge *bridge;
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 690c3338a8ae..464dd29d06c0 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -343,6 +343,7 @@ static int __init xpram_setup_blkdev(void)
343 put_disk(xpram_disks[i]); 343 put_disk(xpram_disks[i]);
344 goto out; 344 goto out;
345 } 345 }
346 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, xpram_queues[i]);
346 blk_queue_make_request(xpram_queues[i], xpram_make_request); 347 blk_queue_make_request(xpram_queues[i], xpram_make_request);
347 blk_queue_logical_block_size(xpram_queues[i], 4096); 348 blk_queue_logical_block_size(xpram_queues[i], 4096);
348 } 349 }
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index 21fabc6d5a9c..6c440d4349d4 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -352,12 +352,48 @@ static ssize_t chp_shared_show(struct device *dev,
352 352
353static DEVICE_ATTR(shared, 0444, chp_shared_show, NULL); 353static DEVICE_ATTR(shared, 0444, chp_shared_show, NULL);
354 354
355static ssize_t chp_chid_show(struct device *dev, struct device_attribute *attr,
356 char *buf)
357{
358 struct channel_path *chp = to_channelpath(dev);
359 ssize_t rc;
360
361 mutex_lock(&chp->lock);
362 if (chp->desc_fmt1.flags & 0x10)
363 rc = sprintf(buf, "%04x\n", chp->desc_fmt1.chid);
364 else
365 rc = 0;
366 mutex_unlock(&chp->lock);
367
368 return rc;
369}
370static DEVICE_ATTR(chid, 0444, chp_chid_show, NULL);
371
372static ssize_t chp_chid_external_show(struct device *dev,
373 struct device_attribute *attr, char *buf)
374{
375 struct channel_path *chp = to_channelpath(dev);
376 ssize_t rc;
377
378 mutex_lock(&chp->lock);
379 if (chp->desc_fmt1.flags & 0x10)
380 rc = sprintf(buf, "%x\n", chp->desc_fmt1.flags & 0x8 ? 1 : 0);
381 else
382 rc = 0;
383 mutex_unlock(&chp->lock);
384
385 return rc;
386}
387static DEVICE_ATTR(chid_external, 0444, chp_chid_external_show, NULL);
388
355static struct attribute *chp_attrs[] = { 389static struct attribute *chp_attrs[] = {
356 &dev_attr_status.attr, 390 &dev_attr_status.attr,
357 &dev_attr_configure.attr, 391 &dev_attr_configure.attr,
358 &dev_attr_type.attr, 392 &dev_attr_type.attr,
359 &dev_attr_cmg.attr, 393 &dev_attr_cmg.attr,
360 &dev_attr_shared.attr, 394 &dev_attr_shared.attr,
395 &dev_attr_chid.attr,
396 &dev_attr_chid_external.attr,
361 NULL, 397 NULL,
362}; 398};
363static struct attribute_group chp_attr_group = { 399static struct attribute_group chp_attr_group = {
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
index 349d5fc47196..e7ef2a683b8f 100644
--- a/drivers/s390/cio/chsc.h
+++ b/drivers/s390/cio/chsc.h
@@ -43,7 +43,9 @@ struct channel_path_desc_fmt1 {
43 u8 chpid; 43 u8 chpid;
44 u32:24; 44 u32:24;
45 u8 chpp; 45 u8 chpp;
46 u32 unused[3]; 46 u32 unused[2];
47 u16 chid;
48 u32:16;
47 u16 mdc; 49 u16 mdc;
48 u16:13; 50 u16:13;
49 u8 r:1; 51 u8 r:1;
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 4e8a1794f50a..aefe820a8005 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -72,10 +72,10 @@ source "drivers/staging/sep/Kconfig"
72 72
73source "drivers/staging/iio/Kconfig" 73source "drivers/staging/iio/Kconfig"
74 74
75source "drivers/staging/zram/Kconfig"
76
77source "drivers/staging/zsmalloc/Kconfig" 75source "drivers/staging/zsmalloc/Kconfig"
78 76
77source "drivers/staging/zram/Kconfig"
78
79source "drivers/staging/wlags49_h2/Kconfig" 79source "drivers/staging/wlags49_h2/Kconfig"
80 80
81source "drivers/staging/wlags49_h25/Kconfig" 81source "drivers/staging/wlags49_h25/Kconfig"
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index b040200a5a55..9bd874789ce5 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -242,7 +242,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log,
242 * 'log->buffer' which contains the first entry readable by 'euid' 242 * 'log->buffer' which contains the first entry readable by 'euid'
243 */ 243 */
244static size_t get_next_entry_by_uid(struct logger_log *log, 244static size_t get_next_entry_by_uid(struct logger_log *log,
245 size_t off, uid_t euid) 245 size_t off, kuid_t euid)
246{ 246{
247 while (off != log->w_off) { 247 while (off != log->w_off) {
248 struct logger_entry *entry; 248 struct logger_entry *entry;
@@ -251,7 +251,7 @@ static size_t get_next_entry_by_uid(struct logger_log *log,
251 251
252 entry = get_entry_header(log, off, &scratch); 252 entry = get_entry_header(log, off, &scratch);
253 253
254 if (entry->euid == euid) 254 if (uid_eq(entry->euid, euid))
255 return off; 255 return off;
256 256
257 next_len = sizeof(struct logger_entry) + entry->len; 257 next_len = sizeof(struct logger_entry) + entry->len;
diff --git a/drivers/staging/android/logger.h b/drivers/staging/android/logger.h
index cc6bbd99c8e0..70af7d805dff 100644
--- a/drivers/staging/android/logger.h
+++ b/drivers/staging/android/logger.h
@@ -66,7 +66,7 @@ struct logger_entry {
66 __s32 tid; 66 __s32 tid;
67 __s32 sec; 67 __s32 sec;
68 __s32 nsec; 68 __s32 nsec;
69 uid_t euid; 69 kuid_t euid;
70 char msg[0]; 70 char msg[0];
71}; 71};
72 72
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 7871579bb83d..87e852a0ef49 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -981,6 +981,7 @@ config COMEDI_ME_DAQ
981 981
982config COMEDI_NI_6527 982config COMEDI_NI_6527
983 tristate "NI 6527 support" 983 tristate "NI 6527 support"
984 depends on HAS_DMA
984 select COMEDI_MITE 985 select COMEDI_MITE
985 ---help--- 986 ---help---
986 Enable support for the National Instruments 6527 PCI card 987 Enable support for the National Instruments 6527 PCI card
@@ -990,6 +991,7 @@ config COMEDI_NI_6527
990 991
991config COMEDI_NI_65XX 992config COMEDI_NI_65XX
992 tristate "NI 65xx static dio PCI card support" 993 tristate "NI 65xx static dio PCI card support"
994 depends on HAS_DMA
993 select COMEDI_MITE 995 select COMEDI_MITE
994 ---help--- 996 ---help---
995 Enable support for National Instruments 65xx static dio boards. 997 Enable support for National Instruments 65xx static dio boards.
@@ -1003,6 +1005,7 @@ config COMEDI_NI_65XX
1003 1005
1004config COMEDI_NI_660X 1006config COMEDI_NI_660X
1005 tristate "NI 660x counter/timer PCI card support" 1007 tristate "NI 660x counter/timer PCI card support"
1008 depends on HAS_DMA
1006 select COMEDI_NI_TIOCMD 1009 select COMEDI_NI_TIOCMD
1007 ---help--- 1010 ---help---
1008 Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602, 1011 Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602,
@@ -1013,6 +1016,7 @@ config COMEDI_NI_660X
1013 1016
1014config COMEDI_NI_670X 1017config COMEDI_NI_670X
1015 tristate "NI 670x PCI card support" 1018 tristate "NI 670x PCI card support"
1019 depends on HAS_DMA
1016 select COMEDI_MITE 1020 select COMEDI_MITE
1017 ---help--- 1021 ---help---
1018 Enable support for National Instruments PCI-6703 and PCI-6704 1022 Enable support for National Instruments PCI-6703 and PCI-6704
@@ -1022,6 +1026,7 @@ config COMEDI_NI_670X
1022 1026
1023config COMEDI_NI_LABPC_PCI 1027config COMEDI_NI_LABPC_PCI
1024 tristate "NI Lab-PC PCI-1200 support" 1028 tristate "NI Lab-PC PCI-1200 support"
1029 depends on HAS_DMA
1025 select COMEDI_NI_LABPC 1030 select COMEDI_NI_LABPC
1026 select COMEDI_MITE 1031 select COMEDI_MITE
1027 ---help--- 1032 ---help---
@@ -1032,6 +1037,7 @@ config COMEDI_NI_LABPC_PCI
1032 1037
1033config COMEDI_NI_PCIDIO 1038config COMEDI_NI_PCIDIO
1034 tristate "NI PCI-DIO32HS, PCI-6533, PCI-6534 support" 1039 tristate "NI PCI-DIO32HS, PCI-6533, PCI-6534 support"
1040 depends on HAS_DMA
1035 select COMEDI_MITE 1041 select COMEDI_MITE
1036 select COMEDI_8255 1042 select COMEDI_8255
1037 ---help--- 1043 ---help---
@@ -1043,6 +1049,7 @@ config COMEDI_NI_PCIDIO
1043 1049
1044config COMEDI_NI_PCIMIO 1050config COMEDI_NI_PCIMIO
1045 tristate "NI PCI-MIO-E series and M series support" 1051 tristate "NI PCI-MIO-E series and M series support"
1052 depends on HAS_DMA
1046 select COMEDI_NI_TIOCMD 1053 select COMEDI_NI_TIOCMD
1047 select COMEDI_8255 1054 select COMEDI_8255
1048 select COMEDI_FC 1055 select COMEDI_FC
@@ -1095,10 +1102,12 @@ config COMEDI_SSV_DNP
1095 called ssv_dnp. 1102 called ssv_dnp.
1096 1103
1097config COMEDI_MITE 1104config COMEDI_MITE
1105 depends on HAS_DMA
1098 tristate 1106 tristate
1099 1107
1100config COMEDI_NI_TIOCMD 1108config COMEDI_NI_TIOCMD
1101 tristate 1109 tristate
1110 depends on HAS_DMA
1102 select COMEDI_NI_TIO 1111 select COMEDI_NI_TIO
1103 select COMEDI_MITE 1112 select COMEDI_MITE
1104 1113
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
index ca709901fb3e..d4be0e68509b 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -51,10 +51,12 @@ static void __comedi_buf_free(struct comedi_device *dev,
51 clear_bit(PG_reserved, 51 clear_bit(PG_reserved,
52 &(virt_to_page(buf->virt_addr)->flags)); 52 &(virt_to_page(buf->virt_addr)->flags));
53 if (s->async_dma_dir != DMA_NONE) { 53 if (s->async_dma_dir != DMA_NONE) {
54#ifdef CONFIG_HAS_DMA
54 dma_free_coherent(dev->hw_dev, 55 dma_free_coherent(dev->hw_dev,
55 PAGE_SIZE, 56 PAGE_SIZE,
56 buf->virt_addr, 57 buf->virt_addr,
57 buf->dma_addr); 58 buf->dma_addr);
59#endif
58 } else { 60 } else {
59 free_page((unsigned long)buf->virt_addr); 61 free_page((unsigned long)buf->virt_addr);
60 } 62 }
@@ -74,6 +76,12 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
74 struct comedi_buf_page *buf; 76 struct comedi_buf_page *buf;
75 unsigned i; 77 unsigned i;
76 78
79 if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) {
80 dev_err(dev->class_dev,
81 "dma buffer allocation not supported\n");
82 return;
83 }
84
77 async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); 85 async->buf_page_list = vzalloc(sizeof(*buf) * n_pages);
78 if (async->buf_page_list) 86 if (async->buf_page_list)
79 pages = vmalloc(sizeof(struct page *) * n_pages); 87 pages = vmalloc(sizeof(struct page *) * n_pages);
@@ -84,11 +92,15 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
84 for (i = 0; i < n_pages; i++) { 92 for (i = 0; i < n_pages; i++) {
85 buf = &async->buf_page_list[i]; 93 buf = &async->buf_page_list[i];
86 if (s->async_dma_dir != DMA_NONE) 94 if (s->async_dma_dir != DMA_NONE)
95#ifdef CONFIG_HAS_DMA
87 buf->virt_addr = dma_alloc_coherent(dev->hw_dev, 96 buf->virt_addr = dma_alloc_coherent(dev->hw_dev,
88 PAGE_SIZE, 97 PAGE_SIZE,
89 &buf->dma_addr, 98 &buf->dma_addr,
90 GFP_KERNEL | 99 GFP_KERNEL |
91 __GFP_COMP); 100 __GFP_COMP);
101#else
102 break;
103#endif
92 else 104 else
93 buf->virt_addr = (void *)get_zeroed_page(GFP_KERNEL); 105 buf->virt_addr = (void *)get_zeroed_page(GFP_KERNEL);
94 if (!buf->virt_addr) 106 if (!buf->virt_addr)
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 00f2547024ec..924c54c9c31f 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -246,9 +246,6 @@ static int resize_async_buffer(struct comedi_device *dev,
246 return -EBUSY; 246 return -EBUSY;
247 } 247 }
248 248
249 if (!async->prealloc_buf)
250 return -EINVAL;
251
252 /* make sure buffer is an integral number of pages 249 /* make sure buffer is an integral number of pages
253 * (we round up) */ 250 * (we round up) */
254 new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK; 251 new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK;
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 3d978f34d212..77a7bb632580 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -976,8 +976,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
976 /* clear flip-flop to make sure 2-byte registers for 976 /* clear flip-flop to make sure 2-byte registers for
977 * count and address get set correctly */ 977 * count and address get set correctly */
978 clear_dma_ff(devpriv->dma_chan); 978 clear_dma_ff(devpriv->dma_chan);
979 set_dma_addr(devpriv->dma_chan, 979 set_dma_addr(devpriv->dma_chan, devpriv->dma_addr);
980 virt_to_bus(devpriv->dma_buffer));
981 /* set appropriate size of transfer */ 980 /* set appropriate size of transfer */
982 devpriv->dma_transfer_size = labpc_suggest_transfer_size(cmd); 981 devpriv->dma_transfer_size = labpc_suggest_transfer_size(cmd);
983 if (cmd->stop_src == TRIG_COUNT && 982 if (cmd->stop_src == TRIG_COUNT &&
@@ -1089,7 +1088,7 @@ static void labpc_drain_dma(struct comedi_device *dev)
1089 devpriv->count -= num_points; 1088 devpriv->count -= num_points;
1090 1089
1091 /* set address and count for next transfer */ 1090 /* set address and count for next transfer */
1092 set_dma_addr(devpriv->dma_chan, virt_to_bus(devpriv->dma_buffer)); 1091 set_dma_addr(devpriv->dma_chan, devpriv->dma_addr);
1093 set_dma_count(devpriv->dma_chan, leftover * sample_size); 1092 set_dma_count(devpriv->dma_chan, leftover * sample_size);
1094 release_dma_lock(flags); 1093 release_dma_lock(flags);
1095 1094
@@ -1741,6 +1740,9 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1741 unsigned long dma_flags; 1740 unsigned long dma_flags;
1742 1741
1743 devpriv->dma_chan = dma_chan; 1742 devpriv->dma_chan = dma_chan;
1743 devpriv->dma_addr =
1744 virt_to_bus(devpriv->dma_buffer);
1745
1744 dma_flags = claim_dma_lock(); 1746 dma_flags = claim_dma_lock();
1745 disable_dma(devpriv->dma_chan); 1747 disable_dma(devpriv->dma_chan);
1746 set_dma_mode(devpriv->dma_chan, DMA_MODE_READ); 1748 set_dma_mode(devpriv->dma_chan, DMA_MODE_READ);
diff --git a/drivers/staging/comedi/drivers/ni_labpc.h b/drivers/staging/comedi/drivers/ni_labpc.h
index 615f16f271c0..4b691f5a9965 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.h
+++ b/drivers/staging/comedi/drivers/ni_labpc.h
@@ -82,6 +82,7 @@ struct labpc_private {
82 unsigned int divisor_b1; 82 unsigned int divisor_b1;
83 unsigned int dma_chan; /* dma channel to use */ 83 unsigned int dma_chan; /* dma channel to use */
84 u16 *dma_buffer; /* buffer ai will dma into */ 84 u16 *dma_buffer; /* buffer ai will dma into */
85 phys_addr_t dma_addr;
85 /* transfer size in bytes for current transfer */ 86 /* transfer size in bytes for current transfer */
86 unsigned int dma_transfer_size; 87 unsigned int dma_transfer_size;
87 /* we are using dma/fifo-half-full/etc. */ 88 /* we are using dma/fifo-half-full/etc. */
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index a46d579016d9..8c5dee9b3b05 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -310,9 +310,11 @@ static int ni_gpct_insn_read(struct comedi_device *dev,
310static int ni_gpct_insn_config(struct comedi_device *dev, 310static int ni_gpct_insn_config(struct comedi_device *dev,
311 struct comedi_subdevice *s, 311 struct comedi_subdevice *s,
312 struct comedi_insn *insn, unsigned int *data); 312 struct comedi_insn *insn, unsigned int *data);
313#ifdef PCIDMA
313static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s); 314static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
314static int ni_gpct_cmdtest(struct comedi_device *dev, 315static int ni_gpct_cmdtest(struct comedi_device *dev,
315 struct comedi_subdevice *s, struct comedi_cmd *cmd); 316 struct comedi_subdevice *s, struct comedi_cmd *cmd);
317#endif
316static int ni_gpct_cancel(struct comedi_device *dev, 318static int ni_gpct_cancel(struct comedi_device *dev,
317 struct comedi_subdevice *s); 319 struct comedi_subdevice *s);
318static void handle_gpct_interrupt(struct comedi_device *dev, 320static void handle_gpct_interrupt(struct comedi_device *dev,
@@ -4617,9 +4619,7 @@ static int ni_E_init(struct comedi_device *dev)
4617 for (j = 0; j < NUM_GPCT; ++j) { 4619 for (j = 0; j < NUM_GPCT; ++j) {
4618 s = &dev->subdevices[NI_GPCT_SUBDEV(j)]; 4620 s = &dev->subdevices[NI_GPCT_SUBDEV(j)];
4619 s->type = COMEDI_SUBD_COUNTER; 4621 s->type = COMEDI_SUBD_COUNTER;
4620 s->subdev_flags = 4622 s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL;
4621 SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_CMD_READ
4622 /* | SDF_CMD_WRITE */ ;
4623 s->n_chan = 3; 4623 s->n_chan = 3;
4624 if (board->reg_type & ni_reg_m_series_mask) 4624 if (board->reg_type & ni_reg_m_series_mask)
4625 s->maxdata = 0xffffffff; 4625 s->maxdata = 0xffffffff;
@@ -4628,11 +4628,14 @@ static int ni_E_init(struct comedi_device *dev)
4628 s->insn_read = &ni_gpct_insn_read; 4628 s->insn_read = &ni_gpct_insn_read;
4629 s->insn_write = &ni_gpct_insn_write; 4629 s->insn_write = &ni_gpct_insn_write;
4630 s->insn_config = &ni_gpct_insn_config; 4630 s->insn_config = &ni_gpct_insn_config;
4631#ifdef PCIDMA
4632 s->subdev_flags |= SDF_CMD_READ /* | SDF_CMD_WRITE */;
4631 s->do_cmd = &ni_gpct_cmd; 4633 s->do_cmd = &ni_gpct_cmd;
4632 s->len_chanlist = 1; 4634 s->len_chanlist = 1;
4633 s->do_cmdtest = &ni_gpct_cmdtest; 4635 s->do_cmdtest = &ni_gpct_cmdtest;
4634 s->cancel = &ni_gpct_cancel; 4636 s->cancel = &ni_gpct_cancel;
4635 s->async_dma_dir = DMA_BIDIRECTIONAL; 4637 s->async_dma_dir = DMA_BIDIRECTIONAL;
4638#endif
4636 s->private = &devpriv->counter_dev->counters[j]; 4639 s->private = &devpriv->counter_dev->counters[j];
4637 4640
4638 devpriv->counter_dev->counters[j].chip_index = 0; 4641 devpriv->counter_dev->counters[j].chip_index = 0;
@@ -5216,10 +5219,10 @@ static int ni_gpct_insn_write(struct comedi_device *dev,
5216 return ni_tio_winsn(counter, insn, data); 5219 return ni_tio_winsn(counter, insn, data);
5217} 5220}
5218 5221
5222#ifdef PCIDMA
5219static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s) 5223static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
5220{ 5224{
5221 int retval; 5225 int retval;
5222#ifdef PCIDMA
5223 struct ni_gpct *counter = s->private; 5226 struct ni_gpct *counter = s->private;
5224/* const struct comedi_cmd *cmd = &s->async->cmd; */ 5227/* const struct comedi_cmd *cmd = &s->async->cmd; */
5225 5228
@@ -5233,23 +5236,20 @@ static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
5233 ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL); 5236 ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL);
5234 ni_e_series_enable_second_irq(dev, counter->counter_index, 1); 5237 ni_e_series_enable_second_irq(dev, counter->counter_index, 1);
5235 retval = ni_tio_cmd(counter, s->async); 5238 retval = ni_tio_cmd(counter, s->async);
5236#else
5237 retval = -ENOTSUPP;
5238#endif
5239 return retval; 5239 return retval;
5240} 5240}
5241#endif
5241 5242
5243#ifdef PCIDMA
5242static int ni_gpct_cmdtest(struct comedi_device *dev, 5244static int ni_gpct_cmdtest(struct comedi_device *dev,
5243 struct comedi_subdevice *s, struct comedi_cmd *cmd) 5245 struct comedi_subdevice *s, struct comedi_cmd *cmd)
5244{ 5246{
5245#ifdef PCIDMA
5246 struct ni_gpct *counter = s->private; 5247 struct ni_gpct *counter = s->private;
5247 5248
5248 return ni_tio_cmdtest(counter, cmd); 5249 return ni_tio_cmdtest(counter, cmd);
5249#else
5250 return -ENOTSUPP; 5250 return -ENOTSUPP;
5251#endif
5252} 5251}
5252#endif
5253 5253
5254static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s) 5254static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
5255{ 5255{
diff --git a/drivers/staging/dwc2/Kconfig b/drivers/staging/dwc2/Kconfig
index f0b4739c65a1..d15d9d58e5ac 100644
--- a/drivers/staging/dwc2/Kconfig
+++ b/drivers/staging/dwc2/Kconfig
@@ -2,7 +2,6 @@ config USB_DWC2
2 tristate "DesignWare USB2 DRD Core Support" 2 tristate "DesignWare USB2 DRD Core Support"
3 depends on USB 3 depends on USB
4 depends on VIRT_TO_BUS 4 depends on VIRT_TO_BUS
5 select USB_OTG_UTILS
6 help 5 help
7 Say Y or M here if your system has a Dual Role HighSpeed 6 Say Y or M here if your system has a Dual Role HighSpeed
8 USB controller based on the DesignWare HSOTG IP Core. 7 USB controller based on the DesignWare HSOTG IP Core.
@@ -39,6 +38,7 @@ config USB_DWC2_TRACK_MISSED_SOFS
39 bool "Enable Missed SOF Tracking" 38 bool "Enable Missed SOF Tracking"
40 help 39 help
41 Say Y here to enable logging of missed SOF events to the dmesg log. 40 Say Y here to enable logging of missed SOF events to the dmesg log.
41 WARNING: This feature is still experimental.
42 If in doubt, say N. 42 If in doubt, say N.
43 43
44config USB_DWC2_DEBUG_PERIODIC 44config USB_DWC2_DEBUG_PERIODIC
diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/staging/dwc2/hcd_intr.c
index 6e5dbed6ccec..e24062f0a49e 100644
--- a/drivers/staging/dwc2/hcd_intr.c
+++ b/drivers/staging/dwc2/hcd_intr.c
@@ -56,8 +56,6 @@
56static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg) 56static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg)
57{ 57{
58#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS 58#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
59#warning Compiling code to track missed SOFs
60
61 u16 curr_frame_number = hsotg->frame_number; 59 u16 curr_frame_number = hsotg->frame_number;
62 60
63 if (hsotg->frame_num_idx < FRAME_NUM_ARRAY_SIZE) { 61 if (hsotg->frame_num_idx < FRAME_NUM_ARRAY_SIZE) {
diff --git a/drivers/staging/dwc2/platform.c b/drivers/staging/dwc2/platform.c
index b610960e93d3..44cce2fa6361 100644
--- a/drivers/staging/dwc2/platform.c
+++ b/drivers/staging/dwc2/platform.c
@@ -95,6 +95,14 @@ static int dwc2_driver_probe(struct platform_device *dev)
95 95
96 hsotg->dev = &dev->dev; 96 hsotg->dev = &dev->dev;
97 97
98 /*
99 * Use reasonable defaults so platforms don't have to provide these.
100 */
101 if (!dev->dev.dma_mask)
102 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
103 if (!dev->dev.coherent_dma_mask)
104 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
105
98 irq = platform_get_irq(dev, 0); 106 irq = platform_get_irq(dev, 0);
99 if (irq < 0) { 107 if (irq < 0) {
100 dev_err(&dev->dev, "missing IRQ resource\n"); 108 dev_err(&dev->dev, "missing IRQ resource\n");
diff --git a/drivers/staging/gdm72xx/Kconfig b/drivers/staging/gdm72xx/Kconfig
index 3c18efe31365..69059138de4a 100644
--- a/drivers/staging/gdm72xx/Kconfig
+++ b/drivers/staging/gdm72xx/Kconfig
@@ -39,7 +39,7 @@ if WIMAX_GDM72XX_USB
39 39
40config WIMAX_GDM72XX_USB_PM 40config WIMAX_GDM72XX_USB_PM
41 bool "Enable power managerment support" 41 bool "Enable power managerment support"
42 depends on USB_SUSPEND 42 depends on PM_RUNTIME
43 43
44endif # WIMAX_GDM72XX_USB 44endif # WIMAX_GDM72XX_USB
45 45
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 2856b8fd44ad..163c638e4095 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -690,7 +690,6 @@ static void mxs_lradc_trigger_remove(struct iio_dev *iio)
690static int mxs_lradc_buffer_preenable(struct iio_dev *iio) 690static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
691{ 691{
692 struct mxs_lradc *lradc = iio_priv(iio); 692 struct mxs_lradc *lradc = iio_priv(iio);
693 struct iio_buffer *buffer = iio->buffer;
694 int ret = 0, chan, ofs = 0; 693 int ret = 0, chan, ofs = 0;
695 unsigned long enable = 0; 694 unsigned long enable = 0;
696 uint32_t ctrl4_set = 0; 695 uint32_t ctrl4_set = 0;
@@ -698,7 +697,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
698 uint32_t ctrl1_irq = 0; 697 uint32_t ctrl1_irq = 0;
699 const uint32_t chan_value = LRADC_CH_ACCUMULATE | 698 const uint32_t chan_value = LRADC_CH_ACCUMULATE |
700 ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET); 699 ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET);
701 const int len = bitmap_weight(buffer->scan_mask, LRADC_MAX_TOTAL_CHANS); 700 const int len = bitmap_weight(iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS);
702 701
703 if (!len) 702 if (!len)
704 return -EINVAL; 703 return -EINVAL;
@@ -725,7 +724,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
725 lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR); 724 lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
726 writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR); 725 writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
727 726
728 for_each_set_bit(chan, buffer->scan_mask, LRADC_MAX_TOTAL_CHANS) { 727 for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
729 ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); 728 ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs);
730 ctrl4_clr |= LRADC_CTRL4_LRADCSELECT_MASK(ofs); 729 ctrl4_clr |= LRADC_CTRL4_LRADCSELECT_MASK(ofs);
731 ctrl1_irq |= LRADC_CTRL1_LRADC_IRQ_EN(ofs); 730 ctrl1_irq |= LRADC_CTRL1_LRADC_IRQ_EN(ofs);
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index d060f2572512..c99f890cc6c6 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1869,6 +1869,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
1869 dev_info(&chip->client->dev, 1869 dev_info(&chip->client->dev,
1870 "%s: i2c device found does not match expected id\n", 1870 "%s: i2c device found does not match expected id\n",
1871 __func__); 1871 __func__);
1872 ret = -EINVAL;
1872 goto fail1; 1873 goto fail1;
1873 } 1874 }
1874 1875
@@ -1907,7 +1908,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
1907 if (ret) { 1908 if (ret) {
1908 dev_err(&clientp->dev, 1909 dev_err(&clientp->dev,
1909 "%s: irq request failed", __func__); 1910 "%s: irq request failed", __func__);
1910 goto fail2; 1911 goto fail1;
1911 } 1912 }
1912 } 1913 }
1913 1914
@@ -1920,17 +1921,17 @@ static int tsl2x7x_probe(struct i2c_client *clientp,
1920 if (ret) { 1921 if (ret) {
1921 dev_err(&clientp->dev, 1922 dev_err(&clientp->dev,
1922 "%s: iio registration failed\n", __func__); 1923 "%s: iio registration failed\n", __func__);
1923 goto fail1; 1924 goto fail2;
1924 } 1925 }
1925 1926
1926 dev_info(&clientp->dev, "%s Light sensor found.\n", id->name); 1927 dev_info(&clientp->dev, "%s Light sensor found.\n", id->name);
1927 1928
1928 return 0; 1929 return 0;
1929 1930
1930fail1: 1931fail2:
1931 if (clientp->irq) 1932 if (clientp->irq)
1932 free_irq(clientp->irq, indio_dev); 1933 free_irq(clientp->irq, indio_dev);
1933fail2: 1934fail1:
1934 iio_device_free(indio_dev); 1935 iio_device_free(indio_dev);
1935 1936
1936 return ret; 1937 return ret;
diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/staging/imx-drm/Kconfig
index 8c9e40390f42..ef699f753186 100644
--- a/drivers/staging/imx-drm/Kconfig
+++ b/drivers/staging/imx-drm/Kconfig
@@ -1,6 +1,7 @@
1config DRM_IMX 1config DRM_IMX
2 tristate "DRM Support for Freescale i.MX" 2 tristate "DRM Support for Freescale i.MX"
3 select DRM_KMS_HELPER 3 select DRM_KMS_HELPER
4 select VIDEOMODE_HELPERS
4 select DRM_GEM_CMA_HELPER 5 select DRM_GEM_CMA_HELPER
5 select DRM_KMS_CMA_HELPER 6 select DRM_KMS_CMA_HELPER
6 depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM) 7 depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM)
@@ -19,10 +20,12 @@ config DRM_IMX_FB_HELPER
19config DRM_IMX_PARALLEL_DISPLAY 20config DRM_IMX_PARALLEL_DISPLAY
20 tristate "Support for parallel displays" 21 tristate "Support for parallel displays"
21 depends on DRM_IMX 22 depends on DRM_IMX
23 select VIDEOMODE_HELPERS
22 24
23config DRM_IMX_TVE 25config DRM_IMX_TVE
24 tristate "Support for TV and VGA displays" 26 tristate "Support for TV and VGA displays"
25 depends on DRM_IMX 27 depends on DRM_IMX
28 select REGMAP_MMIO
26 help 29 help
27 Choose this to enable the internal Television Encoder (TVe) 30 Choose this to enable the internal Television Encoder (TVe)
28 found on i.MX53 processors. 31 found on i.MX53 processors.
@@ -30,6 +33,7 @@ config DRM_IMX_TVE
30config DRM_IMX_IPUV3_CORE 33config DRM_IMX_IPUV3_CORE
31 tristate "IPUv3 core support" 34 tristate "IPUv3 core support"
32 depends on DRM_IMX 35 depends on DRM_IMX
36 depends on RESET_CONTROLLER
33 help 37 help
34 Choose this if you have a i.MX5/6 system and want 38 Choose this if you have a i.MX5/6 system and want
35 to use the IPU. This option only enables IPU base 39 to use the IPU. This option only enables IPU base
@@ -38,5 +42,6 @@ config DRM_IMX_IPUV3_CORE
38config DRM_IMX_IPUV3 42config DRM_IMX_IPUV3
39 tristate "DRM Support for i.MX IPUv3" 43 tristate "DRM Support for i.MX IPUv3"
40 depends on DRM_IMX 44 depends on DRM_IMX
45 depends on DRM_IMX_IPUV3_CORE
41 help 46 help
42 Choose this if you have a i.MX5 or i.MX6 processor. 47 Choose this if you have a i.MX5 or i.MX6 processor.
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index ac1634464407..03892de9bd7e 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -670,7 +670,9 @@ static int imx_tve_probe(struct platform_device *pdev)
670 tve->dac_reg = devm_regulator_get(&pdev->dev, "dac"); 670 tve->dac_reg = devm_regulator_get(&pdev->dev, "dac");
671 if (!IS_ERR(tve->dac_reg)) { 671 if (!IS_ERR(tve->dac_reg)) {
672 regulator_set_voltage(tve->dac_reg, 2750000, 2750000); 672 regulator_set_voltage(tve->dac_reg, 2750000, 2750000);
673 regulator_enable(tve->dac_reg); 673 ret = regulator_enable(tve->dac_reg);
674 if (ret)
675 return ret;
674 } 676 }
675 677
676 tve->clk = devm_clk_get(&pdev->dev, "tve"); 678 tve->clk = devm_clk_get(&pdev->dev, "tve");
diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig
index ec32776ff547..df6569b997b8 100644
--- a/drivers/staging/media/solo6x10/Kconfig
+++ b/drivers/staging/media/solo6x10/Kconfig
@@ -1,6 +1,7 @@
1config SOLO6X10 1config SOLO6X10
2 tristate "Softlogic 6x10 MPEG codec cards" 2 tristate "Softlogic 6x10 MPEG codec cards"
3 depends on PCI && VIDEO_DEV && SND && I2C 3 depends on PCI && VIDEO_DEV && SND && I2C
4 depends on FONTS
4 select VIDEOBUF2_DMA_SG 5 select VIDEOBUF2_DMA_SG
5 select VIDEOBUF2_DMA_CONTIG 6 select VIDEOBUF2_DMA_CONTIG
6 select SND_PCM 7 select SND_PCM
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 863b22e51b45..197c393c4ca7 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -124,6 +124,20 @@ int nvec_register_notifier(struct nvec_chip *nvec, struct notifier_block *nb,
124EXPORT_SYMBOL_GPL(nvec_register_notifier); 124EXPORT_SYMBOL_GPL(nvec_register_notifier);
125 125
126/** 126/**
127 * nvec_unregister_notifier - Unregister a notifier with nvec
128 * @nvec: A &struct nvec_chip
129 * @nb: The notifier block to unregister
130 *
131 * Unregisters a notifier with @nvec. The notifier will be removed from the
132 * atomic notifier chain.
133 */
134int nvec_unregister_notifier(struct nvec_chip *nvec, struct notifier_block *nb)
135{
136 return atomic_notifier_chain_unregister(&nvec->notifier_list, nb);
137}
138EXPORT_SYMBOL_GPL(nvec_unregister_notifier);
139
140/**
127 * nvec_status_notifier - The final notifier 141 * nvec_status_notifier - The final notifier
128 * 142 *
129 * Prints a message about control events not handled in the notifier 143 * Prints a message about control events not handled in the notifier
@@ -185,7 +199,7 @@ static struct nvec_msg *nvec_msg_alloc(struct nvec_chip *nvec,
185 * 199 *
186 * Free the given message 200 * Free the given message
187 */ 201 */
188inline void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg) 202void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg)
189{ 203{
190 if (msg != &nvec->tx_scratch) 204 if (msg != &nvec->tx_scratch)
191 dev_vdbg(nvec->dev, "INFO: Free %ti\n", msg - nvec->msg_pool); 205 dev_vdbg(nvec->dev, "INFO: Free %ti\n", msg - nvec->msg_pool);
@@ -810,7 +824,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
810 return -ENODEV; 824 return -ENODEV;
811 } 825 }
812 826
813 i2c_clk = clk_get(&pdev->dev, "div-clk"); 827 i2c_clk = devm_clk_get(&pdev->dev, "div-clk");
814 if (IS_ERR(i2c_clk)) { 828 if (IS_ERR(i2c_clk)) {
815 dev_err(nvec->dev, "failed to get controller clock\n"); 829 dev_err(nvec->dev, "failed to get controller clock\n");
816 return -ENODEV; 830 return -ENODEV;
@@ -897,8 +911,11 @@ static int tegra_nvec_remove(struct platform_device *pdev)
897 911
898 nvec_toggle_global_events(nvec, false); 912 nvec_toggle_global_events(nvec, false);
899 mfd_remove_devices(nvec->dev); 913 mfd_remove_devices(nvec->dev);
914 nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
900 cancel_work_sync(&nvec->rx_work); 915 cancel_work_sync(&nvec->rx_work);
901 cancel_work_sync(&nvec->tx_work); 916 cancel_work_sync(&nvec->tx_work);
917 /* FIXME: needs check wether nvec is responsible for power off */
918 pm_power_off = NULL;
902 919
903 return 0; 920 return 0;
904} 921}
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
index b7a14bc0ab91..2b1316d87470 100644
--- a/drivers/staging/nvec/nvec.h
+++ b/drivers/staging/nvec/nvec.h
@@ -197,9 +197,8 @@ extern int nvec_register_notifier(struct nvec_chip *nvec,
197 struct notifier_block *nb, 197 struct notifier_block *nb,
198 unsigned int events); 198 unsigned int events);
199 199
200extern int nvec_unregister_notifier(struct device *dev, 200extern int nvec_unregister_notifier(struct nvec_chip *dev,
201 struct notifier_block *nb, 201 struct notifier_block *nb);
202 unsigned int events);
203 202
204extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg); 203extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg);
205 204
diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
index 7445ce6422bb..a0ec52a4114f 100644
--- a/drivers/staging/nvec/nvec_kbd.c
+++ b/drivers/staging/nvec/nvec_kbd.c
@@ -169,8 +169,15 @@ fail:
169 169
170static int nvec_kbd_remove(struct platform_device *pdev) 170static int nvec_kbd_remove(struct platform_device *pdev)
171{ 171{
172 struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
173 char disable_kbd[] = { NVEC_KBD, DISABLE_KBD },
174 uncnfg_wake_key_reporting[] = { NVEC_KBD, CNFG_WAKE_KEY_REPORTING,
175 false };
176 nvec_write_async(nvec, uncnfg_wake_key_reporting, 3);
177 nvec_write_async(nvec, disable_kbd, 2);
178 nvec_unregister_notifier(nvec, &keys_dev.notifier);
179
172 input_unregister_device(keys_dev.input); 180 input_unregister_device(keys_dev.input);
173 input_free_device(keys_dev.input);
174 181
175 return 0; 182 return 0;
176} 183}
@@ -188,4 +195,5 @@ module_platform_driver(nvec_kbd_driver);
188 195
189MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>"); 196MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>");
190MODULE_DESCRIPTION("NVEC keyboard driver"); 197MODULE_DESCRIPTION("NVEC keyboard driver");
198MODULE_ALIAS("platform:nvec-kbd");
191MODULE_LICENSE("GPL"); 199MODULE_LICENSE("GPL");
diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c
index 296f7b9a8c8c..aacfcd6954a3 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -414,6 +414,7 @@ static int nvec_power_remove(struct platform_device *pdev)
414 struct nvec_power *power = platform_get_drvdata(pdev); 414 struct nvec_power *power = platform_get_drvdata(pdev);
415 415
416 cancel_delayed_work_sync(&power->poller); 416 cancel_delayed_work_sync(&power->poller);
417 nvec_unregister_notifier(power->nvec, &power->notifier);
417 switch (pdev->id) { 418 switch (pdev->id) {
418 case AC: 419 case AC:
419 power_supply_unregister(&nvec_psy); 420 power_supply_unregister(&nvec_psy);
diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index aff6b9b9f9aa..06dbb02085a9 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -106,7 +106,7 @@ static int nvec_mouse_probe(struct platform_device *pdev)
106 struct serio *ser_dev; 106 struct serio *ser_dev;
107 char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 }; 107 char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
108 108
109 ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL); 109 ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL);
110 if (ser_dev == NULL) 110 if (ser_dev == NULL)
111 return -ENOMEM; 111 return -ENOMEM;
112 112
@@ -133,6 +133,11 @@ static int nvec_mouse_probe(struct platform_device *pdev)
133 133
134static int nvec_mouse_remove(struct platform_device *pdev) 134static int nvec_mouse_remove(struct platform_device *pdev)
135{ 135{
136 struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
137
138 ps2_sendcommand(ps2_dev.ser_dev, DISABLE_MOUSE);
139 ps2_stopstreaming(ps2_dev.ser_dev);
140 nvec_unregister_notifier(nvec, &ps2_dev.notifier);
136 serio_unregister_port(ps2_dev.ser_dev); 141 serio_unregister_port(ps2_dev.ser_dev);
137 142
138 return 0; 143 return 0;
@@ -179,4 +184,5 @@ module_platform_driver(nvec_mouse_driver);
179 184
180MODULE_DESCRIPTION("NVEC mouse driver"); 185MODULE_DESCRIPTION("NVEC mouse driver");
181MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>"); 186MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>");
187MODULE_ALIAS("platform:nvec-mouse");
182MODULE_LICENSE("GPL"); 188MODULE_LICENSE("GPL");
diff --git a/drivers/staging/sep/Kconfig b/drivers/staging/sep/Kconfig
index 185b676d858a..aab945a316ea 100644
--- a/drivers/staging/sep/Kconfig
+++ b/drivers/staging/sep/Kconfig
@@ -1,6 +1,6 @@
1config DX_SEP 1config DX_SEP
2 tristate "Discretix SEP driver" 2 tristate "Discretix SEP driver"
3 depends on PCI 3 depends on PCI && CRYPTO
4 help 4 help
5 Discretix SEP driver; used for the security processor subsystem 5 Discretix SEP driver; used for the security processor subsystem
6 on board the Intel Mobile Internet Device and adds SEP availability 6 on board the Intel Mobile Internet Device and adds SEP availability
diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
index fe667dde43ce..386362c9964f 100644
--- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
+++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
@@ -1087,7 +1087,11 @@ static int synaptics_rmi4_resume(struct device *dev)
1087 unsigned char intr_status; 1087 unsigned char intr_status;
1088 struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); 1088 struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
1089 1089
1090 regulator_enable(rmi4_data->regulator); 1090 retval = regulator_enable(rmi4_data->regulator);
1091 if (retval) {
1092 dev_err(dev, "Regulator enable failed (%d)\n", retval);
1093 return retval;
1094 }
1091 1095
1092 enable_irq(rmi4_data->i2c_client->irq); 1096 enable_irq(rmi4_data->i2c_client->irq);
1093 rmi4_data->touch_stopped = false; 1097 rmi4_data->touch_stopped = false;
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index f4f1bf7a30fd..c699a3058b39 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -133,7 +133,7 @@ static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked)
133 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", 133 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
134 pDevice->dev->name, pDevice->apdev->name); 134 pDevice->dev->name, pDevice->apdev->name);
135 } 135 }
136 kfree(pDevice->apdev); 136 free_netdev(pDevice->apdev);
137 pDevice->apdev = NULL; 137 pDevice->apdev = NULL;
138 pDevice->bEnable8021x = false; 138 pDevice->bEnable8021x = false;
139 pDevice->bEnableHostWEP = false; 139 pDevice->bEnableHostWEP = false;
diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
index c335808211ee..d0cf7d8a20e5 100644
--- a/drivers/staging/vt6656/iwctl.c
+++ b/drivers/staging/vt6656/iwctl.c
@@ -1345,9 +1345,12 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
1345 return rc; 1345 return rc;
1346 } 1346 }
1347 1347
1348 spin_lock_irq(&pDevice->lock);
1349
1348 if (wrq->disabled) { 1350 if (wrq->disabled) {
1349 pDevice->ePSMode = WMAC_POWER_CAM; 1351 pDevice->ePSMode = WMAC_POWER_CAM;
1350 PSvDisablePowerSaving(pDevice); 1352 PSvDisablePowerSaving(pDevice);
1353 spin_unlock_irq(&pDevice->lock);
1351 return rc; 1354 return rc;
1352 } 1355 }
1353 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { 1356 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
@@ -1358,6 +1361,9 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
1358 pDevice->ePSMode = WMAC_POWER_FAST; 1361 pDevice->ePSMode = WMAC_POWER_FAST;
1359 PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); 1362 PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
1360 } 1363 }
1364
1365 spin_unlock_irq(&pDevice->lock);
1366
1361 switch (wrq->flags & IW_POWER_MODE) { 1367 switch (wrq->flags & IW_POWER_MODE) {
1362 case IW_POWER_UNICAST_R: 1368 case IW_POWER_UNICAST_R:
1363 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); 1369 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
diff --git a/drivers/staging/zcache/ramster/ramster-howto.txt b/drivers/staging/zcache/ramster/ramster-howto.txt
new file mode 100644
index 000000000000..7b1ee3bbfdd5
--- /dev/null
+++ b/drivers/staging/zcache/ramster/ramster-howto.txt
@@ -0,0 +1,366 @@
1 RAMSTER HOW-TO
2
3Author: Dan Magenheimer
4Ramster maintainer: Konrad Wilk <konrad.wilk@oracle.com>
5
6This is a HOWTO document for ramster which, as of this writing, is in
7the kernel as a subdirectory of zcache in drivers/staging, called ramster.
8(Zcache can be built with or without ramster functionality.) If enabled
9and properly configured, ramster allows memory capacity load balancing
10across multiple machines in a cluster. Further, the ramster code serves
11as an example of asynchronous access for zcache (as well as cleancache and
12frontswap) that may prove useful for future transcendent memory
13implementations, such as KVM and NVRAM. While ramster works today on
14any network connection that supports kernel sockets, its features may
15become more interesting on future high-speed fabrics/interconnects.
16
17Ramster requires both kernel and userland support. The userland support,
18called ramster-tools, is known to work with EL6-based distros, but is a
19set of poorly-hacked slightly-modified cluster tools based on ocfs2, which
20includes an init file, a config file, and a userland binary that interfaces
21to the kernel. This state of userland support reflects the abysmal userland
22skills of this suitably-embarrassed author; any help/patches to turn
23ramster-tools into more distributable rpms/debs useful for a wider range
24of distros would be appreciated. The source RPM that can be used as a
25starting point is available at:
26 http://oss.oracle.com/projects/tmem/files/RAMster/
27
28As a result of this author's ignorance, userland setup described in this
29HOWTO assumes an EL6 distro and is described in EL6 syntax. Apologies
30if this offends anyone!
31
32Kernel support has only been tested on x86_64. Systems with an active
33ocfs2 filesystem should work, but since ramster leverages a lot of
34code from ocfs2, there may be latent issues. A kernel configuration that
35includes CONFIG_OCFS2_FS should build OK, and should certainly run OK
36if no ocfs2 filesystem is mounted.
37
38This HOWTO demonstrates memory capacity load balancing for a two-node
39cluster, where one node called the "local" node becomes overcommitted
40and the other node called the "remote" node provides additional RAM
41capacity for use by the local node. Ramster is capable of more complex
42topologies; see the last section titled "ADVANCED RAMSTER TOPOLOGIES".
43
44If you find any terms in this HOWTO unfamiliar or don't understand the
45motivation for ramster, the following LWN reading is recommended:
46-- Transcendent Memory in a Nutshell (lwn.net/Articles/454795)
47-- The future calculus of memory management (lwn.net/Articles/475681)
48And since ramster is built on top of zcache, this article may be helpful:
49-- In-kernel memory compression (lwn.net/Articles/545244)
50
51Now that you've memorized the contents of those articles, let's get started!
52
53A. PRELIMINARY
54
551) Install two x86_64 Linux systems that are known to work when
56 upgraded to a recent upstream Linux kernel version.
57
58On each system:
59
602) Configure, build and install, then boot Linux, just to ensure it
61 can be done with an unmodified upstream kernel. Confirm you booted
62 the upstream kernel with "uname -a".
63
643) If you plan to do any performance testing or unless you plan to
65 test only swapping, the "WasActive" patch is also highly recommended.
66 (Search lkml.org for WasActive, apply the patch, rebuild your kernel.)
67 For a demo or simple testing, the patch can be ignored.
68
694) Install ramster-tools as root. An x86_64 rpm for EL6-based systems
70 can be found at:
71 http://oss.oracle.com/projects/tmem/files/RAMster/
72 (Sorry but for now, non-EL6 users must recreate ramster-tools on
73 their own from source. See above.)
74
755) Ensure that debugfs is mounted at each boot. Examples below assume it
76 is mounted at /sys/kernel/debug.
77
78B. BUILDING RAMSTER INTO THE KERNEL
79
80Do the following on each system:
81
821) Using the kernel configuration mechanism of your choice, change
83 your config to include:
84
85 CONFIG_CLEANCACHE=y
86 CONFIG_FRONTSWAP=y
87 CONFIG_STAGING=y
88 CONFIG_CONFIGFS_FS=y # NOTE: MUST BE y, not m
89 CONFIG_ZCACHE=y
90 CONFIG_RAMSTER=y
91
92 For a linux-3.10 or later kernel, you should also set:
93
94 CONFIG_ZCACHE_DEBUG=y
95 CONFIG_RAMSTER_DEBUG=y
96
97 Before building the kernel please doublecheck your kernel config
98 file to ensure all of the settings are correct.
99
1002) Build this kernel and change your boot file (e.g. /etc/grub.conf)
101 so that the new kernel will boot.
102
1033) Add "zcache" and "ramster" as kernel boot parameters for the new kernel.
104
1054) Reboot each system approximately simultaneously.
106
1075) Check dmesg to ensure there are some messages from ramster, prefixed
108 by "ramster:"
109
110 # dmesg | grep ramster
111
112 You should also see a lot of files in:
113
114 # ls /sys/kernel/debug/zcache
115 # ls /sys/kernel/debug/ramster
116
117 These are mostly counters for various zcache and ramster activities.
118 You should also see files in:
119
120 # ls /sys/kernel/mm/ramster
121
122 These are sysfs files that control ramster as we shall see.
123
124 Ramster now will act as a single-system zcache on each system
125 but doesn't yet know anything about the cluster so can't yet do
126 anything remotely.
127
128C. CONFIGURING THE RAMSTER CLUSTER
129
130This part can be error prone unless you are familiar with clustering
131filesystems. We need to describe the cluster in a /etc/ramster.conf
132file and the init scripts that parse it are extremely picky about
133the syntax.
134
1351) Create a /etc/ramster.conf file and ensure it is identical on both
136 systems. This file mimics the ocfs2 format and there is a good amount
137 of documentation that can be searched for ocfs2.conf, but you can use:
138
139 cluster:
140 name = ramster
141 node_count = 2
142 node:
143 name = system1
144 cluster = ramster
145 number = 0
146 ip_address = my.ip.ad.r1
147 ip_port = 7777
148 node:
149 name = system2
150 cluster = ramster
151 number = 1
152 ip_address = my.ip.ad.r2
153 ip_port = 7777
154
155 You must ensure that the "name" field in the file exactly matches
156 the output of "hostname" on each system; if "hostname" shows a
157 fully-qualified hostname, ensure the name is fully qualified in
158 /etc/ramster.conf. Obviously, substitute my.ip.ad.rx with proper
159 ip addresses.
160
1612) Enable the ramster service and configure it. If you used the
162 EL6 ramster-tools, this would be:
163
164 # chkconfig --add ramster
165 # service ramster configure
166
167 Set "load on boot" to "y", cluster to start is "ramster" (or whatever
168 name you chose in ramster.conf), heartbeat dead threshold as "500",
169 network idle timeout as "1000000". Leave the others as default.
170
1713) Reboot both systems. After reboot, try (assuming EL6 ramster-tools):
172
173 # service ramster status
174
175 You should see "Checking RAMSTER cluster "ramster": Online". If you do
176 not, something is wrong and ramster will not work. Note that you
177 should also see that the driver for "configfs" is loaded and mounted,
178 the driver for ocfs2_dlmfs is not loaded, and some numbers for network
179 parameters. You will also see "Checking RAMSTER heartbeat: Not active".
180 That's all OK.
181
1824) Now you need to start the cluster heartbeat; the cluster is not "up"
183 until all nodes detect a heartbeat. In a real cluster, heartbeat detection
184 is done via a cluster filesystem, but ramster doesn't require one. Some
185 hack-y kernel code in ramster can start the heartbeat for you though if
186 you tell it what nodes are "up". To enable the heartbeat, do:
187
188 # echo 0 > /sys/kernel/mm/ramster/manual_node_up
189 # echo 1 > /sys/kernel/mm/ramster/manual_node_up
190
191 This must be done on BOTH nodes and, to avoid timeouts, must be done
192 approximately concurrently on both nodes. On an EL6 system, it is
193 convenient to put these lines in /etc/rc.local. To confirm that the
194 cluster is now up, on both systems do:
195
196 # dmesg | grep ramster
197
198 You should see ramster "Accepted connection" messages in dmesg on both
199 nodes after this. Note that if you check userland status again with
200
201 # service ramster status
202
203 you will still see "Checking RAMSTER heartbeat: Not active". That's
204 still OK... the ramster kernel heartbeat hack doesn't communicate to
205 userland.
206
2075) You now must tell each node the node to which it should "remotify" pages.
208 On this two node cluster, we will assume the "local" node, node 0, has
209 memory overcommitted and will use ramster to utilize RAM capacity on
210 the "remote node", node 1. To configure this, on node 0, you do:
211
212 # echo 1 > /sys/kernel/mm/ramster/remote_target_nodenum
213
214 You should see "ramster: node 1 set as remotification target" in dmesg
215 on node 0. Again, on EL6, /etc/rc.local is a good place to put this
216 on node 0 so you don't forget to do it at each boot.
217
2186) One more step: By default, the ramster code does not "remotify" any
219 pages; this is primarily for testing purposes, but sometimes it is
220 useful. This may change in the future, but for now, on node 0, you do:
221
222 # echo 1 > /sys/kernel/mm/ramster/pers_remotify_enable
223 # echo 1 > /sys/kernel/mm/ramster/eph_remotify_enable
224
225 The first enables remotifying swap (persistent, aka frontswap) pages,
226 the second enables remotifying of page cache (ephemeral, cleancache)
227 pages.
228
229 On EL6, these lines can also be put in /etc/rc.local (AFTER the
230 node_up lines), or at the beginning of a script that runs a workload.
231
2327) Note that most testing has been done with both/all machines booted
233 roughly simultaneously to avoid cluster timeouts. Ideally, you should
234 do this too unless you are trying to break ramster rather than just
235 use it. ;-)
236
237D. TESTING RAMSTER
238
2391) Note that ramster has no value unless pages get "remotified". For
240 swap/frontswap/persistent pages, this doesn't happen unless/until
241 the workload would cause swapping to occur, at which point pages
242 are put into frontswap/zcache, and the remotification thread starts
243 working. To get to the point where the system swaps, you either
244 need a workload for which the working set exceeds the RAM in the
245 system; or you need to somehow reduce the amount of RAM one of
246 the system sees. This latter is easy when testing in a VM, but
247 harder on physical systems. In some cases, "mem=xxxM" on the
248 kernel command line restricts memory, but for some values of xxx
249 the kernel may fail to boot. One may also try creating a fixed
250 RAMdisk, doing nothing with it, but ensuring that it eats up a fixed
251 amount of RAM.
252
2532) To see if ramster is working, on the "remote node", node 1, try:
254
255 # grep . /sys/kernel/debug/ramster/foreign_*
256 # # note, that is space-dot-space between grep and the pathname
257
258 to monitor the number (and max) ephemeral and persistent pages
259 that ramster has sent. If these stay at zero, ramster is not working
260 either because the workload on the local node (node 0) isn't creating
261 enough memory pressure or because "remotifying" isn't working. On the
262 local system, node 0, you can watch lots of useful information also.
263 Try:
264
265 grep . /sys/kernel/debug/zcache/*pageframes* \
266 /sys/kernel/debug/zcache/*zbytes* \
267 /sys/kernel/debug/zcache/*zpages* \
268 /sys/kernel/debug/ramster/*remote*
269
270 Of particular note are the remote_*_pages_succ_get counters. These
271 show how many disk reads and/or disk writes have been avoided on the
272 overcommitted local system by storing pages remotely using ramster.
273
274 At the risk of information overload, you can also grep:
275
276 /sys/kernel/debug/cleancache/* and /sys/kernel/debug/frontswap/*
277
278 These show, for example, how many disk reads and/or disk writes have
279 been avoided by using zcache to optimize RAM on the local system.
280
281
282AUTOMATIC SWAP REPATRIATION
283
284You may notice that while the systems are idle, the foreign persistent
285page count on the remote machine slowly decreases. This is because
286ramster implements "frontswap selfshrinking": When possible, swap
287pages that have been remotified are slowly repatriated to the local
288machine. This is so that local RAM can be used when possible and
289so that, in case of remote machine crash, the probability of loss
290of data is reduced.
291
292REBOOTING / POWEROFF
293
294If a system is shut down while some of its swap pages still reside
295on a remote system, the system may lock up during the shutdown
296sequence. This will occur if the network is shut down before the
297swap mechansim is shut down, which is the default ordering on many
298distros. To avoid this annoying problem, simply shut off the swap
299subsystem before starting the shutdown sequence, e.g.:
300
301 # swapoff -a
302 # reboot
303
304Ideally, this swapoff-before-ifdown ordering should be enforced permanently
305using shutdown scripts.
306
307KNOWN PROBLEMS
308
3091) You may periodically see messages such as:
310
311 ramster_r2net, message length problem
312
313 This is harmless but indicates that a node is sending messages
314 containing compressed pages that exceed the maximum for zcache
315 (PAGE_SIZE*15/16). The sender side needs to be fixed.
316
3172) If you see a "No longer connected to node..." message or a "No connection
318 established with node X after N seconds", it is possible you may
319 be in an unrecoverable state. If you are certain all of the
320 appropriate cluster configuration steps described above have been
321 performed, try rebooting the two servers concurrently to see if
322 the cluster starts.
323
324 Note that "Connection to node... shutdown, state 7" is an intermediate
325 connection state. As long as you later see "Accepted connection", the
326 intermediate states are harmless.
327
3283) There are known issues in counting certain values. As a result
329 you may see periodic warnings from the kernel. Almost always you
330 will see "ramster: bad accounting for XXX". There are also "WARN_ONCE"
331 messages. If you see kernel warnings with a tombstone, please report
332 them. They are harmless but reflect bugs that need to be eventually fixed.
333
334ADVANCED RAMSTER TOPOLOGIES
335
336The kernel code for ramster can support up to eight nodes in a cluster,
337but no testing has been done with more than three nodes.
338
339In the example described above, the "remote" node serves as a RAM
340overflow for the "local" node. This can be made symmetric by appropriate
341settings of the sysfs remote_target_nodenum file. For example, by setting:
342
343 # echo 1 > /sys/kernel/mm/ramster/remote_target_nodenum
344
345on node 0, and
346
347 # echo 0 > /sys/kernel/mm/ramster/remote_target_nodenum
348
349on node 1, each node can serve as a RAM overflow for the other.
350
351For more than two nodes, a "RAM server" can be configured. For a
352three node system, set:
353
354 # echo 0 > /sys/kernel/mm/ramster/remote_target_nodenum
355
356on node 1, and
357
358 # echo 0 > /sys/kernel/mm/ramster/remote_target_nodenum
359
360on node 2. Then node 0 is a RAM server for node 1 and node 2.
361
362In this implementation of ramster, any remote node is potentially a single
363point of failure (SPOF). Though the probability of failure is reduced
364by automatic swap repatriation (see above), a proposed future enhancement
365to ramster improves high-availability for the cluster by sending a copy
366of each page of date to two other nodes. Patches welcome!
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 522cb8e55142..dcceed29d31a 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1922,15 +1922,15 @@ out:
1922 1922
1923#ifdef CONFIG_ZCACHE_MODULE 1923#ifdef CONFIG_ZCACHE_MODULE
1924#ifdef CONFIG_RAMSTER 1924#ifdef CONFIG_RAMSTER
1925module_param(ramster_enabled, int, S_IRUGO); 1925module_param(ramster_enabled, bool, S_IRUGO);
1926module_param(disable_frontswap_selfshrink, int, S_IRUGO); 1926module_param(disable_frontswap_selfshrink, int, S_IRUGO);
1927#endif 1927#endif
1928module_param(disable_cleancache, int, S_IRUGO); 1928module_param(disable_cleancache, bool, S_IRUGO);
1929module_param(disable_frontswap, int, S_IRUGO); 1929module_param(disable_frontswap, bool, S_IRUGO);
1930#ifdef FRONTSWAP_HAS_EXCLUSIVE_GETS 1930#ifdef FRONTSWAP_HAS_EXCLUSIVE_GETS
1931module_param(frontswap_has_exclusive_gets, bool, S_IRUGO); 1931module_param(frontswap_has_exclusive_gets, bool, S_IRUGO);
1932#endif 1932#endif
1933module_param(disable_frontswap_ignore_nonactive, int, S_IRUGO); 1933module_param(disable_frontswap_ignore_nonactive, bool, S_IRUGO);
1934module_param(zcache_comp_name, charp, S_IRUGO); 1934module_param(zcache_comp_name, charp, S_IRUGO);
1935module_init(zcache_init); 1935module_init(zcache_init);
1936MODULE_LICENSE("GPL"); 1936MODULE_LICENSE("GPL");
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 6d0c27cd03da..9bffcec5ad82 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -859,6 +859,7 @@ error:
859 */ 859 */
860static void __exit ehv_bc_exit(void) 860static void __exit ehv_bc_exit(void)
861{ 861{
862 platform_driver_unregister(&ehv_bc_tty_driver);
862 tty_unregister_driver(ehv_bc_driver); 863 tty_unregister_driver(ehv_bc_driver);
863 put_tty_driver(ehv_bc_driver); 864 put_tty_driver(ehv_bc_driver);
864 kfree(bcs); 865 kfree(bcs);
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 71d6eb2c93b1..4c4a23674569 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1618,8 +1618,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1618 if (ip->type == PORT_16550A) 1618 if (ip->type == PORT_16550A)
1619 me->fifo[p] = 1; 1619 me->fifo[p] = 1;
1620 1620
1621 opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2); 1621 if (ip->board->chip_flag == MOXA_MUST_MU860_HWID) {
1622 opmode &= OP_MODE_MASK; 1622 opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2);
1623 opmode &= OP_MODE_MASK;
1624 } else {
1625 opmode = RS232_MODE;
1626 }
1623 me->iftype[p] = opmode; 1627 me->iftype[p] = opmode;
1624 mutex_unlock(&port->mutex); 1628 mutex_unlock(&port->mutex);
1625 } 1629 }
@@ -1676,6 +1680,9 @@ static int mxser_ioctl(struct tty_struct *tty,
1676 int shiftbit; 1680 int shiftbit;
1677 unsigned char val, mask; 1681 unsigned char val, mask;
1678 1682
1683 if (info->board->chip_flag != MOXA_MUST_MU860_HWID)
1684 return -EFAULT;
1685
1679 p = tty->index % 4; 1686 p = tty->index % 4;
1680 if (cmd == MOXA_SET_OP_MODE) { 1687 if (cmd == MOXA_SET_OP_MODE) {
1681 if (get_user(opmode, (int __user *) argp)) 1688 if (get_user(opmode, (int __user *) argp))
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index d655416087b7..6c7fe90ad72d 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1573,6 +1573,14 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1573 ldata->real_raw = 0; 1573 ldata->real_raw = 0;
1574 } 1574 }
1575 n_tty_set_room(tty); 1575 n_tty_set_room(tty);
1576 /*
1577 * Fix tty hang when I_IXON(tty) is cleared, but the tty
1578 * been stopped by STOP_CHAR(tty) before it.
1579 */
1580 if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) {
1581 start_tty(tty);
1582 }
1583
1576 /* The termios change make the tty ready for I/O */ 1584 /* The termios change make the tty ready for I/O */
1577 wake_up_interruptible(&tty->write_wait); 1585 wake_up_interruptible(&tty->write_wait);
1578 wake_up_interruptible(&tty->read_wait); 1586 wake_up_interruptible(&tty->read_wait);
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 82d35c5a58fd..354564ea47c5 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -150,12 +150,14 @@ static Word_t aiop_intr_bits[AIOP_CTL_SIZE] = {
150 AIOP_INTR_BIT_3 150 AIOP_INTR_BIT_3
151}; 151};
152 152
153#ifdef CONFIG_PCI
153static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = { 154static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = {
154 UPCI_AIOP_INTR_BIT_0, 155 UPCI_AIOP_INTR_BIT_0,
155 UPCI_AIOP_INTR_BIT_1, 156 UPCI_AIOP_INTR_BIT_1,
156 UPCI_AIOP_INTR_BIT_2, 157 UPCI_AIOP_INTR_BIT_2,
157 UPCI_AIOP_INTR_BIT_3 158 UPCI_AIOP_INTR_BIT_3
158}; 159};
160#endif
159 161
160static Byte_t RData[RDATASIZE] = { 162static Byte_t RData[RDATASIZE] = {
161 0x00, 0x09, 0xf6, 0x82, 163 0x00, 0x09, 0xf6, 0x82,
@@ -227,7 +229,6 @@ static unsigned long nextLineNumber;
227static int __init init_ISA(int i); 229static int __init init_ISA(int i);
228static void rp_wait_until_sent(struct tty_struct *tty, int timeout); 230static void rp_wait_until_sent(struct tty_struct *tty, int timeout);
229static void rp_flush_buffer(struct tty_struct *tty); 231static void rp_flush_buffer(struct tty_struct *tty);
230static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model);
231static unsigned char GetLineNumber(int ctrl, int aiop, int ch); 232static unsigned char GetLineNumber(int ctrl, int aiop, int ch);
232static unsigned char SetLineNumber(int ctrl, int aiop, int ch); 233static unsigned char SetLineNumber(int ctrl, int aiop, int ch);
233static void rp_start(struct tty_struct *tty); 234static void rp_start(struct tty_struct *tty);
@@ -241,11 +242,6 @@ static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags);
241static void sModemReset(CONTROLLER_T * CtlP, int chan, int on); 242static void sModemReset(CONTROLLER_T * CtlP, int chan, int on);
242static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on); 243static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on);
243static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data); 244static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data);
244static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
245 ByteIO_t * AiopIOList, int AiopIOListSize,
246 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
247 int PeriodicOnly, int altChanRingIndicator,
248 int UPCIRingInd);
249static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, 245static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO,
250 ByteIO_t * AiopIOList, int AiopIOListSize, 246 ByteIO_t * AiopIOList, int AiopIOListSize,
251 int IRQNum, Byte_t Frequency, int PeriodicOnly); 247 int IRQNum, Byte_t Frequency, int PeriodicOnly);
@@ -1775,6 +1771,145 @@ static DEFINE_PCI_DEVICE_TABLE(rocket_pci_ids) = {
1775}; 1771};
1776MODULE_DEVICE_TABLE(pci, rocket_pci_ids); 1772MODULE_DEVICE_TABLE(pci, rocket_pci_ids);
1777 1773
1774/* Resets the speaker controller on RocketModem II and III devices */
1775static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model)
1776{
1777 ByteIO_t addr;
1778
1779 /* RocketModem II speaker control is at the 8th port location of offset 0x40 */
1780 if ((model == MODEL_RP4M) || (model == MODEL_RP6M)) {
1781 addr = CtlP->AiopIO[0] + 0x4F;
1782 sOutB(addr, 0);
1783 }
1784
1785 /* RocketModem III speaker control is at the 1st port location of offset 0x80 */
1786 if ((model == MODEL_UPCI_RM3_8PORT)
1787 || (model == MODEL_UPCI_RM3_4PORT)) {
1788 addr = CtlP->AiopIO[0] + 0x88;
1789 sOutB(addr, 0);
1790 }
1791}
1792
1793/***************************************************************************
1794Function: sPCIInitController
1795Purpose: Initialization of controller global registers and controller
1796 structure.
1797Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize,
1798 IRQNum,Frequency,PeriodicOnly)
1799 CONTROLLER_T *CtlP; Ptr to controller structure
1800 int CtlNum; Controller number
1801 ByteIO_t *AiopIOList; List of I/O addresses for each AIOP.
1802 This list must be in the order the AIOPs will be found on the
1803 controller. Once an AIOP in the list is not found, it is
1804 assumed that there are no more AIOPs on the controller.
1805 int AiopIOListSize; Number of addresses in AiopIOList
1806 int IRQNum; Interrupt Request number. Can be any of the following:
1807 0: Disable global interrupts
1808 3: IRQ 3
1809 4: IRQ 4
1810 5: IRQ 5
1811 9: IRQ 9
1812 10: IRQ 10
1813 11: IRQ 11
1814 12: IRQ 12
1815 15: IRQ 15
1816 Byte_t Frequency: A flag identifying the frequency
1817 of the periodic interrupt, can be any one of the following:
1818 FREQ_DIS - periodic interrupt disabled
1819 FREQ_137HZ - 137 Hertz
1820 FREQ_69HZ - 69 Hertz
1821 FREQ_34HZ - 34 Hertz
1822 FREQ_17HZ - 17 Hertz
1823 FREQ_9HZ - 9 Hertz
1824 FREQ_4HZ - 4 Hertz
1825 If IRQNum is set to 0 the Frequency parameter is
1826 overidden, it is forced to a value of FREQ_DIS.
1827 int PeriodicOnly: 1 if all interrupts except the periodic
1828 interrupt are to be blocked.
1829 0 is both the periodic interrupt and
1830 other channel interrupts are allowed.
1831 If IRQNum is set to 0 the PeriodicOnly parameter is
1832 overidden, it is forced to a value of 0.
1833Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
1834 initialization failed.
1835
1836Comments:
1837 If periodic interrupts are to be disabled but AIOP interrupts
1838 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0.
1839
1840 If interrupts are to be completely disabled set IRQNum to 0.
1841
1842 Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an
1843 invalid combination.
1844
1845 This function performs initialization of global interrupt modes,
1846 but it does not actually enable global interrupts. To enable
1847 and disable global interrupts use functions sEnGlobalInt() and
1848 sDisGlobalInt(). Enabling of global interrupts is normally not
1849 done until all other initializations are complete.
1850
1851 Even if interrupts are globally enabled, they must also be
1852 individually enabled for each channel that is to generate
1853 interrupts.
1854
1855Warnings: No range checking on any of the parameters is done.
1856
1857 No context switches are allowed while executing this function.
1858
1859 After this function all AIOPs on the controller are disabled,
1860 they can be enabled with sEnAiop().
1861*/
1862static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
1863 ByteIO_t * AiopIOList, int AiopIOListSize,
1864 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
1865 int PeriodicOnly, int altChanRingIndicator,
1866 int UPCIRingInd)
1867{
1868 int i;
1869 ByteIO_t io;
1870
1871 CtlP->AltChanRingIndicator = altChanRingIndicator;
1872 CtlP->UPCIRingInd = UPCIRingInd;
1873 CtlP->CtlNum = CtlNum;
1874 CtlP->CtlID = CTLID_0001; /* controller release 1 */
1875 CtlP->BusType = isPCI; /* controller release 1 */
1876
1877 if (ConfigIO) {
1878 CtlP->isUPCI = 1;
1879 CtlP->PCIIO = ConfigIO + _PCI_9030_INT_CTRL;
1880 CtlP->PCIIO2 = ConfigIO + _PCI_9030_GPIO_CTRL;
1881 CtlP->AiopIntrBits = upci_aiop_intr_bits;
1882 } else {
1883 CtlP->isUPCI = 0;
1884 CtlP->PCIIO =
1885 (WordIO_t) ((ByteIO_t) AiopIOList[0] + _PCI_INT_FUNC);
1886 CtlP->AiopIntrBits = aiop_intr_bits;
1887 }
1888
1889 sPCIControllerEOI(CtlP); /* clear EOI if warm init */
1890 /* Init AIOPs */
1891 CtlP->NumAiop = 0;
1892 for (i = 0; i < AiopIOListSize; i++) {
1893 io = AiopIOList[i];
1894 CtlP->AiopIO[i] = (WordIO_t) io;
1895 CtlP->AiopIntChanIO[i] = io + _INT_CHAN;
1896
1897 CtlP->AiopID[i] = sReadAiopID(io); /* read AIOP ID */
1898 if (CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */
1899 break; /* done looking for AIOPs */
1900
1901 CtlP->AiopNumChan[i] = sReadAiopNumChan((WordIO_t) io); /* num channels in AIOP */
1902 sOutW((WordIO_t) io + _INDX_ADDR, _CLK_PRE); /* clock prescaler */
1903 sOutB(io + _INDX_DATA, sClockPrescale);
1904 CtlP->NumAiop++; /* bump count of AIOPs */
1905 }
1906
1907 if (CtlP->NumAiop == 0)
1908 return (-1);
1909 else
1910 return (CtlP->NumAiop);
1911}
1912
1778/* 1913/*
1779 * Called when a PCI card is found. Retrieves and stores model information, 1914 * Called when a PCI card is found. Retrieves and stores model information,
1780 * init's aiopic and serial port hardware. 1915 * init's aiopic and serial port hardware.
@@ -2519,147 +2654,6 @@ static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO,
2519 return (CtlP->NumAiop); 2654 return (CtlP->NumAiop);
2520} 2655}
2521 2656
2522#ifdef CONFIG_PCI
2523/***************************************************************************
2524Function: sPCIInitController
2525Purpose: Initialization of controller global registers and controller
2526 structure.
2527Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize,
2528 IRQNum,Frequency,PeriodicOnly)
2529 CONTROLLER_T *CtlP; Ptr to controller structure
2530 int CtlNum; Controller number
2531 ByteIO_t *AiopIOList; List of I/O addresses for each AIOP.
2532 This list must be in the order the AIOPs will be found on the
2533 controller. Once an AIOP in the list is not found, it is
2534 assumed that there are no more AIOPs on the controller.
2535 int AiopIOListSize; Number of addresses in AiopIOList
2536 int IRQNum; Interrupt Request number. Can be any of the following:
2537 0: Disable global interrupts
2538 3: IRQ 3
2539 4: IRQ 4
2540 5: IRQ 5
2541 9: IRQ 9
2542 10: IRQ 10
2543 11: IRQ 11
2544 12: IRQ 12
2545 15: IRQ 15
2546 Byte_t Frequency: A flag identifying the frequency
2547 of the periodic interrupt, can be any one of the following:
2548 FREQ_DIS - periodic interrupt disabled
2549 FREQ_137HZ - 137 Hertz
2550 FREQ_69HZ - 69 Hertz
2551 FREQ_34HZ - 34 Hertz
2552 FREQ_17HZ - 17 Hertz
2553 FREQ_9HZ - 9 Hertz
2554 FREQ_4HZ - 4 Hertz
2555 If IRQNum is set to 0 the Frequency parameter is
2556 overidden, it is forced to a value of FREQ_DIS.
2557 int PeriodicOnly: 1 if all interrupts except the periodic
2558 interrupt are to be blocked.
2559 0 is both the periodic interrupt and
2560 other channel interrupts are allowed.
2561 If IRQNum is set to 0 the PeriodicOnly parameter is
2562 overidden, it is forced to a value of 0.
2563Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller
2564 initialization failed.
2565
2566Comments:
2567 If periodic interrupts are to be disabled but AIOP interrupts
2568 are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0.
2569
2570 If interrupts are to be completely disabled set IRQNum to 0.
2571
2572 Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an
2573 invalid combination.
2574
2575 This function performs initialization of global interrupt modes,
2576 but it does not actually enable global interrupts. To enable
2577 and disable global interrupts use functions sEnGlobalInt() and
2578 sDisGlobalInt(). Enabling of global interrupts is normally not
2579 done until all other initializations are complete.
2580
2581 Even if interrupts are globally enabled, they must also be
2582 individually enabled for each channel that is to generate
2583 interrupts.
2584
2585Warnings: No range checking on any of the parameters is done.
2586
2587 No context switches are allowed while executing this function.
2588
2589 After this function all AIOPs on the controller are disabled,
2590 they can be enabled with sEnAiop().
2591*/
2592static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum,
2593 ByteIO_t * AiopIOList, int AiopIOListSize,
2594 WordIO_t ConfigIO, int IRQNum, Byte_t Frequency,
2595 int PeriodicOnly, int altChanRingIndicator,
2596 int UPCIRingInd)
2597{
2598 int i;
2599 ByteIO_t io;
2600
2601 CtlP->AltChanRingIndicator = altChanRingIndicator;
2602 CtlP->UPCIRingInd = UPCIRingInd;
2603 CtlP->CtlNum = CtlNum;
2604 CtlP->CtlID = CTLID_0001; /* controller release 1 */
2605 CtlP->BusType = isPCI; /* controller release 1 */
2606
2607 if (ConfigIO) {
2608 CtlP->isUPCI = 1;
2609 CtlP->PCIIO = ConfigIO + _PCI_9030_INT_CTRL;
2610 CtlP->PCIIO2 = ConfigIO + _PCI_9030_GPIO_CTRL;
2611 CtlP->AiopIntrBits = upci_aiop_intr_bits;
2612 } else {
2613 CtlP->isUPCI = 0;
2614 CtlP->PCIIO =
2615 (WordIO_t) ((ByteIO_t) AiopIOList[0] + _PCI_INT_FUNC);
2616 CtlP->AiopIntrBits = aiop_intr_bits;
2617 }
2618
2619 sPCIControllerEOI(CtlP); /* clear EOI if warm init */
2620 /* Init AIOPs */
2621 CtlP->NumAiop = 0;
2622 for (i = 0; i < AiopIOListSize; i++) {
2623 io = AiopIOList[i];
2624 CtlP->AiopIO[i] = (WordIO_t) io;
2625 CtlP->AiopIntChanIO[i] = io + _INT_CHAN;
2626
2627 CtlP->AiopID[i] = sReadAiopID(io); /* read AIOP ID */
2628 if (CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */
2629 break; /* done looking for AIOPs */
2630
2631 CtlP->AiopNumChan[i] = sReadAiopNumChan((WordIO_t) io); /* num channels in AIOP */
2632 sOutW((WordIO_t) io + _INDX_ADDR, _CLK_PRE); /* clock prescaler */
2633 sOutB(io + _INDX_DATA, sClockPrescale);
2634 CtlP->NumAiop++; /* bump count of AIOPs */
2635 }
2636
2637 if (CtlP->NumAiop == 0)
2638 return (-1);
2639 else
2640 return (CtlP->NumAiop);
2641}
2642
2643/* Resets the speaker controller on RocketModem II and III devices */
2644static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model)
2645{
2646 ByteIO_t addr;
2647
2648 /* RocketModem II speaker control is at the 8th port location of offset 0x40 */
2649 if ((model == MODEL_RP4M) || (model == MODEL_RP6M)) {
2650 addr = CtlP->AiopIO[0] + 0x4F;
2651 sOutB(addr, 0);
2652 }
2653
2654 /* RocketModem III speaker control is at the 1st port location of offset 0x80 */
2655 if ((model == MODEL_UPCI_RM3_8PORT)
2656 || (model == MODEL_UPCI_RM3_4PORT)) {
2657 addr = CtlP->AiopIO[0] + 0x88;
2658 sOutB(addr, 0);
2659 }
2660}
2661#endif
2662
2663/*************************************************************************** 2657/***************************************************************************
2664Function: sReadAiopID 2658Function: sReadAiopID
2665Purpose: Read the AIOP idenfication number directly from an AIOP. 2659Purpose: Read the AIOP idenfication number directly from an AIOP.
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index beaa283f5cc6..d07b6af3a937 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -338,7 +338,8 @@ static int dw8250_runtime_suspend(struct device *dev)
338{ 338{
339 struct dw8250_data *data = dev_get_drvdata(dev); 339 struct dw8250_data *data = dev_get_drvdata(dev);
340 340
341 clk_disable_unprepare(data->clk); 341 if (!IS_ERR(data->clk))
342 clk_disable_unprepare(data->clk);
342 343
343 return 0; 344 return 0;
344} 345}
@@ -347,7 +348,8 @@ static int dw8250_runtime_resume(struct device *dev)
347{ 348{
348 struct dw8250_data *data = dev_get_drvdata(dev); 349 struct dw8250_data *data = dev_get_drvdata(dev);
349 350
350 clk_prepare_enable(data->clk); 351 if (!IS_ERR(data->clk))
352 clk_prepare_enable(data->clk);
351 353
352 return 0; 354 return 0;
353} 355}
@@ -367,6 +369,7 @@ MODULE_DEVICE_TABLE(of, dw8250_of_match);
367static const struct acpi_device_id dw8250_acpi_match[] = { 369static const struct acpi_device_id dw8250_acpi_match[] = {
368 { "INT33C4", 0 }, 370 { "INT33C4", 0 },
369 { "INT33C5", 0 }, 371 { "INT33C5", 0 },
372 { "80860F0A", 0 },
370 { }, 373 { },
371}; 374};
372MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); 375MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8ab70a620919..e2774f9ecd59 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -332,7 +332,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
332 dmaengine_slave_config(chan, &rx_conf); 332 dmaengine_slave_config(chan, &rx_conf);
333 uap->dmarx.chan = chan; 333 uap->dmarx.chan = chan;
334 334
335 if (plat->dma_rx_poll_enable) { 335 if (plat && plat->dma_rx_poll_enable) {
336 /* Set poll rate if specified. */ 336 /* Set poll rate if specified. */
337 if (plat->dma_rx_poll_rate) { 337 if (plat->dma_rx_poll_rate) {
338 uap->dmarx.auto_poll_rate = false; 338 uap->dmarx.auto_poll_rate = false;
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index e956377a38fe..65be0c00c4bf 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -707,8 +707,10 @@ static int __init mcf_init(void)
707 if (rc) 707 if (rc)
708 return rc; 708 return rc;
709 rc = platform_driver_register(&mcf_platform_driver); 709 rc = platform_driver_register(&mcf_platform_driver);
710 if (rc) 710 if (rc) {
711 uart_unregister_driver(&mcf_driver);
711 return rc; 712 return rc;
713 }
712 return 0; 714 return 0;
713} 715}
714 716
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 018bad922554..f51b280f3bf2 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1497,18 +1497,23 @@ mpc52xx_uart_init(void)
1497 if (psc_ops && psc_ops->fifoc_init) { 1497 if (psc_ops && psc_ops->fifoc_init) {
1498 ret = psc_ops->fifoc_init(); 1498 ret = psc_ops->fifoc_init();
1499 if (ret) 1499 if (ret)
1500 return ret; 1500 goto err_init;
1501 } 1501 }
1502 1502
1503 ret = platform_driver_register(&mpc52xx_uart_of_driver); 1503 ret = platform_driver_register(&mpc52xx_uart_of_driver);
1504 if (ret) { 1504 if (ret) {
1505 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", 1505 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
1506 __FILE__, ret); 1506 __FILE__, ret);
1507 uart_unregister_driver(&mpc52xx_uart_driver); 1507 goto err_reg;
1508 return ret;
1509 } 1508 }
1510 1509
1511 return 0; 1510 return 0;
1511err_reg:
1512 if (psc_ops && psc_ops->fifoc_uninit)
1513 psc_ops->fifoc_uninit();
1514err_init:
1515 uart_unregister_driver(&mpc52xx_uart_driver);
1516 return ret;
1512} 1517}
1513 1518
1514static void __exit 1519static void __exit
diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c
index 77287c54f331..549c70a2a63e 100644
--- a/drivers/tty/serial/nwpserial.c
+++ b/drivers/tty/serial/nwpserial.c
@@ -199,7 +199,7 @@ static void nwpserial_shutdown(struct uart_port *port)
199 dcr_write(up->dcr_host, UART_IER, up->ier); 199 dcr_write(up->dcr_host, UART_IER, up->ier);
200 200
201 /* free irq */ 201 /* free irq */
202 free_irq(up->port.irq, port); 202 free_irq(up->port.irq, up);
203} 203}
204 204
205static int nwpserial_verify_port(struct uart_port *port, 205static int nwpserial_verify_port(struct uart_port *port,
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 074b9194144f..89429410a245 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1803,6 +1803,7 @@ static int __init s3c24xx_serial_modinit(void)
1803 1803
1804static void __exit s3c24xx_serial_modexit(void) 1804static void __exit s3c24xx_serial_modexit(void)
1805{ 1805{
1806 platform_driver_unregister(&samsung_serial_driver);
1806 uart_unregister_driver(&s3c24xx_uart_drv); 1807 uart_unregister_driver(&s3c24xx_uart_drv);
1807} 1808}
1808 1809
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index fbd447b390f7..740202d8a5c4 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -779,7 +779,6 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
779 con_set_default_unimap(vc); 779 con_set_default_unimap(vc);
780 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); 780 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
781 if (!vc->vc_screenbuf) { 781 if (!vc->vc_screenbuf) {
782 tty_port_destroy(&vc->port);
783 kfree(vc); 782 kfree(vc);
784 vc_cons[currcons].d = NULL; 783 vc_cons[currcons].d = NULL;
785 return -ENOMEM; 784 return -ENOMEM;
@@ -986,26 +985,25 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws)
986 return ret; 985 return ret;
987} 986}
988 987
989void vc_deallocate(unsigned int currcons) 988struct vc_data *vc_deallocate(unsigned int currcons)
990{ 989{
990 struct vc_data *vc = NULL;
991
991 WARN_CONSOLE_UNLOCKED(); 992 WARN_CONSOLE_UNLOCKED();
992 993
993 if (vc_cons_allocated(currcons)) { 994 if (vc_cons_allocated(currcons)) {
994 struct vc_data *vc = vc_cons[currcons].d; 995 struct vt_notifier_param param;
995 struct vt_notifier_param param = { .vc = vc };
996 996
997 param.vc = vc = vc_cons[currcons].d;
997 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param); 998 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param);
998 vcs_remove_sysfs(currcons); 999 vcs_remove_sysfs(currcons);
999 vc->vc_sw->con_deinit(vc); 1000 vc->vc_sw->con_deinit(vc);
1000 put_pid(vc->vt_pid); 1001 put_pid(vc->vt_pid);
1001 module_put(vc->vc_sw->owner); 1002 module_put(vc->vc_sw->owner);
1002 kfree(vc->vc_screenbuf); 1003 kfree(vc->vc_screenbuf);
1003 if (currcons >= MIN_NR_CONSOLES) {
1004 tty_port_destroy(&vc->port);
1005 kfree(vc);
1006 }
1007 vc_cons[currcons].d = NULL; 1004 vc_cons[currcons].d = NULL;
1008 } 1005 }
1006 return vc;
1009} 1007}
1010 1008
1011/* 1009/*
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 98ff1735eafc..fc2c06c66e89 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -283,6 +283,51 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_
283 return 0; 283 return 0;
284} 284}
285 285
286/* deallocate a single console, if possible (leave 0) */
287static int vt_disallocate(unsigned int vc_num)
288{
289 struct vc_data *vc = NULL;
290 int ret = 0;
291
292 if (!vc_num)
293 return 0;
294
295 console_lock();
296 if (VT_BUSY(vc_num))
297 ret = -EBUSY;
298 else
299 vc = vc_deallocate(vc_num);
300 console_unlock();
301
302 if (vc && vc_num >= MIN_NR_CONSOLES) {
303 tty_port_destroy(&vc->port);
304 kfree(vc);
305 }
306
307 return ret;
308}
309
310/* deallocate all unused consoles, but leave 0 */
311static void vt_disallocate_all(void)
312{
313 struct vc_data *vc[MAX_NR_CONSOLES];
314 int i;
315
316 console_lock();
317 for (i = 1; i < MAX_NR_CONSOLES; i++)
318 if (!VT_BUSY(i))
319 vc[i] = vc_deallocate(i);
320 else
321 vc[i] = NULL;
322 console_unlock();
323
324 for (i = 1; i < MAX_NR_CONSOLES; i++) {
325 if (vc[i] && i >= MIN_NR_CONSOLES) {
326 tty_port_destroy(&vc[i]->port);
327 kfree(vc[i]);
328 }
329 }
330}
286 331
287 332
288/* 333/*
@@ -769,24 +814,10 @@ int vt_ioctl(struct tty_struct *tty,
769 ret = -ENXIO; 814 ret = -ENXIO;
770 break; 815 break;
771 } 816 }
772 if (arg == 0) { 817 if (arg == 0)
773 /* deallocate all unused consoles, but leave 0 */ 818 vt_disallocate_all();
774 console_lock(); 819 else
775 for (i=1; i<MAX_NR_CONSOLES; i++) 820 ret = vt_disallocate(--arg);
776 if (! VT_BUSY(i))
777 vc_deallocate(i);
778 console_unlock();
779 } else {
780 /* deallocate a single console, if possible */
781 arg--;
782 if (VT_BUSY(arg))
783 ret = -EBUSY;
784 else if (arg) { /* leave 0 */
785 console_lock();
786 vc_deallocate(arg);
787 console_unlock();
788 }
789 }
790 break; 821 break;
791 822
792 case VT_RESIZE: 823 case VT_RESIZE:
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index e92eeaf251fe..5295be0342c1 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -45,6 +45,7 @@ config UIO_PDRV_GENIRQ
45 45
46config UIO_DMEM_GENIRQ 46config UIO_DMEM_GENIRQ
47 tristate "Userspace platform driver with generic irq and dynamic memory" 47 tristate "Userspace platform driver with generic irq and dynamic memory"
48 depends on HAS_DMA
48 help 49 help
49 Platform driver for Userspace I/O devices, including generic 50 Platform driver for Userspace I/O devices, including generic
50 interrupt handling code. Shared interrupts are not supported. 51 interrupt handling code. Shared interrupts are not supported.
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index b7eb86ad6bf2..8a7eb77233b4 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -686,7 +686,8 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
686{ 686{
687 int ret, len; 687 int ret, len;
688 __le32 *buf; 688 __le32 *buf;
689 int offb, offd; 689 int offb;
690 unsigned int offd;
690 const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; 691 const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
691 int buflen = ((size - 1) / stride + 1 + size * 2) * 4; 692 int buflen = ((size - 1) / stride + 1 + size * 2) * 4;
692 693
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 608a2aeb400c..b2df442eb3e5 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -20,7 +20,7 @@ config USB_CHIPIDEA_UDC
20config USB_CHIPIDEA_HOST 20config USB_CHIPIDEA_HOST
21 bool "ChipIdea host controller" 21 bool "ChipIdea host controller"
22 depends on USB=y || USB=USB_CHIPIDEA 22 depends on USB=y || USB=USB_CHIPIDEA
23 depends on USB_EHCI_HCD 23 depends on USB_EHCI_HCD=y
24 select USB_EHCI_ROOT_HUB_TT 24 select USB_EHCI_ROOT_HUB_TT
25 help 25 help
26 Say Y here to enable host controller functionality of the 26 Say Y here to enable host controller functionality of the
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
index 8faec9dbbb84..73f9d5f15adb 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -173,17 +173,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
173 173
174 ci13xxx_imx_platdata.phy = data->phy; 174 ci13xxx_imx_platdata.phy = data->phy;
175 175
176 if (!pdev->dev.dma_mask) { 176 if (!pdev->dev.dma_mask)
177 pdev->dev.dma_mask = devm_kzalloc(&pdev->dev, 177 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
178 sizeof(*pdev->dev.dma_mask), GFP_KERNEL); 178 if (!pdev->dev.coherent_dma_mask)
179 if (!pdev->dev.dma_mask) { 179 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
180 ret = -ENOMEM;
181 dev_err(&pdev->dev, "Failed to alloc dma_mask!\n");
182 goto err;
183 }
184 *pdev->dev.dma_mask = DMA_BIT_MASK(32);
185 dma_set_coherent_mask(&pdev->dev, *pdev->dev.dma_mask);
186 }
187 180
188 if (usbmisc_ops && usbmisc_ops->init) { 181 if (usbmisc_ops && usbmisc_ops->init) {
189 ret = usbmisc_ops->init(&pdev->dev); 182 ret = usbmisc_ops->init(&pdev->dev);
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 8772b3659296..db535b0aa172 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -51,7 +51,7 @@ config USB_DYNAMIC_MINORS
51 51
52config USB_OTG 52config USB_OTG
53 bool "OTG support" 53 bool "OTG support"
54 depends on USB_SUSPEND 54 depends on PM_RUNTIME
55 default n 55 default n
56 help 56 help
57 The most notable feature of USB OTG is support for a 57 The most notable feature of USB OTG is support for a
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index ab5638d9c707..a63598895077 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {
88 /* Edirol SD-20 */ 88 /* Edirol SD-20 */
89 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, 89 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
90 90
91 /* Alcor Micro Corp. Hub */
92 { USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME },
93
91 /* appletouch */ 94 /* appletouch */
92 { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, 95 { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
93 96
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index ea5ee9c21c35..757aa18027d0 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -19,21 +19,21 @@ choice
19 19
20config USB_DWC3_HOST 20config USB_DWC3_HOST
21 bool "Host only mode" 21 bool "Host only mode"
22 depends on USB 22 depends on USB=y || USB=USB_DWC3
23 help 23 help
24 Select this when you want to use DWC3 in host mode only, 24 Select this when you want to use DWC3 in host mode only,
25 thereby the gadget feature will be regressed. 25 thereby the gadget feature will be regressed.
26 26
27config USB_DWC3_GADGET 27config USB_DWC3_GADGET
28 bool "Gadget only mode" 28 bool "Gadget only mode"
29 depends on USB_GADGET 29 depends on USB_GADGET=y || USB_GADGET=USB_DWC3
30 help 30 help
31 Select this when you want to use DWC3 in gadget mode only, 31 Select this when you want to use DWC3 in gadget mode only,
32 thereby the host feature will be regressed. 32 thereby the host feature will be regressed.
33 33
34config USB_DWC3_DUAL_ROLE 34config USB_DWC3_DUAL_ROLE
35 bool "Dual Role mode" 35 bool "Dual Role mode"
36 depends on (USB && USB_GADGET) 36 depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3))
37 help 37 help
38 This is the default mode of working of DWC3 controller where 38 This is the default mode of working of DWC3 controller where
39 both host and gadget features are enabled. 39 both host and gadget features are enabled.
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index a8afe6e26621..929e7dd6e58b 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -95,8 +95,6 @@ static int dwc3_exynos_remove_child(struct device *dev, void *unused)
95 return 0; 95 return 0;
96} 96}
97 97
98static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
99
100static int dwc3_exynos_probe(struct platform_device *pdev) 98static int dwc3_exynos_probe(struct platform_device *pdev)
101{ 99{
102 struct dwc3_exynos *exynos; 100 struct dwc3_exynos *exynos;
@@ -118,7 +116,9 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
118 * Once we move to full device tree support this will vanish off. 116 * Once we move to full device tree support this will vanish off.
119 */ 117 */
120 if (!dev->dma_mask) 118 if (!dev->dma_mask)
121 dev->dma_mask = &dwc3_exynos_dma_mask; 119 dev->dma_mask = &dev->coherent_dma_mask;
120 if (!dev->coherent_dma_mask)
121 dev->coherent_dma_mask = DMA_BIT_MASK(32);
122 122
123 platform_set_drvdata(pdev, exynos); 123 platform_set_drvdata(pdev, exynos);
124 124
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 83300d94a893..f41aa0d0c414 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -146,7 +146,6 @@ config USB_LPC32XX
146 depends on ARCH_LPC32XX 146 depends on ARCH_LPC32XX
147 depends on USB_PHY 147 depends on USB_PHY
148 select USB_ISP1301 148 select USB_ISP1301
149 select USB_OTG_UTILS
150 help 149 help
151 This option selects the USB device controller in the LPC32xx SoC. 150 This option selects the USB device controller in the LPC32xx SoC.
152 151
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index f2a970f75bfa..5a5128a226f7 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1992,8 +1992,6 @@ err_map_regs:
1992err_get_hclk: 1992err_get_hclk:
1993 clk_put(pclk); 1993 clk_put(pclk);
1994 1994
1995 platform_set_drvdata(pdev, NULL);
1996
1997 return ret; 1995 return ret;
1998} 1996}
1999 1997
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index 792297798147..fd24cb4540a4 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -2410,7 +2410,6 @@ static int bcm63xx_udc_remove(struct platform_device *pdev)
2410 usb_del_gadget_udc(&udc->gadget); 2410 usb_del_gadget_udc(&udc->gadget);
2411 BUG_ON(udc->driver); 2411 BUG_ON(udc->driver);
2412 2412
2413 platform_set_drvdata(pdev, NULL);
2414 bcm63xx_uninit_udc_hw(udc); 2413 bcm63xx_uninit_udc_hw(udc);
2415 2414
2416 return 0; 2415 return 0;
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 3d5cfc9c2c78..80e7f75a56c7 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -821,8 +821,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
821 gi->gstrings[i] = NULL; 821 gi->gstrings[i] = NULL;
822 s = usb_gstrings_attach(&gi->cdev, gi->gstrings, 822 s = usb_gstrings_attach(&gi->cdev, gi->gstrings,
823 USB_GADGET_FIRST_AVAIL_IDX); 823 USB_GADGET_FIRST_AVAIL_IDX);
824 if (IS_ERR(s)) 824 if (IS_ERR(s)) {
825 ret = PTR_ERR(s);
825 goto err_comp_cleanup; 826 goto err_comp_cleanup;
827 }
826 828
827 gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; 829 gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id;
828 gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; 830 gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id;
@@ -847,8 +849,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
847 } 849 }
848 cfg->gstrings[i] = NULL; 850 cfg->gstrings[i] = NULL;
849 s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); 851 s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1);
850 if (IS_ERR(s)) 852 if (IS_ERR(s)) {
853 ret = PTR_ERR(s);
851 goto err_comp_cleanup; 854 goto err_comp_cleanup;
855 }
852 c->iConfiguration = s[0].id; 856 c->iConfiguration = s[0].id;
853 } 857 }
854 858
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index a792e322f4f1..c588e8e486e5 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1001,7 +1001,6 @@ static int dummy_udc_remove(struct platform_device *pdev)
1001 struct dummy *dum = platform_get_drvdata(pdev); 1001 struct dummy *dum = platform_get_drvdata(pdev);
1002 1002
1003 usb_del_gadget_udc(&dum->gadget); 1003 usb_del_gadget_udc(&dum->gadget);
1004 platform_set_drvdata(pdev, NULL);
1005 device_remove_file(&dum->gadget.dev, &dev_attr_function); 1004 device_remove_file(&dum->gadget.dev, &dev_attr_function);
1006 return 0; 1005 return 0;
1007} 1006}
@@ -2661,8 +2660,10 @@ static int __init init(void)
2661 } 2660 }
2662 for (i = 0; i < mod_data.num; i++) { 2661 for (i = 0; i < mod_data.num; i++) {
2663 dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL); 2662 dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL);
2664 if (!dum[i]) 2663 if (!dum[i]) {
2664 retval = -ENOMEM;
2665 goto err_add_pdata; 2665 goto err_add_pdata;
2666 }
2666 retval = platform_device_add_data(the_hcd_pdev[i], &dum[i], 2667 retval = platform_device_add_data(the_hcd_pdev[i], &dum[i],
2667 sizeof(void *)); 2668 sizeof(void *));
2668 if (retval) 2669 if (retval)
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index d893d6929079..abf8a31ae146 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -816,6 +816,7 @@ ecm_unbind(struct usb_configuration *c, struct usb_function *f)
816 * @c: the configuration to support the network link 816 * @c: the configuration to support the network link
817 * @ethaddr: a buffer in which the ethernet address of the host side 817 * @ethaddr: a buffer in which the ethernet address of the host side
818 * side of the link was recorded 818 * side of the link was recorded
819 * @dev: eth_dev structure
819 * Context: single threaded during gadget setup 820 * Context: single threaded during gadget setup
820 * 821 *
821 * Returns zero on success, else negative errno. 822 * Returns zero on success, else negative errno.
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c
index 185d6f5e4e4d..7be04b342494 100644
--- a/drivers/usb/gadget/f_subset.c
+++ b/drivers/usb/gadget/f_subset.c
@@ -373,6 +373,7 @@ geth_unbind(struct usb_configuration *c, struct usb_function *f)
373 * @c: the configuration to support the network link 373 * @c: the configuration to support the network link
374 * @ethaddr: a buffer in which the ethernet address of the host side 374 * @ethaddr: a buffer in which the ethernet address of the host side
375 * side of the link was recorded 375 * side of the link was recorded
376 * @dev: eth_dev structure
376 * Context: single threaded during gadget setup 377 * Context: single threaded during gadget setup
377 * 378 *
378 * Returns zero on success, else negative errno. 379 * Returns zero on success, else negative errno.
diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c
index c7468b6c07b0..03c1fb686644 100644
--- a/drivers/usb/gadget/f_uac2.c
+++ b/drivers/usb/gadget/f_uac2.c
@@ -456,8 +456,6 @@ static int snd_uac2_remove(struct platform_device *pdev)
456{ 456{
457 struct snd_card *card = platform_get_drvdata(pdev); 457 struct snd_card *card = platform_get_drvdata(pdev);
458 458
459 platform_set_drvdata(pdev, NULL);
460
461 if (card) 459 if (card)
462 return snd_card_free(card); 460 return snd_card_free(card);
463 461
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
index cec8871b77f9..b8632d40f8bf 100644
--- a/drivers/usb/gadget/fusb300_udc.c
+++ b/drivers/usb/gadget/fusb300_udc.c
@@ -1461,8 +1461,10 @@ static int __init fusb300_probe(struct platform_device *pdev)
1461 1461
1462 fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, 1462 fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep,
1463 GFP_KERNEL); 1463 GFP_KERNEL);
1464 if (fusb300->ep0_req == NULL) 1464 if (fusb300->ep0_req == NULL) {
1465 ret = -ENOMEM;
1465 goto clean_up3; 1466 goto clean_up3;
1467 }
1466 1468
1467 init_controller(fusb300); 1469 init_controller(fusb300);
1468 ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget); 1470 ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget);
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
index b5cebd6b0d7a..9b2d24e4c95f 100644
--- a/drivers/usb/gadget/imx_udc.c
+++ b/drivers/usb/gadget/imx_udc.c
@@ -1511,8 +1511,6 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
1511 if (pdata->exit) 1511 if (pdata->exit)
1512 pdata->exit(&pdev->dev); 1512 pdata->exit(&pdev->dev);
1513 1513
1514 platform_set_drvdata(pdev, NULL);
1515
1516 return 0; 1514 return 0;
1517} 1515}
1518 1516
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 866ef0999247..51cfe72da5bb 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1660,8 +1660,10 @@ static int __init m66592_probe(struct platform_device *pdev)
1660 m66592->epaddr2ep[0] = &m66592->ep[0]; 1660 m66592->epaddr2ep[0] = &m66592->ep[0];
1661 1661
1662 m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); 1662 m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL);
1663 if (m66592->ep0_req == NULL) 1663 if (m66592->ep0_req == NULL) {
1664 ret = -ENOMEM;
1664 goto clean_up3; 1665 goto clean_up3;
1666 }
1665 m66592->ep0_req->complete = nop_completion; 1667 m66592->ep0_req->complete = nop_completion;
1666 1668
1667 init_controller(m66592); 1669 init_controller(m66592);
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index ef47495dec8f..95c531d5aa4f 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -2236,7 +2236,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2236 dev->transceiver = NULL; 2236 dev->transceiver = NULL;
2237 } 2237 }
2238 2238
2239 platform_set_drvdata(pdev, NULL);
2240 the_controller = NULL; 2239 the_controller = NULL;
2241 return 0; 2240 return 0;
2242} 2241}
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 0b742d171843..7ff7d9cf2061 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1977,8 +1977,10 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1977 1977
1978 r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep, 1978 r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep,
1979 GFP_KERNEL); 1979 GFP_KERNEL);
1980 if (r8a66597->ep0_req == NULL) 1980 if (r8a66597->ep0_req == NULL) {
1981 ret = -ENOMEM;
1981 goto clean_up3; 1982 goto clean_up3;
1983 }
1982 r8a66597->ep0_req->complete = nop_completion; 1984 r8a66597->ep0_req->complete = nop_completion;
1983 1985
1984 ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); 1986 ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget);
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index a3cdc32115d5..af22f24046b2 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -437,7 +437,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
437 if (hs_req->req.length == 0) 437 if (hs_req->req.length == 0)
438 return; 438 return;
439 439
440 usb_gadget_unmap_request(&hsotg->gadget, hs_req, hs_ep->dir_in); 440 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in);
441} 441}
442 442
443/** 443/**
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index d0e75e1b3ccb..09c4f70c93c4 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1851,6 +1851,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1851 irq = gpio_to_irq(udc_info->vbus_pin); 1851 irq = gpio_to_irq(udc_info->vbus_pin);
1852 if (irq < 0) { 1852 if (irq < 0) {
1853 dev_err(dev, "no irq for gpio vbus pin\n"); 1853 dev_err(dev, "no irq for gpio vbus pin\n");
1854 retval = irq;
1854 goto err_gpio_claim; 1855 goto err_gpio_claim;
1855 } 1856 }
1856 1857
@@ -1948,8 +1949,6 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
1948 iounmap(base_addr); 1949 iounmap(base_addr);
1949 release_mem_region(rsrc_start, rsrc_len); 1950 release_mem_region(rsrc_start, rsrc_len);
1950 1951
1951 platform_set_drvdata(pdev, NULL);
1952
1953 if (!IS_ERR(udc_clock) && udc_clock != NULL) { 1952 if (!IS_ERR(udc_clock) && udc_clock != NULL) {
1954 clk_disable(udc_clock); 1953 clk_disable(udc_clock);
1955 clk_put(udc_clock); 1954 clk_put(udc_clock);
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 2cd6262e8b71..0deb9d6cde26 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -284,12 +284,16 @@ static int __init zero_bind(struct usb_composite_dev *cdev)
284 ss_opts->bulk_buflen = gzero_options.bulk_buflen; 284 ss_opts->bulk_buflen = gzero_options.bulk_buflen;
285 285
286 func_ss = usb_get_function(func_inst_ss); 286 func_ss = usb_get_function(func_inst_ss);
287 if (IS_ERR(func_ss)) 287 if (IS_ERR(func_ss)) {
288 status = PTR_ERR(func_ss);
288 goto err_put_func_inst_ss; 289 goto err_put_func_inst_ss;
290 }
289 291
290 func_inst_lb = usb_get_function_instance("Loopback"); 292 func_inst_lb = usb_get_function_instance("Loopback");
291 if (IS_ERR(func_inst_lb)) 293 if (IS_ERR(func_inst_lb)) {
294 status = PTR_ERR(func_inst_lb);
292 goto err_put_func_ss; 295 goto err_put_func_ss;
296 }
293 297
294 lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst); 298 lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst);
295 lb_opts->bulk_buflen = gzero_options.bulk_buflen; 299 lb_opts->bulk_buflen = gzero_options.bulk_buflen;
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index de94f2699063..344d5e2f87d7 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -507,7 +507,7 @@ endif # USB_OHCI_HCD
507 507
508config USB_UHCI_HCD 508config USB_UHCI_HCD
509 tristate "UHCI HCD (most Intel and VIA) support" 509 tristate "UHCI HCD (most Intel and VIA) support"
510 depends on PCI || SPARC_LEON || ARCH_VT8500 510 depends on PCI || USB_UHCI_SUPPORT_NON_PCI_HC
511 ---help--- 511 ---help---
512 The Universal Host Controller Interface is a standard by Intel for 512 The Universal Host Controller Interface is a standard by Intel for
513 accessing the USB hardware in the PC (which is also called the USB 513 accessing the USB hardware in the PC (which is also called the USB
@@ -524,26 +524,19 @@ config USB_UHCI_HCD
524 524
525config USB_UHCI_SUPPORT_NON_PCI_HC 525config USB_UHCI_SUPPORT_NON_PCI_HC
526 bool 526 bool
527 depends on USB_UHCI_HCD 527 default y if (SPARC_LEON || USB_UHCI_PLATFORM)
528 default y if (SPARC_LEON || ARCH_VT8500)
529 528
530config USB_UHCI_PLATFORM 529config USB_UHCI_PLATFORM
531 bool "Generic UHCI Platform Driver support" 530 bool
532 depends on USB_UHCI_SUPPORT_NON_PCI_HC
533 default y if ARCH_VT8500 531 default y if ARCH_VT8500
534 ---help---
535 Enable support for generic UHCI platform devices that require no
536 additional configuration.
537 532
538config USB_UHCI_BIG_ENDIAN_MMIO 533config USB_UHCI_BIG_ENDIAN_MMIO
539 bool 534 bool
540 depends on USB_UHCI_SUPPORT_NON_PCI_HC && SPARC_LEON 535 default y if SPARC_LEON
541 default y
542 536
543config USB_UHCI_BIG_ENDIAN_DESC 537config USB_UHCI_BIG_ENDIAN_DESC
544 bool 538 bool
545 depends on USB_UHCI_SUPPORT_NON_PCI_HC && SPARC_LEON 539 default y if SPARC_LEON
546 default y
547 540
548config USB_FHCI_HCD 541config USB_FHCI_HCD
549 tristate "Freescale QE USB Host Controller support" 542 tristate "Freescale QE USB Host Controller support"
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 66420097c242..02f4611faa62 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -63,8 +63,6 @@ static void atmel_stop_ehci(struct platform_device *pdev)
63 63
64/*-------------------------------------------------------------------------*/ 64/*-------------------------------------------------------------------------*/
65 65
66static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32);
67
68static int ehci_atmel_drv_probe(struct platform_device *pdev) 66static int ehci_atmel_drv_probe(struct platform_device *pdev)
69{ 67{
70 struct usb_hcd *hcd; 68 struct usb_hcd *hcd;
@@ -93,7 +91,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
93 * Once we have dma capability bindings this can go away. 91 * Once we have dma capability bindings this can go away.
94 */ 92 */
95 if (!pdev->dev.dma_mask) 93 if (!pdev->dev.dma_mask)
96 pdev->dev.dma_mask = &at91_ehci_dma_mask; 94 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
95 if (!pdev->dev.coherent_dma_mask)
96 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
97 97
98 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 98 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
99 if (!hcd) { 99 if (!hcd) {
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 312fc10da3c7..246e124e6ac5 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1286,23 +1286,6 @@ MODULE_LICENSE ("GPL");
1286#define PLATFORM_DRIVER ehci_hcd_sead3_driver 1286#define PLATFORM_DRIVER ehci_hcd_sead3_driver
1287#endif 1287#endif
1288 1288
1289#if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \
1290 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
1291 !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
1292 !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
1293 !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
1294 !IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \
1295 !IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \
1296 !IS_ENABLED(CONFIG_USB_EHCI_S5P) && \
1297 !IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \
1298 !IS_ENABLED(CONFIG_USB_EHCI_MSM) && \
1299 !defined(PLATFORM_DRIVER) && \
1300 !defined(PS3_SYSTEM_BUS_DRIVER) && \
1301 !defined(OF_PLATFORM_DRIVER) && \
1302 !defined(XILINX_OF_PLATFORM_DRIVER)
1303#error "missing bus glue for ehci-hcd"
1304#endif
1305
1306static int __init ehci_hcd_init(void) 1289static int __init ehci_hcd_init(void)
1307{ 1290{
1308 int retval = 0; 1291 int retval = 0;
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 3d1491b5f360..16d7150e8557 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -90,8 +90,6 @@ static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
90 .extra_priv_size = sizeof(struct omap_hcd), 90 .extra_priv_size = sizeof(struct omap_hcd),
91}; 91};
92 92
93static u64 omap_ehci_dma_mask = DMA_BIT_MASK(32);
94
95/** 93/**
96 * ehci_hcd_omap_probe - initialize TI-based HCDs 94 * ehci_hcd_omap_probe - initialize TI-based HCDs
97 * 95 *
@@ -146,8 +144,10 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
146 * Since shared usb code relies on it, set it here for now. 144 * Since shared usb code relies on it, set it here for now.
147 * Once we have dma capability bindings this can go away. 145 * Once we have dma capability bindings this can go away.
148 */ 146 */
149 if (!pdev->dev.dma_mask) 147 if (!dev->dma_mask)
150 pdev->dev.dma_mask = &omap_ehci_dma_mask; 148 dev->dma_mask = &dev->coherent_dma_mask;
149 if (!dev->coherent_dma_mask)
150 dev->coherent_dma_mask = DMA_BIT_MASK(32);
151 151
152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, 152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
153 dev_name(dev)); 153 dev_name(dev));
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 54c579485150..efbc588b48c5 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -137,8 +137,6 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
137 } 137 }
138} 138}
139 139
140static u64 ehci_orion_dma_mask = DMA_BIT_MASK(32);
141
142static int ehci_orion_drv_probe(struct platform_device *pdev) 140static int ehci_orion_drv_probe(struct platform_device *pdev)
143{ 141{
144 struct orion_ehci_data *pd = pdev->dev.platform_data; 142 struct orion_ehci_data *pd = pdev->dev.platform_data;
@@ -183,7 +181,9 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
183 * now. Once we have dma capability bindings this can go away. 181 * now. Once we have dma capability bindings this can go away.
184 */ 182 */
185 if (!pdev->dev.dma_mask) 183 if (!pdev->dev.dma_mask)
186 pdev->dev.dma_mask = &ehci_orion_dma_mask; 184 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
185 if (!pdev->dev.coherent_dma_mask)
186 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
187 187
188 if (!request_mem_region(res->start, resource_size(res), 188 if (!request_mem_region(res->start, resource_size(res),
189 ehci_orion_hc_driver.description)) { 189 ehci_orion_hc_driver.description)) {
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 635775278c7f..379037f51a2f 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -71,8 +71,6 @@ static void s5p_setup_vbus_gpio(struct platform_device *pdev)
71 dev_err(dev, "can't request ehci vbus gpio %d", gpio); 71 dev_err(dev, "can't request ehci vbus gpio %d", gpio);
72} 72}
73 73
74static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
75
76static int s5p_ehci_probe(struct platform_device *pdev) 74static int s5p_ehci_probe(struct platform_device *pdev)
77{ 75{
78 struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; 76 struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
@@ -90,7 +88,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
90 * Once we move to full device tree support this will vanish off. 88 * Once we move to full device tree support this will vanish off.
91 */ 89 */
92 if (!pdev->dev.dma_mask) 90 if (!pdev->dev.dma_mask)
93 pdev->dev.dma_mask = &ehci_s5p_dma_mask; 91 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
94 if (!pdev->dev.coherent_dma_mask) 92 if (!pdev->dev.coherent_dma_mask)
95 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 93 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
96 94
@@ -107,6 +105,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
107 if (IS_ERR(phy)) { 105 if (IS_ERR(phy)) {
108 /* Fallback to pdata */ 106 /* Fallback to pdata */
109 if (!pdata) { 107 if (!pdata) {
108 usb_put_hcd(hcd);
110 dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); 109 dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
111 return -EPROBE_DEFER; 110 return -EPROBE_DEFER;
112 } else { 111 } else {
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 61ecfb3d52f5..bd3e5cbc6240 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -58,8 +58,6 @@ static int ehci_spear_drv_resume(struct device *dev)
58static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, 58static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend,
59 ehci_spear_drv_resume); 59 ehci_spear_drv_resume);
60 60
61static u64 spear_ehci_dma_mask = DMA_BIT_MASK(32);
62
63static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) 61static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
64{ 62{
65 struct usb_hcd *hcd ; 63 struct usb_hcd *hcd ;
@@ -84,7 +82,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
84 * Once we have dma capability bindings this can go away. 82 * Once we have dma capability bindings this can go away.
85 */ 83 */
86 if (!pdev->dev.dma_mask) 84 if (!pdev->dev.dma_mask)
87 pdev->dev.dma_mask = &spear_ehci_dma_mask; 85 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
86 if (!pdev->dev.coherent_dma_mask)
87 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
88 88
89 usbh_clk = devm_clk_get(&pdev->dev, NULL); 89 usbh_clk = devm_clk_get(&pdev->dev, NULL);
90 if (IS_ERR(usbh_clk)) { 90 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index e3eddc31ac83..59d111bf44a9 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -637,8 +637,6 @@ static void tegra_ehci_set_phcd(struct usb_phy *x, bool enable)
637 writel(val, base + TEGRA_USB_PORTSC1); 637 writel(val, base + TEGRA_USB_PORTSC1);
638} 638}
639 639
640static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32);
641
642static int tegra_ehci_probe(struct platform_device *pdev) 640static int tegra_ehci_probe(struct platform_device *pdev)
643{ 641{
644 struct resource *res; 642 struct resource *res;
@@ -661,7 +659,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
661 * Once we have dma capability bindings this can go away. 659 * Once we have dma capability bindings this can go away.
662 */ 660 */
663 if (!pdev->dev.dma_mask) 661 if (!pdev->dev.dma_mask)
664 pdev->dev.dma_mask = &tegra_ehci_dma_mask; 662 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
663 if (!pdev->dev.coherent_dma_mask)
664 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
665 665
666 setup_vbus_gpio(pdev, pdata); 666 setup_vbus_gpio(pdev, pdata);
667 667
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 125e261f5bfc..2facee53eab1 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1739,7 +1739,7 @@ static int isp1760_hub_status_data(struct usb_hcd *hcd, char *buf)
1739 int retval = 1; 1739 int retval = 1;
1740 unsigned long flags; 1740 unsigned long flags;
1741 1741
1742 /* if !USB_SUSPEND, root hub timers won't get shut down ... */ 1742 /* if !PM_RUNTIME, root hub timers won't get shut down ... */
1743 if (!HC_IS_RUNNING(hcd->state)) 1743 if (!HC_IS_RUNNING(hcd->state))
1744 return 0; 1744 return 0;
1745 1745
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index bbb791bd7617..a13709ee4e5d 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -373,8 +373,10 @@ static int isp1760_plat_probe(struct platform_device *pdev)
373 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 373 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
374 if (!irq_res) { 374 if (!irq_res) {
375 pr_warning("isp1760: IRQ resource not available\n"); 375 pr_warning("isp1760: IRQ resource not available\n");
376 return -ENODEV; 376 ret = -ENODEV;
377 goto cleanup;
377 } 378 }
379
378 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK; 380 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK;
379 381
380 if (priv) { 382 if (priv) {
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a0cb44f0e724..2ee1496dbc1d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -504,8 +504,6 @@ static const struct of_device_id at91_ohci_dt_ids[] = {
504 504
505MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids); 505MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
506 506
507static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
508
509static int ohci_at91_of_init(struct platform_device *pdev) 507static int ohci_at91_of_init(struct platform_device *pdev)
510{ 508{
511 struct device_node *np = pdev->dev.of_node; 509 struct device_node *np = pdev->dev.of_node;
@@ -522,7 +520,9 @@ static int ohci_at91_of_init(struct platform_device *pdev)
522 * Once we have dma capability bindings this can go away. 520 * Once we have dma capability bindings this can go away.
523 */ 521 */
524 if (!pdev->dev.dma_mask) 522 if (!pdev->dev.dma_mask)
525 pdev->dev.dma_mask = &at91_ohci_dma_mask; 523 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
524 if (!pdev->dev.coherent_dma_mask)
525 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
526 526
527 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 527 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
528 if (!pdata) 528 if (!pdata)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 07592c00af26..b0b542c14e31 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -98,8 +98,6 @@ static const struct hc_driver exynos_ohci_hc_driver = {
98 .start_port_reset = ohci_start_port_reset, 98 .start_port_reset = ohci_start_port_reset,
99}; 99};
100 100
101static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32);
102
103static int exynos_ohci_probe(struct platform_device *pdev) 101static int exynos_ohci_probe(struct platform_device *pdev)
104{ 102{
105 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; 103 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
@@ -117,7 +115,7 @@ static int exynos_ohci_probe(struct platform_device *pdev)
117 * Once we move to full device tree support this will vanish off. 115 * Once we move to full device tree support this will vanish off.
118 */ 116 */
119 if (!pdev->dev.dma_mask) 117 if (!pdev->dev.dma_mask)
120 pdev->dev.dma_mask = &ohci_exynos_dma_mask; 118 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
121 if (!pdev->dev.coherent_dma_mask) 119 if (!pdev->dev.coherent_dma_mask)
122 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 120 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
123 121
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 9e6de9586ae4..fc627fd54116 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -233,14 +233,14 @@ static int ohci_urb_enqueue (
233 urb->start_frame = frame; 233 urb->start_frame = frame;
234 } 234 }
235 } else if (ed->type == PIPE_ISOCHRONOUS) { 235 } else if (ed->type == PIPE_ISOCHRONOUS) {
236 u16 next = ohci_frame_no(ohci) + 2; 236 u16 next = ohci_frame_no(ohci) + 1;
237 u16 frame = ed->last_iso + ed->interval; 237 u16 frame = ed->last_iso + ed->interval;
238 238
239 /* Behind the scheduling threshold? */ 239 /* Behind the scheduling threshold? */
240 if (unlikely(tick_before(frame, next))) { 240 if (unlikely(tick_before(frame, next))) {
241 241
242 /* USB_ISO_ASAP: Round up to the first available slot */ 242 /* USB_ISO_ASAP: Round up to the first available slot */
243 if (urb->transfer_flags & URB_ISO_ASAP) 243 if (urb->transfer_flags & URB_ISO_ASAP) {
244 frame += (next - frame + ed->interval - 1) & 244 frame += (next - frame + ed->interval - 1) &
245 -ed->interval; 245 -ed->interval;
246 246
@@ -248,21 +248,25 @@ static int ohci_urb_enqueue (
248 * Not ASAP: Use the next slot in the stream. If 248 * Not ASAP: Use the next slot in the stream. If
249 * the entire URB falls before the threshold, fail. 249 * the entire URB falls before the threshold, fail.
250 */ 250 */
251 else if (tick_before(frame + ed->interval * 251 } else {
252 if (tick_before(frame + ed->interval *
252 (urb->number_of_packets - 1), next)) { 253 (urb->number_of_packets - 1), next)) {
253 retval = -EXDEV; 254 retval = -EXDEV;
254 usb_hcd_unlink_urb_from_ep(hcd, urb); 255 usb_hcd_unlink_urb_from_ep(hcd, urb);
255 goto fail; 256 goto fail;
256 } 257 }
257 258
258 /* 259 /*
259 * Some OHCI hardware doesn't handle late TDs 260 * Some OHCI hardware doesn't handle late TDs
260 * correctly. After retiring them it proceeds to 261 * correctly. After retiring them it proceeds
261 * the next ED instead of the next TD. Therefore 262 * to the next ED instead of the next TD.
262 * we have to omit the late TDs entirely. 263 * Therefore we have to omit the late TDs
263 */ 264 * entirely.
264 urb_priv->td_cnt = DIV_ROUND_UP(next - frame, 265 */
265 ed->interval); 266 urb_priv->td_cnt = DIV_ROUND_UP(
267 (u16) (next - frame),
268 ed->interval);
269 }
266 } 270 }
267 urb->start_frame = frame; 271 urb->start_frame = frame;
268 } 272 }
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index f303cb04c2dd..5d7eb72c5064 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -223,8 +223,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
223 223
224 isp1301_i2c_client = isp1301_get_client(isp1301_node); 224 isp1301_i2c_client = isp1301_get_client(isp1301_node);
225 if (!isp1301_i2c_client) { 225 if (!isp1301_i2c_client) {
226 ret = -EPROBE_DEFER; 226 return -EPROBE_DEFER;
227 goto out;
228 } 227 }
229 228
230 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 229 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
@@ -234,7 +233,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
234 if (usb_disabled()) { 233 if (usb_disabled()) {
235 dev_err(&pdev->dev, "USB is disabled\n"); 234 dev_err(&pdev->dev, "USB is disabled\n");
236 ret = -ENODEV; 235 ret = -ENODEV;
237 goto out; 236 goto fail_disable;
238 } 237 }
239 238
240 /* Enable AHB slave USB clock, needed for further USB clock control */ 239 /* Enable AHB slave USB clock, needed for further USB clock control */
@@ -245,19 +244,19 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
245 if (IS_ERR(usb_pll_clk)) { 244 if (IS_ERR(usb_pll_clk)) {
246 dev_err(&pdev->dev, "failed to acquire USB PLL\n"); 245 dev_err(&pdev->dev, "failed to acquire USB PLL\n");
247 ret = PTR_ERR(usb_pll_clk); 246 ret = PTR_ERR(usb_pll_clk);
248 goto out1; 247 goto fail_pll;
249 } 248 }
250 249
251 ret = clk_enable(usb_pll_clk); 250 ret = clk_enable(usb_pll_clk);
252 if (ret < 0) { 251 if (ret < 0) {
253 dev_err(&pdev->dev, "failed to start USB PLL\n"); 252 dev_err(&pdev->dev, "failed to start USB PLL\n");
254 goto out2; 253 goto fail_pllen;
255 } 254 }
256 255
257 ret = clk_set_rate(usb_pll_clk, 48000); 256 ret = clk_set_rate(usb_pll_clk, 48000);
258 if (ret < 0) { 257 if (ret < 0) {
259 dev_err(&pdev->dev, "failed to set USB clock rate\n"); 258 dev_err(&pdev->dev, "failed to set USB clock rate\n");
260 goto out3; 259 goto fail_rate;
261 } 260 }
262 261
263 /* Enable USB device clock */ 262 /* Enable USB device clock */
@@ -265,13 +264,13 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
265 if (IS_ERR(usb_dev_clk)) { 264 if (IS_ERR(usb_dev_clk)) {
266 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); 265 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
267 ret = PTR_ERR(usb_dev_clk); 266 ret = PTR_ERR(usb_dev_clk);
268 goto out4; 267 goto fail_dev;
269 } 268 }
270 269
271 ret = clk_enable(usb_dev_clk); 270 ret = clk_enable(usb_dev_clk);
272 if (ret < 0) { 271 if (ret < 0) {
273 dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); 272 dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
274 goto out5; 273 goto fail_deven;
275 } 274 }
276 275
277 /* Enable USB otg clocks */ 276 /* Enable USB otg clocks */
@@ -279,7 +278,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
279 if (IS_ERR(usb_otg_clk)) { 278 if (IS_ERR(usb_otg_clk)) {
280 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); 279 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
281 ret = PTR_ERR(usb_otg_clk); 280 ret = PTR_ERR(usb_otg_clk);
282 goto out6; 281 goto fail_otg;
283 } 282 }
284 283
285 __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL); 284 __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
@@ -287,7 +286,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
287 ret = clk_enable(usb_otg_clk); 286 ret = clk_enable(usb_otg_clk);
288 if (ret < 0) { 287 if (ret < 0) {
289 dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); 288 dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
290 goto out7; 289 goto fail_otgen;
291 } 290 }
292 291
293 isp1301_configure(); 292 isp1301_configure();
@@ -296,14 +295,14 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
296 if (!hcd) { 295 if (!hcd) {
297 dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); 296 dev_err(&pdev->dev, "Failed to allocate HC buffer\n");
298 ret = -ENOMEM; 297 ret = -ENOMEM;
299 goto out8; 298 goto fail_hcd;
300 } 299 }
301 300
302 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 301 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
303 hcd->regs = devm_ioremap_resource(&pdev->dev, res); 302 hcd->regs = devm_ioremap_resource(&pdev->dev, res);
304 if (IS_ERR(hcd->regs)) { 303 if (IS_ERR(hcd->regs)) {
305 ret = PTR_ERR(hcd->regs); 304 ret = PTR_ERR(hcd->regs);
306 goto out8; 305 goto fail_resource;
307 } 306 }
308 hcd->rsrc_start = res->start; 307 hcd->rsrc_start = res->start;
309 hcd->rsrc_len = resource_size(res); 308 hcd->rsrc_len = resource_size(res);
@@ -311,7 +310,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
311 irq = platform_get_irq(pdev, 0); 310 irq = platform_get_irq(pdev, 0);
312 if (irq < 0) { 311 if (irq < 0) {
313 ret = -ENXIO; 312 ret = -ENXIO;
314 goto out8; 313 goto fail_resource;
315 } 314 }
316 315
317 nxp_start_hc(); 316 nxp_start_hc();
@@ -325,23 +324,24 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
325 return ret; 324 return ret;
326 325
327 nxp_stop_hc(); 326 nxp_stop_hc();
328out8: 327fail_resource:
329 usb_put_hcd(hcd); 328 usb_put_hcd(hcd);
330out7: 329fail_hcd:
331 clk_disable(usb_otg_clk); 330 clk_disable(usb_otg_clk);
332out6: 331fail_otgen:
333 clk_put(usb_otg_clk); 332 clk_put(usb_otg_clk);
334out5: 333fail_otg:
335 clk_disable(usb_dev_clk); 334 clk_disable(usb_dev_clk);
336out4: 335fail_deven:
337 clk_put(usb_dev_clk); 336 clk_put(usb_dev_clk);
338out3: 337fail_dev:
338fail_rate:
339 clk_disable(usb_pll_clk); 339 clk_disable(usb_pll_clk);
340out2: 340fail_pllen:
341 clk_put(usb_pll_clk); 341 clk_put(usb_pll_clk);
342out1: 342fail_pll:
343fail_disable:
343 isp1301_i2c_client = NULL; 344 isp1301_i2c_client = NULL;
344out:
345 return ret; 345 return ret;
346} 346}
347 347
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index ddfc31427bc0..8663851c8d8e 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -114,8 +114,6 @@ static const struct hc_driver ohci_omap3_hc_driver = {
114 114
115/*-------------------------------------------------------------------------*/ 115/*-------------------------------------------------------------------------*/
116 116
117static u64 omap_ohci_dma_mask = DMA_BIT_MASK(32);
118
119/* 117/*
120 * configure so an HC device and id are always provided 118 * configure so an HC device and id are always provided
121 * always called with process context; sleeping is OK 119 * always called with process context; sleeping is OK
@@ -168,8 +166,10 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
168 * Since shared usb code relies on it, set it here for now. 166 * Since shared usb code relies on it, set it here for now.
169 * Once we have dma capability bindings this can go away. 167 * Once we have dma capability bindings this can go away.
170 */ 168 */
171 if (!pdev->dev.dma_mask) 169 if (!dev->dma_mask)
172 pdev->dev.dma_mask = &omap_ohci_dma_mask; 170 dev->dma_mask = &dev->coherent_dma_mask;
171 if (!dev->coherent_dma_mask)
172 dev->coherent_dma_mask = DMA_BIT_MASK(32);
173 173
174 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, 174 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
175 dev_name(dev)); 175 dev_name(dev));
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index efe71f3ca477..279b2ef17411 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -282,8 +282,6 @@ static const struct of_device_id pxa_ohci_dt_ids[] = {
282 282
283MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids); 283MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids);
284 284
285static u64 pxa_ohci_dma_mask = DMA_BIT_MASK(32);
286
287static int ohci_pxa_of_init(struct platform_device *pdev) 285static int ohci_pxa_of_init(struct platform_device *pdev)
288{ 286{
289 struct device_node *np = pdev->dev.of_node; 287 struct device_node *np = pdev->dev.of_node;
@@ -298,7 +296,9 @@ static int ohci_pxa_of_init(struct platform_device *pdev)
298 * Once we have dma capability bindings this can go away. 296 * Once we have dma capability bindings this can go away.
299 */ 297 */
300 if (!pdev->dev.dma_mask) 298 if (!pdev->dev.dma_mask)
301 pdev->dev.dma_mask = &pxa_ohci_dma_mask; 299 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
300 if (!pdev->dev.coherent_dma_mask)
301 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
302 302
303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
304 if (!pdata) 304 if (!pdata)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 9020bf0e2eca..3e19e0170d11 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -91,8 +91,6 @@ static const struct hc_driver ohci_spear_hc_driver = {
91 .start_port_reset = ohci_start_port_reset, 91 .start_port_reset = ohci_start_port_reset,
92}; 92};
93 93
94static u64 spear_ohci_dma_mask = DMA_BIT_MASK(32);
95
96static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) 94static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
97{ 95{
98 const struct hc_driver *driver = &ohci_spear_hc_driver; 96 const struct hc_driver *driver = &ohci_spear_hc_driver;
@@ -114,7 +112,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
114 * Once we have dma capability bindings this can go away. 112 * Once we have dma capability bindings this can go away.
115 */ 113 */
116 if (!pdev->dev.dma_mask) 114 if (!pdev->dev.dma_mask)
117 pdev->dev.dma_mask = &spear_ohci_dma_mask; 115 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
116 if (!pdev->dev.coherent_dma_mask)
117 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
118 118
119 usbh_clk = devm_clk_get(&pdev->dev, NULL); 119 usbh_clk = devm_clk_get(&pdev->dev, NULL);
120 if (IS_ERR(usbh_clk)) { 120 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 4f0f0339532f..0f401dbfaf07 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -3084,7 +3084,7 @@ static int oxu_hub_status_data(struct usb_hcd *hcd, char *buf)
3084 int ports, i, retval = 1; 3084 int ports, i, retval = 1;
3085 unsigned long flags; 3085 unsigned long flags;
3086 3086
3087 /* if !USB_SUSPEND, root hub timers won't get shut down ... */ 3087 /* if !PM_RUNTIME, root hub timers won't get shut down ... */
3088 if (!HC_IS_RUNNING(hcd->state)) 3088 if (!HC_IS_RUNNING(hcd->state))
3089 return 0; 3089 return 0;
3090 3090
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index ad4483efb6d6..b2ec7fe758dd 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -22,7 +22,7 @@
22 * and usb-storage. 22 * and usb-storage.
23 * 23 *
24 * TODO: 24 * TODO:
25 * - usb suspend/resume triggered by sl811 (with USB_SUSPEND) 25 * - usb suspend/resume triggered by sl811 (with PM_RUNTIME)
26 * - various issues noted in the code 26 * - various issues noted in the code
27 * - performance work; use both register banks; ... 27 * - performance work; use both register banks; ...
28 * - use urb->iso_frame_desc[] with ISO transfers 28 * - use urb->iso_frame_desc[] with ISO transfers
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index f87bee6d2789..9189bc984c98 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -225,7 +225,8 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
225 /* auto-stop if nothing connected for 1 second */ 225 /* auto-stop if nothing connected for 1 second */
226 if (any_ports_active(uhci)) 226 if (any_ports_active(uhci))
227 uhci->rh_state = UHCI_RH_RUNNING; 227 uhci->rh_state = UHCI_RH_RUNNING;
228 else if (time_after_eq(jiffies, uhci->auto_stop_time)) 228 else if (time_after_eq(jiffies, uhci->auto_stop_time) &&
229 !uhci->wait_for_hp)
229 suspend_rh(uhci, UHCI_RH_AUTO_STOPPED); 230 suspend_rh(uhci, UHCI_RH_AUTO_STOPPED);
230 break; 231 break;
231 232
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index 8c4dace4b14a..f1db61ada6a8 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -60,8 +60,6 @@ static const struct hc_driver uhci_platform_hc_driver = {
60 .hub_control = uhci_hub_control, 60 .hub_control = uhci_hub_control,
61}; 61};
62 62
63static u64 platform_uhci_dma_mask = DMA_BIT_MASK(32);
64
65static int uhci_hcd_platform_probe(struct platform_device *pdev) 63static int uhci_hcd_platform_probe(struct platform_device *pdev)
66{ 64{
67 struct usb_hcd *hcd; 65 struct usb_hcd *hcd;
@@ -78,7 +76,9 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
78 * Once we have dma capability bindings this can go away. 76 * Once we have dma capability bindings this can go away.
79 */ 77 */
80 if (!pdev->dev.dma_mask) 78 if (!pdev->dev.dma_mask)
81 pdev->dev.dma_mask = &platform_uhci_dma_mask; 79 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
80 if (!pdev->dev.coherent_dma_mask)
81 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
82 82
83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, 83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev,
84 pdev->name); 84 pdev->name);
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index f0976d8190bc..041c6ddb695c 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1287,7 +1287,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
1287 return -EINVAL; /* Can't change the period */ 1287 return -EINVAL; /* Can't change the period */
1288 1288
1289 } else { 1289 } else {
1290 next = uhci->frame_number + 2; 1290 next = uhci->frame_number + 1;
1291 1291
1292 /* Find the next unused frame */ 1292 /* Find the next unused frame */
1293 if (list_empty(&qh->queue)) { 1293 if (list_empty(&qh->queue)) {
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 965b539bc474..2cfc465925bd 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1423,15 +1423,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1423 ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep)); 1423 ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep));
1424 1424
1425 /* Set the max packet size and max burst */ 1425 /* Set the max packet size and max burst */
1426 max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
1427 max_burst = 0;
1426 switch (udev->speed) { 1428 switch (udev->speed) {
1427 case USB_SPEED_SUPER: 1429 case USB_SPEED_SUPER:
1428 max_packet = usb_endpoint_maxp(&ep->desc);
1429 ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet));
1430 /* dig out max burst from ep companion desc */ 1430 /* dig out max burst from ep companion desc */
1431 max_packet = ep->ss_ep_comp.bMaxBurst; 1431 max_burst = ep->ss_ep_comp.bMaxBurst;
1432 ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_packet));
1433 break; 1432 break;
1434 case USB_SPEED_HIGH: 1433 case USB_SPEED_HIGH:
1434 /* Some devices get this wrong */
1435 if (usb_endpoint_xfer_bulk(&ep->desc))
1436 max_packet = 512;
1435 /* bits 11:12 specify the number of additional transaction 1437 /* bits 11:12 specify the number of additional transaction
1436 * opportunities per microframe (USB 2.0, section 9.6.6) 1438 * opportunities per microframe (USB 2.0, section 9.6.6)
1437 */ 1439 */
@@ -1439,17 +1441,16 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1439 usb_endpoint_xfer_int(&ep->desc)) { 1441 usb_endpoint_xfer_int(&ep->desc)) {
1440 max_burst = (usb_endpoint_maxp(&ep->desc) 1442 max_burst = (usb_endpoint_maxp(&ep->desc)
1441 & 0x1800) >> 11; 1443 & 0x1800) >> 11;
1442 ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_burst));
1443 } 1444 }
1444 /* Fall through */ 1445 break;
1445 case USB_SPEED_FULL: 1446 case USB_SPEED_FULL:
1446 case USB_SPEED_LOW: 1447 case USB_SPEED_LOW:
1447 max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
1448 ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet));
1449 break; 1448 break;
1450 default: 1449 default:
1451 BUG(); 1450 BUG();
1452 } 1451 }
1452 ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) |
1453 MAX_BURST(max_burst));
1453 max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep); 1454 max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
1454 ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload)); 1455 ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload));
1455 1456
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 3a18e44e9391..e1b661d04021 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -560,6 +560,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
560 if (!config) { 560 if (!config) {
561 dev_err(&pdev->dev, 561 dev_err(&pdev->dev,
562 "failed to allocate musb hdrc config\n"); 562 "failed to allocate musb hdrc config\n");
563 ret = -ENOMEM;
563 goto err2; 564 goto err2;
564 } 565 }
565 566
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 3551f1a30c65..628b93fe5ccc 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev)
549 glue->control_otghs = omap_get_control_dev(); 549 glue->control_otghs = omap_get_control_dev();
550 if (IS_ERR(glue->control_otghs)) { 550 if (IS_ERR(glue->control_otghs)) {
551 dev_vdbg(&pdev->dev, "Failed to get control device\n"); 551 dev_vdbg(&pdev->dev, "Failed to get control device\n");
552 return -ENODEV; 552 ret = PTR_ERR(glue->control_otghs);
553 goto err2;
553 } 554 }
554 } else { 555 } else {
555 glue->control_otghs = ERR_PTR(-ENODEV); 556 glue->control_otghs = ERR_PTR(-ENODEV);
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 371d0e74e909..7ef3eb8617a6 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -25,7 +25,7 @@ config AB8500_USB
25 25
26config FSL_USB2_OTG 26config FSL_USB2_OTG
27 bool "Freescale USB OTG Transceiver Driver" 27 bool "Freescale USB OTG Transceiver Driver"
28 depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_SUSPEND 28 depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME
29 select USB_OTG 29 select USB_OTG
30 help 30 help
31 Enable this to support Freescale USB OTG transceiver. 31 Enable this to support Freescale USB OTG transceiver.
@@ -139,7 +139,6 @@ config USB_ISP1301
139 tristate "NXP ISP1301 USB transceiver support" 139 tristate "NXP ISP1301 USB transceiver support"
140 depends on USB || USB_GADGET 140 depends on USB || USB_GADGET
141 depends on I2C 141 depends on I2C
142 select USB_OTG_UTILS
143 help 142 help
144 Say Y here to add support for the NXP ISP1301 USB transceiver driver. 143 Say Y here to add support for the NXP ISP1301 USB transceiver driver.
145 This chip is typically used as USB transceiver for USB host, gadget 144 This chip is typically used as USB transceiver for USB host, gadget
@@ -162,7 +161,7 @@ config USB_MSM_OTG
162 161
163config USB_MV_OTG 162config USB_MV_OTG
164 tristate "Marvell USB OTG support" 163 tristate "Marvell USB OTG support"
165 depends on USB_EHCI_MV && USB_MV_UDC && USB_SUSPEND 164 depends on USB_EHCI_MV && USB_MV_UDC && PM_RUNTIME
166 select USB_OTG 165 select USB_OTG
167 help 166 help
168 Say Y here if you want to build Marvell USB OTG transciever 167 Say Y here if you want to build Marvell USB OTG transciever
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 4acef26a2ef5..e5eb1b5a04eb 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -892,8 +892,6 @@ static int ab8500_usb_remove(struct platform_device *pdev)
892 else if (ab->mode == USB_PERIPHERAL) 892 else if (ab->mode == USB_PERIPHERAL)
893 ab8500_usb_peri_phy_dis(ab); 893 ab8500_usb_peri_phy_dis(ab);
894 894
895 platform_set_drvdata(pdev, NULL);
896
897 return 0; 895 return 0;
898} 896}
899 897
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 97b9308507c3..e771bafb9f1d 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -799,6 +799,7 @@ static int fsl_otg_conf(struct platform_device *pdev)
799 799
800 /* initialize the otg structure */ 800 /* initialize the otg structure */
801 fsl_otg_tc->phy.label = DRIVER_DESC; 801 fsl_otg_tc->phy.label = DRIVER_DESC;
802 fsl_otg_tc->phy.dev = &pdev->dev;
802 fsl_otg_tc->phy.set_power = fsl_otg_set_power; 803 fsl_otg_tc->phy.set_power = fsl_otg_set_power;
803 804
804 fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; 805 fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy;
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index 4c76074e518d..8443335c2ea0 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -266,6 +266,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
266 platform_set_drvdata(pdev, gpio_vbus); 266 platform_set_drvdata(pdev, gpio_vbus);
267 gpio_vbus->dev = &pdev->dev; 267 gpio_vbus->dev = &pdev->dev;
268 gpio_vbus->phy.label = "gpio-vbus"; 268 gpio_vbus->phy.label = "gpio-vbus";
269 gpio_vbus->phy.dev = gpio_vbus->dev;
269 gpio_vbus->phy.set_power = gpio_vbus_set_power; 270 gpio_vbus->phy.set_power = gpio_vbus_set_power;
270 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; 271 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend;
271 gpio_vbus->phy.state = OTG_STATE_UNDEFINED; 272 gpio_vbus->phy.state = OTG_STATE_UNDEFINED;
@@ -343,7 +344,6 @@ err_irq:
343 gpio_free(pdata->gpio_pullup); 344 gpio_free(pdata->gpio_pullup);
344 gpio_free(pdata->gpio_vbus); 345 gpio_free(pdata->gpio_vbus);
345err_gpio: 346err_gpio:
346 platform_set_drvdata(pdev, NULL);
347 kfree(gpio_vbus->phy.otg); 347 kfree(gpio_vbus->phy.otg);
348 kfree(gpio_vbus); 348 kfree(gpio_vbus);
349 return err; 349 return err;
@@ -365,7 +365,6 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev)
365 if (gpio_is_valid(pdata->gpio_pullup)) 365 if (gpio_is_valid(pdata->gpio_pullup))
366 gpio_free(pdata->gpio_pullup); 366 gpio_free(pdata->gpio_pullup);
367 gpio_free(gpio); 367 gpio_free(gpio);
368 platform_set_drvdata(pdev, NULL);
369 kfree(gpio_vbus->phy.otg); 368 kfree(gpio_vbus->phy.otg);
370 kfree(gpio_vbus); 369 kfree(gpio_vbus);
371 370
diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c
index 225ae6c97eeb..8a55b37d1a02 100644
--- a/drivers/usb/phy/phy-isp1301.c
+++ b/drivers/usb/phy/phy-isp1301.c
@@ -102,6 +102,7 @@ static int isp1301_probe(struct i2c_client *client,
102 mutex_init(&isp->mutex); 102 mutex_init(&isp->mutex);
103 103
104 phy = &isp->phy; 104 phy = &isp->phy;
105 phy->dev = &client->dev;
105 phy->label = DRV_NAME; 106 phy->label = DRV_NAME;
106 phy->init = isp1301_phy_init; 107 phy->init = isp1301_phy_init;
107 phy->set_vbus = isp1301_phy_set_vbus; 108 phy->set_vbus = isp1301_phy_set_vbus;
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
index c987bbe27851..4a6b03c73876 100644
--- a/drivers/usb/phy/phy-mv-usb.c
+++ b/drivers/usb/phy/phy-mv-usb.c
@@ -667,7 +667,6 @@ int mv_otg_remove(struct platform_device *pdev)
667 mv_otg_disable(mvotg); 667 mv_otg_disable(mvotg);
668 668
669 usb_remove_phy(&mvotg->phy); 669 usb_remove_phy(&mvotg->phy);
670 platform_set_drvdata(pdev, NULL);
671 670
672 return 0; 671 return 0;
673} 672}
@@ -850,8 +849,6 @@ err_destroy_workqueue:
850 flush_workqueue(mvotg->qwork); 849 flush_workqueue(mvotg->qwork);
851 destroy_workqueue(mvotg->qwork); 850 destroy_workqueue(mvotg->qwork);
852 851
853 platform_set_drvdata(pdev, NULL);
854
855 return retval; 852 return retval;
856} 853}
857 854
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index eb25dd2a1429..bd601c537c8d 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -155,6 +155,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
155 mxs_phy->phy.set_suspend = mxs_phy_suspend; 155 mxs_phy->phy.set_suspend = mxs_phy_suspend;
156 mxs_phy->phy.notify_connect = mxs_phy_on_connect; 156 mxs_phy->phy.notify_connect = mxs_phy_on_connect;
157 mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect; 157 mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect;
158 mxs_phy->phy.type = USB_PHY_TYPE_USB2;
158 159
159 ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier); 160 ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier);
160 161
@@ -175,8 +176,6 @@ static int mxs_phy_remove(struct platform_device *pdev)
175 176
176 usb_remove_phy(&mxs_phy->phy); 177 usb_remove_phy(&mxs_phy->phy);
177 178
178 platform_set_drvdata(pdev, NULL);
179
180 return 0; 179 return 0;
181} 180}
182 181
diff --git a/drivers/usb/phy/phy-nop.c b/drivers/usb/phy/phy-nop.c
index 2b10cc969bbb..638cc5dade35 100644
--- a/drivers/usb/phy/phy-nop.c
+++ b/drivers/usb/phy/phy-nop.c
@@ -254,8 +254,6 @@ static int nop_usb_xceiv_remove(struct platform_device *pdev)
254 254
255 usb_remove_phy(&nop->phy); 255 usb_remove_phy(&nop->phy);
256 256
257 platform_set_drvdata(pdev, NULL);
258
259 return 0; 257 return 0;
260} 258}
261 259
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 242b5776648a..7260ec660347 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -189,6 +189,8 @@ static struct usb_device_id id_table_combined [] = {
189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, 189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
190 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, 190 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) },
191 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, 191 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
192 { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) },
193 { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) },
192 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 194 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
193 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 195 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
194 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 196 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
@@ -924,8 +926,8 @@ static int ftdi_tiocmset(struct tty_struct *tty,
924static int ftdi_ioctl(struct tty_struct *tty, 926static int ftdi_ioctl(struct tty_struct *tty,
925 unsigned int cmd, unsigned long arg); 927 unsigned int cmd, unsigned long arg);
926static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 928static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
927static int ftdi_chars_in_buffer(struct tty_struct *tty); 929static bool ftdi_tx_empty(struct usb_serial_port *port);
928static int ftdi_get_modem_status(struct tty_struct *tty, 930static int ftdi_get_modem_status(struct usb_serial_port *port,
929 unsigned char status[2]); 931 unsigned char status[2]);
930 932
931static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); 933static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base);
@@ -961,7 +963,7 @@ static struct usb_serial_driver ftdi_sio_device = {
961 .ioctl = ftdi_ioctl, 963 .ioctl = ftdi_ioctl,
962 .set_termios = ftdi_set_termios, 964 .set_termios = ftdi_set_termios,
963 .break_ctl = ftdi_break_ctl, 965 .break_ctl = ftdi_break_ctl,
964 .chars_in_buffer = ftdi_chars_in_buffer, 966 .tx_empty = ftdi_tx_empty,
965}; 967};
966 968
967static struct usb_serial_driver * const serial_drivers[] = { 969static struct usb_serial_driver * const serial_drivers[] = {
@@ -2056,27 +2058,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2056 2058
2057} 2059}
2058 2060
2059static int ftdi_chars_in_buffer(struct tty_struct *tty) 2061static bool ftdi_tx_empty(struct usb_serial_port *port)
2060{ 2062{
2061 struct usb_serial_port *port = tty->driver_data;
2062 int chars;
2063 unsigned char buf[2]; 2063 unsigned char buf[2];
2064 int ret; 2064 int ret;
2065 2065
2066 chars = usb_serial_generic_chars_in_buffer(tty); 2066 ret = ftdi_get_modem_status(port, buf);
2067 if (chars)
2068 goto out;
2069
2070 /* Check if hardware buffer is empty. */
2071 ret = ftdi_get_modem_status(tty, buf);
2072 if (ret == 2) { 2067 if (ret == 2) {
2073 if (!(buf[1] & FTDI_RS_TEMT)) 2068 if (!(buf[1] & FTDI_RS_TEMT))
2074 chars = 1; 2069 return false;
2075 } 2070 }
2076out:
2077 dev_dbg(&port->dev, "%s - %d\n", __func__, chars);
2078 2071
2079 return chars; 2072 return true;
2080} 2073}
2081 2074
2082/* old_termios contains the original termios settings and tty->termios contains 2075/* old_termios contains the original termios settings and tty->termios contains
@@ -2268,10 +2261,9 @@ no_c_cflag_changes:
2268 * Returns the number of status bytes retrieved (device dependant), or 2261 * Returns the number of status bytes retrieved (device dependant), or
2269 * negative error code. 2262 * negative error code.
2270 */ 2263 */
2271static int ftdi_get_modem_status(struct tty_struct *tty, 2264static int ftdi_get_modem_status(struct usb_serial_port *port,
2272 unsigned char status[2]) 2265 unsigned char status[2])
2273{ 2266{
2274 struct usb_serial_port *port = tty->driver_data;
2275 struct ftdi_private *priv = usb_get_serial_port_data(port); 2267 struct ftdi_private *priv = usb_get_serial_port_data(port);
2276 unsigned char *buf; 2268 unsigned char *buf;
2277 int len; 2269 int len;
@@ -2336,7 +2328,7 @@ static int ftdi_tiocmget(struct tty_struct *tty)
2336 unsigned char buf[2]; 2328 unsigned char buf[2];
2337 int ret; 2329 int ret;
2338 2330
2339 ret = ftdi_get_modem_status(tty, buf); 2331 ret = ftdi_get_modem_status(port, buf);
2340 if (ret < 0) 2332 if (ret < 0)
2341 return ret; 2333 return ret;
2342 2334
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 98528270c43c..6dd79253205d 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -772,6 +772,8 @@
772 */ 772 */
773#define NEWPORT_VID 0x104D 773#define NEWPORT_VID 0x104D
774#define NEWPORT_AGILIS_PID 0x3000 774#define NEWPORT_AGILIS_PID 0x3000
775#define NEWPORT_CONEX_CC_PID 0x3002
776#define NEWPORT_CONEX_AGP_PID 0x3006
775 777
776/* Interbiometrics USB I/O Board */ 778/* Interbiometrics USB I/O Board */
777/* Developed for Interbiometrics by Rudolf Gugler */ 779/* Developed for Interbiometrics by Rudolf Gugler */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 297665fdd16d..ba45170c78e5 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -253,6 +253,37 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
253} 253}
254EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); 254EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer);
255 255
256void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
257{
258 struct usb_serial_port *port = tty->driver_data;
259 unsigned int bps;
260 unsigned long period;
261 unsigned long expire;
262
263 bps = tty_get_baud_rate(tty);
264 if (!bps)
265 bps = 9600; /* B0 */
266 /*
267 * Use a poll-period of roughly the time it takes to send one
268 * character or at least one jiffy.
269 */
270 period = max_t(unsigned long, (10 * HZ / bps), 1);
271 period = min_t(unsigned long, period, timeout);
272
273 dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
274 __func__, jiffies_to_msecs(timeout),
275 jiffies_to_msecs(period));
276 expire = jiffies + timeout;
277 while (!port->serial->type->tx_empty(port)) {
278 schedule_timeout_interruptible(period);
279 if (signal_pending(current))
280 break;
281 if (time_after(jiffies, expire))
282 break;
283 }
284}
285EXPORT_SYMBOL_GPL(usb_serial_generic_wait_until_sent);
286
256static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, 287static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
257 int index, gfp_t mem_flags) 288 int index, gfp_t mem_flags)
258{ 289{
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 158bf4bc29cc..1be6ba7bee27 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2019,8 +2019,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
2019 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2019 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2020 int chars = 0; 2020 int chars = 0;
2021 unsigned long flags; 2021 unsigned long flags;
2022 int ret;
2023
2024 if (edge_port == NULL) 2022 if (edge_port == NULL)
2025 return 0; 2023 return 0;
2026 2024
@@ -2028,16 +2026,22 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
2028 chars = kfifo_len(&edge_port->write_fifo); 2026 chars = kfifo_len(&edge_port->write_fifo);
2029 spin_unlock_irqrestore(&edge_port->ep_lock, flags); 2027 spin_unlock_irqrestore(&edge_port->ep_lock, flags);
2030 2028
2031 if (!chars) {
2032 ret = tx_active(edge_port);
2033 if (ret > 0)
2034 chars = ret;
2035 }
2036
2037 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 2029 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
2038 return chars; 2030 return chars;
2039} 2031}
2040 2032
2033static bool edge_tx_empty(struct usb_serial_port *port)
2034{
2035 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2036 int ret;
2037
2038 ret = tx_active(edge_port);
2039 if (ret > 0)
2040 return false;
2041
2042 return true;
2043}
2044
2041static void edge_throttle(struct tty_struct *tty) 2045static void edge_throttle(struct tty_struct *tty)
2042{ 2046{
2043 struct usb_serial_port *port = tty->driver_data; 2047 struct usb_serial_port *port = tty->driver_data;
@@ -2557,6 +2561,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2557 .write = edge_write, 2561 .write = edge_write,
2558 .write_room = edge_write_room, 2562 .write_room = edge_write_room,
2559 .chars_in_buffer = edge_chars_in_buffer, 2563 .chars_in_buffer = edge_chars_in_buffer,
2564 .tx_empty = edge_tx_empty,
2560 .break_ctl = edge_break, 2565 .break_ctl = edge_break,
2561 .read_int_callback = edge_interrupt_callback, 2566 .read_int_callback = edge_interrupt_callback,
2562 .read_bulk_callback = edge_bulk_in_callback, 2567 .read_bulk_callback = edge_bulk_in_callback,
@@ -2589,6 +2594,7 @@ static struct usb_serial_driver edgeport_2port_device = {
2589 .write = edge_write, 2594 .write = edge_write,
2590 .write_room = edge_write_room, 2595 .write_room = edge_write_room,
2591 .chars_in_buffer = edge_chars_in_buffer, 2596 .chars_in_buffer = edge_chars_in_buffer,
2597 .tx_empty = edge_tx_empty,
2592 .break_ctl = edge_break, 2598 .break_ctl = edge_break,
2593 .read_int_callback = edge_interrupt_callback, 2599 .read_int_callback = edge_interrupt_callback,
2594 .read_bulk_callback = edge_bulk_in_callback, 2600 .read_bulk_callback = edge_bulk_in_callback,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 734372846abb..93d02bc4eb52 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -196,6 +196,7 @@ static void option_instat_callback(struct urb *urb);
196 196
197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */ 197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */
198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */ 198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */
199#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b /* Novatel E371 */
199 200
200#define KYOCERA_VENDOR_ID 0x0c88 201#define KYOCERA_VENDOR_ID 0x0c88
201#define KYOCERA_PRODUCT_KPC650 0x17da 202#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -341,8 +342,8 @@ static void option_instat_callback(struct urb *urb);
341#define CINTERION_PRODUCT_EU3_E 0x0051 342#define CINTERION_PRODUCT_EU3_E 0x0051
342#define CINTERION_PRODUCT_EU3_P 0x0052 343#define CINTERION_PRODUCT_EU3_P 0x0052
343#define CINTERION_PRODUCT_PH8 0x0053 344#define CINTERION_PRODUCT_PH8 0x0053
344#define CINTERION_PRODUCT_AH6 0x0055 345#define CINTERION_PRODUCT_AHXX 0x0055
345#define CINTERION_PRODUCT_PLS8 0x0060 346#define CINTERION_PRODUCT_PLXX 0x0060
346 347
347/* Olivetti products */ 348/* Olivetti products */
348#define OLIVETTI_VENDOR_ID 0x0b3c 349#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -771,6 +772,7 @@ static const struct usb_device_id option_ids[] = {
771 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ 772 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
772 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, 773 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) },
773 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, 774 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) },
775 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) },
774 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ 776 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
775 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 777 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
776 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, 778 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -966,6 +968,8 @@ static const struct usb_device_id option_ids[] = {
966 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 968 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
967 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, 969 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) },
968 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, 970 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) },
971 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */
972 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
969 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, 973 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) },
970 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, 974 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) },
971 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), 975 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
@@ -1264,8 +1268,9 @@ static const struct usb_device_id option_ids[] = {
1264 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, 1268 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
1265 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, 1269 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
1266 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, 1270 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
1267 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, 1271 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
1268 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, 1272 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
1273 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1269 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 1274 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
1270 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, 1275 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1271 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, 1276 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index cac47aef2918..c92c5ed4e580 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -101,6 +101,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
101 const unsigned char *data, int count); 101 const unsigned char *data, int count);
102static int ti_write_room(struct tty_struct *tty); 102static int ti_write_room(struct tty_struct *tty);
103static int ti_chars_in_buffer(struct tty_struct *tty); 103static int ti_chars_in_buffer(struct tty_struct *tty);
104static bool ti_tx_empty(struct usb_serial_port *port);
104static void ti_throttle(struct tty_struct *tty); 105static void ti_throttle(struct tty_struct *tty);
105static void ti_unthrottle(struct tty_struct *tty); 106static void ti_unthrottle(struct tty_struct *tty);
106static int ti_ioctl(struct tty_struct *tty, 107static int ti_ioctl(struct tty_struct *tty,
@@ -222,6 +223,7 @@ static struct usb_serial_driver ti_1port_device = {
222 .write = ti_write, 223 .write = ti_write,
223 .write_room = ti_write_room, 224 .write_room = ti_write_room,
224 .chars_in_buffer = ti_chars_in_buffer, 225 .chars_in_buffer = ti_chars_in_buffer,
226 .tx_empty = ti_tx_empty,
225 .throttle = ti_throttle, 227 .throttle = ti_throttle,
226 .unthrottle = ti_unthrottle, 228 .unthrottle = ti_unthrottle,
227 .ioctl = ti_ioctl, 229 .ioctl = ti_ioctl,
@@ -253,6 +255,7 @@ static struct usb_serial_driver ti_2port_device = {
253 .write = ti_write, 255 .write = ti_write,
254 .write_room = ti_write_room, 256 .write_room = ti_write_room,
255 .chars_in_buffer = ti_chars_in_buffer, 257 .chars_in_buffer = ti_chars_in_buffer,
258 .tx_empty = ti_tx_empty,
256 .throttle = ti_throttle, 259 .throttle = ti_throttle,
257 .unthrottle = ti_unthrottle, 260 .unthrottle = ti_unthrottle,
258 .ioctl = ti_ioctl, 261 .ioctl = ti_ioctl,
@@ -684,8 +687,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
684 struct ti_port *tport = usb_get_serial_port_data(port); 687 struct ti_port *tport = usb_get_serial_port_data(port);
685 int chars = 0; 688 int chars = 0;
686 unsigned long flags; 689 unsigned long flags;
687 int ret;
688 u8 lsr;
689 690
690 if (tport == NULL) 691 if (tport == NULL)
691 return 0; 692 return 0;
@@ -694,16 +695,22 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
694 chars = kfifo_len(&tport->write_fifo); 695 chars = kfifo_len(&tport->write_fifo);
695 spin_unlock_irqrestore(&tport->tp_lock, flags); 696 spin_unlock_irqrestore(&tport->tp_lock, flags);
696 697
697 if (!chars) {
698 ret = ti_get_lsr(tport, &lsr);
699 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
700 chars = 1;
701 }
702
703 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 698 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
704 return chars; 699 return chars;
705} 700}
706 701
702static bool ti_tx_empty(struct usb_serial_port *port)
703{
704 struct ti_port *tport = usb_get_serial_port_data(port);
705 int ret;
706 u8 lsr;
707
708 ret = ti_get_lsr(tport, &lsr);
709 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
710 return false;
711
712 return true;
713}
707 714
708static void ti_throttle(struct tty_struct *tty) 715static void ti_throttle(struct tty_struct *tty)
709{ 716{
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index cf75beb1251b..4753c005cfb6 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -359,20 +359,29 @@ static int serial_chars_in_buffer(struct tty_struct *tty)
359{ 359{
360 struct usb_serial_port *port = tty->driver_data; 360 struct usb_serial_port *port = tty->driver_data;
361 struct usb_serial *serial = port->serial; 361 struct usb_serial *serial = port->serial;
362 int count = 0;
363 362
364 dev_dbg(tty->dev, "%s\n", __func__); 363 dev_dbg(tty->dev, "%s\n", __func__);
365 364
366 mutex_lock(&serial->disc_mutex);
367 /* if the device was unplugged then any remaining characters
368 fell out of the connector ;) */
369 if (serial->disconnected) 365 if (serial->disconnected)
370 count = 0; 366 return 0;
371 else 367
372 count = serial->type->chars_in_buffer(tty); 368 return serial->type->chars_in_buffer(tty);
373 mutex_unlock(&serial->disc_mutex); 369}
370
371static void serial_wait_until_sent(struct tty_struct *tty, int timeout)
372{
373 struct usb_serial_port *port = tty->driver_data;
374 struct usb_serial *serial = port->serial;
375
376 dev_dbg(tty->dev, "%s\n", __func__);
377
378 if (!port->serial->type->wait_until_sent)
379 return;
374 380
375 return count; 381 mutex_lock(&serial->disc_mutex);
382 if (!serial->disconnected)
383 port->serial->type->wait_until_sent(tty, timeout);
384 mutex_unlock(&serial->disc_mutex);
376} 385}
377 386
378static void serial_throttle(struct tty_struct *tty) 387static void serial_throttle(struct tty_struct *tty)
@@ -1191,6 +1200,7 @@ static const struct tty_operations serial_ops = {
1191 .unthrottle = serial_unthrottle, 1200 .unthrottle = serial_unthrottle,
1192 .break_ctl = serial_break, 1201 .break_ctl = serial_break,
1193 .chars_in_buffer = serial_chars_in_buffer, 1202 .chars_in_buffer = serial_chars_in_buffer,
1203 .wait_until_sent = serial_wait_until_sent,
1194 .tiocmget = serial_tiocmget, 1204 .tiocmget = serial_tiocmget,
1195 .tiocmset = serial_tiocmset, 1205 .tiocmset = serial_tiocmset,
1196 .get_icount = serial_get_icount, 1206 .get_icount = serial_get_icount,
@@ -1316,6 +1326,8 @@ static void usb_serial_operations_init(struct usb_serial_driver *device)
1316 set_to_generic_if_null(device, close); 1326 set_to_generic_if_null(device, close);
1317 set_to_generic_if_null(device, write_room); 1327 set_to_generic_if_null(device, write_room);
1318 set_to_generic_if_null(device, chars_in_buffer); 1328 set_to_generic_if_null(device, chars_in_buffer);
1329 if (device->tx_empty)
1330 set_to_generic_if_null(device, wait_until_sent);
1319 set_to_generic_if_null(device, read_bulk_callback); 1331 set_to_generic_if_null(device, read_bulk_callback);
1320 set_to_generic_if_null(device, write_bulk_callback); 1332 set_to_generic_if_null(device, write_bulk_callback);
1321 set_to_generic_if_null(device, process_read_urb); 1333 set_to_generic_if_null(device, process_read_urb);
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 8623577bbbe7..281be56d5648 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -105,8 +105,9 @@ struct rts51x_chip {
105 int status_len; 105 int status_len;
106 106
107 u32 flag; 107 u32 flag;
108#ifdef CONFIG_REALTEK_AUTOPM
109 struct us_data *us; 108 struct us_data *us;
109
110#ifdef CONFIG_REALTEK_AUTOPM
110 struct timer_list rts51x_suspend_timer; 111 struct timer_list rts51x_suspend_timer;
111 unsigned long timer_expires; 112 unsigned long timer_expires;
112 int pwr_state; 113 int pwr_state;
@@ -988,6 +989,7 @@ static int init_realtek_cr(struct us_data *us)
988 us->extra = chip; 989 us->extra = chip;
989 us->extra_destructor = realtek_cr_destructor; 990 us->extra_destructor = realtek_cr_destructor;
990 us->max_lun = chip->max_lun = rts51x_get_max_lun(us); 991 us->max_lun = chip->max_lun = rts51x_get_max_lun(us);
992 chip->us = us;
991 993
992 usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun); 994 usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun);
993 995
@@ -1010,10 +1012,8 @@ static int init_realtek_cr(struct us_data *us)
1010 SET_AUTO_DELINK(chip); 1012 SET_AUTO_DELINK(chip);
1011 } 1013 }
1012#ifdef CONFIG_REALTEK_AUTOPM 1014#ifdef CONFIG_REALTEK_AUTOPM
1013 if (ss_en) { 1015 if (ss_en)
1014 chip->us = us;
1015 realtek_cr_autosuspend_setup(us); 1016 realtek_cr_autosuspend_setup(us);
1016 }
1017#endif 1017#endif
1018 1018
1019 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); 1019 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag);
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index a862e9173ebe..48da25c96cd3 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -18,6 +18,8 @@ font-objs-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o
18 18
19font-objs += $(font-objs-y) 19font-objs += $(font-objs-y)
20 20
21obj-$(CONFIG_FONTS) += font.o
22
21# Each configuration option enables a list of files. 23# Each configuration option enables a list of files.
22 24
23obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o 25obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o