aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/removed/net_dma8
-rw-r--r--Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt22
-rw-r--r--Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt14
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt50
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt179
-rw-r--r--Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt6
-rw-r--r--Documentation/devicetree/bindings/pinctrl/ti,omap-pinctrl.txt13
-rw-r--r--Documentation/devicetree/bindings/regmap/regmap.txt47
-rw-r--r--Documentation/networking/ip-sysctl.txt6
-rw-r--r--Documentation/pinctrl.txt14
-rw-r--r--MAINTAINERS30
-rw-r--r--Makefile17
-rw-r--r--arch/arm/include/asm/cacheflush.h1
-rw-r--r--arch/arm/include/asm/tls.h2
-rw-r--r--arch/arm/kernel/kprobes-test.c16
-rw-r--r--arch/arm/kernel/kprobes-test.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pio.h6
-rw-r--r--arch/arm/mm/alignment.c3
-rw-r--r--arch/arm/mm/proc-v7-3level.S4
-rw-r--r--arch/x86/Kconfig12
-rw-r--r--arch/x86/Makefile7
-rw-r--r--arch/x86/boot/Makefile7
-rw-r--r--arch/x86/boot/compressed/Makefile17
-rw-r--r--arch/x86/boot/compressed/aslr.c3
-rw-r--r--arch/x86/boot/compressed/early_serial_console.c4
-rw-r--r--arch/x86/boot/cpu.c68
-rw-r--r--arch/x86/configs/tiny.config1
-rw-r--r--arch/x86/include/asm/cpufeature.h7
-rw-r--r--arch/x86/kernel/cpu/Makefile7
-rw-r--r--arch/x86/kernel/cpu/common.c4
-rw-r--r--crypto/async_tx/async_xor.c3
-rw-r--r--drivers/base/regmap/Kconfig3
-rw-r--r--drivers/base/regmap/internal.h6
-rw-r--r--drivers/base/regmap/regcache.c13
-rw-r--r--drivers/base/regmap/regmap-debugfs.c8
-rw-r--r--drivers/base/regmap/regmap-i2c.c2
-rw-r--r--drivers/base/regmap/regmap-spi.c2
-rw-r--r--drivers/base/regmap/regmap.c86
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c15
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c12
-rw-r--r--drivers/cpufreq/cpufreq.c7
-rw-r--r--drivers/cpufreq/integrator-cpufreq.c4
-rw-r--r--drivers/cpufreq/pcc-cpufreq.c2
-rw-r--r--drivers/dma/Kconfig12
-rw-r--r--drivers/dma/Makefile1
-rw-r--r--drivers/dma/dmaengine.c104
-rw-r--r--drivers/dma/dmatest.c4
-rw-r--r--drivers/dma/ioat/dca.c13
-rw-r--r--drivers/dma/ioat/dma.c3
-rw-r--r--drivers/dma/ioat/dma.h7
-rw-r--r--drivers/dma/ioat/dma_v2.c4
-rw-r--r--drivers/dma/ioat/dma_v3.c7
-rw-r--r--drivers/dma/iovlock.c280
-rw-r--r--drivers/dma/mv_xor.c80
-rw-r--r--drivers/edac/amd64_edac.c146
-rw-r--r--drivers/edac/amd64_edac.h5
-rw-r--r--drivers/edac/edac_core.h2
-rw-r--r--drivers/edac/edac_mc.c2
-rw-r--r--drivers/edac/mpc85xx_edac.c2
-rw-r--r--drivers/edac/ppc4xx_edac.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c14
-rw-r--r--drivers/gpu/drm/i915/i915_params.c8
-rw-r--r--drivers/gpu/drm/i915/intel_opregion.c16
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.c7
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c23
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.h5
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c51
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c23
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.h1
-rw-r--r--drivers/i2c/busses/i2c-qup.c12
-rw-r--r--drivers/i2c/busses/i2c-rk3x.c2
-rw-r--r--drivers/md/raid5.c18
-rw-r--r--drivers/media/usb/em28xx/em28xx-cards.c1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2.c5
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c3
-rw-r--r--drivers/net/ethernet/cadence/macb.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c4
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c6
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c5
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c10
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c11
-rw-r--r--drivers/net/hyperv/netvsc_drv.c3
-rw-r--r--drivers/net/macvtap.c18
-rw-r--r--drivers/net/usb/r8152.c88
-rw-r--r--drivers/parisc/superio.c3
-rw-r--r--drivers/pinctrl/Kconfig103
-rw-r--r--drivers/pinctrl/Makefile23
-rw-r--r--drivers/pinctrl/berlin/berlin.c29
-rw-r--r--drivers/pinctrl/freescale/Kconfig108
-rw-r--r--drivers/pinctrl/freescale/Makefile19
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx.c (renamed from drivers/pinctrl/pinctrl-imx.c)17
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx.h (renamed from drivers/pinctrl/pinctrl-imx.h)7
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx1-core.c (renamed from drivers/pinctrl/pinctrl-imx1-core.c)8
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx1.c (renamed from drivers/pinctrl/pinctrl-imx1.c)0
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx1.h (renamed from drivers/pinctrl/pinctrl-imx1.h)0
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx21.c342
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx23.c (renamed from drivers/pinctrl/pinctrl-imx23.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx25.c (renamed from drivers/pinctrl/pinctrl-imx25.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx27.c (renamed from drivers/pinctrl/pinctrl-imx27.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx28.c (renamed from drivers/pinctrl/pinctrl-imx28.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx35.c (renamed from drivers/pinctrl/pinctrl-imx35.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx50.c (renamed from drivers/pinctrl/pinctrl-imx50.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx51.c (renamed from drivers/pinctrl/pinctrl-imx51.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx53.c (renamed from drivers/pinctrl/pinctrl-imx53.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx6dl.c (renamed from drivers/pinctrl/pinctrl-imx6dl.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx6q.c (renamed from drivers/pinctrl/pinctrl-imx6q.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx6sl.c (renamed from drivers/pinctrl/pinctrl-imx6sl.c)3
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx6sx.c (renamed from drivers/pinctrl/pinctrl-imx6sx.c)2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-mxs.c (renamed from drivers/pinctrl/pinctrl-mxs.c)8
-rw-r--r--drivers/pinctrl/freescale/pinctrl-mxs.h (renamed from drivers/pinctrl/pinctrl-mxs.h)0
-rw-r--r--drivers/pinctrl/freescale/pinctrl-vf610.c (renamed from drivers/pinctrl/pinctrl-vf610.c)2
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-mvebu.c6
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-abx500.c99
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-nomadik.c142
-rw-r--r--drivers/pinctrl/pinctrl-adi2.c7
-rw-r--r--drivers/pinctrl/pinctrl-as3722.c4
-rw-r--r--drivers/pinctrl/pinctrl-at91.c212
-rw-r--r--drivers/pinctrl/pinctrl-bcm281xx.c8
-rw-r--r--drivers/pinctrl/pinctrl-bcm2835.c4
-rw-r--r--drivers/pinctrl/pinctrl-lantiq.c8
-rw-r--r--drivers/pinctrl/pinctrl-palmas.c5
-rw-r--r--drivers/pinctrl/pinctrl-rockchip.c6
-rw-r--r--drivers/pinctrl/pinctrl-single.c18
-rw-r--r--drivers/pinctrl/pinctrl-st.c7
-rw-r--r--drivers/pinctrl/pinctrl-tb10x.c4
-rw-r--r--drivers/pinctrl/pinctrl-tegra-xusb.c8
-rw-r--r--drivers/pinctrl/pinctrl-tegra.c7
-rw-r--r--drivers/pinctrl/pinctrl-tegra114.c2
-rw-r--r--drivers/pinctrl/pinctrl-tegra124.c69
-rw-r--r--drivers/pinctrl/pinctrl-tegra20.c2
-rw-r--r--drivers/pinctrl/pinctrl-tegra30.c2
-rw-r--r--drivers/pinctrl/pinctrl-tz1090-pdc.c7
-rw-r--r--drivers/pinctrl/pinctrl-tz1090.c6
-rw-r--r--drivers/pinctrl/pinctrl-u300.c6
-rw-r--r--drivers/pinctrl/pinctrl-xway.c2
-rw-r--r--drivers/pinctrl/pinmux.c10
-rw-r--r--drivers/pinctrl/qcom/Kconfig8
-rw-r--r--drivers/pinctrl/qcom/Makefile1
-rw-r--r--drivers/pinctrl/qcom/pinctrl-apq8064.c9
-rw-r--r--drivers/pinctrl/qcom/pinctrl-apq8084.c1245
-rw-r--r--drivers/pinctrl/qcom/pinctrl-ipq8064.c2
-rw-r--r--drivers/pinctrl/qcom/pinctrl-msm.c49
-rw-r--r--drivers/pinctrl/qcom/pinctrl-msm.h3
-rw-r--r--drivers/pinctrl/qcom/pinctrl-msm8960.c2
-rw-r--r--drivers/pinctrl/qcom/pinctrl-msm8x74.c2
-rw-r--r--drivers/pinctrl/samsung/pinctrl-exynos5440.c7
-rw-r--r--drivers/pinctrl/samsung/pinctrl-samsung.c7
-rw-r--r--drivers/pinctrl/sh-pfc/core.c10
-rw-r--r--drivers/pinctrl/sh-pfc/core.h1
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-r8a73a4.c4
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-r8a7740.c4
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh7372.c4
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-sh73a0.c23
-rw-r--r--drivers/pinctrl/sh-pfc/pinctrl.c6
-rw-r--r--drivers/pinctrl/sh-pfc/sh_pfc.h1
-rw-r--r--drivers/pinctrl/sirf/pinctrl-atlas6.c129
-rw-r--r--drivers/pinctrl/sirf/pinctrl-prima2.c173
-rw-r--r--drivers/pinctrl/sirf/pinctrl-sirf.c72
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1310.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1340.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear300.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear310.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear320.c2
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sunxi.c8
-rw-r--r--drivers/pinctrl/vt8500/pinctrl-wmt.c8
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c2
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c57
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h3
-rw-r--r--drivers/tty/serial/8250/8250_core.c2
-rw-r--r--drivers/usb/storage/uas.c7
-rw-r--r--fs/cifs/file.c8
-rw-r--r--fs/cifs/smb1ops.c2
-rw-r--r--fs/cifs/smb2maperror.c2
-rw-r--r--fs/nfsd/nfs4xdr.c3
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c4
-rw-r--r--include/dt-bindings/pinctrl/at91.h5
-rw-r--r--include/dt-bindings/pinctrl/rockchip.h2
-rw-r--r--include/linux/dmaengine.h22
-rw-r--r--include/linux/moduleparam.h50
-rw-r--r--include/linux/pinctrl/pinconf-generic.h2
-rw-r--r--include/linux/pinctrl/pinmux.h7
-rw-r--r--include/linux/skbuff.h8
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/net/ip6_fib.h5
-rw-r--r--include/net/net_namespace.h20
-rw-r--r--include/net/netdma.h32
-rw-r--r--include/net/sock.h19
-rw-r--r--include/net/tcp.h9
-rw-r--r--init/Kconfig56
-rw-r--r--kernel/configs/tiny.config4
-rw-r--r--kernel/events/core.c4
-rw-r--r--kernel/fork.c5
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/params.c17
-rw-r--r--kernel/sys_ni.c3
-rw-r--r--kernel/sysctl_binary.c1
-rw-r--r--kernel/trace/ring_buffer.c2
-rw-r--r--lib/rhashtable.c8
-rw-r--r--mm/Makefile7
-rw-r--r--mm/huge_memory.c7
-rw-r--r--mm/memcontrol.c36
-rw-r--r--mm/migrate.c5
-rw-r--r--mm/page_alloc.c7
-rw-r--r--net/core/Makefile1
-rw-r--r--net/core/dev.c10
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/core/sock.c6
-rw-r--r--net/core/user_dma.c131
-rw-r--r--net/dccp/proto.c4
-rw-r--r--net/ipv4/ip_tunnel.c11
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/sysctl_net_ipv4.c9
-rw-r--r--net/ipv4/tcp.c149
-rw-r--r--net/ipv4/tcp_input.c83
-rw-r--r--net/ipv4/tcp_ipv4.c18
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/ipv6/addrconf_core.c7
-rw-r--r--net/ipv6/ip6_fib.c20
-rw-r--r--net/ipv6/ip6_gre.c3
-rw-r--r--net/ipv6/ip6_tunnel.c6
-rw-r--r--net/ipv6/ip6_vti.c6
-rw-r--r--net/ipv6/route.c4
-rw-r--r--net/ipv6/tcp_ipv6.c13
-rw-r--r--net/llc/af_llc.c10
-rw-r--r--net/netfilter/Kconfig1
-rw-r--r--net/netfilter/nfnetlink.c64
-rw-r--r--net/netfilter/nft_hash.c12
-rw-r--r--net/netfilter/nft_rbtree.c2
-rw-r--r--net/sched/ematch.c6
-rw-r--r--scripts/Makefile.modinst7
-rw-r--r--scripts/Makefile.modsign2
-rwxr-xr-xscripts/bloat-o-meter2
-rw-r--r--scripts/kconfig/Makefile19
-rw-r--r--scripts/mod/modpost.c25
-rw-r--r--security/apparmor/lsm.c4
-rw-r--r--sound/soc/codecs/rt286.c7
-rw-r--r--sound/soc/codecs/ssm2602.c2
-rw-r--r--sound/soc/fsl/fsl_ssi.c12
-rw-r--r--sound/soc/soc-compress.c6
-rw-r--r--sound/soc/soc-core.c2
244 files changed, 3983 insertions, 2038 deletions
diff --git a/Documentation/ABI/removed/net_dma b/Documentation/ABI/removed/net_dma
new file mode 100644
index 000000000000..a173aecc2f18
--- /dev/null
+++ b/Documentation/ABI/removed/net_dma
@@ -0,0 +1,8 @@
1What: tcp_dma_copybreak sysctl
2Date: Removed in kernel v3.13
3Contact: Dan Williams <dan.j.williams@intel.com>
4Description:
5 Formerly the lower limit, in bytes, of the size of socket reads
6 that will be offloaded to a DMA copy engine. Removed due to
7 coherency issues of the cpu potentially touching the buffers
8 while dma is in flight.
diff --git a/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
index 02ab5ab198a4..b7a93e80a302 100644
--- a/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
@@ -19,6 +19,7 @@ such as pull-up, multi drive, etc.
19 19
20Required properties for iomux controller: 20Required properties for iomux controller:
21- compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl" 21- compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl"
22 or "atmel,sama5d3-pinctrl"
22- atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be 23- atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be
23 configured in this periph mode. All the periph and bank need to be describe. 24 configured in this periph mode. All the periph and bank need to be describe.
24 25
@@ -85,13 +86,20 @@ Required properties for pin configuration node:
85 PIN_BANK 0 is pioA, PIN_BANK 1 is pioB... 86 PIN_BANK 0 is pioA, PIN_BANK 1 is pioB...
86 87
87Bits used for CONFIG: 88Bits used for CONFIG:
88PULL_UP (1 << 0): indicate this pin need a pull up. 89PULL_UP (1 << 0): indicate this pin needs a pull up.
89MULTIDRIVE (1 << 1): indicate this pin need to be configured as multidrive. 90MULTIDRIVE (1 << 1): indicate this pin needs to be configured as multi-drive.
90DEGLITCH (1 << 2): indicate this pin need deglitch. 91 Multi-drive is equivalent to open-drain type output.
91PULL_DOWN (1 << 3): indicate this pin need a pull down. 92DEGLITCH (1 << 2): indicate this pin needs deglitch.
92DIS_SCHMIT (1 << 4): indicate this pin need to disable schmit trigger. 93PULL_DOWN (1 << 3): indicate this pin needs a pull down.
93DEBOUNCE (1 << 16): indicate this pin need debounce. 94DIS_SCHMIT (1 << 4): indicate this pin needs to the disable schmitt trigger.
94DEBOUNCE_VAL (0x3fff << 17): debounce val. 95DRIVE_STRENGTH (3 << 5): indicate the drive strength of the pin using the
96 following values:
97 00 - No change (reset state value kept)
98 01 - Low
99 10 - Medium
100 11 - High
101DEBOUNCE (1 << 16): indicate this pin needs debounce.
102DEBOUNCE_VAL (0x3fff << 17): debounce value.
95 103
96NOTE: 104NOTE:
97Some requirements for using atmel,at91rm9200-pinctrl binding: 105Some requirements for using atmel,at91rm9200-pinctrl binding:
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
index 6464bf769460..189814e7cdc7 100644
--- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
+++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
@@ -10,6 +10,7 @@ Required properties:
10- reg: Should contain a list of base address and size pairs for: 10- reg: Should contain a list of base address and size pairs for:
11 -- first entry - the drive strength and pad control registers. 11 -- first entry - the drive strength and pad control registers.
12 -- second entry - the pinmux registers 12 -- second entry - the pinmux registers
13 -- third entry - the MIPI_PAD_CTRL register
13 14
14Tegra124 adds the following optional properties for pin configuration subnodes. 15Tegra124 adds the following optional properties for pin configuration subnodes.
15The macros for options are defined in the 16The macros for options are defined in the
@@ -91,6 +92,12 @@ Valid values for pin and group names are:
91 dbg, sdio3, spi, uaa, uab, uart2, uart3, sdio1, ddc, gma, gme, gmf, gmg, 92 dbg, sdio3, spi, uaa, uab, uart2, uart3, sdio1, ddc, gma, gme, gmf, gmg,
92 gmh, owr, uda, gpv, dev3, cec, usb_vbus_en, ao3, ao0, hv0, sdio4, ao4. 93 gmh, owr, uda, gpv, dev3, cec, usb_vbus_en, ao3, ao0, hv0, sdio4, ao4.
93 94
95 MIPI pad control groups:
96
97 These support only the nvidia,function property.
98
99 dsi_b
100
94Valid values for nvidia,functions are: 101Valid values for nvidia,functions are:
95 102
96 blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3, displaya, 103 blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3, displaya,
@@ -101,14 +108,15 @@ Valid values for nvidia,functions are:
101 sdmmc4, soc, spdif, spi1, spi2, spi3, spi4, spi5, spi6, trace, uarta, 108 sdmmc4, soc, spdif, spi1, spi2, spi3, spi4, spi5, spi6, trace, uarta,
102 uartb, uartc, uartd, ulpi, usb, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6, 109 uartb, uartc, uartd, ulpi, usb, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6,
103 vi, vi_alt1, vi_alt3, vimclk2, vimclk2_alt, sata, ccla, pe0, pe, pe1, 110 vi, vi_alt1, vi_alt3, vimclk2, vimclk2_alt, sata, ccla, pe0, pe, pe1,
104 dp, rtck, sys, clk tmds. 111 dp, rtck, sys, clk tmds, csi, dsi_b
105 112
106Example: 113Example:
107 114
108 pinmux: pinmux { 115 pinmux: pinmux {
109 compatible = "nvidia,tegra124-pinmux"; 116 compatible = "nvidia,tegra124-pinmux";
110 reg = <0x70000868 0x164 /* Pad control registers */ 117 reg = <0x0 0x70000868 0x0 0x164>, /* Pad control registers */
111 0x70003000 0x434>; /* PinMux registers */ 118 <0x0 0x70003000 0x0 0x434>, /* Mux registers */
119 <0x0 0x70000820 0x0 0x8>; /* MIPI pad control */
112 }; 120 };
113 121
114Example pinmux entries: 122Example pinmux entries:
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
index fa40a177164c..98eb94d91a1c 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
@@ -127,6 +127,24 @@ whether there is any interaction between the child and intermediate parent
127nodes, is again defined entirely by the binding for the individual pin 127nodes, is again defined entirely by the binding for the individual pin
128controller device. 128controller device.
129 129
130== Generic pin multiplexing node content ==
131
132pin multiplexing nodes:
133
134function - the mux function to select
135groups - the list of groups to select with this function
136
137Example:
138
139state_0_node_a {
140 function = "uart0";
141 groups = "u0rxtx", "u0rtscts";
142};
143state_1_node_a {
144 function = "spi0";
145 groups = "spi0pins";
146};
147
130== Generic pin configuration node content == 148== Generic pin configuration node content ==
131 149
132Many data items that are represented in a pin configuration node are common 150Many data items that are represented in a pin configuration node are common
@@ -139,8 +157,12 @@ structure of the DT nodes that contain these properties.
139Supported generic properties are: 157Supported generic properties are:
140 158
141pins - the list of pins that properties in the node 159pins - the list of pins that properties in the node
142 apply to 160 apply to (either this or "group" has to be
143function - the mux function to select 161 specified)
162group - the group to apply the properties to, if the driver
163 supports configuration of whole groups rather than
164 individual pins (either this or "pins" has to be
165 specified)
144bias-disable - disable any pin bias 166bias-disable - disable any pin bias
145bias-high-impedance - high impedance mode ("third-state", "floating") 167bias-high-impedance - high impedance mode ("third-state", "floating")
146bias-bus-hold - latch weakly 168bias-bus-hold - latch weakly
@@ -163,6 +185,21 @@ output-low - set the pin to output mode with low level
163output-high - set the pin to output mode with high level 185output-high - set the pin to output mode with high level
164slew-rate - set the slew rate 186slew-rate - set the slew rate
165 187
188For example:
189
190state_0_node_a {
191 pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
192 bias-pull-up;
193};
194state_1_node_a {
195 pins = "GPIO1_AJ3", "GPIO3_AH3"; /* RTS+TXD */
196 output-high;
197};
198state_2_node_a {
199 group = "foo-group";
200 bias-pull-up;
201};
202
166Some of the generic properties take arguments. For those that do, the 203Some of the generic properties take arguments. For those that do, the
167arguments are described below. 204arguments are described below.
168 205
@@ -170,15 +207,6 @@ arguments are described below.
170 binding for the hardware defines: 207 binding for the hardware defines:
171 - Whether the entries are integers or strings, and their meaning. 208 - Whether the entries are integers or strings, and their meaning.
172 209
173- function takes a list of function names/IDs as a required argument. The
174 specific binding for the hardware defines:
175 - Whether the entries are integers or strings, and their meaning.
176 - Whether only a single entry is allowed (which is applied to all entries
177 in the pins property), or whether there may alternatively be one entry per
178 entry in the pins property, in which case the list lengths must match, and
179 for each list index i, the function at list index i is applied to the pin
180 at list index i.
181
182- bias-pull-up, -down and -pin-default take as optional argument on hardware 210- bias-pull-up, -down and -pin-default take as optional argument on hardware
183 supporting it the pull strength in Ohm. bias-disable will disable the pull. 211 supporting it the pull strength in Ohm. bias-disable will disable the pull.
184 212
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index 92fae82f35f2..2fb90b37aa09 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -50,7 +50,7 @@ Valid values for function are:
50 gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6, 50 gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
51 gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1, 51 gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
52 gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm, 52 gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
53 riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic, 53 riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic, ps_hold
54 54
55Example: 55Example:
56 56
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt
new file mode 100644
index 000000000000..ffafa1990a30
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt
@@ -0,0 +1,179 @@
1Qualcomm APQ8084 TLMM block
2
3This binding describes the Top Level Mode Multiplexer block found in the
4MSM8960 platform.
5
6- compatible:
7 Usage: required
8 Value type: <string>
9 Definition: must be "qcom,apq8084-pinctrl"
10
11- reg:
12 Usage: required
13 Value type: <prop-encoded-array>
14 Definition: the base address and size of the TLMM register space.
15
16- interrupts:
17 Usage: required
18 Value type: <prop-encoded-array>
19 Definition: should specify the TLMM summary IRQ.
20
21- interrupt-controller:
22 Usage: required
23 Value type: <none>
24 Definition: identifies this node as an interrupt controller
25
26- #interrupt-cells:
27 Usage: required
28 Value type: <u32>
29 Definition: must be 2. Specifying the pin number and flags, as defined
30 in <dt-bindings/interrupt-controller/irq.h>
31
32- gpio-controller:
33 Usage: required
34 Value type: <none>
35 Definition: identifies this node as a gpio controller
36
37- #gpio-cells:
38 Usage: required
39 Value type: <u32>
40 Definition: must be 2. Specifying the pin number and flags, as defined
41 in <dt-bindings/gpio/gpio.h>
42
43Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for
44a general description of GPIO and interrupt bindings.
45
46Please refer to pinctrl-bindings.txt in this directory for details of the
47common pinctrl bindings used by client devices, including the meaning of the
48phrase "pin configuration node".
49
50The pin configuration nodes act as a container for an abitrary number of
51subnodes. Each of these subnodes represents some desired configuration for a
52pin, a group, or a list of pins or groups. This configuration can include the
53mux function to select on those pin(s)/group(s), and various pin configuration
54parameters, such as pull-up, drive strength, etc.
55
56
57PIN CONFIGURATION NODES:
58
59The name of each subnode is not important; all subnodes should be enumerated
60and processed purely based on their content.
61
62Each subnode only affects those parameters that are explicitly listed. In
63other words, a subnode that lists a mux function but no pin configuration
64parameters implies no information about any pin configuration parameters.
65Similarly, a pin subnode that describes a pullup parameter implies no
66information about e.g. the mux function.
67
68
69The following generic properties as defined in pinctrl-bindings.txt are valid
70to specify in a pin configuration subnode:
71
72- pins:
73 Usage: required
74 Value type: <string-array>
75 Definition: List of gpio pins affected by the properties specified in
76 this subnode. Valid pins are:
77 gpio0-gpio146,
78 sdc1_clk,
79 sdc1_cmd,
80 sdc1_data
81 sdc2_clk,
82 sdc2_cmd,
83 sdc2_data
84
85- function:
86 Usage: required
87 Value type: <string>
88 Definition: Specify the alternative function to be configured for the
89 specified pins. Functions are only valid for gpio pins.
90 Valid values are:
91 adsp_ext, audio_ref, blsp_i2c1, blsp_i2c2, blsp_i2c3,
92 blsp_i2c4, blsp_i2c5, blsp_i2c6, blsp_i2c7, blsp_i2c8,
93 blsp_i2c9, blsp_i2c10, blsp_i2c11, blsp_i2c12,
94 blsp_spi1, blsp_spi2, blsp_spi3, blsp_spi4, blsp_spi5,
95 blsp_spi6, blsp_spi7, blsp_spi8, blsp_spi9, blsp_spi10,
96 blsp_spi11, blsp_spi12, blsp_uart1, blsp_uart2, blsp_uart3,
97 blsp_uart4, blsp_uart5, blsp_uart6, blsp_uart7, blsp_uart8,
98 blsp_uart9, blsp_uart10, blsp_uart11, blsp_uart12,
99 blsp_uim1, blsp_uim2, blsp_uim3, blsp_uim4, blsp_uim5,
100 blsp_uim6, blsp_uim7, blsp_uim8, blsp_uim9, blsp_uim10,
101 blsp_uim11, blsp_uim12, cam_mclk0, cam_mclk1, cam_mclk2,
102 cam_mclk3, cci_async, cci_async_in0, cci_i2c0, cci_i2c1,
103 cci_timer0, cci_timer1, cci_timer2, cci_timer3, cci_timer4,
104 edp_hpd, gcc_gp1, gcc_gp2, gcc_gp3, gcc_obt, gcc_vtt,i
105 gp_mn, gp_pdm0, gp_pdm1, gp_pdm2, gp0_clk, gp1_clk, gpio,
106 hdmi_cec, hdmi_ddc, hdmi_dtest, hdmi_hpd, hdmi_rcv, hsic,
107 ldo_en, ldo_update, mdp_vsync, pci_e0, pci_e0_n, pci_e0_rst,
108 pci_e1, pci_e1_rst, pci_e1_rst_n, pci_e1_clkreq_n, pri_mi2s,
109 qua_mi2s, sata_act, sata_devsleep, sata_devsleep_n,
110 sd_write, sdc_emmc_mode, sdc3, sdc4, sec_mi2s, slimbus,
111 spdif_tx, spkr_i2s, spkr_i2s_ws, spss_geni, ter_mi2s, tsif1,
112 tsif2, uim, uim_batt_alarm
113
114- bias-disable:
115 Usage: optional
116 Value type: <none>
117 Definition: The specified pins should be configued as no pull.
118
119- bias-pull-down:
120 Usage: optional
121 Value type: <none>
122 Definition: The specified pins should be configued as pull down.
123
124- bias-pull-up:
125 Usage: optional
126 Value type: <none>
127 Definition: The specified pins should be configued as pull up.
128
129- output-high:
130 Usage: optional
131 Value type: <none>
132 Definition: The specified pins are configured in output mode, driven
133 high.
134 Not valid for sdc pins.
135
136- output-low:
137 Usage: optional
138 Value type: <none>
139 Definition: The specified pins are configured in output mode, driven
140 low.
141 Not valid for sdc pins.
142
143- drive-strength:
144 Usage: optional
145 Value type: <u32>
146 Definition: Selects the drive strength for the specified pins, in mA.
147 Valid values are: 2, 4, 6, 8, 10, 12, 14 and 16
148
149Example:
150
151 tlmm: pinctrl@fd510000 {
152 compatible = "qcom,apq8084-pinctrl";
153 reg = <0xfd510000 0x4000>;
154
155 gpio-controller;
156 #gpio-cells = <2>;
157 interrupt-controller;
158 #interrupt-cells = <2>;
159 interrupts = <0 208 0>;
160
161 uart2: uart2-default {
162 mux {
163 pins = "gpio4", "gpio5";
164 function = "blsp_uart2";
165 };
166
167 tx {
168 pins = "gpio4";
169 drive-strength = <4>;
170 bias-disable;
171 };
172
173 rx {
174 pins = "gpio5";
175 drive-strength = <2>;
176 bias-pull-up;
177 };
178 };
179 };
diff --git a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
index 4658b69d4f4d..388b213249fd 100644
--- a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
@@ -2,8 +2,8 @@
2 2
3The Rockchip Pinmux Controller, enables the IC 3The Rockchip Pinmux Controller, enables the IC
4to share one PAD to several functional blocks. The sharing is done by 4to share one PAD to several functional blocks. The sharing is done by
5multiplexing the PAD input/output signals. For each PAD there are up to 5multiplexing the PAD input/output signals. For each PAD there are several
64 muxing options with option 0 being the use as a GPIO. 6muxing options with option 0 being the use as a GPIO.
7 7
8Please refer to pinctrl-bindings.txt in this directory for details of the 8Please refer to pinctrl-bindings.txt in this directory for details of the
9common pinctrl bindings used by client devices, including the meaning of the 9common pinctrl bindings used by client devices, including the meaning of the
@@ -58,7 +58,7 @@ Deprecated properties for gpio sub nodes:
58Required properties for pin configuration node: 58Required properties for pin configuration node:
59 - rockchip,pins: 3 integers array, represents a group of pins mux and config 59 - rockchip,pins: 3 integers array, represents a group of pins mux and config
60 setting. The format is rockchip,pins = <PIN_BANK PIN_BANK_IDX MUX &phandle>. 60 setting. The format is rockchip,pins = <PIN_BANK PIN_BANK_IDX MUX &phandle>.
61 The MUX 0 means gpio and MUX 1 to 3 mean the specific device function. 61 The MUX 0 means gpio and MUX 1 to N mean the specific device function.
62 The phandle of a node containing the generic pinconfig options 62 The phandle of a node containing the generic pinconfig options
63 to use, as described in pinctrl-bindings.txt in this directory. 63 to use, as described in pinctrl-bindings.txt in this directory.
64 64
diff --git a/Documentation/devicetree/bindings/pinctrl/ti,omap-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/ti,omap-pinctrl.txt
new file mode 100644
index 000000000000..88c80273da91
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/ti,omap-pinctrl.txt
@@ -0,0 +1,13 @@
1OMAP Pinctrl definitions
2
3Required properties:
4- compatible : Should be one of:
5 "ti,omap2420-padconf" - OMAP2420 compatible pinctrl
6 "ti,omap2430-padconf" - OMAP2430 compatible pinctrl
7 "ti,omap3-padconf" - OMAP3 compatible pinctrl
8 "ti,omap4-padconf" - OMAP4 compatible pinctrl
9 "ti,omap5-padconf" - OMAP5 compatible pinctrl
10 "ti,dra7-padconf" - DRA7 compatible pinctrl
11 "ti,am437-padconf" - AM437x compatible pinctrl
12
13See Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt for further details.
diff --git a/Documentation/devicetree/bindings/regmap/regmap.txt b/Documentation/devicetree/bindings/regmap/regmap.txt
new file mode 100644
index 000000000000..b494f8b8ef72
--- /dev/null
+++ b/Documentation/devicetree/bindings/regmap/regmap.txt
@@ -0,0 +1,47 @@
1Device-Tree binding for regmap
2
3The endianness mode of CPU & Device scenarios:
4Index Device Endianness properties
5---------------------------------------------------
61 BE 'big-endian'
72 LE 'little-endian'
8
9For one device driver, which will run in different scenarios above
10on different SoCs using the devicetree, we need one way to simplify
11this.
12
13Required properties:
14- {big,little}-endian: these are boolean properties, if absent
15 meaning that the CPU and the Device are in the same endianness mode,
16 these properties are for register values and all the buffers only.
17
18Examples:
19Scenario 1 : CPU in LE mode & device in LE mode.
20dev: dev@40031000 {
21 compatible = "name";
22 reg = <0x40031000 0x1000>;
23 ...
24};
25
26Scenario 2 : CPU in LE mode & device in BE mode.
27dev: dev@40031000 {
28 compatible = "name";
29 reg = <0x40031000 0x1000>;
30 ...
31 big-endian;
32};
33
34Scenario 3 : CPU in BE mode & device in BE mode.
35dev: dev@40031000 {
36 compatible = "name";
37 reg = <0x40031000 0x1000>;
38 ...
39};
40
41Scenario 4 : CPU in BE mode & device in LE mode.
42dev: dev@40031000 {
43 compatible = "name";
44 reg = <0x40031000 0x1000>;
45 ...
46 little-endian;
47};
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 29a93518bf18..caedb18d4564 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -580,12 +580,6 @@ tcp_workaround_signed_windows - BOOLEAN
580 not receive a window scaling option from them. 580 not receive a window scaling option from them.
581 Default: 0 581 Default: 0
582 582
583tcp_dma_copybreak - INTEGER
584 Lower limit, in bytes, of the size of socket reads that will be
585 offloaded to a DMA copy engine, if one is present in the system
586 and CONFIG_NET_DMA is enabled.
587 Default: 4096
588
589tcp_thin_linear_timeouts - BOOLEAN 583tcp_thin_linear_timeouts - BOOLEAN
590 Enable dynamic triggering of linear timeouts for thin streams. 584 Enable dynamic triggering of linear timeouts for thin streams.
591 If set, a check is performed upon retransmission by timeout to 585 If set, a check is performed upon retransmission by timeout to
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index 23f1590f49fe..b8f2147b96dd 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -702,7 +702,7 @@ static int foo_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
702 return 0; 702 return 0;
703} 703}
704 704
705int foo_enable(struct pinctrl_dev *pctldev, unsigned selector, 705int foo_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
706 unsigned group) 706 unsigned group)
707{ 707{
708 u8 regbit = (1 << selector + group); 708 u8 regbit = (1 << selector + group);
@@ -711,21 +711,11 @@ int foo_enable(struct pinctrl_dev *pctldev, unsigned selector,
711 return 0; 711 return 0;
712} 712}
713 713
714void foo_disable(struct pinctrl_dev *pctldev, unsigned selector,
715 unsigned group)
716{
717 u8 regbit = (1 << selector + group);
718
719 writeb((readb(MUX) & ~(regbit)), MUX)
720 return 0;
721}
722
723struct pinmux_ops foo_pmxops = { 714struct pinmux_ops foo_pmxops = {
724 .get_functions_count = foo_get_functions_count, 715 .get_functions_count = foo_get_functions_count,
725 .get_function_name = foo_get_fname, 716 .get_function_name = foo_get_fname,
726 .get_function_groups = foo_get_groups, 717 .get_function_groups = foo_get_groups,
727 .enable = foo_enable, 718 .set_mux = foo_set_mux,
728 .disable = foo_disable,
729}; 719};
730 720
731/* Pinmux operations are handled by some pin controller */ 721/* Pinmux operations are handled by some pin controller */
diff --git a/MAINTAINERS b/MAINTAINERS
index 4c6c341bc9c7..78cb4aad5bfe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1025,24 +1025,20 @@ F: arch/arm/mach-pxa/colibri-pxa270-income.c
1025 1025
1026ARM/INTEL IOP32X ARM ARCHITECTURE 1026ARM/INTEL IOP32X ARM ARCHITECTURE
1027M: Lennert Buytenhek <kernel@wantstofly.org> 1027M: Lennert Buytenhek <kernel@wantstofly.org>
1028M: Dan Williams <dan.j.williams@intel.com>
1029L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1028L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1030S: Maintained 1029S: Maintained
1031 1030
1032ARM/INTEL IOP33X ARM ARCHITECTURE 1031ARM/INTEL IOP33X ARM ARCHITECTURE
1033M: Dan Williams <dan.j.williams@intel.com>
1034L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1032L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1035S: Maintained 1033S: Orphan
1036 1034
1037ARM/INTEL IOP13XX ARM ARCHITECTURE 1035ARM/INTEL IOP13XX ARM ARCHITECTURE
1038M: Lennert Buytenhek <kernel@wantstofly.org> 1036M: Lennert Buytenhek <kernel@wantstofly.org>
1039M: Dan Williams <dan.j.williams@intel.com>
1040L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1037L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1041S: Maintained 1038S: Maintained
1042 1039
1043ARM/INTEL IQ81342EX MACHINE SUPPORT 1040ARM/INTEL IQ81342EX MACHINE SUPPORT
1044M: Lennert Buytenhek <kernel@wantstofly.org> 1041M: Lennert Buytenhek <kernel@wantstofly.org>
1045M: Dan Williams <dan.j.williams@intel.com>
1046L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1042L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1047S: Maintained 1043S: Maintained
1048 1044
@@ -1067,7 +1063,6 @@ F: drivers/pcmcia/pxa2xx_stargate2.c
1067 1063
1068ARM/INTEL XSC3 (MANZANO) ARM CORE 1064ARM/INTEL XSC3 (MANZANO) ARM CORE
1069M: Lennert Buytenhek <kernel@wantstofly.org> 1065M: Lennert Buytenhek <kernel@wantstofly.org>
1070M: Dan Williams <dan.j.williams@intel.com>
1071L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1066L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1072S: Maintained 1067S: Maintained
1073 1068
@@ -1562,9 +1557,9 @@ F: drivers/platform/x86/asus*.c
1562F: drivers/platform/x86/eeepc*.c 1557F: drivers/platform/x86/eeepc*.c
1563 1558
1564ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API 1559ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
1565M: Dan Williams <dan.j.williams@intel.com> 1560R: Dan Williams <dan.j.williams@intel.com>
1566W: http://sourceforge.net/projects/xscaleiop 1561W: http://sourceforge.net/projects/xscaleiop
1567S: Maintained 1562S: Odd fixes
1568F: Documentation/crypto/async-tx-api.txt 1563F: Documentation/crypto/async-tx-api.txt
1569F: crypto/async_tx/ 1564F: crypto/async_tx/
1570F: drivers/dma/ 1565F: drivers/dma/
@@ -1665,6 +1660,12 @@ M: Nicolas Ferre <nicolas.ferre@atmel.com>
1665S: Supported 1660S: Supported
1666F: drivers/tty/serial/atmel_serial.c 1661F: drivers/tty/serial/atmel_serial.c
1667 1662
1663ATMEL Audio ALSA driver
1664M: Bo Shen <voice.shen@atmel.com>
1665L: alsa-devel@alsa-project.org (moderated for non-subscribers)
1666S: Supported
1667F: sound/soc/atmel
1668
1668ATMEL DMA DRIVER 1669ATMEL DMA DRIVER
1669M: Nicolas Ferre <nicolas.ferre@atmel.com> 1670M: Nicolas Ferre <nicolas.ferre@atmel.com>
1670L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1671L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -2098,7 +2099,7 @@ S: Supported
2098F: drivers/scsi/bfa/ 2099F: drivers/scsi/bfa/
2099 2100
2100BROCADE BNA 10 GIGABIT ETHERNET DRIVER 2101BROCADE BNA 10 GIGABIT ETHERNET DRIVER
2101M: Rasesh Mody <rmody@brocade.com> 2102M: Rasesh Mody <rasesh.mody@qlogic.com>
2102L: netdev@vger.kernel.org 2103L: netdev@vger.kernel.org
2103S: Supported 2104S: Supported
2104F: drivers/net/ethernet/brocade/bna/ 2105F: drivers/net/ethernet/brocade/bna/
@@ -2989,13 +2990,11 @@ T: git git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git
2989 2990
2990DMA GENERIC OFFLOAD ENGINE SUBSYSTEM 2991DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
2991M: Vinod Koul <vinod.koul@intel.com> 2992M: Vinod Koul <vinod.koul@intel.com>
2992M: Dan Williams <dan.j.williams@intel.com>
2993L: dmaengine@vger.kernel.org 2993L: dmaengine@vger.kernel.org
2994Q: https://patchwork.kernel.org/project/linux-dmaengine/list/ 2994Q: https://patchwork.kernel.org/project/linux-dmaengine/list/
2995S: Supported 2995S: Maintained
2996F: drivers/dma/ 2996F: drivers/dma/
2997F: include/linux/dma* 2997F: include/linux/dma*
2998T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx.git
2999T: git git://git.infradead.org/users/vkoul/slave-dma.git (slave-dma) 2998T: git git://git.infradead.org/users/vkoul/slave-dma.git (slave-dma)
3000 2999
3001DME1737 HARDWARE MONITOR DRIVER 3000DME1737 HARDWARE MONITOR DRIVER
@@ -4748,8 +4747,8 @@ F: arch/x86/kernel/cpu/microcode/core*
4748F: arch/x86/kernel/cpu/microcode/intel* 4747F: arch/x86/kernel/cpu/microcode/intel*
4749 4748
4750INTEL I/OAT DMA DRIVER 4749INTEL I/OAT DMA DRIVER
4751M: Dan Williams <dan.j.williams@intel.com>
4752M: Dave Jiang <dave.jiang@intel.com> 4750M: Dave Jiang <dave.jiang@intel.com>
4751R: Dan Williams <dan.j.williams@intel.com>
4753L: dmaengine@vger.kernel.org 4752L: dmaengine@vger.kernel.org
4754Q: https://patchwork.kernel.org/project/linux-dmaengine/list/ 4753Q: https://patchwork.kernel.org/project/linux-dmaengine/list/
4755S: Supported 4754S: Supported
@@ -4764,7 +4763,7 @@ F: drivers/iommu/intel-iommu.c
4764F: include/linux/intel-iommu.h 4763F: include/linux/intel-iommu.h
4765 4764
4766INTEL IOP-ADMA DMA DRIVER 4765INTEL IOP-ADMA DMA DRIVER
4767M: Dan Williams <dan.j.williams@intel.com> 4766R: Dan Williams <dan.j.williams@intel.com>
4768S: Odd fixes 4767S: Odd fixes
4769F: drivers/dma/iop-adma.c 4768F: drivers/dma/iop-adma.c
4770 4769
@@ -5478,7 +5477,7 @@ F: drivers/macintosh/
5478LINUX FOR POWERPC EMBEDDED MPC5XXX 5477LINUX FOR POWERPC EMBEDDED MPC5XXX
5479M: Anatolij Gustschin <agust@denx.de> 5478M: Anatolij Gustschin <agust@denx.de>
5480L: linuxppc-dev@lists.ozlabs.org 5479L: linuxppc-dev@lists.ozlabs.org
5481T: git git://git.denx.de/linux-2.6-agust.git 5480T: git git://git.denx.de/linux-denx-agust.git
5482S: Maintained 5481S: Maintained
5483F: arch/powerpc/platforms/512x/ 5482F: arch/powerpc/platforms/512x/
5484F: arch/powerpc/platforms/52xx/ 5483F: arch/powerpc/platforms/52xx/
@@ -7596,6 +7595,7 @@ F: fs/reiserfs/
7596 7595
7597REGISTER MAP ABSTRACTION 7596REGISTER MAP ABSTRACTION
7598M: Mark Brown <broonie@kernel.org> 7597M: Mark Brown <broonie@kernel.org>
7598L: linux-kernel@vger.kernel.org
7599T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 7599T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
7600S: Supported 7600S: Supported
7601F: drivers/base/regmap/ 7601F: drivers/base/regmap/
diff --git a/Makefile b/Makefile
index be79944f74d2..5826c02842c4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 17 2PATCHLEVEL = 17
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc7 4EXTRAVERSION =
5NAME = Shuffling Zombie Juror 5NAME = Shuffling Zombie Juror
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -842,6 +842,21 @@ mod_strip_cmd = true
842endif # INSTALL_MOD_STRIP 842endif # INSTALL_MOD_STRIP
843export mod_strip_cmd 843export mod_strip_cmd
844 844
845# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed
846# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP
847# or CONFIG_MODULE_COMPRESS_XZ.
848
849mod_compress_cmd = true
850ifdef CONFIG_MODULE_COMPRESS
851 ifdef CONFIG_MODULE_COMPRESS_GZIP
852 mod_compress_cmd = gzip -n
853 endif # CONFIG_MODULE_COMPRESS_GZIP
854 ifdef CONFIG_MODULE_COMPRESS_XZ
855 mod_compress_cmd = xz
856 endif # CONFIG_MODULE_COMPRESS_XZ
857endif # CONFIG_MODULE_COMPRESS
858export mod_compress_cmd
859
845# Select initial ramdisk compression format, default is gzip(1). 860# Select initial ramdisk compression format, default is gzip(1).
846# This shall be used by the dracut(8) tool while creating an initramfs image. 861# This shall be used by the dracut(8) tool while creating an initramfs image.
847# 862#
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 79ecb4f34ffb..10e78d00a0bb 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -466,6 +466,7 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
466 */ 466 */
467#define v7_exit_coherency_flush(level) \ 467#define v7_exit_coherency_flush(level) \
468 asm volatile( \ 468 asm volatile( \
469 ".arch armv7-a \n\t" \
469 "stmfd sp!, {fp, ip} \n\t" \ 470 "stmfd sp!, {fp, ip} \n\t" \
470 "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \ 471 "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \
471 "bic r0, r0, #"__stringify(CR_C)" \n\t" \ 472 "bic r0, r0, #"__stringify(CR_C)" \n\t" \
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
index 36172adda9d0..5f833f7adba1 100644
--- a/arch/arm/include/asm/tls.h
+++ b/arch/arm/include/asm/tls.h
@@ -81,6 +81,7 @@ static inline void set_tls(unsigned long val)
81 asm("mcr p15, 0, %0, c13, c0, 3" 81 asm("mcr p15, 0, %0, c13, c0, 3"
82 : : "r" (val)); 82 : : "r" (val));
83 } else { 83 } else {
84#ifdef CONFIG_KUSER_HELPERS
84 /* 85 /*
85 * User space must never try to access this 86 * User space must never try to access this
86 * directly. Expect your app to break 87 * directly. Expect your app to break
@@ -89,6 +90,7 @@ static inline void set_tls(unsigned long val)
89 * entry-armv.S for details) 90 * entry-armv.S for details)
90 */ 91 */
91 *((unsigned int *)0xffff0ff0) = val; 92 *((unsigned int *)0xffff0ff0) = val;
93#endif
92 } 94 }
93 95
94 } 96 }
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 08d731294bcd..b206d7790c77 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -110,10 +110,13 @@
110 * 110 *
111 * @ TESTCASE_START 111 * @ TESTCASE_START
112 * bl __kprobes_test_case_start 112 * bl __kprobes_test_case_start
113 * @ start of inline data... 113 * .pushsection .rodata
114 * "10:
114 * .ascii "mov r0, r7" @ text title for test case 115 * .ascii "mov r0, r7" @ text title for test case
115 * .byte 0 116 * .byte 0
116 * .align 2, 0 117 * .popsection
118 * @ start of inline data...
119 * .word 10b @ pointer to title in .rodata section
117 * 120 *
118 * @ TEST_ARG_REG 121 * @ TEST_ARG_REG
119 * .byte ARG_TYPE_REG 122 * .byte ARG_TYPE_REG
@@ -971,7 +974,7 @@ void __naked __kprobes_test_case_start(void)
971 __asm__ __volatile__ ( 974 __asm__ __volatile__ (
972 "stmdb sp!, {r4-r11} \n\t" 975 "stmdb sp!, {r4-r11} \n\t"
973 "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t" 976 "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t"
974 "bic r0, lr, #1 @ r0 = inline title string \n\t" 977 "bic r0, lr, #1 @ r0 = inline data \n\t"
975 "mov r1, sp \n\t" 978 "mov r1, sp \n\t"
976 "bl kprobes_test_case_start \n\t" 979 "bl kprobes_test_case_start \n\t"
977 "bx r0 \n\t" 980 "bx r0 \n\t"
@@ -1349,15 +1352,14 @@ static unsigned long next_instruction(unsigned long pc)
1349 return pc + 4; 1352 return pc + 4;
1350} 1353}
1351 1354
1352static uintptr_t __used kprobes_test_case_start(const char *title, void *stack) 1355static uintptr_t __used kprobes_test_case_start(const char **title, void *stack)
1353{ 1356{
1354 struct test_arg *args; 1357 struct test_arg *args;
1355 struct test_arg_end *end_arg; 1358 struct test_arg_end *end_arg;
1356 unsigned long test_code; 1359 unsigned long test_code;
1357 1360
1358 args = (struct test_arg *)PTR_ALIGN(title + strlen(title) + 1, 4); 1361 current_title = *title++;
1359 1362 args = (struct test_arg *)title;
1360 current_title = title;
1361 current_args = args; 1363 current_args = args;
1362 current_stack = stack; 1364 current_stack = stack;
1363 1365
diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h
index eecc90a0fd91..4430990e90e7 100644
--- a/arch/arm/kernel/kprobes-test.h
+++ b/arch/arm/kernel/kprobes-test.h
@@ -111,11 +111,14 @@ struct test_arg_end {
111#define TESTCASE_START(title) \ 111#define TESTCASE_START(title) \
112 __asm__ __volatile__ ( \ 112 __asm__ __volatile__ ( \
113 "bl __kprobes_test_case_start \n\t" \ 113 "bl __kprobes_test_case_start \n\t" \
114 ".pushsection .rodata \n\t" \
115 "10: \n\t" \
114 /* don't use .asciz here as 'title' may be */ \ 116 /* don't use .asciz here as 'title' may be */ \
115 /* multiple strings to be concatenated. */ \ 117 /* multiple strings to be concatenated. */ \
116 ".ascii "#title" \n\t" \ 118 ".ascii "#title" \n\t" \
117 ".byte 0 \n\t" \ 119 ".byte 0 \n\t" \
118 ".align 2, 0 \n\t" 120 ".popsection \n\t" \
121 ".word 10b \n\t"
119 122
120#define TEST_ARG_REG(reg, val) \ 123#define TEST_ARG_REG(reg, val) \
121 ".byte "__stringify(ARG_TYPE_REG)" \n\t" \ 124 ".byte "__stringify(ARG_TYPE_REG)" \n\t" \
diff --git a/arch/arm/mach-at91/include/mach/at91_pio.h b/arch/arm/mach-at91/include/mach/at91_pio.h
index 732b11c37f1a..7b7366253ceb 100644
--- a/arch/arm/mach-at91/include/mach/at91_pio.h
+++ b/arch/arm/mach-at91/include/mach/at91_pio.h
@@ -71,4 +71,10 @@
71#define ABCDSR_PERIPH_C 0x2 71#define ABCDSR_PERIPH_C 0x2
72#define ABCDSR_PERIPH_D 0x3 72#define ABCDSR_PERIPH_D 0x3
73 73
74#define SAMA5D3_PIO_DRIVER1 0x118 /*PIO Driver 1 register offset*/
75#define SAMA5D3_PIO_DRIVER2 0x11C /*PIO Driver 2 register offset*/
76
77#define AT91SAM9X5_PIO_DRIVER1 0x114 /*PIO Driver 1 register offset*/
78#define AT91SAM9X5_PIO_DRIVER2 0x118 /*PIO Driver 2 register offset*/
79
74#endif 80#endif
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 0c1ab49e5f7b..83792f4324ea 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -41,6 +41,7 @@
41 * This code is not portable to processors with late data abort handling. 41 * This code is not portable to processors with late data abort handling.
42 */ 42 */
43#define CODING_BITS(i) (i & 0x0e000000) 43#define CODING_BITS(i) (i & 0x0e000000)
44#define COND_BITS(i) (i & 0xf0000000)
44 45
45#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */ 46#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
46#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */ 47#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
@@ -821,6 +822,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
821 break; 822 break;
822 823
823 case 0x04000000: /* ldr or str immediate */ 824 case 0x04000000: /* ldr or str immediate */
825 if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */
826 goto bad;
824 offset.un = OFFSET_BITS(instr); 827 offset.un = OFFSET_BITS(instr);
825 handler = do_alignment_ldrstr; 828 handler = do_alignment_ldrstr;
826 break; 829 break;
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index b64e67c7f176..d3daed0ae0ad 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -157,9 +157,9 @@ ENDPROC(cpu_v7_set_pte_ext)
157 * TFR EV X F IHD LR S 157 * TFR EV X F IHD LR S
158 * .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM 158 * .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM
159 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced 159 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced
160 * 11 0 110 1 0011 1100 .111 1101 < we want 160 * 11 0 110 0 0011 1100 .111 1101 < we want
161 */ 161 */
162 .align 2 162 .align 2
163 .type v7_crval, #object 163 .type v7_crval, #object
164v7_crval: 164v7_crval:
165 crval clear=0x0120c302, mmuset=0x30c23c7d, ucset=0x00c01c7c 165 crval clear=0x0122c302, mmuset=0x30c03c7d, ucset=0x00c01c7c
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 36327438caf0..e4b1f431c7ed 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -137,6 +137,7 @@ config X86
137 select HAVE_ACPI_APEI if ACPI 137 select HAVE_ACPI_APEI if ACPI
138 select HAVE_ACPI_APEI_NMI if ACPI 138 select HAVE_ACPI_APEI_NMI if ACPI
139 select ACPI_LEGACY_TABLES_LOOKUP if ACPI 139 select ACPI_LEGACY_TABLES_LOOKUP if ACPI
140 select X86_FEATURE_NAMES if PROC_FS
140 141
141config INSTRUCTION_DECODER 142config INSTRUCTION_DECODER
142 def_bool y 143 def_bool y
@@ -314,6 +315,17 @@ config SMP
314 315
315 If you don't know what to do here, say N. 316 If you don't know what to do here, say N.
316 317
318config X86_FEATURE_NAMES
319 bool "Processor feature human-readable names" if EMBEDDED
320 default y
321 ---help---
322 This option compiles in a table of x86 feature bits and corresponding
323 names. This is required to support /proc/cpuinfo and a few kernel
324 messages. You can disable this to save space, at the expense of
325 making those few kernel messages show numeric feature bits instead.
326
327 If in doubt, say Y.
328
317config X86_X2APIC 329config X86_X2APIC
318 bool "Support x2apic" 330 bool "Support x2apic"
319 depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP 331 depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 60087ca37679..5692d6ac0f18 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -253,12 +253,6 @@ archclean:
253 $(Q)$(MAKE) $(clean)=arch/x86/tools 253 $(Q)$(MAKE) $(clean)=arch/x86/tools
254 $(Q)$(MAKE) $(clean)=arch/x86/purgatory 254 $(Q)$(MAKE) $(clean)=arch/x86/purgatory
255 255
256PHONY += kvmconfig
257kvmconfig:
258 $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
259 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(srctree)/arch/x86/configs/kvm_guest.config
260 $(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
261
262define archhelp 256define archhelp
263 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 257 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
264 echo ' install - Install kernel using' 258 echo ' install - Install kernel using'
@@ -272,5 +266,4 @@ define archhelp
272 echo ' bzdisk/fdimage*/isoimage also accept:' 266 echo ' bzdisk/fdimage*/isoimage also accept:'
273 echo ' FDARGS="..." arguments for the booted kernel' 267 echo ' FDARGS="..." arguments for the booted kernel'
274 echo ' FDINITRD=file initrd for the booted kernel' 268 echo ' FDINITRD=file initrd for the booted kernel'
275 echo ' kvmconfig - Enable additional options for guest kernel support'
276endef 269endef
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index dbe8dd2fe247..5b016e2498f3 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -35,19 +35,22 @@ setup-y += video-vesa.o
35setup-y += video-bios.o 35setup-y += video-bios.o
36 36
37targets += $(setup-y) 37targets += $(setup-y)
38hostprogs-y := mkcpustr tools/build 38hostprogs-y := tools/build
39hostprogs-$(CONFIG_X86_FEATURE_NAMES) += mkcpustr
39 40
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include \ 41HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
41 -include include/generated/autoconf.h \ 42 -include include/generated/autoconf.h \
42 -D__EXPORTED_HEADERS__ 43 -D__EXPORTED_HEADERS__
43 44
45ifdef CONFIG_X86_FEATURE_NAMES
44$(obj)/cpu.o: $(obj)/cpustr.h 46$(obj)/cpu.o: $(obj)/cpustr.h
45 47
46quiet_cmd_cpustr = CPUSTR $@ 48quiet_cmd_cpustr = CPUSTR $@
47 cmd_cpustr = $(obj)/mkcpustr > $@ 49 cmd_cpustr = $(obj)/mkcpustr > $@
48targets += cpustr.h 50targets += cpustr.h
49$(obj)/cpustr.h: $(obj)/mkcpustr FORCE 51$(obj)/cpustr.h: $(obj)/mkcpustr FORCE
50 $(call if_changed,cpustr) 52 $(call if_changed,cpustr)
53endif
51 54
52# --------------------------------------------------------------------------- 55# ---------------------------------------------------------------------------
53 56
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 0fcd9133790c..704f58aa79cd 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -26,17 +26,18 @@ LDFLAGS_vmlinux := -T
26hostprogs-y := mkpiggy 26hostprogs-y := mkpiggy
27HOST_EXTRACFLAGS += -I$(srctree)/tools/include 27HOST_EXTRACFLAGS += -I$(srctree)/tools/include
28 28
29VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ 29vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
30 $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \ 30 $(obj)/string.o $(obj)/cmdline.o \
31 $(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o 31 $(obj)/piggy.o $(obj)/cpuflags.o
32
33vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o
34vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
32 35
33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 36$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34 37
35ifeq ($(CONFIG_EFI_STUB), y) 38vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
37endif
38 39
39$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE 40$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
40 $(call if_changed,ld) 41 $(call if_changed,ld)
41 @: 42 @:
42 43
@@ -44,7 +45,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
44$(obj)/vmlinux.bin: vmlinux FORCE 45$(obj)/vmlinux.bin: vmlinux FORCE
45 $(call if_changed,objcopy) 46 $(call if_changed,objcopy)
46 47
47targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs 48targets += $(patsubst $(obj)/%,%,$(vmlinux-objs-y)) vmlinux.bin.all vmlinux.relocs
48 49
49CMD_RELOCS = arch/x86/tools/relocs 50CMD_RELOCS = arch/x86/tools/relocs
50quiet_cmd_relocs = RELOCS $@ 51quiet_cmd_relocs = RELOCS $@
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index d39189ba7f8e..7c68808edeb7 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -1,6 +1,5 @@
1#include "misc.h" 1#include "misc.h"
2 2
3#ifdef CONFIG_RANDOMIZE_BASE
4#include <asm/msr.h> 3#include <asm/msr.h>
5#include <asm/archrandom.h> 4#include <asm/archrandom.h>
6#include <asm/e820.h> 5#include <asm/e820.h>
@@ -335,5 +334,3 @@ unsigned char *choose_kernel_location(unsigned char *input,
335out: 334out:
336 return (unsigned char *)choice; 335 return (unsigned char *)choice;
337} 336}
338
339#endif /* CONFIG_RANDOMIZE_BASE */
diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
index d3d003cb5481..261e81fb9582 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,9 +1,5 @@
1#include "misc.h" 1#include "misc.h"
2 2
3#ifdef CONFIG_EARLY_PRINTK
4
5int early_serial_base; 3int early_serial_base;
6 4
7#include "../early_serial_console.c" 5#include "../early_serial_console.c"
8
9#endif
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c
index 6ec6bb6e9957..29207f69ae8c 100644
--- a/arch/x86/boot/cpu.c
+++ b/arch/x86/boot/cpu.c
@@ -16,7 +16,9 @@
16 */ 16 */
17 17
18#include "boot.h" 18#include "boot.h"
19#ifdef CONFIG_X86_FEATURE_NAMES
19#include "cpustr.h" 20#include "cpustr.h"
21#endif
20 22
21static char *cpu_name(int level) 23static char *cpu_name(int level)
22{ 24{
@@ -32,11 +34,48 @@ static char *cpu_name(int level)
32 } 34 }
33} 35}
34 36
37static void show_cap_strs(u32 *err_flags)
38{
39 int i, j;
40#ifdef CONFIG_X86_FEATURE_NAMES
41 const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
42 for (i = 0; i < NCAPINTS; i++) {
43 u32 e = err_flags[i];
44 for (j = 0; j < 32; j++) {
45 if (msg_strs[0] < i ||
46 (msg_strs[0] == i && msg_strs[1] < j)) {
47 /* Skip to the next string */
48 msg_strs += 2;
49 while (*msg_strs++)
50 ;
51 }
52 if (e & 1) {
53 if (msg_strs[0] == i &&
54 msg_strs[1] == j &&
55 msg_strs[2])
56 printf("%s ", msg_strs+2);
57 else
58 printf("%d:%d ", i, j);
59 }
60 e >>= 1;
61 }
62 }
63#else
64 for (i = 0; i < NCAPINTS; i++) {
65 u32 e = err_flags[i];
66 for (j = 0; j < 32; j++) {
67 if (e & 1)
68 printf("%d:%d ", i, j);
69 e >>= 1;
70 }
71 }
72#endif
73}
74
35int validate_cpu(void) 75int validate_cpu(void)
36{ 76{
37 u32 *err_flags; 77 u32 *err_flags;
38 int cpu_level, req_level; 78 int cpu_level, req_level;
39 const unsigned char *msg_strs;
40 79
41 check_cpu(&cpu_level, &req_level, &err_flags); 80 check_cpu(&cpu_level, &req_level, &err_flags);
42 81
@@ -49,34 +88,9 @@ int validate_cpu(void)
49 } 88 }
50 89
51 if (err_flags) { 90 if (err_flags) {
52 int i, j;
53 puts("This kernel requires the following features " 91 puts("This kernel requires the following features "
54 "not present on the CPU:\n"); 92 "not present on the CPU:\n");
55 93 show_cap_strs(err_flags);
56 msg_strs = (const unsigned char *)x86_cap_strs;
57
58 for (i = 0; i < NCAPINTS; i++) {
59 u32 e = err_flags[i];
60
61 for (j = 0; j < 32; j++) {
62 if (msg_strs[0] < i ||
63 (msg_strs[0] == i && msg_strs[1] < j)) {
64 /* Skip to the next string */
65 msg_strs += 2;
66 while (*msg_strs++)
67 ;
68 }
69 if (e & 1) {
70 if (msg_strs[0] == i &&
71 msg_strs[1] == j &&
72 msg_strs[2])
73 printf("%s ", msg_strs+2);
74 else
75 printf("%d:%d ", i, j);
76 }
77 e >>= 1;
78 }
79 }
80 putchar('\n'); 94 putchar('\n');
81 return -1; 95 return -1;
82 } else { 96 } else {
diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
new file mode 100644
index 000000000000..4e2ecfa23c15
--- /dev/null
+++ b/arch/x86/configs/tiny.config
@@ -0,0 +1 @@
CONFIG_NOHIGHMEM=y
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index bb9b258d60e7..516903b98e06 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -250,8 +250,15 @@
250#include <asm/asm.h> 250#include <asm/asm.h>
251#include <linux/bitops.h> 251#include <linux/bitops.h>
252 252
253#ifdef CONFIG_X86_FEATURE_NAMES
253extern const char * const x86_cap_flags[NCAPINTS*32]; 254extern const char * const x86_cap_flags[NCAPINTS*32];
254extern const char * const x86_power_flags[32]; 255extern const char * const x86_power_flags[32];
256#define X86_CAP_FMT "%s"
257#define x86_cap_flag(flag) x86_cap_flags[flag]
258#else
259#define X86_CAP_FMT "%d:%d"
260#define x86_cap_flag(flag) ((flag) >> 5), ((flag) & 31)
261#endif
255 262
256/* 263/*
257 * In order to save room, we index into this array by doing 264 * In order to save room, we index into this array by doing
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 7fd54f09b011..77dcab277710 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -13,10 +13,13 @@ nostackp := $(call cc-option, -fno-stack-protector)
13CFLAGS_common.o := $(nostackp) 13CFLAGS_common.o := $(nostackp)
14 14
15obj-y := intel_cacheinfo.o scattered.o topology.o 15obj-y := intel_cacheinfo.o scattered.o topology.o
16obj-y += proc.o capflags.o powerflags.o common.o 16obj-y += common.o
17obj-y += rdrand.o 17obj-y += rdrand.o
18obj-y += match.o 18obj-y += match.o
19 19
20obj-$(CONFIG_PROC_FS) += proc.o
21obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
22
20obj-$(CONFIG_X86_32) += bugs.o 23obj-$(CONFIG_X86_32) += bugs.o
21obj-$(CONFIG_X86_64) += bugs_64.o 24obj-$(CONFIG_X86_64) += bugs_64.o
22 25
@@ -48,6 +51,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
48 51
49obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o 52obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
50 53
54ifdef CONFIG_X86_FEATURE_NAMES
51quiet_cmd_mkcapflags = MKCAP $@ 55quiet_cmd_mkcapflags = MKCAP $@
52 cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@ 56 cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
53 57
@@ -56,3 +60,4 @@ cpufeature = $(src)/../../include/asm/cpufeature.h
56targets += capflags.c 60targets += capflags.c
57$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE 61$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
58 $(call if_changed,mkcapflags) 62 $(call if_changed,mkcapflags)
63endif
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index e4ab2b42bd6f..c649f236e288 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -346,8 +346,8 @@ static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
346 continue; 346 continue;
347 347
348 printk(KERN_WARNING 348 printk(KERN_WARNING
349 "CPU: CPU feature %s disabled, no CPUID level 0x%x\n", 349 "CPU: CPU feature " X86_CAP_FMT " disabled, no CPUID level 0x%x\n",
350 x86_cap_flags[df->feature], df->level); 350 x86_cap_flag(df->feature), df->level);
351 } 351 }
352} 352}
353 353
diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c
index 3c562f5a60bb..e1bce26cd4f9 100644
--- a/crypto/async_tx/async_xor.c
+++ b/crypto/async_tx/async_xor.c
@@ -78,8 +78,6 @@ do_async_xor(struct dma_chan *chan, struct dmaengine_unmap_data *unmap,
78 tx = dma->device_prep_dma_xor(chan, dma_dest, src_list, 78 tx = dma->device_prep_dma_xor(chan, dma_dest, src_list,
79 xor_src_cnt, unmap->len, 79 xor_src_cnt, unmap->len,
80 dma_flags); 80 dma_flags);
81 src_list[0] = tmp;
82
83 81
84 if (unlikely(!tx)) 82 if (unlikely(!tx))
85 async_tx_quiesce(&submit->depend_tx); 83 async_tx_quiesce(&submit->depend_tx);
@@ -92,6 +90,7 @@ do_async_xor(struct dma_chan *chan, struct dmaengine_unmap_data *unmap,
92 xor_src_cnt, unmap->len, 90 xor_src_cnt, unmap->len,
93 dma_flags); 91 dma_flags);
94 } 92 }
93 src_list[0] = tmp;
95 94
96 dma_set_unmap(tx, unmap); 95 dma_set_unmap(tx, unmap);
97 async_tx_submit(chan, tx, submit); 96 async_tx_submit(chan, tx, submit);
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index 4251570610c9..8a3f51f7b1b9 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -11,12 +11,15 @@ config REGMAP
11 11
12config REGMAP_I2C 12config REGMAP_I2C
13 tristate 13 tristate
14 depends on I2C
14 15
15config REGMAP_SPI 16config REGMAP_SPI
16 tristate 17 tristate
18 depends on SPI
17 19
18config REGMAP_SPMI 20config REGMAP_SPMI
19 tristate 21 tristate
22 depends on SPMI
20 23
21config REGMAP_MMIO 24config REGMAP_MMIO
22 tristate 25 tristate
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index bfc90b8547f2..0da5865df5b1 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -49,8 +49,10 @@ struct regmap_async {
49}; 49};
50 50
51struct regmap { 51struct regmap {
52 struct mutex mutex; 52 union {
53 spinlock_t spinlock; 53 struct mutex mutex;
54 spinlock_t spinlock;
55 };
54 unsigned long spinlock_flags; 56 unsigned long spinlock_flags;
55 regmap_lock lock; 57 regmap_lock lock;
56 regmap_unlock unlock; 58 regmap_unlock unlock;
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 5617da6dc898..f1280dc356d0 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -269,8 +269,11 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
269 map->cache_bypass = 1; 269 map->cache_bypass = 1;
270 ret = _regmap_write(map, reg, val); 270 ret = _regmap_write(map, reg, val);
271 map->cache_bypass = 0; 271 map->cache_bypass = 0;
272 if (ret) 272 if (ret) {
273 dev_err(map->dev, "Unable to sync register %#x. %d\n",
274 reg, ret);
273 return ret; 275 return ret;
276 }
274 dev_dbg(map->dev, "Synced register %#x, value %#x\n", reg, val); 277 dev_dbg(map->dev, "Synced register %#x, value %#x\n", reg, val);
275 } 278 }
276 279
@@ -615,8 +618,11 @@ static int regcache_sync_block_single(struct regmap *map, void *block,
615 ret = _regmap_write(map, regtmp, val); 618 ret = _regmap_write(map, regtmp, val);
616 619
617 map->cache_bypass = 0; 620 map->cache_bypass = 0;
618 if (ret != 0) 621 if (ret != 0) {
622 dev_err(map->dev, "Unable to sync register %#x. %d\n",
623 regtmp, ret);
619 return ret; 624 return ret;
625 }
620 dev_dbg(map->dev, "Synced register %#x, value %#x\n", 626 dev_dbg(map->dev, "Synced register %#x, value %#x\n",
621 regtmp, val); 627 regtmp, val);
622 } 628 }
@@ -641,6 +647,9 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
641 map->cache_bypass = 1; 647 map->cache_bypass = 1;
642 648
643 ret = _regmap_raw_write(map, base, *data, count * val_bytes); 649 ret = _regmap_raw_write(map, base, *data, count * val_bytes);
650 if (ret)
651 dev_err(map->dev, "Unable to sync registers %#x-%#x. %d\n",
652 base, cur - map->reg_stride, ret);
644 653
645 map->cache_bypass = 0; 654 map->cache_bypass = 0;
646 655
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 0c94b661c16f..5799a0b9e6cc 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -473,6 +473,7 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
473{ 473{
474 struct rb_node *next; 474 struct rb_node *next;
475 struct regmap_range_node *range_node; 475 struct regmap_range_node *range_node;
476 const char *devname = "dummy";
476 477
477 /* If we don't have the debugfs root yet, postpone init */ 478 /* If we don't have the debugfs root yet, postpone init */
478 if (!regmap_debugfs_root) { 479 if (!regmap_debugfs_root) {
@@ -491,12 +492,15 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
491 INIT_LIST_HEAD(&map->debugfs_off_cache); 492 INIT_LIST_HEAD(&map->debugfs_off_cache);
492 mutex_init(&map->cache_lock); 493 mutex_init(&map->cache_lock);
493 494
495 if (map->dev)
496 devname = dev_name(map->dev);
497
494 if (name) { 498 if (name) {
495 map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", 499 map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",
496 dev_name(map->dev), name); 500 devname, name);
497 name = map->debugfs_name; 501 name = map->debugfs_name;
498 } else { 502 } else {
499 name = dev_name(map->dev); 503 name = devname;
500 } 504 }
501 505
502 map->debugfs = debugfs_create_dir(name, regmap_debugfs_root); 506 map->debugfs = debugfs_create_dir(name, regmap_debugfs_root);
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
index ca193d1ef47c..053150a7f9f2 100644
--- a/drivers/base/regmap/regmap-i2c.c
+++ b/drivers/base/regmap/regmap-i2c.c
@@ -168,6 +168,8 @@ static struct regmap_bus regmap_i2c = {
168 .write = regmap_i2c_write, 168 .write = regmap_i2c_write,
169 .gather_write = regmap_i2c_gather_write, 169 .gather_write = regmap_i2c_gather_write,
170 .read = regmap_i2c_read, 170 .read = regmap_i2c_read,
171 .reg_format_endian_default = REGMAP_ENDIAN_BIG,
172 .val_format_endian_default = REGMAP_ENDIAN_BIG,
171}; 173};
172 174
173static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c, 175static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c
index 0eb3097c0d76..53d1148e80a0 100644
--- a/drivers/base/regmap/regmap-spi.c
+++ b/drivers/base/regmap/regmap-spi.c
@@ -109,6 +109,8 @@ static struct regmap_bus regmap_spi = {
109 .async_alloc = regmap_spi_async_alloc, 109 .async_alloc = regmap_spi_async_alloc,
110 .read = regmap_spi_read, 110 .read = regmap_spi_read,
111 .read_flag_mask = 0x80, 111 .read_flag_mask = 0x80,
112 .reg_format_endian_default = REGMAP_ENDIAN_BIG,
113 .val_format_endian_default = REGMAP_ENDIAN_BIG,
112}; 114};
113 115
114/** 116/**
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 1cf427bc0d4a..d2f8a818d200 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -15,6 +15,7 @@
15#include <linux/export.h> 15#include <linux/export.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/of.h>
18#include <linux/rbtree.h> 19#include <linux/rbtree.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20 21
@@ -448,6 +449,71 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
448} 449}
449EXPORT_SYMBOL_GPL(regmap_attach_dev); 450EXPORT_SYMBOL_GPL(regmap_attach_dev);
450 451
452static enum regmap_endian regmap_get_reg_endian(const struct regmap_bus *bus,
453 const struct regmap_config *config)
454{
455 enum regmap_endian endian;
456
457 /* Retrieve the endianness specification from the regmap config */
458 endian = config->reg_format_endian;
459
460 /* If the regmap config specified a non-default value, use that */
461 if (endian != REGMAP_ENDIAN_DEFAULT)
462 return endian;
463
464 /* Retrieve the endianness specification from the bus config */
465 if (bus && bus->reg_format_endian_default)
466 endian = bus->reg_format_endian_default;
467
468 /* If the bus specified a non-default value, use that */
469 if (endian != REGMAP_ENDIAN_DEFAULT)
470 return endian;
471
472 /* Use this if no other value was found */
473 return REGMAP_ENDIAN_BIG;
474}
475
476static enum regmap_endian regmap_get_val_endian(struct device *dev,
477 const struct regmap_bus *bus,
478 const struct regmap_config *config)
479{
480 struct device_node *np;
481 enum regmap_endian endian;
482
483 /* Retrieve the endianness specification from the regmap config */
484 endian = config->val_format_endian;
485
486 /* If the regmap config specified a non-default value, use that */
487 if (endian != REGMAP_ENDIAN_DEFAULT)
488 return endian;
489
490 /* If the dev and dev->of_node exist try to get endianness from DT */
491 if (dev && dev->of_node) {
492 np = dev->of_node;
493
494 /* Parse the device's DT node for an endianness specification */
495 if (of_property_read_bool(np, "big-endian"))
496 endian = REGMAP_ENDIAN_BIG;
497 else if (of_property_read_bool(np, "little-endian"))
498 endian = REGMAP_ENDIAN_LITTLE;
499
500 /* If the endianness was specified in DT, use that */
501 if (endian != REGMAP_ENDIAN_DEFAULT)
502 return endian;
503 }
504
505 /* Retrieve the endianness specification from the bus config */
506 if (bus && bus->val_format_endian_default)
507 endian = bus->val_format_endian_default;
508
509 /* If the bus specified a non-default value, use that */
510 if (endian != REGMAP_ENDIAN_DEFAULT)
511 return endian;
512
513 /* Use this if no other value was found */
514 return REGMAP_ENDIAN_BIG;
515}
516
451/** 517/**
452 * regmap_init(): Initialise register map 518 * regmap_init(): Initialise register map
453 * 519 *
@@ -551,17 +617,8 @@ struct regmap *regmap_init(struct device *dev,
551 map->reg_read = _regmap_bus_read; 617 map->reg_read = _regmap_bus_read;
552 } 618 }
553 619
554 reg_endian = config->reg_format_endian; 620 reg_endian = regmap_get_reg_endian(bus, config);
555 if (reg_endian == REGMAP_ENDIAN_DEFAULT) 621 val_endian = regmap_get_val_endian(dev, bus, config);
556 reg_endian = bus->reg_format_endian_default;
557 if (reg_endian == REGMAP_ENDIAN_DEFAULT)
558 reg_endian = REGMAP_ENDIAN_BIG;
559
560 val_endian = config->val_format_endian;
561 if (val_endian == REGMAP_ENDIAN_DEFAULT)
562 val_endian = bus->val_format_endian_default;
563 if (val_endian == REGMAP_ENDIAN_DEFAULT)
564 val_endian = REGMAP_ENDIAN_BIG;
565 622
566 switch (config->reg_bits + map->reg_shift) { 623 switch (config->reg_bits + map->reg_shift) {
567 case 2: 624 case 2:
@@ -1408,7 +1465,7 @@ int _regmap_write(struct regmap *map, unsigned int reg,
1408 } 1465 }
1409 1466
1410#ifdef LOG_DEVICE 1467#ifdef LOG_DEVICE
1411 if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) 1468 if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
1412 dev_info(map->dev, "%x <= %x\n", reg, val); 1469 dev_info(map->dev, "%x <= %x\n", reg, val);
1413#endif 1470#endif
1414 1471
@@ -1659,6 +1716,9 @@ out:
1659 } else { 1716 } else {
1660 void *wval; 1717 void *wval;
1661 1718
1719 if (!val_count)
1720 return -EINVAL;
1721
1662 wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL); 1722 wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
1663 if (!wval) { 1723 if (!wval) {
1664 dev_err(map->dev, "Error in memory allocation\n"); 1724 dev_err(map->dev, "Error in memory allocation\n");
@@ -2058,7 +2118,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
2058 ret = map->reg_read(context, reg, val); 2118 ret = map->reg_read(context, reg, val);
2059 if (ret == 0) { 2119 if (ret == 0) {
2060#ifdef LOG_DEVICE 2120#ifdef LOG_DEVICE
2061 if (strcmp(dev_name(map->dev), LOG_DEVICE) == 0) 2121 if (map->dev && strcmp(dev_name(map->dev), LOG_DEVICE) == 0)
2062 dev_info(map->dev, "%x => %x\n", reg, *val); 2122 dev_info(map->dev, "%x => %x\n", reg, *val);
2063#endif 2123#endif
2064 2124
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index e6db9381b2c7..f816211f062f 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2796,7 +2796,6 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
2796 = IPMI_CHANNEL_MEDIUM_IPMB; 2796 = IPMI_CHANNEL_MEDIUM_IPMB;
2797 intf->channels[0].protocol 2797 intf->channels[0].protocol
2798 = IPMI_CHANNEL_PROTOCOL_IPMB; 2798 = IPMI_CHANNEL_PROTOCOL_IPMB;
2799 rv = -ENOSYS;
2800 2799
2801 intf->curr_channel = IPMI_MAX_CHANNELS; 2800 intf->curr_channel = IPMI_MAX_CHANNELS;
2802 wake_up(&intf->waitq); 2801 wake_up(&intf->waitq);
@@ -2821,12 +2820,12 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
2821 2820
2822 if (rv) { 2821 if (rv) {
2823 /* Got an error somehow, just give up. */ 2822 /* Got an error somehow, just give up. */
2823 printk(KERN_WARNING PFX
2824 "Error sending channel information for channel"
2825 " %d: %d\n", intf->curr_channel, rv);
2826
2824 intf->curr_channel = IPMI_MAX_CHANNELS; 2827 intf->curr_channel = IPMI_MAX_CHANNELS;
2825 wake_up(&intf->waitq); 2828 wake_up(&intf->waitq);
2826
2827 printk(KERN_WARNING PFX
2828 "Error sending channel information: %d\n",
2829 rv);
2830 } 2829 }
2831 } 2830 }
2832 out: 2831 out:
@@ -2964,8 +2963,12 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
2964 intf->null_user_handler = channel_handler; 2963 intf->null_user_handler = channel_handler;
2965 intf->curr_channel = 0; 2964 intf->curr_channel = 0;
2966 rv = send_channel_info_cmd(intf, 0); 2965 rv = send_channel_info_cmd(intf, 0);
2967 if (rv) 2966 if (rv) {
2967 printk(KERN_WARNING PFX
2968 "Error sending channel information for channel"
2969 " 0, %d\n", rv);
2968 goto out; 2970 goto out;
2971 }
2969 2972
2970 /* Wait for the channel info to be read. */ 2973 /* Wait for the channel info to be read. */
2971 wait_event(intf->waitq, 2974 wait_event(intf->waitq,
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 5d665680ae33..5c4e1f625bbb 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -965,9 +965,9 @@ static inline int ipmi_si_is_busy(struct timespec *ts)
965 return ts->tv_nsec != -1; 965 return ts->tv_nsec != -1;
966} 966}
967 967
968static int ipmi_thread_busy_wait(enum si_sm_result smi_result, 968static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
969 const struct smi_info *smi_info, 969 const struct smi_info *smi_info,
970 struct timespec *busy_until) 970 struct timespec *busy_until)
971{ 971{
972 unsigned int max_busy_us = 0; 972 unsigned int max_busy_us = 0;
973 973
@@ -2658,6 +2658,9 @@ static int ipmi_probe(struct platform_device *dev)
2658 if (!match) 2658 if (!match)
2659 return -EINVAL; 2659 return -EINVAL;
2660 2660
2661 if (!of_device_is_available(np))
2662 return -EINVAL;
2663
2661 ret = of_address_to_resource(np, 0, &resource); 2664 ret = of_address_to_resource(np, 0, &resource);
2662 if (ret) { 2665 if (ret) {
2663 dev_warn(&dev->dev, PFX "invalid address from OF\n"); 2666 dev_warn(&dev->dev, PFX "invalid address from OF\n");
@@ -3655,6 +3658,9 @@ static void cleanup_one_si(struct smi_info *to_clean)
3655 if (!to_clean) 3658 if (!to_clean)
3656 return; 3659 return;
3657 3660
3661 if (to_clean->dev)
3662 dev_set_drvdata(to_clean->dev, NULL);
3663
3658 list_del(&to_clean->link); 3664 list_del(&to_clean->link);
3659 3665
3660 /* Tell the driver that we are shutting down. */ 3666 /* Tell the driver that we are shutting down. */
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 6e93e7f98358..61190f6b4829 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1658,10 +1658,8 @@ void cpufreq_suspend(void)
1658 if (!cpufreq_driver) 1658 if (!cpufreq_driver)
1659 return; 1659 return;
1660 1660
1661 cpufreq_suspended = true;
1662
1663 if (!has_target()) 1661 if (!has_target())
1664 return; 1662 goto suspend;
1665 1663
1666 pr_debug("%s: Suspending Governors\n", __func__); 1664 pr_debug("%s: Suspending Governors\n", __func__);
1667 1665
@@ -1674,6 +1672,9 @@ void cpufreq_suspend(void)
1674 pr_err("%s: Failed to suspend driver: %p\n", __func__, 1672 pr_err("%s: Failed to suspend driver: %p\n", __func__,
1675 policy); 1673 policy);
1676 } 1674 }
1675
1676suspend:
1677 cpufreq_suspended = true;
1677} 1678}
1678 1679
1679/** 1680/**
diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c
index c1320528b9d0..6bd69adc3c5e 100644
--- a/drivers/cpufreq/integrator-cpufreq.c
+++ b/drivers/cpufreq/integrator-cpufreq.c
@@ -213,9 +213,9 @@ static int __init integrator_cpufreq_probe(struct platform_device *pdev)
213 return cpufreq_register_driver(&integrator_driver); 213 return cpufreq_register_driver(&integrator_driver);
214} 214}
215 215
216static void __exit integrator_cpufreq_remove(struct platform_device *pdev) 216static int __exit integrator_cpufreq_remove(struct platform_device *pdev)
217{ 217{
218 cpufreq_unregister_driver(&integrator_driver); 218 return cpufreq_unregister_driver(&integrator_driver);
219} 219}
220 220
221static const struct of_device_id integrator_cpufreq_match[] = { 221static const struct of_device_id integrator_cpufreq_match[] = {
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index 728a2d879499..4d2c8e861089 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -204,7 +204,6 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
204 u32 input_buffer; 204 u32 input_buffer;
205 int cpu; 205 int cpu;
206 206
207 spin_lock(&pcc_lock);
208 cpu = policy->cpu; 207 cpu = policy->cpu;
209 pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); 208 pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu);
210 209
@@ -216,6 +215,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
216 freqs.old = policy->cur; 215 freqs.old = policy->cur;
217 freqs.new = target_freq; 216 freqs.new = target_freq;
218 cpufreq_freq_transition_begin(policy, &freqs); 217 cpufreq_freq_transition_begin(policy, &freqs);
218 spin_lock(&pcc_lock);
219 219
220 input_buffer = 0x1 | (((target_freq * 100) 220 input_buffer = 0x1 | (((target_freq * 100)
221 / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); 221 / (ioread32(&pcch_hdr->nominal) * 1000)) << 8);
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 9b1ea0ef59af..a016490c95ae 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -427,18 +427,6 @@ config DMA_OF
427comment "DMA Clients" 427comment "DMA Clients"
428 depends on DMA_ENGINE 428 depends on DMA_ENGINE
429 429
430config NET_DMA
431 bool "Network: TCP receive copy offload"
432 depends on DMA_ENGINE && NET
433 default (INTEL_IOATDMA || FSL_DMA)
434 depends on BROKEN
435 help
436 This enables the use of DMA engines in the network stack to
437 offload receive copy-to-user operations, freeing CPU cycles.
438
439 Say Y here if you enabled INTEL_IOATDMA or FSL_DMA, otherwise
440 say N.
441
442config ASYNC_TX_DMA 430config ASYNC_TX_DMA
443 bool "Async_tx: Offload support for the async_tx api" 431 bool "Async_tx: Offload support for the async_tx api"
444 depends on DMA_ENGINE 432 depends on DMA_ENGINE
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index c6adb925f0b9..cb626c179911 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -6,7 +6,6 @@ obj-$(CONFIG_DMA_VIRTUAL_CHANNELS) += virt-dma.o
6obj-$(CONFIG_DMA_ACPI) += acpi-dma.o 6obj-$(CONFIG_DMA_ACPI) += acpi-dma.o
7obj-$(CONFIG_DMA_OF) += of-dma.o 7obj-$(CONFIG_DMA_OF) += of-dma.o
8 8
9obj-$(CONFIG_NET_DMA) += iovlock.o
10obj-$(CONFIG_INTEL_MID_DMAC) += intel_mid_dma.o 9obj-$(CONFIG_INTEL_MID_DMAC) += intel_mid_dma.o
11obj-$(CONFIG_DMATEST) += dmatest.o 10obj-$(CONFIG_DMATEST) += dmatest.o
12obj-$(CONFIG_INTEL_IOATDMA) += ioat/ 11obj-$(CONFIG_INTEL_IOATDMA) += ioat/
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index d5d30ed863ce..24bfaf0b92ba 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -1081,110 +1081,6 @@ dmaengine_get_unmap_data(struct device *dev, int nr, gfp_t flags)
1081} 1081}
1082EXPORT_SYMBOL(dmaengine_get_unmap_data); 1082EXPORT_SYMBOL(dmaengine_get_unmap_data);
1083 1083
1084/**
1085 * dma_async_memcpy_pg_to_pg - offloaded copy from page to page
1086 * @chan: DMA channel to offload copy to
1087 * @dest_pg: destination page
1088 * @dest_off: offset in page to copy to
1089 * @src_pg: source page
1090 * @src_off: offset in page to copy from
1091 * @len: length
1092 *
1093 * Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus
1094 * address according to the DMA mapping API rules for streaming mappings.
1095 * Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident
1096 * (kernel memory or locked user space pages).
1097 */
1098dma_cookie_t
1099dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg,
1100 unsigned int dest_off, struct page *src_pg, unsigned int src_off,
1101 size_t len)
1102{
1103 struct dma_device *dev = chan->device;
1104 struct dma_async_tx_descriptor *tx;
1105 struct dmaengine_unmap_data *unmap;
1106 dma_cookie_t cookie;
1107 unsigned long flags;
1108
1109 unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOWAIT);
1110 if (!unmap)
1111 return -ENOMEM;
1112
1113 unmap->to_cnt = 1;
1114 unmap->from_cnt = 1;
1115 unmap->addr[0] = dma_map_page(dev->dev, src_pg, src_off, len,
1116 DMA_TO_DEVICE);
1117 unmap->addr[1] = dma_map_page(dev->dev, dest_pg, dest_off, len,
1118 DMA_FROM_DEVICE);
1119 unmap->len = len;
1120 flags = DMA_CTRL_ACK;
1121 tx = dev->device_prep_dma_memcpy(chan, unmap->addr[1], unmap->addr[0],
1122 len, flags);
1123
1124 if (!tx) {
1125 dmaengine_unmap_put(unmap);
1126 return -ENOMEM;
1127 }
1128
1129 dma_set_unmap(tx, unmap);
1130 cookie = tx->tx_submit(tx);
1131 dmaengine_unmap_put(unmap);
1132
1133 preempt_disable();
1134 __this_cpu_add(chan->local->bytes_transferred, len);
1135 __this_cpu_inc(chan->local->memcpy_count);
1136 preempt_enable();
1137
1138 return cookie;
1139}
1140EXPORT_SYMBOL(dma_async_memcpy_pg_to_pg);
1141
1142/**
1143 * dma_async_memcpy_buf_to_buf - offloaded copy between virtual addresses
1144 * @chan: DMA channel to offload copy to
1145 * @dest: destination address (virtual)
1146 * @src: source address (virtual)
1147 * @len: length
1148 *
1149 * Both @dest and @src must be mappable to a bus address according to the
1150 * DMA mapping API rules for streaming mappings.
1151 * Both @dest and @src must stay memory resident (kernel memory or locked
1152 * user space pages).
1153 */
1154dma_cookie_t
1155dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest,
1156 void *src, size_t len)
1157{
1158 return dma_async_memcpy_pg_to_pg(chan, virt_to_page(dest),
1159 (unsigned long) dest & ~PAGE_MASK,
1160 virt_to_page(src),
1161 (unsigned long) src & ~PAGE_MASK, len);
1162}
1163EXPORT_SYMBOL(dma_async_memcpy_buf_to_buf);
1164
1165/**
1166 * dma_async_memcpy_buf_to_pg - offloaded copy from address to page
1167 * @chan: DMA channel to offload copy to
1168 * @page: destination page
1169 * @offset: offset in page to copy to
1170 * @kdata: source address (virtual)
1171 * @len: length
1172 *
1173 * Both @page/@offset and @kdata must be mappable to a bus address according
1174 * to the DMA mapping API rules for streaming mappings.
1175 * Both @page/@offset and @kdata must stay memory resident (kernel memory or
1176 * locked user space pages)
1177 */
1178dma_cookie_t
1179dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page,
1180 unsigned int offset, void *kdata, size_t len)
1181{
1182 return dma_async_memcpy_pg_to_pg(chan, page, offset,
1183 virt_to_page(kdata),
1184 (unsigned long) kdata & ~PAGE_MASK, len);
1185}
1186EXPORT_SYMBOL(dma_async_memcpy_buf_to_pg);
1187
1188void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, 1084void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
1189 struct dma_chan *chan) 1085 struct dma_chan *chan)
1190{ 1086{
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index e27cec25c59e..a8d7809e2f4c 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -688,14 +688,14 @@ static int dmatest_func(void *data)
688 runtime = ktime_us_delta(ktime_get(), ktime); 688 runtime = ktime_us_delta(ktime_get(), ktime);
689 689
690 ret = 0; 690 ret = 0;
691err_dstbuf:
691 for (i = 0; thread->dsts[i]; i++) 692 for (i = 0; thread->dsts[i]; i++)
692 kfree(thread->dsts[i]); 693 kfree(thread->dsts[i]);
693err_dstbuf:
694 kfree(thread->dsts); 694 kfree(thread->dsts);
695err_dsts: 695err_dsts:
696err_srcbuf:
696 for (i = 0; thread->srcs[i]; i++) 697 for (i = 0; thread->srcs[i]; i++)
697 kfree(thread->srcs[i]); 698 kfree(thread->srcs[i]);
698err_srcbuf:
699 kfree(thread->srcs); 699 kfree(thread->srcs);
700err_srcs: 700err_srcs:
701 kfree(pq_coefs); 701 kfree(pq_coefs);
diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c
index 9e84d5bc9307..3b55bb8d969a 100644
--- a/drivers/dma/ioat/dca.c
+++ b/drivers/dma/ioat/dca.c
@@ -35,6 +35,7 @@
35 35
36#include "dma.h" 36#include "dma.h"
37#include "registers.h" 37#include "registers.h"
38#include "dma_v2.h"
38 39
39/* 40/*
40 * Bit 7 of a tag map entry is the "valid" bit, if it is set then bits 0:6 41 * Bit 7 of a tag map entry is the "valid" bit, if it is set then bits 0:6
@@ -147,7 +148,7 @@ static int ioat_dca_add_requester(struct dca_provider *dca, struct device *dev)
147 u16 id; 148 u16 id;
148 149
149 /* This implementation only supports PCI-Express */ 150 /* This implementation only supports PCI-Express */
150 if (dev->bus != &pci_bus_type) 151 if (!dev_is_pci(dev))
151 return -ENODEV; 152 return -ENODEV;
152 pdev = to_pci_dev(dev); 153 pdev = to_pci_dev(dev);
153 id = dcaid_from_pcidev(pdev); 154 id = dcaid_from_pcidev(pdev);
@@ -179,7 +180,7 @@ static int ioat_dca_remove_requester(struct dca_provider *dca,
179 int i; 180 int i;
180 181
181 /* This implementation only supports PCI-Express */ 182 /* This implementation only supports PCI-Express */
182 if (dev->bus != &pci_bus_type) 183 if (!dev_is_pci(dev))
183 return -ENODEV; 184 return -ENODEV;
184 pdev = to_pci_dev(dev); 185 pdev = to_pci_dev(dev);
185 186
@@ -320,7 +321,7 @@ static int ioat2_dca_add_requester(struct dca_provider *dca, struct device *dev)
320 u16 global_req_table; 321 u16 global_req_table;
321 322
322 /* This implementation only supports PCI-Express */ 323 /* This implementation only supports PCI-Express */
323 if (dev->bus != &pci_bus_type) 324 if (!dev_is_pci(dev))
324 return -ENODEV; 325 return -ENODEV;
325 pdev = to_pci_dev(dev); 326 pdev = to_pci_dev(dev);
326 id = dcaid_from_pcidev(pdev); 327 id = dcaid_from_pcidev(pdev);
@@ -354,7 +355,7 @@ static int ioat2_dca_remove_requester(struct dca_provider *dca,
354 u16 global_req_table; 355 u16 global_req_table;
355 356
356 /* This implementation only supports PCI-Express */ 357 /* This implementation only supports PCI-Express */
357 if (dev->bus != &pci_bus_type) 358 if (!dev_is_pci(dev))
358 return -ENODEV; 359 return -ENODEV;
359 pdev = to_pci_dev(dev); 360 pdev = to_pci_dev(dev);
360 361
@@ -496,7 +497,7 @@ static int ioat3_dca_add_requester(struct dca_provider *dca, struct device *dev)
496 u16 global_req_table; 497 u16 global_req_table;
497 498
498 /* This implementation only supports PCI-Express */ 499 /* This implementation only supports PCI-Express */
499 if (dev->bus != &pci_bus_type) 500 if (!dev_is_pci(dev))
500 return -ENODEV; 501 return -ENODEV;
501 pdev = to_pci_dev(dev); 502 pdev = to_pci_dev(dev);
502 id = dcaid_from_pcidev(pdev); 503 id = dcaid_from_pcidev(pdev);
@@ -530,7 +531,7 @@ static int ioat3_dca_remove_requester(struct dca_provider *dca,
530 u16 global_req_table; 531 u16 global_req_table;
531 532
532 /* This implementation only supports PCI-Express */ 533 /* This implementation only supports PCI-Express */
533 if (dev->bus != &pci_bus_type) 534 if (!dev_is_pci(dev))
534 return -ENODEV; 535 return -ENODEV;
535 pdev = to_pci_dev(dev); 536 pdev = to_pci_dev(dev);
536 537
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 4e3549a16132..940c1502a8b5 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -947,7 +947,7 @@ msix:
947 for (i = 0; i < msixcnt; i++) 947 for (i = 0; i < msixcnt; i++)
948 device->msix_entries[i].entry = i; 948 device->msix_entries[i].entry = i;
949 949
950 err = pci_enable_msix(pdev, device->msix_entries, msixcnt); 950 err = pci_enable_msix_exact(pdev, device->msix_entries, msixcnt);
951 if (err) 951 if (err)
952 goto msi; 952 goto msi;
953 953
@@ -1222,7 +1222,6 @@ int ioat1_dma_probe(struct ioatdma_device *device, int dca)
1222 err = ioat_probe(device); 1222 err = ioat_probe(device);
1223 if (err) 1223 if (err)
1224 return err; 1224 return err;
1225 ioat_set_tcp_copy_break(4096);
1226 err = ioat_register(device); 1225 err = ioat_register(device);
1227 if (err) 1226 if (err)
1228 return err; 1227 return err;
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index e982f00a9843..d63f68b1aa35 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -214,13 +214,6 @@ __dump_desc_dbg(struct ioat_chan_common *chan, struct ioat_dma_descriptor *hw,
214#define dump_desc_dbg(c, d) \ 214#define dump_desc_dbg(c, d) \
215 ({ if (d) __dump_desc_dbg(&c->base, d->hw, &d->txd, desc_id(d)); 0; }) 215 ({ if (d) __dump_desc_dbg(&c->base, d->hw, &d->txd, desc_id(d)); 0; })
216 216
217static inline void ioat_set_tcp_copy_break(unsigned long copybreak)
218{
219 #ifdef CONFIG_NET_DMA
220 sysctl_tcp_dma_copybreak = copybreak;
221 #endif
222}
223
224static inline struct ioat_chan_common * 217static inline struct ioat_chan_common *
225ioat_chan_by_index(struct ioatdma_device *device, int index) 218ioat_chan_by_index(struct ioatdma_device *device, int index)
226{ 219{
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 8d1058085eeb..695483e6be32 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -735,7 +735,8 @@ int ioat2_check_space_lock(struct ioat2_dma_chan *ioat, int num_descs)
735 * called under bh_disabled so we need to trigger the timer 735 * called under bh_disabled so we need to trigger the timer
736 * event directly 736 * event directly
737 */ 737 */
738 if (jiffies > chan->timer.expires && timer_pending(&chan->timer)) { 738 if (time_is_before_jiffies(chan->timer.expires)
739 && timer_pending(&chan->timer)) {
739 struct ioatdma_device *device = chan->device; 740 struct ioatdma_device *device = chan->device;
740 741
741 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); 742 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT);
@@ -899,7 +900,6 @@ int ioat2_dma_probe(struct ioatdma_device *device, int dca)
899 err = ioat_probe(device); 900 err = ioat_probe(device);
900 if (err) 901 if (err)
901 return err; 902 return err;
902 ioat_set_tcp_copy_break(2048);
903 903
904 list_for_each_entry(c, &dma->channels, device_node) { 904 list_for_each_entry(c, &dma->channels, device_node) {
905 chan = to_chan_common(c); 905 chan = to_chan_common(c);
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index b9b38a1cf92f..895f869d6c2c 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -740,7 +740,7 @@ ioat3_prep_xor(struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
740 return __ioat3_prep_xor_lock(chan, NULL, dest, src, src_cnt, len, flags); 740 return __ioat3_prep_xor_lock(chan, NULL, dest, src, src_cnt, len, flags);
741} 741}
742 742
743struct dma_async_tx_descriptor * 743static struct dma_async_tx_descriptor *
744ioat3_prep_xor_val(struct dma_chan *chan, dma_addr_t *src, 744ioat3_prep_xor_val(struct dma_chan *chan, dma_addr_t *src,
745 unsigned int src_cnt, size_t len, 745 unsigned int src_cnt, size_t len,
746 enum sum_check_flags *result, unsigned long flags) 746 enum sum_check_flags *result, unsigned long flags)
@@ -1091,7 +1091,7 @@ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
1091 } 1091 }
1092} 1092}
1093 1093
1094struct dma_async_tx_descriptor * 1094static struct dma_async_tx_descriptor *
1095ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, 1095ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
1096 unsigned int src_cnt, const unsigned char *scf, size_t len, 1096 unsigned int src_cnt, const unsigned char *scf, size_t len,
1097 enum sum_check_flags *pqres, unsigned long flags) 1097 enum sum_check_flags *pqres, unsigned long flags)
@@ -1133,7 +1133,7 @@ ioat3_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
1133 flags); 1133 flags);
1134} 1134}
1135 1135
1136struct dma_async_tx_descriptor * 1136static struct dma_async_tx_descriptor *
1137ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src, 1137ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
1138 unsigned int src_cnt, size_t len, 1138 unsigned int src_cnt, size_t len,
1139 enum sum_check_flags *result, unsigned long flags) 1139 enum sum_check_flags *result, unsigned long flags)
@@ -1655,7 +1655,6 @@ int ioat3_dma_probe(struct ioatdma_device *device, int dca)
1655 err = ioat_probe(device); 1655 err = ioat_probe(device);
1656 if (err) 1656 if (err)
1657 return err; 1657 return err;
1658 ioat_set_tcp_copy_break(262144);
1659 1658
1660 list_for_each_entry(c, &dma->channels, device_node) { 1659 list_for_each_entry(c, &dma->channels, device_node) {
1661 chan = to_chan_common(c); 1660 chan = to_chan_common(c);
diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
deleted file mode 100644
index bb48a57c2fc1..000000000000
--- a/drivers/dma/iovlock.c
+++ /dev/null
@@ -1,280 +0,0 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 * Portions based on net/core/datagram.c and copyrighted by their authors.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59
17 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 * The full GNU General Public License is included in this distribution in the
20 * file called COPYING.
21 */
22
23/*
24 * This code allows the net stack to make use of a DMA engine for
25 * skb to iovec copies.
26 */
27
28#include <linux/dmaengine.h>
29#include <linux/pagemap.h>
30#include <linux/slab.h>
31#include <net/tcp.h> /* for memcpy_toiovec */
32#include <asm/io.h>
33#include <asm/uaccess.h>
34
35static int num_pages_spanned(struct iovec *iov)
36{
37 return
38 ((PAGE_ALIGN((unsigned long)iov->iov_base + iov->iov_len) -
39 ((unsigned long)iov->iov_base & PAGE_MASK)) >> PAGE_SHIFT);
40}
41
42/*
43 * Pin down all the iovec pages needed for len bytes.
44 * Return a struct dma_pinned_list to keep track of pages pinned down.
45 *
46 * We are allocating a single chunk of memory, and then carving it up into
47 * 3 sections, the latter 2 whose size depends on the number of iovecs and the
48 * total number of pages, respectively.
49 */
50struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len)
51{
52 struct dma_pinned_list *local_list;
53 struct page **pages;
54 int i;
55 int ret;
56 int nr_iovecs = 0;
57 int iovec_len_used = 0;
58 int iovec_pages_used = 0;
59
60 /* don't pin down non-user-based iovecs */
61 if (segment_eq(get_fs(), KERNEL_DS))
62 return NULL;
63
64 /* determine how many iovecs/pages there are, up front */
65 do {
66 iovec_len_used += iov[nr_iovecs].iov_len;
67 iovec_pages_used += num_pages_spanned(&iov[nr_iovecs]);
68 nr_iovecs++;
69 } while (iovec_len_used < len);
70
71 /* single kmalloc for pinned list, page_list[], and the page arrays */
72 local_list = kmalloc(sizeof(*local_list)
73 + (nr_iovecs * sizeof (struct dma_page_list))
74 + (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
75 if (!local_list)
76 goto out;
77
78 /* list of pages starts right after the page list array */
79 pages = (struct page **) &local_list->page_list[nr_iovecs];
80
81 local_list->nr_iovecs = 0;
82
83 for (i = 0; i < nr_iovecs; i++) {
84 struct dma_page_list *page_list = &local_list->page_list[i];
85
86 len -= iov[i].iov_len;
87
88 if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len))
89 goto unpin;
90
91 page_list->nr_pages = num_pages_spanned(&iov[i]);
92 page_list->base_address = iov[i].iov_base;
93
94 page_list->pages = pages;
95 pages += page_list->nr_pages;
96
97 /* pin pages down */
98 down_read(&current->mm->mmap_sem);
99 ret = get_user_pages(
100 current,
101 current->mm,
102 (unsigned long) iov[i].iov_base,
103 page_list->nr_pages,
104 1, /* write */
105 0, /* force */
106 page_list->pages,
107 NULL);
108 up_read(&current->mm->mmap_sem);
109
110 if (ret != page_list->nr_pages)
111 goto unpin;
112
113 local_list->nr_iovecs = i + 1;
114 }
115
116 return local_list;
117
118unpin:
119 dma_unpin_iovec_pages(local_list);
120out:
121 return NULL;
122}
123
124void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)
125{
126 int i, j;
127
128 if (!pinned_list)
129 return;
130
131 for (i = 0; i < pinned_list->nr_iovecs; i++) {
132 struct dma_page_list *page_list = &pinned_list->page_list[i];
133 for (j = 0; j < page_list->nr_pages; j++) {
134 set_page_dirty_lock(page_list->pages[j]);
135 page_cache_release(page_list->pages[j]);
136 }
137 }
138
139 kfree(pinned_list);
140}
141
142
143/*
144 * We have already pinned down the pages we will be using in the iovecs.
145 * Each entry in iov array has corresponding entry in pinned_list->page_list.
146 * Using array indexing to keep iov[] and page_list[] in sync.
147 * Initial elements in iov array's iov->iov_len will be 0 if already copied into
148 * by another call.
149 * iov array length remaining guaranteed to be bigger than len.
150 */
151dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
152 struct dma_pinned_list *pinned_list, unsigned char *kdata, size_t len)
153{
154 int iov_byte_offset;
155 int copy;
156 dma_cookie_t dma_cookie = 0;
157 int iovec_idx;
158 int page_idx;
159
160 if (!chan)
161 return memcpy_toiovec(iov, kdata, len);
162
163 iovec_idx = 0;
164 while (iovec_idx < pinned_list->nr_iovecs) {
165 struct dma_page_list *page_list;
166
167 /* skip already used-up iovecs */
168 while (!iov[iovec_idx].iov_len)
169 iovec_idx++;
170
171 page_list = &pinned_list->page_list[iovec_idx];
172
173 iov_byte_offset = ((unsigned long)iov[iovec_idx].iov_base & ~PAGE_MASK);
174 page_idx = (((unsigned long)iov[iovec_idx].iov_base & PAGE_MASK)
175 - ((unsigned long)page_list->base_address & PAGE_MASK)) >> PAGE_SHIFT;
176
177 /* break up copies to not cross page boundary */
178 while (iov[iovec_idx].iov_len) {
179 copy = min_t(int, PAGE_SIZE - iov_byte_offset, len);
180 copy = min_t(int, copy, iov[iovec_idx].iov_len);
181
182 dma_cookie = dma_async_memcpy_buf_to_pg(chan,
183 page_list->pages[page_idx],
184 iov_byte_offset,
185 kdata,
186 copy);
187 /* poll for a descriptor slot */
188 if (unlikely(dma_cookie < 0)) {
189 dma_async_issue_pending(chan);
190 continue;
191 }
192
193 len -= copy;
194 iov[iovec_idx].iov_len -= copy;
195 iov[iovec_idx].iov_base += copy;
196
197 if (!len)
198 return dma_cookie;
199
200 kdata += copy;
201 iov_byte_offset = 0;
202 page_idx++;
203 }
204 iovec_idx++;
205 }
206
207 /* really bad if we ever run out of iovecs */
208 BUG();
209 return -EFAULT;
210}
211
212dma_cookie_t dma_memcpy_pg_to_iovec(struct dma_chan *chan, struct iovec *iov,
213 struct dma_pinned_list *pinned_list, struct page *page,
214 unsigned int offset, size_t len)
215{
216 int iov_byte_offset;
217 int copy;
218 dma_cookie_t dma_cookie = 0;
219 int iovec_idx;
220 int page_idx;
221 int err;
222
223 /* this needs as-yet-unimplemented buf-to-buff, so punt. */
224 /* TODO: use dma for this */
225 if (!chan || !pinned_list) {
226 u8 *vaddr = kmap(page);
227 err = memcpy_toiovec(iov, vaddr + offset, len);
228 kunmap(page);
229 return err;
230 }
231
232 iovec_idx = 0;
233 while (iovec_idx < pinned_list->nr_iovecs) {
234 struct dma_page_list *page_list;
235
236 /* skip already used-up iovecs */
237 while (!iov[iovec_idx].iov_len)
238 iovec_idx++;
239
240 page_list = &pinned_list->page_list[iovec_idx];
241
242 iov_byte_offset = ((unsigned long)iov[iovec_idx].iov_base & ~PAGE_MASK);
243 page_idx = (((unsigned long)iov[iovec_idx].iov_base & PAGE_MASK)
244 - ((unsigned long)page_list->base_address & PAGE_MASK)) >> PAGE_SHIFT;
245
246 /* break up copies to not cross page boundary */
247 while (iov[iovec_idx].iov_len) {
248 copy = min_t(int, PAGE_SIZE - iov_byte_offset, len);
249 copy = min_t(int, copy, iov[iovec_idx].iov_len);
250
251 dma_cookie = dma_async_memcpy_pg_to_pg(chan,
252 page_list->pages[page_idx],
253 iov_byte_offset,
254 page,
255 offset,
256 copy);
257 /* poll for a descriptor slot */
258 if (unlikely(dma_cookie < 0)) {
259 dma_async_issue_pending(chan);
260 continue;
261 }
262
263 len -= copy;
264 iov[iovec_idx].iov_len -= copy;
265 iov[iovec_idx].iov_base += copy;
266
267 if (!len)
268 return dma_cookie;
269
270 offset += copy;
271 iov_byte_offset = 0;
272 page_idx++;
273 }
274 iovec_idx++;
275 }
276
277 /* really bad if we ever run out of iovecs */
278 BUG();
279 return -EFAULT;
280}
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 394cbc5c93e3..7938272f2edf 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -310,7 +310,8 @@ mv_xor_clean_slot(struct mv_xor_desc_slot *desc,
310 return 0; 310 return 0;
311} 311}
312 312
313static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) 313/* This function must be called with the mv_xor_chan spinlock held */
314static void mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
314{ 315{
315 struct mv_xor_desc_slot *iter, *_iter; 316 struct mv_xor_desc_slot *iter, *_iter;
316 dma_cookie_t cookie = 0; 317 dma_cookie_t cookie = 0;
@@ -366,18 +367,13 @@ static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
366 mv_chan->dmachan.completed_cookie = cookie; 367 mv_chan->dmachan.completed_cookie = cookie;
367} 368}
368 369
369static void
370mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
371{
372 spin_lock_bh(&mv_chan->lock);
373 __mv_xor_slot_cleanup(mv_chan);
374 spin_unlock_bh(&mv_chan->lock);
375}
376
377static void mv_xor_tasklet(unsigned long data) 370static void mv_xor_tasklet(unsigned long data)
378{ 371{
379 struct mv_xor_chan *chan = (struct mv_xor_chan *) data; 372 struct mv_xor_chan *chan = (struct mv_xor_chan *) data;
373
374 spin_lock_bh(&chan->lock);
380 mv_xor_slot_cleanup(chan); 375 mv_xor_slot_cleanup(chan);
376 spin_unlock_bh(&chan->lock);
381} 377}
382 378
383static struct mv_xor_desc_slot * 379static struct mv_xor_desc_slot *
@@ -656,9 +652,10 @@ static void mv_xor_free_chan_resources(struct dma_chan *chan)
656 struct mv_xor_desc_slot *iter, *_iter; 652 struct mv_xor_desc_slot *iter, *_iter;
657 int in_use_descs = 0; 653 int in_use_descs = 0;
658 654
655 spin_lock_bh(&mv_chan->lock);
656
659 mv_xor_slot_cleanup(mv_chan); 657 mv_xor_slot_cleanup(mv_chan);
660 658
661 spin_lock_bh(&mv_chan->lock);
662 list_for_each_entry_safe(iter, _iter, &mv_chan->chain, 659 list_for_each_entry_safe(iter, _iter, &mv_chan->chain,
663 chain_node) { 660 chain_node) {
664 in_use_descs++; 661 in_use_descs++;
@@ -700,11 +697,12 @@ static enum dma_status mv_xor_status(struct dma_chan *chan,
700 enum dma_status ret; 697 enum dma_status ret;
701 698
702 ret = dma_cookie_status(chan, cookie, txstate); 699 ret = dma_cookie_status(chan, cookie, txstate);
703 if (ret == DMA_COMPLETE) { 700 if (ret == DMA_COMPLETE)
704 mv_xor_clean_completed_slots(mv_chan);
705 return ret; 701 return ret;
706 } 702
703 spin_lock_bh(&mv_chan->lock);
707 mv_xor_slot_cleanup(mv_chan); 704 mv_xor_slot_cleanup(mv_chan);
705 spin_unlock_bh(&mv_chan->lock);
708 706
709 return dma_cookie_status(chan, cookie, txstate); 707 return dma_cookie_status(chan, cookie, txstate);
710} 708}
@@ -782,7 +780,7 @@ static void mv_xor_issue_pending(struct dma_chan *chan)
782 780
783static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) 781static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
784{ 782{
785 int i; 783 int i, ret;
786 void *src, *dest; 784 void *src, *dest;
787 dma_addr_t src_dma, dest_dma; 785 dma_addr_t src_dma, dest_dma;
788 struct dma_chan *dma_chan; 786 struct dma_chan *dma_chan;
@@ -819,19 +817,44 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
819 817
820 src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src), 0, 818 src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src), 0,
821 PAGE_SIZE, DMA_TO_DEVICE); 819 PAGE_SIZE, DMA_TO_DEVICE);
822 unmap->to_cnt = 1;
823 unmap->addr[0] = src_dma; 820 unmap->addr[0] = src_dma;
824 821
822 ret = dma_mapping_error(dma_chan->device->dev, src_dma);
823 if (ret) {
824 err = -ENOMEM;
825 goto free_resources;
826 }
827 unmap->to_cnt = 1;
828
825 dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest), 0, 829 dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest), 0,
826 PAGE_SIZE, DMA_FROM_DEVICE); 830 PAGE_SIZE, DMA_FROM_DEVICE);
827 unmap->from_cnt = 1;
828 unmap->addr[1] = dest_dma; 831 unmap->addr[1] = dest_dma;
829 832
833 ret = dma_mapping_error(dma_chan->device->dev, dest_dma);
834 if (ret) {
835 err = -ENOMEM;
836 goto free_resources;
837 }
838 unmap->from_cnt = 1;
830 unmap->len = PAGE_SIZE; 839 unmap->len = PAGE_SIZE;
831 840
832 tx = mv_xor_prep_dma_memcpy(dma_chan, dest_dma, src_dma, 841 tx = mv_xor_prep_dma_memcpy(dma_chan, dest_dma, src_dma,
833 PAGE_SIZE, 0); 842 PAGE_SIZE, 0);
843 if (!tx) {
844 dev_err(dma_chan->device->dev,
845 "Self-test cannot prepare operation, disabling\n");
846 err = -ENODEV;
847 goto free_resources;
848 }
849
834 cookie = mv_xor_tx_submit(tx); 850 cookie = mv_xor_tx_submit(tx);
851 if (dma_submit_error(cookie)) {
852 dev_err(dma_chan->device->dev,
853 "Self-test submit error, disabling\n");
854 err = -ENODEV;
855 goto free_resources;
856 }
857
835 mv_xor_issue_pending(dma_chan); 858 mv_xor_issue_pending(dma_chan);
836 async_tx_ack(tx); 859 async_tx_ack(tx);
837 msleep(1); 860 msleep(1);
@@ -866,7 +889,7 @@ out:
866static int 889static int
867mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) 890mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
868{ 891{
869 int i, src_idx; 892 int i, src_idx, ret;
870 struct page *dest; 893 struct page *dest;
871 struct page *xor_srcs[MV_XOR_NUM_SRC_TEST]; 894 struct page *xor_srcs[MV_XOR_NUM_SRC_TEST];
872 dma_addr_t dma_srcs[MV_XOR_NUM_SRC_TEST]; 895 dma_addr_t dma_srcs[MV_XOR_NUM_SRC_TEST];
@@ -929,19 +952,42 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
929 unmap->addr[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i], 952 unmap->addr[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i],
930 0, PAGE_SIZE, DMA_TO_DEVICE); 953 0, PAGE_SIZE, DMA_TO_DEVICE);
931 dma_srcs[i] = unmap->addr[i]; 954 dma_srcs[i] = unmap->addr[i];
955 ret = dma_mapping_error(dma_chan->device->dev, unmap->addr[i]);
956 if (ret) {
957 err = -ENOMEM;
958 goto free_resources;
959 }
932 unmap->to_cnt++; 960 unmap->to_cnt++;
933 } 961 }
934 962
935 unmap->addr[src_count] = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE, 963 unmap->addr[src_count] = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
936 DMA_FROM_DEVICE); 964 DMA_FROM_DEVICE);
937 dest_dma = unmap->addr[src_count]; 965 dest_dma = unmap->addr[src_count];
966 ret = dma_mapping_error(dma_chan->device->dev, unmap->addr[src_count]);
967 if (ret) {
968 err = -ENOMEM;
969 goto free_resources;
970 }
938 unmap->from_cnt = 1; 971 unmap->from_cnt = 1;
939 unmap->len = PAGE_SIZE; 972 unmap->len = PAGE_SIZE;
940 973
941 tx = mv_xor_prep_dma_xor(dma_chan, dest_dma, dma_srcs, 974 tx = mv_xor_prep_dma_xor(dma_chan, dest_dma, dma_srcs,
942 src_count, PAGE_SIZE, 0); 975 src_count, PAGE_SIZE, 0);
976 if (!tx) {
977 dev_err(dma_chan->device->dev,
978 "Self-test cannot prepare operation, disabling\n");
979 err = -ENODEV;
980 goto free_resources;
981 }
943 982
944 cookie = mv_xor_tx_submit(tx); 983 cookie = mv_xor_tx_submit(tx);
984 if (dma_submit_error(cookie)) {
985 dev_err(dma_chan->device->dev,
986 "Self-test submit error, disabling\n");
987 err = -ENODEV;
988 goto free_resources;
989 }
990
945 mv_xor_issue_pending(dma_chan); 991 mv_xor_issue_pending(dma_chan);
946 async_tx_ack(tx); 992 async_tx_ack(tx);
947 msleep(8); 993 msleep(8);
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index f8bf00010d45..bbd65149cdb2 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -87,61 +87,73 @@ int __amd64_write_pci_cfg_dword(struct pci_dev *pdev, int offset,
87} 87}
88 88
89/* 89/*
90 * Select DCT to which PCI cfg accesses are routed
91 */
92static void f15h_select_dct(struct amd64_pvt *pvt, u8 dct)
93{
94 u32 reg = 0;
95
96 amd64_read_pci_cfg(pvt->F1, DCT_CFG_SEL, &reg);
97 reg &= (pvt->model == 0x30) ? ~3 : ~1;
98 reg |= dct;
99 amd64_write_pci_cfg(pvt->F1, DCT_CFG_SEL, reg);
100}
101
102/*
90 * 103 *
91 * Depending on the family, F2 DCT reads need special handling: 104 * Depending on the family, F2 DCT reads need special handling:
92 * 105 *
93 * K8: has a single DCT only 106 * K8: has a single DCT only and no address offsets >= 0x100
94 * 107 *
95 * F10h: each DCT has its own set of regs 108 * F10h: each DCT has its own set of regs
96 * DCT0 -> F2x040.. 109 * DCT0 -> F2x040..
97 * DCT1 -> F2x140.. 110 * DCT1 -> F2x140..
98 * 111 *
99 * F15h: we select which DCT we access using F1x10C[DctCfgSel]
100 *
101 * F16h: has only 1 DCT 112 * F16h: has only 1 DCT
113 *
114 * F15h: we select which DCT we access using F1x10C[DctCfgSel]
102 */ 115 */
103static int k8_read_dct_pci_cfg(struct amd64_pvt *pvt, int addr, u32 *val, 116static inline int amd64_read_dct_pci_cfg(struct amd64_pvt *pvt, u8 dct,
104 const char *func) 117 int offset, u32 *val)
105{ 118{
106 if (addr >= 0x100) 119 switch (pvt->fam) {
107 return -EINVAL; 120 case 0xf:
108 121 if (dct || offset >= 0x100)
109 return __amd64_read_pci_cfg_dword(pvt->F2, addr, val, func); 122 return -EINVAL;
110} 123 break;
111 124
112static int f10_read_dct_pci_cfg(struct amd64_pvt *pvt, int addr, u32 *val, 125 case 0x10:
113 const char *func) 126 if (dct) {
114{ 127 /*
115 return __amd64_read_pci_cfg_dword(pvt->F2, addr, val, func); 128 * Note: If ganging is enabled, barring the regs
116} 129 * F2x[1,0]98 and F2x[1,0]9C; reads reads to F2x1xx
130 * return 0. (cf. Section 2.8.1 F10h BKDG)
131 */
132 if (dct_ganging_enabled(pvt))
133 return 0;
117 134
118/* 135 offset += 0x100;
119 * Select DCT to which PCI cfg accesses are routed 136 }
120 */ 137 break;
121static void f15h_select_dct(struct amd64_pvt *pvt, u8 dct)
122{
123 u32 reg = 0;
124 138
125 amd64_read_pci_cfg(pvt->F1, DCT_CFG_SEL, &reg); 139 case 0x15:
126 reg &= (pvt->model >= 0x30) ? ~3 : ~1; 140 /*
127 reg |= dct; 141 * F15h: F2x1xx addresses do not map explicitly to DCT1.
128 amd64_write_pci_cfg(pvt->F1, DCT_CFG_SEL, reg); 142 * We should select which DCT we access using F1x10C[DctCfgSel]
129} 143 */
144 dct = (dct && pvt->model == 0x30) ? 3 : dct;
145 f15h_select_dct(pvt, dct);
146 break;
130 147
131static int f15_read_dct_pci_cfg(struct amd64_pvt *pvt, int addr, u32 *val, 148 case 0x16:
132 const char *func) 149 if (dct)
133{ 150 return -EINVAL;
134 u8 dct = 0; 151 break;
135 152
136 /* For F15 M30h, the second dct is DCT 3, refer to BKDG Section 2.10 */ 153 default:
137 if (addr >= 0x140 && addr <= 0x1a0) { 154 break;
138 dct = (pvt->model >= 0x30) ? 3 : 1;
139 addr -= 0x100;
140 } 155 }
141 156 return amd64_read_pci_cfg(pvt->F2, offset, val);
142 f15h_select_dct(pvt, dct);
143
144 return __amd64_read_pci_cfg_dword(pvt->F2, addr, val, func);
145} 157}
146 158
147/* 159/*
@@ -768,16 +780,17 @@ static void read_dct_base_mask(struct amd64_pvt *pvt)
768 u32 *base0 = &pvt->csels[0].csbases[cs]; 780 u32 *base0 = &pvt->csels[0].csbases[cs];
769 u32 *base1 = &pvt->csels[1].csbases[cs]; 781 u32 *base1 = &pvt->csels[1].csbases[cs];
770 782
771 if (!amd64_read_dct_pci_cfg(pvt, reg0, base0)) 783 if (!amd64_read_dct_pci_cfg(pvt, 0, reg0, base0))
772 edac_dbg(0, " DCSB0[%d]=0x%08x reg: F2x%x\n", 784 edac_dbg(0, " DCSB0[%d]=0x%08x reg: F2x%x\n",
773 cs, *base0, reg0); 785 cs, *base0, reg0);
774 786
775 if (pvt->fam == 0xf || dct_ganging_enabled(pvt)) 787 if (pvt->fam == 0xf)
776 continue; 788 continue;
777 789
778 if (!amd64_read_dct_pci_cfg(pvt, reg1, base1)) 790 if (!amd64_read_dct_pci_cfg(pvt, 1, reg0, base1))
779 edac_dbg(0, " DCSB1[%d]=0x%08x reg: F2x%x\n", 791 edac_dbg(0, " DCSB1[%d]=0x%08x reg: F2x%x\n",
780 cs, *base1, reg1); 792 cs, *base1, (pvt->fam == 0x10) ? reg1
793 : reg0);
781 } 794 }
782 795
783 for_each_chip_select_mask(cs, 0, pvt) { 796 for_each_chip_select_mask(cs, 0, pvt) {
@@ -786,16 +799,17 @@ static void read_dct_base_mask(struct amd64_pvt *pvt)
786 u32 *mask0 = &pvt->csels[0].csmasks[cs]; 799 u32 *mask0 = &pvt->csels[0].csmasks[cs];
787 u32 *mask1 = &pvt->csels[1].csmasks[cs]; 800 u32 *mask1 = &pvt->csels[1].csmasks[cs];
788 801
789 if (!amd64_read_dct_pci_cfg(pvt, reg0, mask0)) 802 if (!amd64_read_dct_pci_cfg(pvt, 0, reg0, mask0))
790 edac_dbg(0, " DCSM0[%d]=0x%08x reg: F2x%x\n", 803 edac_dbg(0, " DCSM0[%d]=0x%08x reg: F2x%x\n",
791 cs, *mask0, reg0); 804 cs, *mask0, reg0);
792 805
793 if (pvt->fam == 0xf || dct_ganging_enabled(pvt)) 806 if (pvt->fam == 0xf)
794 continue; 807 continue;
795 808
796 if (!amd64_read_dct_pci_cfg(pvt, reg1, mask1)) 809 if (!amd64_read_dct_pci_cfg(pvt, 1, reg0, mask1))
797 edac_dbg(0, " DCSM1[%d]=0x%08x reg: F2x%x\n", 810 edac_dbg(0, " DCSM1[%d]=0x%08x reg: F2x%x\n",
798 cs, *mask1, reg1); 811 cs, *mask1, (pvt->fam == 0x10) ? reg1
812 : reg0);
799 } 813 }
800} 814}
801 815
@@ -1198,7 +1212,7 @@ static void read_dram_ctl_register(struct amd64_pvt *pvt)
1198 if (pvt->fam == 0xf) 1212 if (pvt->fam == 0xf)
1199 return; 1213 return;
1200 1214
1201 if (!amd64_read_dct_pci_cfg(pvt, DCT_SEL_LO, &pvt->dct_sel_lo)) { 1215 if (!amd64_read_pci_cfg(pvt->F2, DCT_SEL_LO, &pvt->dct_sel_lo)) {
1202 edac_dbg(0, "F2x110 (DCTSelLow): 0x%08x, High range addrs at: 0x%x\n", 1216 edac_dbg(0, "F2x110 (DCTSelLow): 0x%08x, High range addrs at: 0x%x\n",
1203 pvt->dct_sel_lo, dct_sel_baseaddr(pvt)); 1217 pvt->dct_sel_lo, dct_sel_baseaddr(pvt));
1204 1218
@@ -1219,7 +1233,7 @@ static void read_dram_ctl_register(struct amd64_pvt *pvt)
1219 dct_sel_interleave_addr(pvt)); 1233 dct_sel_interleave_addr(pvt));
1220 } 1234 }
1221 1235
1222 amd64_read_dct_pci_cfg(pvt, DCT_SEL_HI, &pvt->dct_sel_hi); 1236 amd64_read_pci_cfg(pvt->F2, DCT_SEL_HI, &pvt->dct_sel_hi);
1223} 1237}
1224 1238
1225/* 1239/*
@@ -1430,7 +1444,7 @@ static u64 f1x_swap_interleaved_region(struct amd64_pvt *pvt, u64 sys_addr)
1430 return sys_addr; 1444 return sys_addr;
1431 } 1445 }
1432 1446
1433 amd64_read_dct_pci_cfg(pvt, SWAP_INTLV_REG, &swap_reg); 1447 amd64_read_pci_cfg(pvt->F2, SWAP_INTLV_REG, &swap_reg);
1434 1448
1435 if (!(swap_reg & 0x1)) 1449 if (!(swap_reg & 0x1))
1436 return sys_addr; 1450 return sys_addr;
@@ -1723,10 +1737,16 @@ static void debug_display_dimm_sizes(struct amd64_pvt *pvt, u8 ctrl)
1723 WARN_ON(ctrl != 0); 1737 WARN_ON(ctrl != 0);
1724 } 1738 }
1725 1739
1726 dbam = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->dbam1 : pvt->dbam0; 1740 if (pvt->fam == 0x10) {
1727 dcsb = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->csels[1].csbases 1741 dbam = (ctrl && !dct_ganging_enabled(pvt)) ? pvt->dbam1
1728 : pvt->csels[0].csbases; 1742 : pvt->dbam0;
1729 1743 dcsb = (ctrl && !dct_ganging_enabled(pvt)) ?
1744 pvt->csels[1].csbases :
1745 pvt->csels[0].csbases;
1746 } else if (ctrl) {
1747 dbam = pvt->dbam0;
1748 dcsb = pvt->csels[1].csbases;
1749 }
1730 edac_dbg(1, "F2x%d80 (DRAM Bank Address Mapping): 0x%08x\n", 1750 edac_dbg(1, "F2x%d80 (DRAM Bank Address Mapping): 0x%08x\n",
1731 ctrl, dbam); 1751 ctrl, dbam);
1732 1752
@@ -1760,7 +1780,6 @@ static struct amd64_family_type family_types[] = {
1760 .early_channel_count = k8_early_channel_count, 1780 .early_channel_count = k8_early_channel_count,
1761 .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow, 1781 .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow,
1762 .dbam_to_cs = k8_dbam_to_chip_select, 1782 .dbam_to_cs = k8_dbam_to_chip_select,
1763 .read_dct_pci_cfg = k8_read_dct_pci_cfg,
1764 } 1783 }
1765 }, 1784 },
1766 [F10_CPUS] = { 1785 [F10_CPUS] = {
@@ -1771,7 +1790,6 @@ static struct amd64_family_type family_types[] = {
1771 .early_channel_count = f1x_early_channel_count, 1790 .early_channel_count = f1x_early_channel_count,
1772 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, 1791 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1773 .dbam_to_cs = f10_dbam_to_chip_select, 1792 .dbam_to_cs = f10_dbam_to_chip_select,
1774 .read_dct_pci_cfg = f10_read_dct_pci_cfg,
1775 } 1793 }
1776 }, 1794 },
1777 [F15_CPUS] = { 1795 [F15_CPUS] = {
@@ -1782,7 +1800,6 @@ static struct amd64_family_type family_types[] = {
1782 .early_channel_count = f1x_early_channel_count, 1800 .early_channel_count = f1x_early_channel_count,
1783 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, 1801 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1784 .dbam_to_cs = f15_dbam_to_chip_select, 1802 .dbam_to_cs = f15_dbam_to_chip_select,
1785 .read_dct_pci_cfg = f15_read_dct_pci_cfg,
1786 } 1803 }
1787 }, 1804 },
1788 [F15_M30H_CPUS] = { 1805 [F15_M30H_CPUS] = {
@@ -1793,7 +1810,6 @@ static struct amd64_family_type family_types[] = {
1793 .early_channel_count = f1x_early_channel_count, 1810 .early_channel_count = f1x_early_channel_count,
1794 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, 1811 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1795 .dbam_to_cs = f16_dbam_to_chip_select, 1812 .dbam_to_cs = f16_dbam_to_chip_select,
1796 .read_dct_pci_cfg = f15_read_dct_pci_cfg,
1797 } 1813 }
1798 }, 1814 },
1799 [F16_CPUS] = { 1815 [F16_CPUS] = {
@@ -1804,7 +1820,6 @@ static struct amd64_family_type family_types[] = {
1804 .early_channel_count = f1x_early_channel_count, 1820 .early_channel_count = f1x_early_channel_count,
1805 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, 1821 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1806 .dbam_to_cs = f16_dbam_to_chip_select, 1822 .dbam_to_cs = f16_dbam_to_chip_select,
1807 .read_dct_pci_cfg = f10_read_dct_pci_cfg,
1808 } 1823 }
1809 }, 1824 },
1810 [F16_M30H_CPUS] = { 1825 [F16_M30H_CPUS] = {
@@ -1815,7 +1830,6 @@ static struct amd64_family_type family_types[] = {
1815 .early_channel_count = f1x_early_channel_count, 1830 .early_channel_count = f1x_early_channel_count,
1816 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, 1831 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1817 .dbam_to_cs = f16_dbam_to_chip_select, 1832 .dbam_to_cs = f16_dbam_to_chip_select,
1818 .read_dct_pci_cfg = f10_read_dct_pci_cfg,
1819 } 1833 }
1820 }, 1834 },
1821}; 1835};
@@ -2148,25 +2162,25 @@ static void read_mc_regs(struct amd64_pvt *pvt)
2148 read_dct_base_mask(pvt); 2162 read_dct_base_mask(pvt);
2149 2163
2150 amd64_read_pci_cfg(pvt->F1, DHAR, &pvt->dhar); 2164 amd64_read_pci_cfg(pvt->F1, DHAR, &pvt->dhar);
2151 amd64_read_dct_pci_cfg(pvt, DBAM0, &pvt->dbam0); 2165 amd64_read_dct_pci_cfg(pvt, 0, DBAM0, &pvt->dbam0);
2152 2166
2153 amd64_read_pci_cfg(pvt->F3, F10_ONLINE_SPARE, &pvt->online_spare); 2167 amd64_read_pci_cfg(pvt->F3, F10_ONLINE_SPARE, &pvt->online_spare);
2154 2168
2155 amd64_read_dct_pci_cfg(pvt, DCLR0, &pvt->dclr0); 2169 amd64_read_dct_pci_cfg(pvt, 0, DCLR0, &pvt->dclr0);
2156 amd64_read_dct_pci_cfg(pvt, DCHR0, &pvt->dchr0); 2170 amd64_read_dct_pci_cfg(pvt, 0, DCHR0, &pvt->dchr0);
2157 2171
2158 if (!dct_ganging_enabled(pvt)) { 2172 if (!dct_ganging_enabled(pvt)) {
2159 amd64_read_dct_pci_cfg(pvt, DCLR1, &pvt->dclr1); 2173 amd64_read_dct_pci_cfg(pvt, 1, DCLR0, &pvt->dclr1);
2160 amd64_read_dct_pci_cfg(pvt, DCHR1, &pvt->dchr1); 2174 amd64_read_dct_pci_cfg(pvt, 1, DCHR0, &pvt->dchr1);
2161 } 2175 }
2162 2176
2163 pvt->ecc_sym_sz = 4; 2177 pvt->ecc_sym_sz = 4;
2164 2178
2165 if (pvt->fam >= 0x10) { 2179 if (pvt->fam >= 0x10) {
2166 amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp); 2180 amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp);
2181 /* F16h has only DCT0, so no need to read dbam1 */
2167 if (pvt->fam != 0x16) 2182 if (pvt->fam != 0x16)
2168 /* F16h has only DCT0 */ 2183 amd64_read_dct_pci_cfg(pvt, 1, DBAM0, &pvt->dbam1);
2169 amd64_read_dct_pci_cfg(pvt, DBAM1, &pvt->dbam1);
2170 2184
2171 /* F10h, revD and later can do x8 ECC too */ 2185 /* F10h, revD and later can do x8 ECC too */
2172 if ((pvt->fam > 0x10 || pvt->model > 7) && tmp & BIT(25)) 2186 if ((pvt->fam > 0x10 || pvt->model > 7) && tmp & BIT(25))
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index d903e0c21144..55fb5941c6d4 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -481,8 +481,6 @@ struct low_ops {
481 void (*map_sysaddr_to_csrow) (struct mem_ctl_info *mci, u64 sys_addr, 481 void (*map_sysaddr_to_csrow) (struct mem_ctl_info *mci, u64 sys_addr,
482 struct err_info *); 482 struct err_info *);
483 int (*dbam_to_cs) (struct amd64_pvt *pvt, u8 dct, unsigned cs_mode); 483 int (*dbam_to_cs) (struct amd64_pvt *pvt, u8 dct, unsigned cs_mode);
484 int (*read_dct_pci_cfg) (struct amd64_pvt *pvt, int offset,
485 u32 *val, const char *func);
486}; 484};
487 485
488struct amd64_family_type { 486struct amd64_family_type {
@@ -502,9 +500,6 @@ int __amd64_write_pci_cfg_dword(struct pci_dev *pdev, int offset,
502#define amd64_write_pci_cfg(pdev, offset, val) \ 500#define amd64_write_pci_cfg(pdev, offset, val) \
503 __amd64_write_pci_cfg_dword(pdev, offset, val, __func__) 501 __amd64_write_pci_cfg_dword(pdev, offset, val, __func__)
504 502
505#define amd64_read_dct_pci_cfg(pvt, offset, val) \
506 pvt->ops->read_dct_pci_cfg(pvt, offset, val, __func__)
507
508int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base, 503int amd64_get_dram_hole_info(struct mem_ctl_info *mci, u64 *hole_base,
509 u64 *hole_offset, u64 *hole_size); 504 u64 *hole_offset, u64 *hole_size);
510 505
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index 3c2625e7980d..6c9f381e8fe6 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -66,7 +66,7 @@
66#define EDAC_PCI "PCI" 66#define EDAC_PCI "PCI"
67#define EDAC_DEBUG "DEBUG" 67#define EDAC_DEBUG "DEBUG"
68 68
69extern const char *edac_mem_types[]; 69extern const char * const edac_mem_types[];
70 70
71#ifdef CONFIG_EDAC_DEBUG 71#ifdef CONFIG_EDAC_DEBUG
72extern int edac_debug_level; 72extern int edac_debug_level;
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 9f134823fa75..c3893b0ddb18 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -128,7 +128,7 @@ static void edac_mc_dump_mci(struct mem_ctl_info *mci)
128/* 128/*
129 * keep those in sync with the enum mem_type 129 * keep those in sync with the enum mem_type
130 */ 130 */
131const char *edac_mem_types[] = { 131const char * const edac_mem_types[] = {
132 "Empty csrow", 132 "Empty csrow",
133 "Reserved csrow type", 133 "Reserved csrow type",
134 "Unknown csrow type", 134 "Unknown csrow type",
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index f4aec2e6ef56..7d3742edbaa2 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -633,7 +633,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
633 if (edac_op_state == EDAC_OPSTATE_INT) { 633 if (edac_op_state == EDAC_OPSTATE_INT) {
634 pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0); 634 pdata->irq = irq_of_parse_and_map(op->dev.of_node, 0);
635 res = devm_request_irq(&op->dev, pdata->irq, 635 res = devm_request_irq(&op->dev, pdata->irq,
636 mpc85xx_l2_isr, 0, 636 mpc85xx_l2_isr, IRQF_SHARED,
637 "[EDAC] L2 err", edac_dev); 637 "[EDAC] L2 err", edac_dev);
638 if (res < 0) { 638 if (res < 0) {
639 printk(KERN_ERR 639 printk(KERN_ERR
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index ef6b7e08f485..0f04d5ead521 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -974,7 +974,7 @@ static int ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
974 * page size (PAGE_SIZE) or the memory width (2 or 4). 974 * page size (PAGE_SIZE) or the memory width (2 or 4).
975 */ 975 */
976 for (j = 0; j < csi->nr_channels; j++) { 976 for (j = 0; j < csi->nr_channels; j++) {
977 struct dimm_info *dimm = csi->channels[j].dimm; 977 struct dimm_info *dimm = csi->channels[j]->dimm;
978 978
979 dimm->nr_pages = nr_pages / csi->nr_channels; 979 dimm->nr_pages = nr_pages / csi->nr_channels;
980 dimm->grain = 1; 980 dimm->grain = 1;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 1411613f2174..e42925f76b4b 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1310,6 +1310,16 @@ void i915_check_and_clear_faults(struct drm_device *dev)
1310 POSTING_READ(RING_FAULT_REG(&dev_priv->ring[RCS])); 1310 POSTING_READ(RING_FAULT_REG(&dev_priv->ring[RCS]));
1311} 1311}
1312 1312
1313static void i915_ggtt_flush(struct drm_i915_private *dev_priv)
1314{
1315 if (INTEL_INFO(dev_priv->dev)->gen < 6) {
1316 intel_gtt_chipset_flush();
1317 } else {
1318 I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN);
1319 POSTING_READ(GFX_FLSH_CNTL_GEN6);
1320 }
1321}
1322
1313void i915_gem_suspend_gtt_mappings(struct drm_device *dev) 1323void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
1314{ 1324{
1315 struct drm_i915_private *dev_priv = dev->dev_private; 1325 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1326,6 +1336,8 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
1326 dev_priv->gtt.base.start, 1336 dev_priv->gtt.base.start,
1327 dev_priv->gtt.base.total, 1337 dev_priv->gtt.base.total,
1328 true); 1338 true);
1339
1340 i915_ggtt_flush(dev_priv);
1329} 1341}
1330 1342
1331void i915_gem_restore_gtt_mappings(struct drm_device *dev) 1343void i915_gem_restore_gtt_mappings(struct drm_device *dev)
@@ -1378,7 +1390,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
1378 gen6_write_pdes(container_of(vm, struct i915_hw_ppgtt, base)); 1390 gen6_write_pdes(container_of(vm, struct i915_hw_ppgtt, base));
1379 } 1391 }
1380 1392
1381 i915_gem_chipset_flush(dev); 1393 i915_ggtt_flush(dev_priv);
1382} 1394}
1383 1395
1384int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) 1396int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj)
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 7f84dd263ee8..9842fd2e742a 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -66,12 +66,12 @@ module_param_named(powersave, i915.powersave, int, 0600);
66MODULE_PARM_DESC(powersave, 66MODULE_PARM_DESC(powersave,
67 "Enable powersavings, fbc, downclocking, etc. (default: true)"); 67 "Enable powersavings, fbc, downclocking, etc. (default: true)");
68 68
69module_param_named(semaphores, i915.semaphores, int, 0400); 69module_param_named_unsafe(semaphores, i915.semaphores, int, 0400);
70MODULE_PARM_DESC(semaphores, 70MODULE_PARM_DESC(semaphores,
71 "Use semaphores for inter-ring sync " 71 "Use semaphores for inter-ring sync "
72 "(default: -1 (use per-chip defaults))"); 72 "(default: -1 (use per-chip defaults))");
73 73
74module_param_named(enable_rc6, i915.enable_rc6, int, 0400); 74module_param_named_unsafe(enable_rc6, i915.enable_rc6, int, 0400);
75MODULE_PARM_DESC(enable_rc6, 75MODULE_PARM_DESC(enable_rc6,
76 "Enable power-saving render C-state 6. " 76 "Enable power-saving render C-state 6. "
77 "Different stages can be selected via bitmask values " 77 "Different stages can be selected via bitmask values "
@@ -79,7 +79,7 @@ MODULE_PARM_DESC(enable_rc6,
79 "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. " 79 "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. "
80 "default: -1 (use per-chip default)"); 80 "default: -1 (use per-chip default)");
81 81
82module_param_named(enable_fbc, i915.enable_fbc, int, 0600); 82module_param_named_unsafe(enable_fbc, i915.enable_fbc, int, 0600);
83MODULE_PARM_DESC(enable_fbc, 83MODULE_PARM_DESC(enable_fbc,
84 "Enable frame buffer compression for power savings " 84 "Enable frame buffer compression for power savings "
85 "(default: -1 (use per-chip default))"); 85 "(default: -1 (use per-chip default))");
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(enable_hangcheck,
113 "WARNING: Disabling this can cause system wide hangs. " 113 "WARNING: Disabling this can cause system wide hangs. "
114 "(default: true)"); 114 "(default: true)");
115 115
116module_param_named(enable_ppgtt, i915.enable_ppgtt, int, 0400); 116module_param_named_unsafe(enable_ppgtt, i915.enable_ppgtt, int, 0400);
117MODULE_PARM_DESC(enable_ppgtt, 117MODULE_PARM_DESC(enable_ppgtt,
118 "Override PPGTT usage. " 118 "Override PPGTT usage. "
119 "(-1=auto [default], 0=disabled, 1=aliasing, 2=full)"); 119 "(-1=auto [default], 0=disabled, 1=aliasing, 2=full)");
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index ca52ad2ae7d1..d8de1d5140a7 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -396,6 +396,16 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
396 return -EINVAL; 396 return -EINVAL;
397} 397}
398 398
399/*
400 * If the vendor backlight interface is not in use and ACPI backlight interface
401 * is broken, do not bother processing backlight change requests from firmware.
402 */
403static bool should_ignore_backlight_request(void)
404{
405 return acpi_video_backlight_support() &&
406 !acpi_video_verify_backlight_support();
407}
408
399static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) 409static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
400{ 410{
401 struct drm_i915_private *dev_priv = dev->dev_private; 411 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -404,11 +414,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
404 414
405 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); 415 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
406 416
407 /* 417 if (should_ignore_backlight_request()) {
408 * If the acpi_video interface is not supposed to be used, don't
409 * bother processing backlight level change requests from firmware.
410 */
411 if (!acpi_video_verify_backlight_support()) {
412 DRM_DEBUG_KMS("opregion backlight request ignored\n"); 418 DRM_DEBUG_KMS("opregion backlight request ignored\n");
413 return 0; 419 return 0;
414 } 420 }
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
index 4b5bb5d58a54..f8cbb512132f 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
@@ -1763,9 +1763,10 @@ nv50_disp_intr_unk40_0_tmds(struct nv50_disp_priv *priv, struct dcb_output *outp
1763 const int or = ffs(outp->or) - 1; 1763 const int or = ffs(outp->or) - 1;
1764 const u32 loff = (or * 0x800) + (link * 0x80); 1764 const u32 loff = (or * 0x800) + (link * 0x80);
1765 const u16 mask = (outp->sorconf.link << 6) | outp->or; 1765 const u16 mask = (outp->sorconf.link << 6) | outp->or;
1766 struct dcb_output match;
1766 u8 ver, hdr; 1767 u8 ver, hdr;
1767 1768
1768 if (dcb_outp_match(bios, DCB_OUTPUT_DP, mask, &ver, &hdr, outp)) 1769 if (dcb_outp_match(bios, DCB_OUTPUT_DP, mask, &ver, &hdr, &match))
1769 nv_mask(priv, 0x61c10c + loff, 0x00000001, 0x00000000); 1770 nv_mask(priv, 0x61c10c + loff, 0x00000001, 0x00000000);
1770} 1771}
1771 1772
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c
index 99cd9e4a2aa6..3440fc999f2f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -285,6 +285,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
285 struct nouveau_software_chan *swch; 285 struct nouveau_software_chan *swch;
286 struct nv_dma_v0 args = {}; 286 struct nv_dma_v0 args = {};
287 int ret, i; 287 int ret, i;
288 bool save;
288 289
289 nvif_object_map(chan->object); 290 nvif_object_map(chan->object);
290 291
@@ -386,7 +387,11 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
386 } 387 }
387 388
388 /* initialise synchronisation */ 389 /* initialise synchronisation */
389 return nouveau_fence(chan->drm)->context_new(chan); 390 save = cli->base.super;
391 cli->base.super = true; /* hack until fencenv50 fixed */
392 ret = nouveau_fence(chan->drm)->context_new(chan);
393 cli->base.super = save;
394 return ret;
390} 395}
391 396
392int 397int
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 65b4fd53dd4e..4a21b2b06ce2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -550,14 +550,12 @@ nouveau_display_destroy(struct drm_device *dev)
550} 550}
551 551
552int 552int
553nouveau_display_suspend(struct drm_device *dev) 553nouveau_display_suspend(struct drm_device *dev, bool runtime)
554{ 554{
555 struct nouveau_drm *drm = nouveau_drm(dev);
556 struct drm_crtc *crtc; 555 struct drm_crtc *crtc;
557 556
558 nouveau_display_fini(dev); 557 nouveau_display_fini(dev);
559 558
560 NV_INFO(drm, "unpinning framebuffer(s)...\n");
561 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 559 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
562 struct nouveau_framebuffer *nouveau_fb; 560 struct nouveau_framebuffer *nouveau_fb;
563 561
@@ -579,12 +577,13 @@ nouveau_display_suspend(struct drm_device *dev)
579} 577}
580 578
581void 579void
582nouveau_display_repin(struct drm_device *dev) 580nouveau_display_resume(struct drm_device *dev, bool runtime)
583{ 581{
584 struct nouveau_drm *drm = nouveau_drm(dev); 582 struct nouveau_drm *drm = nouveau_drm(dev);
585 struct drm_crtc *crtc; 583 struct drm_crtc *crtc;
586 int ret; 584 int ret, head;
587 585
586 /* re-pin fb/cursors */
588 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 587 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
589 struct nouveau_framebuffer *nouveau_fb; 588 struct nouveau_framebuffer *nouveau_fb;
590 589
@@ -606,13 +605,6 @@ nouveau_display_repin(struct drm_device *dev)
606 if (ret) 605 if (ret)
607 NV_ERROR(drm, "Could not pin/map cursor.\n"); 606 NV_ERROR(drm, "Could not pin/map cursor.\n");
608 } 607 }
609}
610
611void
612nouveau_display_resume(struct drm_device *dev)
613{
614 struct drm_crtc *crtc;
615 int head;
616 608
617 nouveau_display_init(dev); 609 nouveau_display_init(dev);
618 610
@@ -627,6 +619,13 @@ nouveau_display_resume(struct drm_device *dev)
627 for (head = 0; head < dev->mode_config.num_crtc; head++) 619 for (head = 0; head < dev->mode_config.num_crtc; head++)
628 drm_vblank_on(dev, head); 620 drm_vblank_on(dev, head);
629 621
622 /* This should ensure we don't hit a locking problem when someone
623 * wakes us up via a connector. We should never go into suspend
624 * while the display is on anyways.
625 */
626 if (runtime)
627 return;
628
630 drm_helper_resume_force_mode(dev); 629 drm_helper_resume_force_mode(dev);
631 630
632 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 631 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
index 88ca177cb1c7..be3d5947c6be 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -63,9 +63,8 @@ int nouveau_display_create(struct drm_device *dev);
63void nouveau_display_destroy(struct drm_device *dev); 63void nouveau_display_destroy(struct drm_device *dev);
64int nouveau_display_init(struct drm_device *dev); 64int nouveau_display_init(struct drm_device *dev);
65void nouveau_display_fini(struct drm_device *dev); 65void nouveau_display_fini(struct drm_device *dev);
66int nouveau_display_suspend(struct drm_device *dev); 66int nouveau_display_suspend(struct drm_device *dev, bool runtime);
67void nouveau_display_repin(struct drm_device *dev); 67void nouveau_display_resume(struct drm_device *dev, bool runtime);
68void nouveau_display_resume(struct drm_device *dev);
69int nouveau_display_vblank_enable(struct drm_device *, int); 68int nouveau_display_vblank_enable(struct drm_device *, int);
70void nouveau_display_vblank_disable(struct drm_device *, int); 69void nouveau_display_vblank_disable(struct drm_device *, int);
71int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int, 70int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 9c3af96a7153..3ed32dd90303 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -547,9 +547,11 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
547 struct nouveau_cli *cli; 547 struct nouveau_cli *cli;
548 int ret; 548 int ret;
549 549
550 if (dev->mode_config.num_crtc && !runtime) { 550 if (dev->mode_config.num_crtc) {
551 NV_INFO(drm, "suspending console...\n");
552 nouveau_fbcon_set_suspend(dev, 1);
551 NV_INFO(drm, "suspending display...\n"); 553 NV_INFO(drm, "suspending display...\n");
552 ret = nouveau_display_suspend(dev); 554 ret = nouveau_display_suspend(dev, runtime);
553 if (ret) 555 if (ret)
554 return ret; 556 return ret;
555 } 557 }
@@ -603,7 +605,7 @@ fail_client:
603fail_display: 605fail_display:
604 if (dev->mode_config.num_crtc) { 606 if (dev->mode_config.num_crtc) {
605 NV_INFO(drm, "resuming display...\n"); 607 NV_INFO(drm, "resuming display...\n");
606 nouveau_display_resume(dev); 608 nouveau_display_resume(dev, runtime);
607 } 609 }
608 return ret; 610 return ret;
609} 611}
@@ -618,9 +620,6 @@ int nouveau_pmops_suspend(struct device *dev)
618 drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) 620 drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
619 return 0; 621 return 0;
620 622
621 if (drm_dev->mode_config.num_crtc)
622 nouveau_fbcon_set_suspend(drm_dev, 1);
623
624 ret = nouveau_do_suspend(drm_dev, false); 623 ret = nouveau_do_suspend(drm_dev, false);
625 if (ret) 624 if (ret)
626 return ret; 625 return ret;
@@ -633,7 +632,7 @@ int nouveau_pmops_suspend(struct device *dev)
633} 632}
634 633
635static int 634static int
636nouveau_do_resume(struct drm_device *dev) 635nouveau_do_resume(struct drm_device *dev, bool runtime)
637{ 636{
638 struct nouveau_drm *drm = nouveau_drm(dev); 637 struct nouveau_drm *drm = nouveau_drm(dev);
639 struct nouveau_cli *cli; 638 struct nouveau_cli *cli;
@@ -658,7 +657,9 @@ nouveau_do_resume(struct drm_device *dev)
658 657
659 if (dev->mode_config.num_crtc) { 658 if (dev->mode_config.num_crtc) {
660 NV_INFO(drm, "resuming display...\n"); 659 NV_INFO(drm, "resuming display...\n");
661 nouveau_display_repin(dev); 660 nouveau_display_resume(dev, runtime);
661 NV_INFO(drm, "resuming console...\n");
662 nouveau_fbcon_set_suspend(dev, 0);
662 } 663 }
663 664
664 return 0; 665 return 0;
@@ -681,47 +682,21 @@ int nouveau_pmops_resume(struct device *dev)
681 return ret; 682 return ret;
682 pci_set_master(pdev); 683 pci_set_master(pdev);
683 684
684 ret = nouveau_do_resume(drm_dev); 685 return nouveau_do_resume(drm_dev, false);
685 if (ret)
686 return ret;
687
688 if (drm_dev->mode_config.num_crtc) {
689 nouveau_display_resume(drm_dev);
690 nouveau_fbcon_set_suspend(drm_dev, 0);
691 }
692
693 return 0;
694} 686}
695 687
696static int nouveau_pmops_freeze(struct device *dev) 688static int nouveau_pmops_freeze(struct device *dev)
697{ 689{
698 struct pci_dev *pdev = to_pci_dev(dev); 690 struct pci_dev *pdev = to_pci_dev(dev);
699 struct drm_device *drm_dev = pci_get_drvdata(pdev); 691 struct drm_device *drm_dev = pci_get_drvdata(pdev);
700 int ret; 692 return nouveau_do_suspend(drm_dev, false);
701
702 if (drm_dev->mode_config.num_crtc)
703 nouveau_fbcon_set_suspend(drm_dev, 1);
704
705 ret = nouveau_do_suspend(drm_dev, false);
706 return ret;
707} 693}
708 694
709static int nouveau_pmops_thaw(struct device *dev) 695static int nouveau_pmops_thaw(struct device *dev)
710{ 696{
711 struct pci_dev *pdev = to_pci_dev(dev); 697 struct pci_dev *pdev = to_pci_dev(dev);
712 struct drm_device *drm_dev = pci_get_drvdata(pdev); 698 struct drm_device *drm_dev = pci_get_drvdata(pdev);
713 int ret; 699 return nouveau_do_resume(drm_dev, false);
714
715 ret = nouveau_do_resume(drm_dev);
716 if (ret)
717 return ret;
718
719 if (drm_dev->mode_config.num_crtc) {
720 nouveau_display_resume(drm_dev);
721 nouveau_fbcon_set_suspend(drm_dev, 0);
722 }
723
724 return 0;
725} 700}
726 701
727 702
@@ -977,7 +952,7 @@ static int nouveau_pmops_runtime_resume(struct device *dev)
977 return ret; 952 return ret;
978 pci_set_master(pdev); 953 pci_set_master(pdev);
979 954
980 ret = nouveau_do_resume(drm_dev); 955 ret = nouveau_do_resume(drm_dev, true);
981 drm_kms_helper_poll_enable(drm_dev); 956 drm_kms_helper_poll_enable(drm_dev);
982 /* do magic */ 957 /* do magic */
983 nvif_mask(device, 0x88488, (1 << 25), (1 << 25)); 958 nvif_mask(device, 0x88488, (1 << 25), (1 << 25));
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 8bdd27091db8..49fe6075cc7c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -486,6 +486,16 @@ static const struct drm_fb_helper_funcs nouveau_fbcon_helper_funcs = {
486 .fb_probe = nouveau_fbcon_create, 486 .fb_probe = nouveau_fbcon_create,
487}; 487};
488 488
489static void
490nouveau_fbcon_set_suspend_work(struct work_struct *work)
491{
492 struct nouveau_fbdev *fbcon = container_of(work, typeof(*fbcon), work);
493 console_lock();
494 nouveau_fbcon_accel_restore(fbcon->dev);
495 nouveau_fbcon_zfill(fbcon->dev, fbcon);
496 fb_set_suspend(fbcon->helper.fbdev, FBINFO_STATE_RUNNING);
497 console_unlock();
498}
489 499
490int 500int
491nouveau_fbcon_init(struct drm_device *dev) 501nouveau_fbcon_init(struct drm_device *dev)
@@ -503,6 +513,7 @@ nouveau_fbcon_init(struct drm_device *dev)
503 if (!fbcon) 513 if (!fbcon)
504 return -ENOMEM; 514 return -ENOMEM;
505 515
516 INIT_WORK(&fbcon->work, nouveau_fbcon_set_suspend_work);
506 fbcon->dev = dev; 517 fbcon->dev = dev;
507 drm->fbcon = fbcon; 518 drm->fbcon = fbcon;
508 519
@@ -551,14 +562,14 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state)
551{ 562{
552 struct nouveau_drm *drm = nouveau_drm(dev); 563 struct nouveau_drm *drm = nouveau_drm(dev);
553 if (drm->fbcon) { 564 if (drm->fbcon) {
554 console_lock(); 565 if (state == FBINFO_STATE_RUNNING) {
555 if (state == 0) { 566 schedule_work(&drm->fbcon->work);
556 nouveau_fbcon_accel_restore(dev); 567 return;
557 nouveau_fbcon_zfill(dev, drm->fbcon);
558 } 568 }
569 flush_work(&drm->fbcon->work);
570 console_lock();
559 fb_set_suspend(drm->fbcon->helper.fbdev, state); 571 fb_set_suspend(drm->fbcon->helper.fbdev, state);
560 if (state == 1) 572 nouveau_fbcon_accel_save_disable(dev);
561 nouveau_fbcon_accel_save_disable(dev);
562 console_unlock(); 573 console_unlock();
563 } 574 }
564} 575}
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
index 34658cfa8f5d..0b465c7d3907 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
@@ -36,6 +36,7 @@ struct nouveau_fbdev {
36 struct nouveau_framebuffer nouveau_fb; 36 struct nouveau_framebuffer nouveau_fb;
37 struct list_head fbdev_list; 37 struct list_head fbdev_list;
38 struct drm_device *dev; 38 struct drm_device *dev;
39 struct work_struct work;
39 unsigned int saved_flags; 40 unsigned int saved_flags;
40 struct nvif_object surf2d; 41 struct nvif_object surf2d;
41 struct nvif_object clip; 42 struct nvif_object clip;
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 3a4d64e1dfb1..092d89bd3224 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -674,16 +674,20 @@ static int qup_i2c_probe(struct platform_device *pdev)
674 qup->adap.dev.of_node = pdev->dev.of_node; 674 qup->adap.dev.of_node = pdev->dev.of_node;
675 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); 675 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));
676 676
677 ret = i2c_add_adapter(&qup->adap);
678 if (ret)
679 goto fail;
680
681 pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC); 677 pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
682 pm_runtime_use_autosuspend(qup->dev); 678 pm_runtime_use_autosuspend(qup->dev);
683 pm_runtime_set_active(qup->dev); 679 pm_runtime_set_active(qup->dev);
684 pm_runtime_enable(qup->dev); 680 pm_runtime_enable(qup->dev);
681
682 ret = i2c_add_adapter(&qup->adap);
683 if (ret)
684 goto fail_runtime;
685
685 return 0; 686 return 0;
686 687
688fail_runtime:
689 pm_runtime_disable(qup->dev);
690 pm_runtime_set_suspended(qup->dev);
687fail: 691fail:
688 qup_i2c_disable_clocks(qup); 692 qup_i2c_disable_clocks(qup);
689 return ret; 693 return ret;
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 93cfc837200b..b38b0529946a 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c)
238 for (i = 0; i < 8; ++i) { 238 for (i = 0; i < 8; ++i) {
239 val = 0; 239 val = 0;
240 for (j = 0; j < 4; ++j) { 240 for (j = 0; j < 4; ++j) {
241 if (i2c->processed == i2c->msg->len) 241 if ((i2c->processed == i2c->msg->len) && (cnt != 0))
242 break; 242 break;
243 243
244 if (i2c->processed == 0 && cnt == 0) 244 if (i2c->processed == 0 && cnt == 0)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 183588b11fc1..9f0fbecd1eb5 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -64,6 +64,10 @@
64#define cpu_to_group(cpu) cpu_to_node(cpu) 64#define cpu_to_group(cpu) cpu_to_node(cpu)
65#define ANY_GROUP NUMA_NO_NODE 65#define ANY_GROUP NUMA_NO_NODE
66 66
67static bool devices_handle_discard_safely = false;
68module_param(devices_handle_discard_safely, bool, 0644);
69MODULE_PARM_DESC(devices_handle_discard_safely,
70 "Set to Y if all devices in each array reliably return zeroes on reads from discarded regions");
67static struct workqueue_struct *raid5_wq; 71static struct workqueue_struct *raid5_wq;
68/* 72/*
69 * Stripe cache 73 * Stripe cache
@@ -6208,7 +6212,7 @@ static int run(struct mddev *mddev)
6208 mddev->queue->limits.discard_granularity = stripe; 6212 mddev->queue->limits.discard_granularity = stripe;
6209 /* 6213 /*
6210 * unaligned part of discard request will be ignored, so can't 6214 * unaligned part of discard request will be ignored, so can't
6211 * guarantee discard_zerors_data 6215 * guarantee discard_zeroes_data
6212 */ 6216 */
6213 mddev->queue->limits.discard_zeroes_data = 0; 6217 mddev->queue->limits.discard_zeroes_data = 0;
6214 6218
@@ -6233,6 +6237,18 @@ static int run(struct mddev *mddev)
6233 !bdev_get_queue(rdev->bdev)-> 6237 !bdev_get_queue(rdev->bdev)->
6234 limits.discard_zeroes_data) 6238 limits.discard_zeroes_data)
6235 discard_supported = false; 6239 discard_supported = false;
6240 /* Unfortunately, discard_zeroes_data is not currently
6241 * a guarantee - just a hint. So we only allow DISCARD
6242 * if the sysadmin has confirmed that only safe devices
6243 * are in use by setting a module parameter.
6244 */
6245 if (!devices_handle_discard_safely) {
6246 if (discard_supported) {
6247 pr_info("md/raid456: discard support disabled due to uncertainty.\n");
6248 pr_info("Set raid456.devices_handle_discard_safely=Y to override.\n");
6249 }
6250 discard_supported = false;
6251 }
6236 } 6252 }
6237 6253
6238 if (discard_supported && 6254 if (discard_supported &&
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index a7e24848f6c8..9da812b8a786 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3524,6 +3524,7 @@ static struct usb_driver em28xx_usb_driver = {
3524 .disconnect = em28xx_usb_disconnect, 3524 .disconnect = em28xx_usb_disconnect,
3525 .suspend = em28xx_usb_suspend, 3525 .suspend = em28xx_usb_suspend,
3526 .resume = em28xx_usb_resume, 3526 .resume = em28xx_usb_resume,
3527 .reset_resume = em28xx_usb_resume,
3527 .id_table = em28xx_id_table, 3528 .id_table = em28xx_id_table,
3528}; 3529};
3529 3530
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 2fee73b878c2..823d01c5684c 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3236,8 +3236,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3236 3236
3237 skb->protocol = eth_type_trans(skb, bp->dev); 3237 skb->protocol = eth_type_trans(skb, bp->dev);
3238 3238
3239 if ((len > (bp->dev->mtu + ETH_HLEN)) && 3239 if (len > (bp->dev->mtu + ETH_HLEN) &&
3240 (ntohs(skb->protocol) != 0x8100)) { 3240 skb->protocol != htons(0x8100) &&
3241 skb->protocol != htons(ETH_P_8021AD)) {
3241 3242
3242 dev_kfree_skb(skb); 3243 dev_kfree_skb(skb);
3243 goto next_rx; 3244 goto next_rx;
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index e7d3a620d96a..ba499489969a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
6918 skb->protocol = eth_type_trans(skb, tp->dev); 6918 skb->protocol = eth_type_trans(skb, tp->dev);
6919 6919
6920 if (len > (tp->dev->mtu + ETH_HLEN) && 6920 if (len > (tp->dev->mtu + ETH_HLEN) &&
6921 skb->protocol != htons(ETH_P_8021Q)) { 6921 skb->protocol != htons(ETH_P_8021Q) &&
6922 skb->protocol != htons(ETH_P_8021AD)) {
6922 dev_kfree_skb_any(skb); 6923 dev_kfree_skb_any(skb);
6923 goto drop_it_no_recycle; 6924 goto drop_it_no_recycle;
6924 } 6925 }
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index ca5d7798b265..e1e02fba4fcc 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -30,7 +30,6 @@
30#include <linux/of_device.h> 30#include <linux/of_device.h>
31#include <linux/of_mdio.h> 31#include <linux/of_mdio.h>
32#include <linux/of_net.h> 32#include <linux/of_net.h>
33#include <linux/pinctrl/consumer.h>
34 33
35#include "macb.h" 34#include "macb.h"
36 35
@@ -2071,7 +2070,6 @@ static int __init macb_probe(struct platform_device *pdev)
2071 struct phy_device *phydev; 2070 struct phy_device *phydev;
2072 u32 config; 2071 u32 config;
2073 int err = -ENXIO; 2072 int err = -ENXIO;
2074 struct pinctrl *pinctrl;
2075 const char *mac; 2073 const char *mac;
2076 2074
2077 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2075 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2080,15 +2078,6 @@ static int __init macb_probe(struct platform_device *pdev)
2080 goto err_out; 2078 goto err_out;
2081 } 2079 }
2082 2080
2083 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
2084 if (IS_ERR(pinctrl)) {
2085 err = PTR_ERR(pinctrl);
2086 if (err == -EPROBE_DEFER)
2087 goto err_out;
2088
2089 dev_warn(&pdev->dev, "No pinctrl provided\n");
2090 }
2091
2092 err = -ENOMEM; 2081 err = -ENOMEM;
2093 dev = alloc_etherdev(sizeof(*bp)); 2082 dev = alloc_etherdev(sizeof(*bp));
2094 if (!dev) 2083 if (!dev)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 7e2d5d57c598..871e3a5bda38 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -78,13 +78,13 @@ MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero");
78#endif /* CONFIG_PCI_MSI */ 78#endif /* CONFIG_PCI_MSI */
79 79
80static uint8_t num_vfs[3] = {0, 0, 0}; 80static uint8_t num_vfs[3] = {0, 0, 0};
81static int num_vfs_argc = 3; 81static int num_vfs_argc;
82module_param_array(num_vfs, byte , &num_vfs_argc, 0444); 82module_param_array(num_vfs, byte , &num_vfs_argc, 0444);
83MODULE_PARM_DESC(num_vfs, "enable #num_vfs functions if num_vfs > 0\n" 83MODULE_PARM_DESC(num_vfs, "enable #num_vfs functions if num_vfs > 0\n"
84 "num_vfs=port1,port2,port1+2"); 84 "num_vfs=port1,port2,port1+2");
85 85
86static uint8_t probe_vf[3] = {0, 0, 0}; 86static uint8_t probe_vf[3] = {0, 0, 0};
87static int probe_vfs_argc = 3; 87static int probe_vfs_argc;
88module_param_array(probe_vf, byte, &probe_vfs_argc, 0444); 88module_param_array(probe_vf, byte, &probe_vfs_argc, 0444);
89MODULE_PARM_DESC(probe_vf, "number of vfs to probe by pf driver (num_vfs > 0)\n" 89MODULE_PARM_DESC(probe_vf, "number of vfs to probe by pf driver (num_vfs > 0)\n"
90 "probe_vf=port1,port2,port1+2"); 90 "probe_vf=port1,port2,port1+2");
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index 32058614151a..5c4068353f66 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -135,6 +135,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
135 int i, j; 135 int i, j;
136 struct nx_host_tx_ring *tx_ring = adapter->tx_ring; 136 struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
137 137
138 spin_lock(&adapter->tx_clean_lock);
138 cmd_buf = tx_ring->cmd_buf_arr; 139 cmd_buf = tx_ring->cmd_buf_arr;
139 for (i = 0; i < tx_ring->num_desc; i++) { 140 for (i = 0; i < tx_ring->num_desc; i++) {
140 buffrag = cmd_buf->frag_array; 141 buffrag = cmd_buf->frag_array;
@@ -158,6 +159,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
158 } 159 }
159 cmd_buf++; 160 cmd_buf++;
160 } 161 }
162 spin_unlock(&adapter->tx_clean_lock);
161} 163}
162 164
163void netxen_free_sw_resources(struct netxen_adapter *adapter) 165void netxen_free_sw_resources(struct netxen_adapter *adapter)
@@ -1792,9 +1794,9 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
1792 break; 1794 break;
1793 } 1795 }
1794 1796
1795 if (count && netif_running(netdev)) { 1797 tx_ring->sw_consumer = sw_consumer;
1796 tx_ring->sw_consumer = sw_consumer;
1797 1798
1799 if (count && netif_running(netdev)) {
1798 smp_mb(); 1800 smp_mb();
1799 1801
1800 if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) 1802 if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev))
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 1159031f885b..5ec5a2b0e989 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1186,7 +1186,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
1186 return; 1186 return;
1187 1187
1188 smp_mb(); 1188 smp_mb();
1189 spin_lock(&adapter->tx_clean_lock);
1190 netif_carrier_off(netdev); 1189 netif_carrier_off(netdev);
1191 netif_tx_disable(netdev); 1190 netif_tx_disable(netdev);
1192 1191
@@ -1204,7 +1203,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
1204 netxen_napi_disable(adapter); 1203 netxen_napi_disable(adapter);
1205 1204
1206 netxen_release_tx_buffers(adapter); 1205 netxen_release_tx_buffers(adapter);
1207 spin_unlock(&adapter->tx_clean_lock);
1208} 1206}
1209 1207
1210/* Usage: During suspend and firmware recovery module */ 1208/* Usage: During suspend and firmware recovery module */
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index 86783e1afcf7..3172cdf591fe 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -1177,9 +1177,8 @@ static void qlcnic_83xx_setup_idc_parameters(struct qlcnic_adapter *adapter)
1177{ 1177{
1178 u32 idc_params, val; 1178 u32 idc_params, val;
1179 1179
1180 if (qlcnic_83xx_lockless_flash_read32(adapter, 1180 if (qlcnic_83xx_flash_read32(adapter, QLC_83XX_IDC_FLASH_PARAM_ADDR,
1181 QLC_83XX_IDC_FLASH_PARAM_ADDR, 1181 (u8 *)&idc_params, 1)) {
1182 (u8 *)&idc_params, 1)) {
1183 dev_info(&adapter->pdev->dev, 1182 dev_info(&adapter->pdev->dev,
1184 "%s:failed to get IDC params from flash\n", __func__); 1183 "%s:failed to get IDC params from flash\n", __func__);
1185 adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS; 1184 adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 141f116eb868..494e8105adee 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1333,21 +1333,21 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
1333 struct qlcnic_host_tx_ring *tx_ring; 1333 struct qlcnic_host_tx_ring *tx_ring;
1334 struct qlcnic_esw_statistics port_stats; 1334 struct qlcnic_esw_statistics port_stats;
1335 struct qlcnic_mac_statistics mac_stats; 1335 struct qlcnic_mac_statistics mac_stats;
1336 int index, ret, length, size, tx_size, ring; 1336 int index, ret, length, size, ring;
1337 char *p; 1337 char *p;
1338 1338
1339 tx_size = adapter->drv_tx_rings * QLCNIC_TX_STATS_LEN; 1339 memset(data, 0, stats->n_stats * sizeof(u64));
1340 1340
1341 memset(data, 0, tx_size * sizeof(u64));
1342 for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) { 1341 for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) {
1343 if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { 1342 if (adapter->is_up == QLCNIC_ADAPTER_UP_MAGIC) {
1344 tx_ring = &adapter->tx_ring[ring]; 1343 tx_ring = &adapter->tx_ring[ring];
1345 data = qlcnic_fill_tx_queue_stats(data, tx_ring); 1344 data = qlcnic_fill_tx_queue_stats(data, tx_ring);
1346 qlcnic_update_stats(adapter); 1345 qlcnic_update_stats(adapter);
1346 } else {
1347 data += QLCNIC_TX_STATS_LEN;
1347 } 1348 }
1348 } 1349 }
1349 1350
1350 memset(data, 0, stats->n_stats * sizeof(u64));
1351 length = QLCNIC_STATS_LEN; 1351 length = QLCNIC_STATS_LEN;
1352 for (index = 0; index < length; index++) { 1352 for (index = 0; index < length; index++) {
1353 p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset; 1353 p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 6e6ee226de04..b0c1521e08a3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2786,8 +2786,15 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
2786 if (IS_ERR(priv->stmmac_clk)) { 2786 if (IS_ERR(priv->stmmac_clk)) {
2787 dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", 2787 dev_warn(priv->device, "%s: warning: cannot get CSR clock\n",
2788 __func__); 2788 __func__);
2789 ret = PTR_ERR(priv->stmmac_clk); 2789 /* If failed to obtain stmmac_clk and specific clk_csr value
2790 goto error_clk_get; 2790 * is NOT passed from the platform, probe fail.
2791 */
2792 if (!priv->plat->clk_csr) {
2793 ret = PTR_ERR(priv->stmmac_clk);
2794 goto error_clk_get;
2795 } else {
2796 priv->stmmac_clk = NULL;
2797 }
2791 } 2798 }
2792 clk_prepare_enable(priv->stmmac_clk); 2799 clk_prepare_enable(priv->stmmac_clk);
2793 2800
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index a9c5eaadc426..0fcb5e7eb073 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -387,6 +387,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
387 int hdr_offset; 387 int hdr_offset;
388 u32 net_trans_info; 388 u32 net_trans_info;
389 u32 hash; 389 u32 hash;
390 u32 skb_length = skb->len;
390 391
391 392
392 /* We will atmost need two pages to describe the rndis 393 /* We will atmost need two pages to describe the rndis
@@ -562,7 +563,7 @@ do_send:
562 563
563drop: 564drop:
564 if (ret == 0) { 565 if (ret == 0) {
565 net->stats.tx_bytes += skb->len; 566 net->stats.tx_bytes += skb_length;
566 net->stats.tx_packets++; 567 net->stats.tx_packets++;
567 } else { 568 } else {
568 kfree(packet); 569 kfree(packet);
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3381c4f91a8c..0c6adaaf898c 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -112,17 +112,15 @@ out:
112 return err; 112 return err;
113} 113}
114 114
115/* Requires RTNL */
115static int macvtap_set_queue(struct net_device *dev, struct file *file, 116static int macvtap_set_queue(struct net_device *dev, struct file *file,
116 struct macvtap_queue *q) 117 struct macvtap_queue *q)
117{ 118{
118 struct macvlan_dev *vlan = netdev_priv(dev); 119 struct macvlan_dev *vlan = netdev_priv(dev);
119 int err = -EBUSY;
120 120
121 rtnl_lock();
122 if (vlan->numqueues == MAX_MACVTAP_QUEUES) 121 if (vlan->numqueues == MAX_MACVTAP_QUEUES)
123 goto out; 122 return -EBUSY;
124 123
125 err = 0;
126 rcu_assign_pointer(q->vlan, vlan); 124 rcu_assign_pointer(q->vlan, vlan);
127 rcu_assign_pointer(vlan->taps[vlan->numvtaps], q); 125 rcu_assign_pointer(vlan->taps[vlan->numvtaps], q);
128 sock_hold(&q->sk); 126 sock_hold(&q->sk);
@@ -136,9 +134,7 @@ static int macvtap_set_queue(struct net_device *dev, struct file *file,
136 vlan->numvtaps++; 134 vlan->numvtaps++;
137 vlan->numqueues++; 135 vlan->numqueues++;
138 136
139out: 137 return 0;
140 rtnl_unlock();
141 return err;
142} 138}
143 139
144static int macvtap_disable_queue(struct macvtap_queue *q) 140static int macvtap_disable_queue(struct macvtap_queue *q)
@@ -454,11 +450,12 @@ static void macvtap_sock_destruct(struct sock *sk)
454static int macvtap_open(struct inode *inode, struct file *file) 450static int macvtap_open(struct inode *inode, struct file *file)
455{ 451{
456 struct net *net = current->nsproxy->net_ns; 452 struct net *net = current->nsproxy->net_ns;
457 struct net_device *dev = dev_get_by_macvtap_minor(iminor(inode)); 453 struct net_device *dev;
458 struct macvtap_queue *q; 454 struct macvtap_queue *q;
459 int err; 455 int err = -ENODEV;
460 456
461 err = -ENODEV; 457 rtnl_lock();
458 dev = dev_get_by_macvtap_minor(iminor(inode));
462 if (!dev) 459 if (!dev)
463 goto out; 460 goto out;
464 461
@@ -498,6 +495,7 @@ out:
498 if (dev) 495 if (dev)
499 dev_put(dev); 496 dev_put(dev);
500 497
498 rtnl_unlock();
501 return err; 499 return err;
502} 500}
503 501
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 74760e8143e3..604ef210a4de 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -24,7 +24,7 @@
24#include <net/ip6_checksum.h> 24#include <net/ip6_checksum.h>
25 25
26/* Version Information */ 26/* Version Information */
27#define DRIVER_VERSION "v1.06.0 (2014/03/03)" 27#define DRIVER_VERSION "v1.06.1 (2014/10/01)"
28#define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" 28#define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>"
29#define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" 29#define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters"
30#define MODULENAME "r8152" 30#define MODULENAME "r8152"
@@ -1949,10 +1949,34 @@ static void rxdy_gated_en(struct r8152 *tp, bool enable)
1949 ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); 1949 ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data);
1950} 1950}
1951 1951
1952static int rtl_start_rx(struct r8152 *tp)
1953{
1954 int i, ret = 0;
1955
1956 INIT_LIST_HEAD(&tp->rx_done);
1957 for (i = 0; i < RTL8152_MAX_RX; i++) {
1958 INIT_LIST_HEAD(&tp->rx_info[i].list);
1959 ret = r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL);
1960 if (ret)
1961 break;
1962 }
1963
1964 return ret;
1965}
1966
1967static int rtl_stop_rx(struct r8152 *tp)
1968{
1969 int i;
1970
1971 for (i = 0; i < RTL8152_MAX_RX; i++)
1972 usb_kill_urb(tp->rx_info[i].urb);
1973
1974 return 0;
1975}
1976
1952static int rtl_enable(struct r8152 *tp) 1977static int rtl_enable(struct r8152 *tp)
1953{ 1978{
1954 u32 ocp_data; 1979 u32 ocp_data;
1955 int i, ret;
1956 1980
1957 r8152b_reset_packet_filter(tp); 1981 r8152b_reset_packet_filter(tp);
1958 1982
@@ -1962,14 +1986,7 @@ static int rtl_enable(struct r8152 *tp)
1962 1986
1963 rxdy_gated_en(tp, false); 1987 rxdy_gated_en(tp, false);
1964 1988
1965 INIT_LIST_HEAD(&tp->rx_done); 1989 return rtl_start_rx(tp);
1966 ret = 0;
1967 for (i = 0; i < RTL8152_MAX_RX; i++) {
1968 INIT_LIST_HEAD(&tp->rx_info[i].list);
1969 ret |= r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL);
1970 }
1971
1972 return ret;
1973} 1990}
1974 1991
1975static int rtl8152_enable(struct r8152 *tp) 1992static int rtl8152_enable(struct r8152 *tp)
@@ -2053,8 +2070,7 @@ static void rtl_disable(struct r8152 *tp)
2053 mdelay(1); 2070 mdelay(1);
2054 } 2071 }
2055 2072
2056 for (i = 0; i < RTL8152_MAX_RX; i++) 2073 rtl_stop_rx(tp);
2057 usb_kill_urb(tp->rx_info[i].urb);
2058 2074
2059 rtl8152_nic_reset(tp); 2075 rtl8152_nic_reset(tp);
2060} 2076}
@@ -2185,28 +2201,6 @@ static void rtl_phy_reset(struct r8152 *tp)
2185 } 2201 }
2186} 2202}
2187 2203
2188static void rtl_clear_bp(struct r8152 *tp)
2189{
2190 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0);
2191 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0);
2192 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0);
2193 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0);
2194 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0);
2195 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0);
2196 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0);
2197 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0);
2198 mdelay(3);
2199 ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0);
2200 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0);
2201}
2202
2203static void r8153_clear_bp(struct r8152 *tp)
2204{
2205 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0);
2206 ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0);
2207 rtl_clear_bp(tp);
2208}
2209
2210static void r8153_teredo_off(struct r8152 *tp) 2204static void r8153_teredo_off(struct r8152 *tp)
2211{ 2205{
2212 u32 ocp_data; 2206 u32 ocp_data;
@@ -2249,8 +2243,6 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp)
2249 r8152_mdio_write(tp, MII_BMCR, data); 2243 r8152_mdio_write(tp, MII_BMCR, data);
2250 } 2244 }
2251 2245
2252 rtl_clear_bp(tp);
2253
2254 set_bit(PHY_RESET, &tp->flags); 2246 set_bit(PHY_RESET, &tp->flags);
2255} 2247}
2256 2248
@@ -2401,8 +2393,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp)
2401 r8152_mdio_write(tp, MII_BMCR, data); 2393 r8152_mdio_write(tp, MII_BMCR, data);
2402 } 2394 }
2403 2395
2404 r8153_clear_bp(tp);
2405
2406 if (tp->version == RTL_VER_03) { 2396 if (tp->version == RTL_VER_03) {
2407 data = ocp_reg_read(tp, OCP_EEE_CFG); 2397 data = ocp_reg_read(tp, OCP_EEE_CFG);
2408 data &= ~CTAP_SHORT_EN; 2398 data &= ~CTAP_SHORT_EN;
@@ -3083,13 +3073,14 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message)
3083 clear_bit(WORK_ENABLE, &tp->flags); 3073 clear_bit(WORK_ENABLE, &tp->flags);
3084 usb_kill_urb(tp->intr_urb); 3074 usb_kill_urb(tp->intr_urb);
3085 cancel_delayed_work_sync(&tp->schedule); 3075 cancel_delayed_work_sync(&tp->schedule);
3076 tasklet_disable(&tp->tl);
3086 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { 3077 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
3078 rtl_stop_rx(tp);
3087 rtl_runtime_suspend_enable(tp, true); 3079 rtl_runtime_suspend_enable(tp, true);
3088 } else { 3080 } else {
3089 tasklet_disable(&tp->tl);
3090 tp->rtl_ops.down(tp); 3081 tp->rtl_ops.down(tp);
3091 tasklet_enable(&tp->tl);
3092 } 3082 }
3083 tasklet_enable(&tp->tl);
3093 } 3084 }
3094 3085
3095 return 0; 3086 return 0;
@@ -3108,17 +3099,18 @@ static int rtl8152_resume(struct usb_interface *intf)
3108 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { 3099 if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
3109 rtl_runtime_suspend_enable(tp, false); 3100 rtl_runtime_suspend_enable(tp, false);
3110 clear_bit(SELECTIVE_SUSPEND, &tp->flags); 3101 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
3102 set_bit(WORK_ENABLE, &tp->flags);
3111 if (tp->speed & LINK_STATUS) 3103 if (tp->speed & LINK_STATUS)
3112 tp->rtl_ops.disable(tp); 3104 rtl_start_rx(tp);
3113 } else { 3105 } else {
3114 tp->rtl_ops.up(tp); 3106 tp->rtl_ops.up(tp);
3115 rtl8152_set_speed(tp, AUTONEG_ENABLE, 3107 rtl8152_set_speed(tp, AUTONEG_ENABLE,
3116 tp->mii.supports_gmii ? SPEED_1000 : SPEED_100, 3108 tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
3117 DUPLEX_FULL); 3109 DUPLEX_FULL);
3110 tp->speed = 0;
3111 netif_carrier_off(tp->netdev);
3112 set_bit(WORK_ENABLE, &tp->flags);
3118 } 3113 }
3119 tp->speed = 0;
3120 netif_carrier_off(tp->netdev);
3121 set_bit(WORK_ENABLE, &tp->flags);
3122 usb_submit_urb(tp->intr_urb, GFP_KERNEL); 3114 usb_submit_urb(tp->intr_urb, GFP_KERNEL);
3123 } 3115 }
3124 3116
@@ -3405,7 +3397,7 @@ static void rtl8153_unload(struct r8152 *tp)
3405 if (test_bit(RTL8152_UNPLUG, &tp->flags)) 3397 if (test_bit(RTL8152_UNPLUG, &tp->flags))
3406 return; 3398 return;
3407 3399
3408 r8153_power_cut_en(tp, true); 3400 r8153_power_cut_en(tp, false);
3409} 3401}
3410 3402
3411static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) 3403static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
@@ -3558,7 +3550,11 @@ static void rtl8152_disconnect(struct usb_interface *intf)
3558 3550
3559 usb_set_intfdata(intf, NULL); 3551 usb_set_intfdata(intf, NULL);
3560 if (tp) { 3552 if (tp) {
3561 set_bit(RTL8152_UNPLUG, &tp->flags); 3553 struct usb_device *udev = tp->udev;
3554
3555 if (udev->state == USB_STATE_NOTATTACHED)
3556 set_bit(RTL8152_UNPLUG, &tp->flags);
3557
3562 tasklet_kill(&tp->tl); 3558 tasklet_kill(&tp->tl);
3563 unregister_netdev(tp->netdev); 3559 unregister_netdev(tp->netdev);
3564 tp->rtl_ops.unload(tp); 3560 tp->rtl_ops.unload(tp);
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index a042d065a0c7..8be2096c8423 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -395,7 +395,8 @@ static void __init superio_serial_init(void)
395 serial_port.iotype = UPIO_PORT; 395 serial_port.iotype = UPIO_PORT;
396 serial_port.type = PORT_16550A; 396 serial_port.type = PORT_16550A;
397 serial_port.uartclk = 115200*16; 397 serial_port.uartclk = 115200*16;
398 serial_port.fifosize = 16; 398 serial_port.flags = UPF_FIXED_PORT | UPF_FIXED_TYPE |
399 UPF_BOOT_AUTOCONF;
399 400
400 /* serial port #1 */ 401 /* serial port #1 */
401 serial_port.iobase = sio_dev.sp1_base; 402 serial_port.iobase = sio_dev.sp1_base;
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index bfd2c2e9f6cd..64d06b52f98a 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -97,95 +97,6 @@ config PINCTRL_BCM281XX
97 BCM28145, and BCM28155 SoCs. This driver requires the pinctrl 97 BCM28145, and BCM28155 SoCs. This driver requires the pinctrl
98 framework. GPIO is provided by a separate GPIO driver. 98 framework. GPIO is provided by a separate GPIO driver.
99 99
100config PINCTRL_IMX
101 bool
102 select PINMUX
103 select PINCONF
104
105config PINCTRL_IMX1_CORE
106 bool
107 select PINMUX
108 select PINCONF
109
110config PINCTRL_IMX1
111 bool "IMX1 pinctrl driver"
112 depends on SOC_IMX1
113 select PINCTRL_IMX1_CORE
114 help
115 Say Y here to enable the imx1 pinctrl driver
116
117config PINCTRL_IMX27
118 bool "IMX27 pinctrl driver"
119 depends on SOC_IMX27
120 select PINCTRL_IMX1_CORE
121 help
122 Say Y here to enable the imx27 pinctrl driver
123
124
125config PINCTRL_IMX25
126 bool "IMX25 pinctrl driver"
127 depends on OF
128 depends on SOC_IMX25
129 select PINCTRL_IMX
130 help
131 Say Y here to enable the imx25 pinctrl driver
132
133config PINCTRL_IMX35
134 bool "IMX35 pinctrl driver"
135 depends on SOC_IMX35
136 select PINCTRL_IMX
137 help
138 Say Y here to enable the imx35 pinctrl driver
139
140config PINCTRL_IMX50
141 bool "IMX50 pinctrl driver"
142 depends on SOC_IMX50
143 select PINCTRL_IMX
144 help
145 Say Y here to enable the imx50 pinctrl driver
146
147config PINCTRL_IMX51
148 bool "IMX51 pinctrl driver"
149 depends on SOC_IMX51
150 select PINCTRL_IMX
151 help
152 Say Y here to enable the imx51 pinctrl driver
153
154config PINCTRL_IMX53
155 bool "IMX53 pinctrl driver"
156 depends on SOC_IMX53
157 select PINCTRL_IMX
158 help
159 Say Y here to enable the imx53 pinctrl driver
160
161config PINCTRL_IMX6Q
162 bool "IMX6Q/DL pinctrl driver"
163 depends on SOC_IMX6Q
164 select PINCTRL_IMX
165 help
166 Say Y here to enable the imx6q/dl pinctrl driver
167
168config PINCTRL_IMX6SL
169 bool "IMX6SL pinctrl driver"
170 depends on SOC_IMX6SL
171 select PINCTRL_IMX
172 help
173 Say Y here to enable the imx6sl pinctrl driver
174
175config PINCTRL_IMX6SX
176 bool "IMX6SX pinctrl driver"
177 depends on SOC_IMX6SX
178 select PINCTRL_IMX
179 help
180 Say Y here to enable the imx6sx pinctrl driver
181
182config PINCTRL_VF610
183 bool "Freescale Vybrid VF610 pinctrl driver"
184 depends on SOC_VF610
185 select PINCTRL_IMX
186 help
187 Say Y here to enable the Freescale Vybrid VF610 pinctrl driver
188
189config PINCTRL_LANTIQ 100config PINCTRL_LANTIQ
190 bool 101 bool
191 depends on LANTIQ 102 depends on LANTIQ
@@ -197,19 +108,6 @@ config PINCTRL_FALCON
197 depends on SOC_FALCON 108 depends on SOC_FALCON
198 depends on PINCTRL_LANTIQ 109 depends on PINCTRL_LANTIQ
199 110
200config PINCTRL_MXS
201 bool
202 select PINMUX
203 select PINCONF
204
205config PINCTRL_IMX23
206 bool
207 select PINCTRL_MXS
208
209config PINCTRL_IMX28
210 bool
211 select PINCTRL_MXS
212
213config PINCTRL_ROCKCHIP 111config PINCTRL_ROCKCHIP
214 bool 112 bool
215 select PINMUX 113 select PINMUX
@@ -306,6 +204,7 @@ config PINCTRL_PALMAS
306 TPS65913, TPS80036 etc. 204 TPS65913, TPS80036 etc.
307 205
308source "drivers/pinctrl/berlin/Kconfig" 206source "drivers/pinctrl/berlin/Kconfig"
207source "drivers/pinctrl/freescale/Kconfig"
309source "drivers/pinctrl/mvebu/Kconfig" 208source "drivers/pinctrl/mvebu/Kconfig"
310source "drivers/pinctrl/nomadik/Kconfig" 209source "drivers/pinctrl/nomadik/Kconfig"
311source "drivers/pinctrl/qcom/Kconfig" 210source "drivers/pinctrl/qcom/Kconfig"
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 05d227508c95..51f52d32859e 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -17,23 +17,7 @@ obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o
17obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o 17obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o
18obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o 18obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o
19obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o 19obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o
20obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o
21obj-$(CONFIG_PINCTRL_IMX1_CORE) += pinctrl-imx1-core.o
22obj-$(CONFIG_PINCTRL_IMX1) += pinctrl-imx1.o
23obj-$(CONFIG_PINCTRL_IMX27) += pinctrl-imx27.o
24obj-$(CONFIG_PINCTRL_IMX35) += pinctrl-imx35.o
25obj-$(CONFIG_PINCTRL_IMX50) += pinctrl-imx50.o
26obj-$(CONFIG_PINCTRL_IMX51) += pinctrl-imx51.o
27obj-$(CONFIG_PINCTRL_IMX53) += pinctrl-imx53.o
28obj-$(CONFIG_PINCTRL_IMX6Q) += pinctrl-imx6q.o
29obj-$(CONFIG_PINCTRL_IMX6Q) += pinctrl-imx6dl.o
30obj-$(CONFIG_PINCTRL_IMX6SL) += pinctrl-imx6sl.o
31obj-$(CONFIG_PINCTRL_IMX6SX) += pinctrl-imx6sx.o
32obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o 20obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o
33obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o
34obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o
35obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o
36obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o
37obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o 21obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o
38obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o 22obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
39obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o 23obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
@@ -52,15 +36,14 @@ obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o
52obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o 36obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o
53obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o 37obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o
54obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o 38obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
55obj-$(CONFIG_PINCTRL_VF610) += pinctrl-vf610.o
56 39
57obj-$(CONFIG_ARCH_BERLIN) += berlin/ 40obj-$(CONFIG_ARCH_BERLIN) += berlin/
41obj-y += freescale/
58obj-$(CONFIG_PLAT_ORION) += mvebu/ 42obj-$(CONFIG_PLAT_ORION) += mvebu/
59obj-y += nomadik/ 43obj-y += nomadik/
60obj-$(CONFIG_ARCH_QCOM) += qcom/ 44obj-$(CONFIG_ARCH_QCOM) += qcom/
61obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ 45obj-$(CONFIG_PINCTRL_SAMSUNG) += samsung/
62obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ 46obj-$(CONFIG_PINCTRL_SH_PFC) += sh-pfc/
63obj-$(CONFIG_SUPERH) += sh-pfc/
64obj-$(CONFIG_PLAT_SPEAR) += spear/ 47obj-$(CONFIG_PLAT_SPEAR) += spear/
65obj-$(CONFIG_ARCH_SUNXI) += sunxi/ 48obj-$(CONFIG_ARCH_SUNXI) += sunxi/
66obj-$(CONFIG_ARCH_VT8500) += vt8500/ 49obj-$(CONFIG_ARCH_VT8500) += vt8500/
diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c
index 86db2235ab00..7f0b0f93242b 100644
--- a/drivers/pinctrl/berlin/berlin.c
+++ b/drivers/pinctrl/berlin/berlin.c
@@ -99,30 +99,11 @@ static int berlin_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrl_dev,
99 return 0; 99 return 0;
100} 100}
101 101
102static void berlin_pinctrl_dt_free_map(struct pinctrl_dev *pctrl_dev,
103 struct pinctrl_map *map,
104 unsigned nmaps)
105{
106 int i;
107
108 for (i = 0; i < nmaps; i++) {
109 if (map[i].type == PIN_MAP_TYPE_MUX_GROUP) {
110 kfree(map[i].data.mux.group);
111
112 /* a function can be applied to multiple groups */
113 if (i == 0)
114 kfree(map[i].data.mux.function);
115 }
116 }
117
118 kfree(map);
119}
120
121static const struct pinctrl_ops berlin_pinctrl_ops = { 102static const struct pinctrl_ops berlin_pinctrl_ops = {
122 .get_groups_count = &berlin_pinctrl_get_group_count, 103 .get_groups_count = &berlin_pinctrl_get_group_count,
123 .get_group_name = &berlin_pinctrl_get_group_name, 104 .get_group_name = &berlin_pinctrl_get_group_name,
124 .dt_node_to_map = &berlin_pinctrl_dt_node_to_map, 105 .dt_node_to_map = &berlin_pinctrl_dt_node_to_map,
125 .dt_free_map = &berlin_pinctrl_dt_free_map, 106 .dt_free_map = &pinctrl_utils_dt_free_map,
126}; 107};
127 108
128static int berlin_pinmux_get_functions_count(struct pinctrl_dev *pctrl_dev) 109static int berlin_pinmux_get_functions_count(struct pinctrl_dev *pctrl_dev)
@@ -170,9 +151,9 @@ berlin_pinctrl_find_function_by_name(struct berlin_pinctrl *pctrl,
170 return NULL; 151 return NULL;
171} 152}
172 153
173static int berlin_pinmux_enable(struct pinctrl_dev *pctrl_dev, 154static int berlin_pinmux_set(struct pinctrl_dev *pctrl_dev,
174 unsigned function, 155 unsigned function,
175 unsigned group) 156 unsigned group)
176{ 157{
177 struct berlin_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrl_dev); 158 struct berlin_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrl_dev);
178 const struct berlin_desc_group *group_desc = pctrl->desc->groups + group; 159 const struct berlin_desc_group *group_desc = pctrl->desc->groups + group;
@@ -197,7 +178,7 @@ static const struct pinmux_ops berlin_pinmux_ops = {
197 .get_functions_count = &berlin_pinmux_get_functions_count, 178 .get_functions_count = &berlin_pinmux_get_functions_count,
198 .get_function_name = &berlin_pinmux_get_function_name, 179 .get_function_name = &berlin_pinmux_get_function_name,
199 .get_function_groups = &berlin_pinmux_get_function_groups, 180 .get_function_groups = &berlin_pinmux_get_function_groups,
200 .enable = &berlin_pinmux_enable, 181 .set_mux = &berlin_pinmux_set,
201}; 182};
202 183
203static int berlin_pinctrl_add_function(struct berlin_pinctrl *pctrl, 184static int berlin_pinctrl_add_function(struct berlin_pinctrl *pctrl,
diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig
new file mode 100644
index 000000000000..16aac38793fe
--- /dev/null
+++ b/drivers/pinctrl/freescale/Kconfig
@@ -0,0 +1,108 @@
1config PINCTRL_IMX
2 bool
3 select PINMUX
4 select PINCONF
5
6config PINCTRL_IMX1_CORE
7 bool
8 select PINMUX
9 select PINCONF
10
11config PINCTRL_IMX1
12 bool "IMX1 pinctrl driver"
13 depends on SOC_IMX1
14 select PINCTRL_IMX1_CORE
15 help
16 Say Y here to enable the imx1 pinctrl driver
17
18config PINCTRL_IMX21
19 bool "i.MX21 pinctrl driver"
20 depends on SOC_IMX21
21 select PINCTRL_IMX1_CORE
22 help
23 Say Y here to enable the i.MX21 pinctrl driver
24
25config PINCTRL_IMX27
26 bool "IMX27 pinctrl driver"
27 depends on SOC_IMX27
28 select PINCTRL_IMX1_CORE
29 help
30 Say Y here to enable the imx27 pinctrl driver
31
32
33config PINCTRL_IMX25
34 bool "IMX25 pinctrl driver"
35 depends on OF
36 depends on SOC_IMX25
37 select PINCTRL_IMX
38 help
39 Say Y here to enable the imx25 pinctrl driver
40
41config PINCTRL_IMX35
42 bool "IMX35 pinctrl driver"
43 depends on SOC_IMX35
44 select PINCTRL_IMX
45 help
46 Say Y here to enable the imx35 pinctrl driver
47
48config PINCTRL_IMX50
49 bool "IMX50 pinctrl driver"
50 depends on SOC_IMX50
51 select PINCTRL_IMX
52 help
53 Say Y here to enable the imx50 pinctrl driver
54
55config PINCTRL_IMX51
56 bool "IMX51 pinctrl driver"
57 depends on SOC_IMX51
58 select PINCTRL_IMX
59 help
60 Say Y here to enable the imx51 pinctrl driver
61
62config PINCTRL_IMX53
63 bool "IMX53 pinctrl driver"
64 depends on SOC_IMX53
65 select PINCTRL_IMX
66 help
67 Say Y here to enable the imx53 pinctrl driver
68
69config PINCTRL_IMX6Q
70 bool "IMX6Q/DL pinctrl driver"
71 depends on SOC_IMX6Q
72 select PINCTRL_IMX
73 help
74 Say Y here to enable the imx6q/dl pinctrl driver
75
76config PINCTRL_IMX6SL
77 bool "IMX6SL pinctrl driver"
78 depends on SOC_IMX6SL
79 select PINCTRL_IMX
80 help
81 Say Y here to enable the imx6sl pinctrl driver
82
83config PINCTRL_IMX6SX
84 bool "IMX6SX pinctrl driver"
85 depends on SOC_IMX6SX
86 select PINCTRL_IMX
87 help
88 Say Y here to enable the imx6sx pinctrl driver
89
90config PINCTRL_VF610
91 bool "Freescale Vybrid VF610 pinctrl driver"
92 depends on SOC_VF610
93 select PINCTRL_IMX
94 help
95 Say Y here to enable the Freescale Vybrid VF610 pinctrl driver
96
97config PINCTRL_MXS
98 bool
99 select PINMUX
100 select PINCONF
101
102config PINCTRL_IMX23
103 bool
104 select PINCTRL_MXS
105
106config PINCTRL_IMX28
107 bool
108 select PINCTRL_MXS
diff --git a/drivers/pinctrl/freescale/Makefile b/drivers/pinctrl/freescale/Makefile
new file mode 100644
index 000000000000..bba73c22f043
--- /dev/null
+++ b/drivers/pinctrl/freescale/Makefile
@@ -0,0 +1,19 @@
1# Freescale pin control drivers
2obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o
3obj-$(CONFIG_PINCTRL_IMX1_CORE) += pinctrl-imx1-core.o
4obj-$(CONFIG_PINCTRL_IMX1) += pinctrl-imx1.o
5obj-$(CONFIG_PINCTRL_IMX21) += pinctrl-imx21.o
6obj-$(CONFIG_PINCTRL_IMX27) += pinctrl-imx27.o
7obj-$(CONFIG_PINCTRL_IMX35) += pinctrl-imx35.o
8obj-$(CONFIG_PINCTRL_IMX50) += pinctrl-imx50.o
9obj-$(CONFIG_PINCTRL_IMX51) += pinctrl-imx51.o
10obj-$(CONFIG_PINCTRL_IMX53) += pinctrl-imx53.o
11obj-$(CONFIG_PINCTRL_IMX6Q) += pinctrl-imx6q.o
12obj-$(CONFIG_PINCTRL_IMX6Q) += pinctrl-imx6dl.o
13obj-$(CONFIG_PINCTRL_IMX6SL) += pinctrl-imx6sl.o
14obj-$(CONFIG_PINCTRL_IMX6SX) += pinctrl-imx6sx.o
15obj-$(CONFIG_PINCTRL_VF610) += pinctrl-vf610.o
16obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o
17obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o
18obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o
19obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 946d594a64dd..f2446769247f 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -24,7 +24,7 @@
24#include <linux/pinctrl/pinmux.h> 24#include <linux/pinctrl/pinmux.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include "core.h" 27#include "../core.h"
28#include "pinctrl-imx.h" 28#include "pinctrl-imx.h"
29 29
30/* The bits in CONFIG cell defined in binding doc*/ 30/* The bits in CONFIG cell defined in binding doc*/
@@ -179,8 +179,8 @@ static const struct pinctrl_ops imx_pctrl_ops = {
179 179
180}; 180};
181 181
182static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, 182static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
183 unsigned group) 183 unsigned group)
184{ 184{
185 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); 185 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
186 const struct imx_pinctrl_soc_info *info = ipctl->info; 186 const struct imx_pinctrl_soc_info *info = ipctl->info;
@@ -204,7 +204,7 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
204 pin_id = pin->pin; 204 pin_id = pin->pin;
205 pin_reg = &info->pin_regs[pin_id]; 205 pin_reg = &info->pin_regs[pin_id];
206 206
207 if (!(info->flags & ZERO_OFFSET_VALID) && !pin_reg->mux_reg) { 207 if (pin_reg->mux_reg == -1) {
208 dev_err(ipctl->dev, "Pin(%s) does not support mux function\n", 208 dev_err(ipctl->dev, "Pin(%s) does not support mux function\n",
209 info->pins[pin_id].name); 209 info->pins[pin_id].name);
210 return -EINVAL; 210 return -EINVAL;
@@ -298,7 +298,7 @@ static const struct pinmux_ops imx_pmx_ops = {
298 .get_functions_count = imx_pmx_get_funcs_count, 298 .get_functions_count = imx_pmx_get_funcs_count,
299 .get_function_name = imx_pmx_get_func_name, 299 .get_function_name = imx_pmx_get_func_name,
300 .get_function_groups = imx_pmx_get_groups, 300 .get_function_groups = imx_pmx_get_groups,
301 .enable = imx_pmx_enable, 301 .set_mux = imx_pmx_set,
302}; 302};
303 303
304static int imx_pinconf_get(struct pinctrl_dev *pctldev, 304static int imx_pinconf_get(struct pinctrl_dev *pctldev,
@@ -308,7 +308,7 @@ static int imx_pinconf_get(struct pinctrl_dev *pctldev,
308 const struct imx_pinctrl_soc_info *info = ipctl->info; 308 const struct imx_pinctrl_soc_info *info = ipctl->info;
309 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; 309 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id];
310 310
311 if (!(info->flags & ZERO_OFFSET_VALID) && !pin_reg->conf_reg) { 311 if (pin_reg->conf_reg == -1) {
312 dev_err(info->dev, "Pin(%s) does not support config function\n", 312 dev_err(info->dev, "Pin(%s) does not support config function\n",
313 info->pins[pin_id].name); 313 info->pins[pin_id].name);
314 return -EINVAL; 314 return -EINVAL;
@@ -331,7 +331,7 @@ static int imx_pinconf_set(struct pinctrl_dev *pctldev,
331 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; 331 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id];
332 int i; 332 int i;
333 333
334 if (!(info->flags & ZERO_OFFSET_VALID) && !pin_reg->conf_reg) { 334 if (pin_reg->conf_reg == -1) {
335 dev_err(info->dev, "Pin(%s) does not support config function\n", 335 dev_err(info->dev, "Pin(%s) does not support config function\n",
336 info->pins[pin_id].name); 336 info->pins[pin_id].name);
337 return -EINVAL; 337 return -EINVAL;
@@ -586,10 +586,11 @@ int imx_pinctrl_probe(struct platform_device *pdev,
586 if (!ipctl) 586 if (!ipctl)
587 return -ENOMEM; 587 return -ENOMEM;
588 588
589 info->pin_regs = devm_kzalloc(&pdev->dev, sizeof(*info->pin_regs) * 589 info->pin_regs = devm_kmalloc(&pdev->dev, sizeof(*info->pin_regs) *
590 info->npins, GFP_KERNEL); 590 info->npins, GFP_KERNEL);
591 if (!info->pin_regs) 591 if (!info->pin_regs)
592 return -ENOMEM; 592 return -ENOMEM;
593 memset(info->pin_regs, 0xff, sizeof(*info->pin_regs) * info->npins);
593 594
594 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 595 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
595 ipctl->base = devm_ioremap_resource(&pdev->dev, res); 596 ipctl->base = devm_ioremap_resource(&pdev->dev, res);
diff --git a/drivers/pinctrl/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h
index db408b057000..49e55d39f7c8 100644
--- a/drivers/pinctrl/pinctrl-imx.h
+++ b/drivers/pinctrl/freescale/pinctrl-imx.h
@@ -67,8 +67,8 @@ struct imx_pmx_func {
67 * @conf_reg: config register offset 67 * @conf_reg: config register offset
68 */ 68 */
69struct imx_pin_reg { 69struct imx_pin_reg {
70 u16 mux_reg; 70 s16 mux_reg;
71 u16 conf_reg; 71 s16 conf_reg;
72}; 72};
73 73
74struct imx_pinctrl_soc_info { 74struct imx_pinctrl_soc_info {
@@ -83,8 +83,7 @@ struct imx_pinctrl_soc_info {
83 unsigned int flags; 83 unsigned int flags;
84}; 84};
85 85
86#define ZERO_OFFSET_VALID 0x1 86#define SHARE_MUX_CONF_REG 0x1
87#define SHARE_MUX_CONF_REG 0x2
88 87
89#define NO_MUX 0x0 88#define NO_MUX 0x0
90#define NO_PAD 0x0 89#define NO_PAD 0x0
diff --git a/drivers/pinctrl/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
index 483420757c9f..5ac59fbb2440 100644
--- a/drivers/pinctrl/pinctrl-imx1-core.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
@@ -28,7 +28,7 @@
28#include <linux/pinctrl/pinmux.h> 28#include <linux/pinctrl/pinmux.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30 30
31#include "core.h" 31#include "../core.h"
32#include "pinctrl-imx1.h" 32#include "pinctrl-imx1.h"
33 33
34struct imx1_pinctrl { 34struct imx1_pinctrl {
@@ -298,8 +298,8 @@ static const struct pinctrl_ops imx1_pctrl_ops = {
298 298
299}; 299};
300 300
301static int imx1_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, 301static int imx1_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
302 unsigned group) 302 unsigned group)
303{ 303{
304 struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); 304 struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
305 const struct imx1_pinctrl_soc_info *info = ipctl->info; 305 const struct imx1_pinctrl_soc_info *info = ipctl->info;
@@ -385,7 +385,7 @@ static const struct pinmux_ops imx1_pmx_ops = {
385 .get_functions_count = imx1_pmx_get_funcs_count, 385 .get_functions_count = imx1_pmx_get_funcs_count,
386 .get_function_name = imx1_pmx_get_func_name, 386 .get_function_name = imx1_pmx_get_func_name,
387 .get_function_groups = imx1_pmx_get_groups, 387 .get_function_groups = imx1_pmx_get_groups,
388 .enable = imx1_pmx_enable, 388 .set_mux = imx1_pmx_set,
389}; 389};
390 390
391static int imx1_pinconf_get(struct pinctrl_dev *pctldev, 391static int imx1_pinconf_get(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/pinctrl-imx1.c b/drivers/pinctrl/freescale/pinctrl-imx1.c
index 533a6e519648..533a6e519648 100644
--- a/drivers/pinctrl/pinctrl-imx1.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx1.c
diff --git a/drivers/pinctrl/pinctrl-imx1.h b/drivers/pinctrl/freescale/pinctrl-imx1.h
index 692a54c15cda..692a54c15cda 100644
--- a/drivers/pinctrl/pinctrl-imx1.h
+++ b/drivers/pinctrl/freescale/pinctrl-imx1.h
diff --git a/drivers/pinctrl/freescale/pinctrl-imx21.c b/drivers/pinctrl/freescale/pinctrl-imx21.c
new file mode 100644
index 000000000000..1b3b2311b033
--- /dev/null
+++ b/drivers/pinctrl/freescale/pinctrl-imx21.c
@@ -0,0 +1,342 @@
1/*
2 * i.MX21 pinctrl driver based on imx pinmux core
3 *
4 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/module.h>
13#include <linux/of.h>
14#include <linux/platform_device.h>
15#include <linux/pinctrl/pinctrl.h>
16
17#include "pinctrl-imx1.h"
18
19#define PAD_ID(port, pin) ((port) * 32 + (pin))
20#define PA 0
21#define PB 1
22#define PC 2
23#define PD 3
24#define PE 4
25#define PF 5
26
27enum imx21_pads {
28 MX21_PAD_LSCLK = PAD_ID(PA, 5),
29 MX21_PAD_LD0 = PAD_ID(PA, 6),
30 MX21_PAD_LD1 = PAD_ID(PA, 7),
31 MX21_PAD_LD2 = PAD_ID(PA, 8),
32 MX21_PAD_LD3 = PAD_ID(PA, 9),
33 MX21_PAD_LD4 = PAD_ID(PA, 10),
34 MX21_PAD_LD5 = PAD_ID(PA, 11),
35 MX21_PAD_LD6 = PAD_ID(PA, 12),
36 MX21_PAD_LD7 = PAD_ID(PA, 13),
37 MX21_PAD_LD8 = PAD_ID(PA, 14),
38 MX21_PAD_LD9 = PAD_ID(PA, 15),
39 MX21_PAD_LD10 = PAD_ID(PA, 16),
40 MX21_PAD_LD11 = PAD_ID(PA, 17),
41 MX21_PAD_LD12 = PAD_ID(PA, 18),
42 MX21_PAD_LD13 = PAD_ID(PA, 19),
43 MX21_PAD_LD14 = PAD_ID(PA, 20),
44 MX21_PAD_LD15 = PAD_ID(PA, 21),
45 MX21_PAD_LD16 = PAD_ID(PA, 22),
46 MX21_PAD_LD17 = PAD_ID(PA, 23),
47 MX21_PAD_REV = PAD_ID(PA, 24),
48 MX21_PAD_CLS = PAD_ID(PA, 25),
49 MX21_PAD_PS = PAD_ID(PA, 26),
50 MX21_PAD_SPL_SPR = PAD_ID(PA, 27),
51 MX21_PAD_HSYNC = PAD_ID(PA, 28),
52 MX21_PAD_VSYNC = PAD_ID(PA, 29),
53 MX21_PAD_CONTRAST = PAD_ID(PA, 30),
54 MX21_PAD_OE_ACD = PAD_ID(PA, 31),
55 MX21_PAD_SD2_D0 = PAD_ID(PB, 4),
56 MX21_PAD_SD2_D1 = PAD_ID(PB, 5),
57 MX21_PAD_SD2_D2 = PAD_ID(PB, 6),
58 MX21_PAD_SD2_D3 = PAD_ID(PB, 7),
59 MX21_PAD_SD2_CMD = PAD_ID(PB, 8),
60 MX21_PAD_SD2_CLK = PAD_ID(PB, 9),
61 MX21_PAD_CSI_D0 = PAD_ID(PB, 10),
62 MX21_PAD_CSI_D1 = PAD_ID(PB, 11),
63 MX21_PAD_CSI_D2 = PAD_ID(PB, 12),
64 MX21_PAD_CSI_D3 = PAD_ID(PB, 13),
65 MX21_PAD_CSI_D4 = PAD_ID(PB, 14),
66 MX21_PAD_CSI_MCLK = PAD_ID(PB, 15),
67 MX21_PAD_CSI_PIXCLK = PAD_ID(PB, 16),
68 MX21_PAD_CSI_D5 = PAD_ID(PB, 17),
69 MX21_PAD_CSI_D6 = PAD_ID(PB, 18),
70 MX21_PAD_CSI_D7 = PAD_ID(PB, 19),
71 MX21_PAD_CSI_VSYNC = PAD_ID(PB, 20),
72 MX21_PAD_CSI_HSYNC = PAD_ID(PB, 21),
73 MX21_PAD_USB_BYP = PAD_ID(PB, 22),
74 MX21_PAD_USB_PWR = PAD_ID(PB, 23),
75 MX21_PAD_USB_OC = PAD_ID(PB, 24),
76 MX21_PAD_USBH_ON = PAD_ID(PB, 25),
77 MX21_PAD_USBH1_FS = PAD_ID(PB, 26),
78 MX21_PAD_USBH1_OE = PAD_ID(PB, 27),
79 MX21_PAD_USBH1_TXDM = PAD_ID(PB, 28),
80 MX21_PAD_USBH1_TXDP = PAD_ID(PB, 29),
81 MX21_PAD_USBH1_RXDM = PAD_ID(PB, 30),
82 MX21_PAD_USBH1_RXDP = PAD_ID(PB, 31),
83 MX21_PAD_USBG_SDA = PAD_ID(PC, 5),
84 MX21_PAD_USBG_SCL = PAD_ID(PC, 6),
85 MX21_PAD_USBG_ON = PAD_ID(PC, 7),
86 MX21_PAD_USBG_FS = PAD_ID(PC, 8),
87 MX21_PAD_USBG_OE = PAD_ID(PC, 9),
88 MX21_PAD_USBG_TXDM = PAD_ID(PC, 10),
89 MX21_PAD_USBG_TXDP = PAD_ID(PC, 11),
90 MX21_PAD_USBG_RXDM = PAD_ID(PC, 12),
91 MX21_PAD_USBG_RXDP = PAD_ID(PC, 13),
92 MX21_PAD_TOUT = PAD_ID(PC, 14),
93 MX21_PAD_TIN = PAD_ID(PC, 15),
94 MX21_PAD_SAP_FS = PAD_ID(PC, 16),
95 MX21_PAD_SAP_RXD = PAD_ID(PC, 17),
96 MX21_PAD_SAP_TXD = PAD_ID(PC, 18),
97 MX21_PAD_SAP_CLK = PAD_ID(PC, 19),
98 MX21_PAD_SSI1_FS = PAD_ID(PC, 20),
99 MX21_PAD_SSI1_RXD = PAD_ID(PC, 21),
100 MX21_PAD_SSI1_TXD = PAD_ID(PC, 22),
101 MX21_PAD_SSI1_CLK = PAD_ID(PC, 23),
102 MX21_PAD_SSI2_FS = PAD_ID(PC, 24),
103 MX21_PAD_SSI2_RXD = PAD_ID(PC, 25),
104 MX21_PAD_SSI2_TXD = PAD_ID(PC, 26),
105 MX21_PAD_SSI2_CLK = PAD_ID(PC, 27),
106 MX21_PAD_SSI3_FS = PAD_ID(PC, 28),
107 MX21_PAD_SSI3_RXD = PAD_ID(PC, 29),
108 MX21_PAD_SSI3_TXD = PAD_ID(PC, 30),
109 MX21_PAD_SSI3_CLK = PAD_ID(PC, 31),
110 MX21_PAD_I2C_DATA = PAD_ID(PD, 17),
111 MX21_PAD_I2C_CLK = PAD_ID(PD, 18),
112 MX21_PAD_CSPI2_SS2 = PAD_ID(PD, 19),
113 MX21_PAD_CSPI2_SS1 = PAD_ID(PD, 20),
114 MX21_PAD_CSPI2_SS0 = PAD_ID(PD, 21),
115 MX21_PAD_CSPI2_SCLK = PAD_ID(PD, 22),
116 MX21_PAD_CSPI2_MISO = PAD_ID(PD, 23),
117 MX21_PAD_CSPI2_MOSI = PAD_ID(PD, 24),
118 MX21_PAD_CSPI1_RDY = PAD_ID(PD, 25),
119 MX21_PAD_CSPI1_SS2 = PAD_ID(PD, 26),
120 MX21_PAD_CSPI1_SS1 = PAD_ID(PD, 27),
121 MX21_PAD_CSPI1_SS0 = PAD_ID(PD, 28),
122 MX21_PAD_CSPI1_SCLK = PAD_ID(PD, 29),
123 MX21_PAD_CSPI1_MISO = PAD_ID(PD, 30),
124 MX21_PAD_CSPI1_MOSI = PAD_ID(PD, 31),
125 MX21_PAD_TEST_WB2 = PAD_ID(PE, 0),
126 MX21_PAD_TEST_WB1 = PAD_ID(PE, 1),
127 MX21_PAD_TEST_WB0 = PAD_ID(PE, 2),
128 MX21_PAD_UART2_CTS = PAD_ID(PE, 3),
129 MX21_PAD_UART2_RTS = PAD_ID(PE, 4),
130 MX21_PAD_PWMO = PAD_ID(PE, 5),
131 MX21_PAD_UART2_TXD = PAD_ID(PE, 6),
132 MX21_PAD_UART2_RXD = PAD_ID(PE, 7),
133 MX21_PAD_UART3_TXD = PAD_ID(PE, 8),
134 MX21_PAD_UART3_RXD = PAD_ID(PE, 9),
135 MX21_PAD_UART3_CTS = PAD_ID(PE, 10),
136 MX21_PAD_UART3_RTS = PAD_ID(PE, 11),
137 MX21_PAD_UART1_TXD = PAD_ID(PE, 12),
138 MX21_PAD_UART1_RXD = PAD_ID(PE, 13),
139 MX21_PAD_UART1_CTS = PAD_ID(PE, 14),
140 MX21_PAD_UART1_RTS = PAD_ID(PE, 15),
141 MX21_PAD_RTCK = PAD_ID(PE, 16),
142 MX21_PAD_RESET_OUT = PAD_ID(PE, 17),
143 MX21_PAD_SD1_D0 = PAD_ID(PE, 18),
144 MX21_PAD_SD1_D1 = PAD_ID(PE, 19),
145 MX21_PAD_SD1_D2 = PAD_ID(PE, 20),
146 MX21_PAD_SD1_D3 = PAD_ID(PE, 21),
147 MX21_PAD_SD1_CMD = PAD_ID(PE, 22),
148 MX21_PAD_SD1_CLK = PAD_ID(PE, 23),
149 MX21_PAD_NFRB = PAD_ID(PF, 0),
150 MX21_PAD_NFCE = PAD_ID(PF, 1),
151 MX21_PAD_NFWP = PAD_ID(PF, 2),
152 MX21_PAD_NFCLE = PAD_ID(PF, 3),
153 MX21_PAD_NFALE = PAD_ID(PF, 4),
154 MX21_PAD_NFRE = PAD_ID(PF, 5),
155 MX21_PAD_NFWE = PAD_ID(PF, 6),
156 MX21_PAD_NFIO0 = PAD_ID(PF, 7),
157 MX21_PAD_NFIO1 = PAD_ID(PF, 8),
158 MX21_PAD_NFIO2 = PAD_ID(PF, 9),
159 MX21_PAD_NFIO3 = PAD_ID(PF, 10),
160 MX21_PAD_NFIO4 = PAD_ID(PF, 11),
161 MX21_PAD_NFIO5 = PAD_ID(PF, 12),
162 MX21_PAD_NFIO6 = PAD_ID(PF, 13),
163 MX21_PAD_NFIO7 = PAD_ID(PF, 14),
164 MX21_PAD_CLKO = PAD_ID(PF, 15),
165 MX21_PAD_RESERVED = PAD_ID(PF, 16),
166 MX21_PAD_CS4 = PAD_ID(PF, 21),
167 MX21_PAD_CS5 = PAD_ID(PF, 22),
168};
169
170/* Pad names for the pinmux subsystem */
171static const struct pinctrl_pin_desc imx21_pinctrl_pads[] = {
172 IMX_PINCTRL_PIN(MX21_PAD_LSCLK),
173 IMX_PINCTRL_PIN(MX21_PAD_LD0),
174 IMX_PINCTRL_PIN(MX21_PAD_LD1),
175 IMX_PINCTRL_PIN(MX21_PAD_LD2),
176 IMX_PINCTRL_PIN(MX21_PAD_LD3),
177 IMX_PINCTRL_PIN(MX21_PAD_LD4),
178 IMX_PINCTRL_PIN(MX21_PAD_LD5),
179 IMX_PINCTRL_PIN(MX21_PAD_LD6),
180 IMX_PINCTRL_PIN(MX21_PAD_LD7),
181 IMX_PINCTRL_PIN(MX21_PAD_LD8),
182 IMX_PINCTRL_PIN(MX21_PAD_LD9),
183 IMX_PINCTRL_PIN(MX21_PAD_LD10),
184 IMX_PINCTRL_PIN(MX21_PAD_LD11),
185 IMX_PINCTRL_PIN(MX21_PAD_LD12),
186 IMX_PINCTRL_PIN(MX21_PAD_LD13),
187 IMX_PINCTRL_PIN(MX21_PAD_LD14),
188 IMX_PINCTRL_PIN(MX21_PAD_LD15),
189 IMX_PINCTRL_PIN(MX21_PAD_LD16),
190 IMX_PINCTRL_PIN(MX21_PAD_LD17),
191 IMX_PINCTRL_PIN(MX21_PAD_REV),
192 IMX_PINCTRL_PIN(MX21_PAD_CLS),
193 IMX_PINCTRL_PIN(MX21_PAD_PS),
194 IMX_PINCTRL_PIN(MX21_PAD_SPL_SPR),
195 IMX_PINCTRL_PIN(MX21_PAD_HSYNC),
196 IMX_PINCTRL_PIN(MX21_PAD_VSYNC),
197 IMX_PINCTRL_PIN(MX21_PAD_CONTRAST),
198 IMX_PINCTRL_PIN(MX21_PAD_OE_ACD),
199 IMX_PINCTRL_PIN(MX21_PAD_SD2_D0),
200 IMX_PINCTRL_PIN(MX21_PAD_SD2_D1),
201 IMX_PINCTRL_PIN(MX21_PAD_SD2_D2),
202 IMX_PINCTRL_PIN(MX21_PAD_SD2_D3),
203 IMX_PINCTRL_PIN(MX21_PAD_SD2_CMD),
204 IMX_PINCTRL_PIN(MX21_PAD_SD2_CLK),
205 IMX_PINCTRL_PIN(MX21_PAD_CSI_D0),
206 IMX_PINCTRL_PIN(MX21_PAD_CSI_D1),
207 IMX_PINCTRL_PIN(MX21_PAD_CSI_D2),
208 IMX_PINCTRL_PIN(MX21_PAD_CSI_D3),
209 IMX_PINCTRL_PIN(MX21_PAD_CSI_D4),
210 IMX_PINCTRL_PIN(MX21_PAD_CSI_MCLK),
211 IMX_PINCTRL_PIN(MX21_PAD_CSI_PIXCLK),
212 IMX_PINCTRL_PIN(MX21_PAD_CSI_D5),
213 IMX_PINCTRL_PIN(MX21_PAD_CSI_D6),
214 IMX_PINCTRL_PIN(MX21_PAD_CSI_D7),
215 IMX_PINCTRL_PIN(MX21_PAD_CSI_VSYNC),
216 IMX_PINCTRL_PIN(MX21_PAD_CSI_HSYNC),
217 IMX_PINCTRL_PIN(MX21_PAD_USB_BYP),
218 IMX_PINCTRL_PIN(MX21_PAD_USB_PWR),
219 IMX_PINCTRL_PIN(MX21_PAD_USB_OC),
220 IMX_PINCTRL_PIN(MX21_PAD_USBH_ON),
221 IMX_PINCTRL_PIN(MX21_PAD_USBH1_FS),
222 IMX_PINCTRL_PIN(MX21_PAD_USBH1_OE),
223 IMX_PINCTRL_PIN(MX21_PAD_USBH1_TXDM),
224 IMX_PINCTRL_PIN(MX21_PAD_USBH1_TXDP),
225 IMX_PINCTRL_PIN(MX21_PAD_USBH1_RXDM),
226 IMX_PINCTRL_PIN(MX21_PAD_USBH1_RXDP),
227 IMX_PINCTRL_PIN(MX21_PAD_USBG_SDA),
228 IMX_PINCTRL_PIN(MX21_PAD_USBG_SCL),
229 IMX_PINCTRL_PIN(MX21_PAD_USBG_ON),
230 IMX_PINCTRL_PIN(MX21_PAD_USBG_FS),
231 IMX_PINCTRL_PIN(MX21_PAD_USBG_OE),
232 IMX_PINCTRL_PIN(MX21_PAD_USBG_TXDM),
233 IMX_PINCTRL_PIN(MX21_PAD_USBG_TXDP),
234 IMX_PINCTRL_PIN(MX21_PAD_USBG_RXDM),
235 IMX_PINCTRL_PIN(MX21_PAD_USBG_RXDP),
236 IMX_PINCTRL_PIN(MX21_PAD_TOUT),
237 IMX_PINCTRL_PIN(MX21_PAD_TIN),
238 IMX_PINCTRL_PIN(MX21_PAD_SAP_FS),
239 IMX_PINCTRL_PIN(MX21_PAD_SAP_RXD),
240 IMX_PINCTRL_PIN(MX21_PAD_SAP_TXD),
241 IMX_PINCTRL_PIN(MX21_PAD_SAP_CLK),
242 IMX_PINCTRL_PIN(MX21_PAD_SSI1_FS),
243 IMX_PINCTRL_PIN(MX21_PAD_SSI1_RXD),
244 IMX_PINCTRL_PIN(MX21_PAD_SSI1_TXD),
245 IMX_PINCTRL_PIN(MX21_PAD_SSI1_CLK),
246 IMX_PINCTRL_PIN(MX21_PAD_SSI2_FS),
247 IMX_PINCTRL_PIN(MX21_PAD_SSI2_RXD),
248 IMX_PINCTRL_PIN(MX21_PAD_SSI2_TXD),
249 IMX_PINCTRL_PIN(MX21_PAD_SSI2_CLK),
250 IMX_PINCTRL_PIN(MX21_PAD_SSI3_FS),
251 IMX_PINCTRL_PIN(MX21_PAD_SSI3_RXD),
252 IMX_PINCTRL_PIN(MX21_PAD_SSI3_TXD),
253 IMX_PINCTRL_PIN(MX21_PAD_SSI3_CLK),
254 IMX_PINCTRL_PIN(MX21_PAD_I2C_DATA),
255 IMX_PINCTRL_PIN(MX21_PAD_I2C_CLK),
256 IMX_PINCTRL_PIN(MX21_PAD_CSPI2_SS2),
257 IMX_PINCTRL_PIN(MX21_PAD_CSPI2_SS1),
258 IMX_PINCTRL_PIN(MX21_PAD_CSPI2_SS0),
259 IMX_PINCTRL_PIN(MX21_PAD_CSPI2_SCLK),
260 IMX_PINCTRL_PIN(MX21_PAD_CSPI2_MISO),
261 IMX_PINCTRL_PIN(MX21_PAD_CSPI2_MOSI),
262 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_RDY),
263 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_SS2),
264 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_SS1),
265 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_SS0),
266 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_SCLK),
267 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_MISO),
268 IMX_PINCTRL_PIN(MX21_PAD_CSPI1_MOSI),
269 IMX_PINCTRL_PIN(MX21_PAD_TEST_WB2),
270 IMX_PINCTRL_PIN(MX21_PAD_TEST_WB1),
271 IMX_PINCTRL_PIN(MX21_PAD_TEST_WB0),
272 IMX_PINCTRL_PIN(MX21_PAD_UART2_CTS),
273 IMX_PINCTRL_PIN(MX21_PAD_UART2_RTS),
274 IMX_PINCTRL_PIN(MX21_PAD_PWMO),
275 IMX_PINCTRL_PIN(MX21_PAD_UART2_TXD),
276 IMX_PINCTRL_PIN(MX21_PAD_UART2_RXD),
277 IMX_PINCTRL_PIN(MX21_PAD_UART3_TXD),
278 IMX_PINCTRL_PIN(MX21_PAD_UART3_RXD),
279 IMX_PINCTRL_PIN(MX21_PAD_UART3_CTS),
280 IMX_PINCTRL_PIN(MX21_PAD_UART3_RTS),
281 IMX_PINCTRL_PIN(MX21_PAD_UART1_TXD),
282 IMX_PINCTRL_PIN(MX21_PAD_UART1_RXD),
283 IMX_PINCTRL_PIN(MX21_PAD_UART1_CTS),
284 IMX_PINCTRL_PIN(MX21_PAD_UART1_RTS),
285 IMX_PINCTRL_PIN(MX21_PAD_RTCK),
286 IMX_PINCTRL_PIN(MX21_PAD_RESET_OUT),
287 IMX_PINCTRL_PIN(MX21_PAD_SD1_D0),
288 IMX_PINCTRL_PIN(MX21_PAD_SD1_D1),
289 IMX_PINCTRL_PIN(MX21_PAD_SD1_D2),
290 IMX_PINCTRL_PIN(MX21_PAD_SD1_D3),
291 IMX_PINCTRL_PIN(MX21_PAD_SD1_CMD),
292 IMX_PINCTRL_PIN(MX21_PAD_SD1_CLK),
293 IMX_PINCTRL_PIN(MX21_PAD_NFRB),
294 IMX_PINCTRL_PIN(MX21_PAD_NFCE),
295 IMX_PINCTRL_PIN(MX21_PAD_NFWP),
296 IMX_PINCTRL_PIN(MX21_PAD_NFCLE),
297 IMX_PINCTRL_PIN(MX21_PAD_NFALE),
298 IMX_PINCTRL_PIN(MX21_PAD_NFRE),
299 IMX_PINCTRL_PIN(MX21_PAD_NFWE),
300 IMX_PINCTRL_PIN(MX21_PAD_NFIO0),
301 IMX_PINCTRL_PIN(MX21_PAD_NFIO1),
302 IMX_PINCTRL_PIN(MX21_PAD_NFIO2),
303 IMX_PINCTRL_PIN(MX21_PAD_NFIO3),
304 IMX_PINCTRL_PIN(MX21_PAD_NFIO4),
305 IMX_PINCTRL_PIN(MX21_PAD_NFIO5),
306 IMX_PINCTRL_PIN(MX21_PAD_NFIO6),
307 IMX_PINCTRL_PIN(MX21_PAD_NFIO7),
308 IMX_PINCTRL_PIN(MX21_PAD_CLKO),
309 IMX_PINCTRL_PIN(MX21_PAD_RESERVED),
310 IMX_PINCTRL_PIN(MX21_PAD_CS4),
311 IMX_PINCTRL_PIN(MX21_PAD_CS5),
312};
313
314static struct imx1_pinctrl_soc_info imx21_pinctrl_info = {
315 .pins = imx21_pinctrl_pads,
316 .npins = ARRAY_SIZE(imx21_pinctrl_pads),
317};
318
319static int __init imx21_pinctrl_probe(struct platform_device *pdev)
320{
321 return imx1_pinctrl_core_probe(pdev, &imx21_pinctrl_info);
322}
323
324static const struct of_device_id imx21_pinctrl_of_match[] = {
325 { .compatible = "fsl,imx21-iomuxc", },
326 { }
327};
328MODULE_DEVICE_TABLE(of, imx21_pinctrl_of_match);
329
330static struct platform_driver imx21_pinctrl_driver = {
331 .driver = {
332 .name = "imx21-pinctrl",
333 .owner = THIS_MODULE,
334 .of_match_table = imx21_pinctrl_of_match,
335 },
336 .remove = imx1_pinctrl_core_remove,
337};
338module_platform_driver_probe(imx21_pinctrl_driver, imx21_pinctrl_probe);
339
340MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
341MODULE_DESCRIPTION("Freescale i.MX21 pinctrl driver");
342MODULE_LICENSE("GPL");
diff --git a/drivers/pinctrl/pinctrl-imx23.c b/drivers/pinctrl/freescale/pinctrl-imx23.c
index e76d75c9d1ba..df79096becb0 100644
--- a/drivers/pinctrl/pinctrl-imx23.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx23.c
@@ -272,7 +272,7 @@ static int imx23_pinctrl_probe(struct platform_device *pdev)
272 return mxs_pinctrl_probe(pdev, &imx23_pinctrl_data); 272 return mxs_pinctrl_probe(pdev, &imx23_pinctrl_data);
273} 273}
274 274
275static struct of_device_id imx23_pinctrl_of_match[] = { 275static const struct of_device_id imx23_pinctrl_of_match[] = {
276 { .compatible = "fsl,imx23-pinctrl", }, 276 { .compatible = "fsl,imx23-pinctrl", },
277 { /* sentinel */ } 277 { /* sentinel */ }
278}; 278};
diff --git a/drivers/pinctrl/pinctrl-imx25.c b/drivers/pinctrl/freescale/pinctrl-imx25.c
index 1aae1b61c4dc..550e6d77ac2b 100644
--- a/drivers/pinctrl/pinctrl-imx25.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx25.c
@@ -315,7 +315,7 @@ static struct imx_pinctrl_soc_info imx25_pinctrl_info = {
315 .npins = ARRAY_SIZE(imx25_pinctrl_pads), 315 .npins = ARRAY_SIZE(imx25_pinctrl_pads),
316}; 316};
317 317
318static struct of_device_id imx25_pinctrl_of_match[] = { 318static const struct of_device_id imx25_pinctrl_of_match[] = {
319 { .compatible = "fsl,imx25-iomuxc", }, 319 { .compatible = "fsl,imx25-iomuxc", },
320 { /* sentinel */ } 320 { /* sentinel */ }
321}; 321};
diff --git a/drivers/pinctrl/pinctrl-imx27.c b/drivers/pinctrl/freescale/pinctrl-imx27.c
index f8dfefb69968..945eccadea74 100644
--- a/drivers/pinctrl/pinctrl-imx27.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx27.c
@@ -389,7 +389,7 @@ static struct imx1_pinctrl_soc_info imx27_pinctrl_info = {
389 .npins = ARRAY_SIZE(imx27_pinctrl_pads), 389 .npins = ARRAY_SIZE(imx27_pinctrl_pads),
390}; 390};
391 391
392static struct of_device_id imx27_pinctrl_of_match[] = { 392static const struct of_device_id imx27_pinctrl_of_match[] = {
393 { .compatible = "fsl,imx27-iomuxc", }, 393 { .compatible = "fsl,imx27-iomuxc", },
394 { /* sentinel */ } 394 { /* sentinel */ }
395}; 395};
diff --git a/drivers/pinctrl/pinctrl-imx28.c b/drivers/pinctrl/freescale/pinctrl-imx28.c
index 79c9c8d296af..3bd45da21229 100644
--- a/drivers/pinctrl/pinctrl-imx28.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx28.c
@@ -388,7 +388,7 @@ static int imx28_pinctrl_probe(struct platform_device *pdev)
388 return mxs_pinctrl_probe(pdev, &imx28_pinctrl_data); 388 return mxs_pinctrl_probe(pdev, &imx28_pinctrl_data);
389} 389}
390 390
391static struct of_device_id imx28_pinctrl_of_match[] = { 391static const struct of_device_id imx28_pinctrl_of_match[] = {
392 { .compatible = "fsl,imx28-pinctrl", }, 392 { .compatible = "fsl,imx28-pinctrl", },
393 { /* sentinel */ } 393 { /* sentinel */ }
394}; 394};
diff --git a/drivers/pinctrl/pinctrl-imx35.c b/drivers/pinctrl/freescale/pinctrl-imx35.c
index 278a04ae8940..6bfbcd0112c1 100644
--- a/drivers/pinctrl/pinctrl-imx35.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx35.c
@@ -1005,7 +1005,7 @@ static struct imx_pinctrl_soc_info imx35_pinctrl_info = {
1005 .npins = ARRAY_SIZE(imx35_pinctrl_pads), 1005 .npins = ARRAY_SIZE(imx35_pinctrl_pads),
1006}; 1006};
1007 1007
1008static struct of_device_id imx35_pinctrl_of_match[] = { 1008static const struct of_device_id imx35_pinctrl_of_match[] = {
1009 { .compatible = "fsl,imx35-iomuxc", }, 1009 { .compatible = "fsl,imx35-iomuxc", },
1010 { /* sentinel */ } 1010 { /* sentinel */ }
1011}; 1011};
diff --git a/drivers/pinctrl/pinctrl-imx50.c b/drivers/pinctrl/freescale/pinctrl-imx50.c
index b06feed1b038..e8bd604ab147 100644
--- a/drivers/pinctrl/pinctrl-imx50.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx50.c
@@ -391,7 +391,7 @@ static struct imx_pinctrl_soc_info imx50_pinctrl_info = {
391 .npins = ARRAY_SIZE(imx50_pinctrl_pads), 391 .npins = ARRAY_SIZE(imx50_pinctrl_pads),
392}; 392};
393 393
394static struct of_device_id imx50_pinctrl_of_match[] = { 394static const struct of_device_id imx50_pinctrl_of_match[] = {
395 { .compatible = "fsl,imx50-iomuxc", }, 395 { .compatible = "fsl,imx50-iomuxc", },
396 { /* sentinel */ } 396 { /* sentinel */ }
397}; 397};
diff --git a/drivers/pinctrl/pinctrl-imx51.c b/drivers/pinctrl/freescale/pinctrl-imx51.c
index 19ab182bef61..b818051db7c9 100644
--- a/drivers/pinctrl/pinctrl-imx51.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx51.c
@@ -768,7 +768,7 @@ static struct imx_pinctrl_soc_info imx51_pinctrl_info = {
768 .npins = ARRAY_SIZE(imx51_pinctrl_pads), 768 .npins = ARRAY_SIZE(imx51_pinctrl_pads),
769}; 769};
770 770
771static struct of_device_id imx51_pinctrl_of_match[] = { 771static const struct of_device_id imx51_pinctrl_of_match[] = {
772 { .compatible = "fsl,imx51-iomuxc", }, 772 { .compatible = "fsl,imx51-iomuxc", },
773 { /* sentinel */ } 773 { /* sentinel */ }
774}; 774};
diff --git a/drivers/pinctrl/pinctrl-imx53.c b/drivers/pinctrl/freescale/pinctrl-imx53.c
index f8d45c4cfde7..1884d53cf750 100644
--- a/drivers/pinctrl/pinctrl-imx53.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx53.c
@@ -454,7 +454,7 @@ static struct imx_pinctrl_soc_info imx53_pinctrl_info = {
454 .npins = ARRAY_SIZE(imx53_pinctrl_pads), 454 .npins = ARRAY_SIZE(imx53_pinctrl_pads),
455}; 455};
456 456
457static struct of_device_id imx53_pinctrl_of_match[] = { 457static const struct of_device_id imx53_pinctrl_of_match[] = {
458 { .compatible = "fsl,imx53-iomuxc", }, 458 { .compatible = "fsl,imx53-iomuxc", },
459 { /* sentinel */ } 459 { /* sentinel */ }
460}; 460};
diff --git a/drivers/pinctrl/pinctrl-imx6dl.c b/drivers/pinctrl/freescale/pinctrl-imx6dl.c
index db2a1489bd99..656c4b08cc2e 100644
--- a/drivers/pinctrl/pinctrl-imx6dl.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6dl.c
@@ -460,7 +460,7 @@ static struct imx_pinctrl_soc_info imx6dl_pinctrl_info = {
460 .npins = ARRAY_SIZE(imx6dl_pinctrl_pads), 460 .npins = ARRAY_SIZE(imx6dl_pinctrl_pads),
461}; 461};
462 462
463static struct of_device_id imx6dl_pinctrl_of_match[] = { 463static const struct of_device_id imx6dl_pinctrl_of_match[] = {
464 { .compatible = "fsl,imx6dl-iomuxc", }, 464 { .compatible = "fsl,imx6dl-iomuxc", },
465 { /* sentinel */ } 465 { /* sentinel */ }
466}; 466};
diff --git a/drivers/pinctrl/pinctrl-imx6q.c b/drivers/pinctrl/freescale/pinctrl-imx6q.c
index 8eb5ac1bd5f6..59bb5b4ec0f6 100644
--- a/drivers/pinctrl/pinctrl-imx6q.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6q.c
@@ -466,7 +466,7 @@ static struct imx_pinctrl_soc_info imx6q_pinctrl_info = {
466 .npins = ARRAY_SIZE(imx6q_pinctrl_pads), 466 .npins = ARRAY_SIZE(imx6q_pinctrl_pads),
467}; 467};
468 468
469static struct of_device_id imx6q_pinctrl_of_match[] = { 469static const struct of_device_id imx6q_pinctrl_of_match[] = {
470 { .compatible = "fsl,imx6q-iomuxc", }, 470 { .compatible = "fsl,imx6q-iomuxc", },
471 { /* sentinel */ } 471 { /* sentinel */ }
472}; 472};
diff --git a/drivers/pinctrl/pinctrl-imx6sl.c b/drivers/pinctrl/freescale/pinctrl-imx6sl.c
index f21b7389df3c..e0924bd7b98c 100644
--- a/drivers/pinctrl/pinctrl-imx6sl.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6sl.c
@@ -366,10 +366,11 @@ static struct imx_pinctrl_soc_info imx6sl_pinctrl_info = {
366 .npins = ARRAY_SIZE(imx6sl_pinctrl_pads), 366 .npins = ARRAY_SIZE(imx6sl_pinctrl_pads),
367}; 367};
368 368
369static struct of_device_id imx6sl_pinctrl_of_match[] = { 369static const struct of_device_id imx6sl_pinctrl_of_match[] = {
370 { .compatible = "fsl,imx6sl-iomuxc", }, 370 { .compatible = "fsl,imx6sl-iomuxc", },
371 { /* sentinel */ } 371 { /* sentinel */ }
372}; 372};
373MODULE_DEVICE_TABLE(of, imx6sl_pinctrl_of_match);
373 374
374static int imx6sl_pinctrl_probe(struct platform_device *pdev) 375static int imx6sl_pinctrl_probe(struct platform_device *pdev)
375{ 376{
diff --git a/drivers/pinctrl/pinctrl-imx6sx.c b/drivers/pinctrl/freescale/pinctrl-imx6sx.c
index 09758a56b9df..840344c8580d 100644
--- a/drivers/pinctrl/pinctrl-imx6sx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6sx.c
@@ -370,7 +370,7 @@ static struct imx_pinctrl_soc_info imx6sx_pinctrl_info = {
370 .npins = ARRAY_SIZE(imx6sx_pinctrl_pads), 370 .npins = ARRAY_SIZE(imx6sx_pinctrl_pads),
371}; 371};
372 372
373static struct of_device_id imx6sx_pinctrl_of_match[] = { 373static const struct of_device_id imx6sx_pinctrl_of_match[] = {
374 { .compatible = "fsl,imx6sx-iomuxc", }, 374 { .compatible = "fsl,imx6sx-iomuxc", },
375 { /* sentinel */ } 375 { /* sentinel */ }
376}; 376};
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 40c76f26998c..f98c6bb0f769 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -21,7 +21,7 @@
21#include <linux/pinctrl/pinmux.h> 21#include <linux/pinctrl/pinmux.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include "core.h" 24#include "../core.h"
25#include "pinctrl-mxs.h" 25#include "pinctrl-mxs.h"
26 26
27#define SUFFIX_LEN 4 27#define SUFFIX_LEN 4
@@ -195,8 +195,8 @@ static int mxs_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
195 return 0; 195 return 0;
196} 196}
197 197
198static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector, 198static int mxs_pinctrl_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
199 unsigned group) 199 unsigned group)
200{ 200{
201 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev); 201 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
202 struct mxs_group *g = &d->soc->groups[group]; 202 struct mxs_group *g = &d->soc->groups[group];
@@ -223,7 +223,7 @@ static const struct pinmux_ops mxs_pinmux_ops = {
223 .get_functions_count = mxs_pinctrl_get_funcs_count, 223 .get_functions_count = mxs_pinctrl_get_funcs_count,
224 .get_function_name = mxs_pinctrl_get_func_name, 224 .get_function_name = mxs_pinctrl_get_func_name,
225 .get_function_groups = mxs_pinctrl_get_func_groups, 225 .get_function_groups = mxs_pinctrl_get_func_groups,
226 .enable = mxs_pinctrl_enable, 226 .set_mux = mxs_pinctrl_set_mux,
227}; 227};
228 228
229static int mxs_pinconf_get(struct pinctrl_dev *pctldev, 229static int mxs_pinconf_get(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/pinctrl-mxs.h b/drivers/pinctrl/freescale/pinctrl-mxs.h
index fdd88d0bae22..fdd88d0bae22 100644
--- a/drivers/pinctrl/pinctrl-mxs.h
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.h
diff --git a/drivers/pinctrl/pinctrl-vf610.c b/drivers/pinctrl/freescale/pinctrl-vf610.c
index bddd913d28ba..b788e1578954 100644
--- a/drivers/pinctrl/pinctrl-vf610.c
+++ b/drivers/pinctrl/freescale/pinctrl-vf610.c
@@ -299,7 +299,7 @@ static const struct pinctrl_pin_desc vf610_pinctrl_pads[] = {
299static struct imx_pinctrl_soc_info vf610_pinctrl_info = { 299static struct imx_pinctrl_soc_info vf610_pinctrl_info = {
300 .pins = vf610_pinctrl_pads, 300 .pins = vf610_pinctrl_pads,
301 .npins = ARRAY_SIZE(vf610_pinctrl_pads), 301 .npins = ARRAY_SIZE(vf610_pinctrl_pads),
302 .flags = ZERO_OFFSET_VALID | SHARE_MUX_CONF_REG, 302 .flags = SHARE_MUX_CONF_REG,
303}; 303};
304 304
305static struct of_device_id vf610_pinctrl_of_match[] = { 305static struct of_device_id vf610_pinctrl_of_match[] = {
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 9908374f8f92..f3b426cdaf8f 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -259,8 +259,8 @@ static int mvebu_pinmux_get_groups(struct pinctrl_dev *pctldev, unsigned fid,
259 return 0; 259 return 0;
260} 260}
261 261
262static int mvebu_pinmux_enable(struct pinctrl_dev *pctldev, unsigned fid, 262static int mvebu_pinmux_set(struct pinctrl_dev *pctldev, unsigned fid,
263 unsigned gid) 263 unsigned gid)
264{ 264{
265 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); 265 struct mvebu_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
266 struct mvebu_pinctrl_function *func = &pctl->functions[fid]; 266 struct mvebu_pinctrl_function *func = &pctl->functions[fid];
@@ -344,7 +344,7 @@ static const struct pinmux_ops mvebu_pinmux_ops = {
344 .get_function_groups = mvebu_pinmux_get_groups, 344 .get_function_groups = mvebu_pinmux_get_groups,
345 .gpio_request_enable = mvebu_pinmux_gpio_request_enable, 345 .gpio_request_enable = mvebu_pinmux_gpio_request_enable,
346 .gpio_set_direction = mvebu_pinmux_gpio_set_direction, 346 .gpio_set_direction = mvebu_pinmux_gpio_set_direction,
347 .enable = mvebu_pinmux_enable, 347 .set_mux = mvebu_pinmux_set,
348}; 348};
349 349
350static int mvebu_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) 350static int mvebu_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c
index 8c6fd8d4dd3c..47f493149863 100644
--- a/drivers/pinctrl/nomadik/pinctrl-abx500.c
+++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c
@@ -34,6 +34,7 @@
34#include "pinctrl-abx500.h" 34#include "pinctrl-abx500.h"
35#include "../core.h" 35#include "../core.h"
36#include "../pinconf.h" 36#include "../pinconf.h"
37#include "../pinctrl-utils.h"
37 38
38/* 39/*
39 * The AB9540 and AB8540 GPIO support are extended versions 40 * The AB9540 and AB8540 GPIO support are extended versions
@@ -708,8 +709,8 @@ static int abx500_pmx_get_func_groups(struct pinctrl_dev *pctldev,
708 return 0; 709 return 0;
709} 710}
710 711
711static int abx500_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, 712static int abx500_pmx_set(struct pinctrl_dev *pctldev, unsigned function,
712 unsigned group) 713 unsigned group)
713{ 714{
714 struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev); 715 struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
715 struct gpio_chip *chip = &pct->chip; 716 struct gpio_chip *chip = &pct->chip;
@@ -783,7 +784,7 @@ static const struct pinmux_ops abx500_pinmux_ops = {
783 .get_functions_count = abx500_pmx_get_funcs_cnt, 784 .get_functions_count = abx500_pmx_get_funcs_cnt,
784 .get_function_name = abx500_pmx_get_func_name, 785 .get_function_name = abx500_pmx_get_func_name,
785 .get_function_groups = abx500_pmx_get_func_groups, 786 .get_function_groups = abx500_pmx_get_func_groups,
786 .enable = abx500_pmx_enable, 787 .set_mux = abx500_pmx_set,
787 .gpio_request_enable = abx500_gpio_request_enable, 788 .gpio_request_enable = abx500_gpio_request_enable,
788 .gpio_disable_free = abx500_gpio_disable_free, 789 .gpio_disable_free = abx500_gpio_disable_free,
789}; 790};
@@ -826,41 +827,6 @@ static void abx500_pin_dbg_show(struct pinctrl_dev *pctldev,
826 chip->base + offset - 1); 827 chip->base + offset - 1);
827} 828}
828 829
829static void abx500_dt_free_map(struct pinctrl_dev *pctldev,
830 struct pinctrl_map *map, unsigned num_maps)
831{
832 int i;
833
834 for (i = 0; i < num_maps; i++)
835 if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN)
836 kfree(map[i].data.configs.configs);
837 kfree(map);
838}
839
840static int abx500_dt_reserve_map(struct pinctrl_map **map,
841 unsigned *reserved_maps,
842 unsigned *num_maps,
843 unsigned reserve)
844{
845 unsigned old_num = *reserved_maps;
846 unsigned new_num = *num_maps + reserve;
847 struct pinctrl_map *new_map;
848
849 if (old_num >= new_num)
850 return 0;
851
852 new_map = krealloc(*map, sizeof(*new_map) * new_num, GFP_KERNEL);
853 if (!new_map)
854 return -ENOMEM;
855
856 memset(new_map + old_num, 0, (new_num - old_num) * sizeof(*new_map));
857
858 *map = new_map;
859 *reserved_maps = new_num;
860
861 return 0;
862}
863
864static int abx500_dt_add_map_mux(struct pinctrl_map **map, 830static int abx500_dt_add_map_mux(struct pinctrl_map **map,
865 unsigned *reserved_maps, 831 unsigned *reserved_maps,
866 unsigned *num_maps, const char *group, 832 unsigned *num_maps, const char *group,
@@ -926,19 +892,32 @@ static int abx500_dt_subnode_to_map(struct pinctrl_dev *pctldev,
926 unsigned long *configs; 892 unsigned long *configs;
927 unsigned int nconfigs = 0; 893 unsigned int nconfigs = 0;
928 bool has_config = 0; 894 bool has_config = 0;
929 unsigned reserve = 0;
930 struct property *prop; 895 struct property *prop;
931 const char *group, *gpio_name; 896 const char *group, *gpio_name;
932 struct device_node *np_config; 897 struct device_node *np_config;
933 898
934 ret = of_property_read_string(np, "ste,function", &function); 899 ret = of_property_read_string(np, "ste,function", &function);
935 if (ret >= 0) 900 if (ret >= 0) {
936 reserve = 1; 901 ret = of_property_count_strings(np, "ste,pins");
902 if (ret < 0)
903 goto exit;
904
905 ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps,
906 num_maps, ret);
907 if (ret < 0)
908 goto exit;
909
910 of_property_for_each_string(np, "ste,pins", prop, group) {
911 ret = abx500_dt_add_map_mux(map, reserved_maps,
912 num_maps, group, function);
913 if (ret < 0)
914 goto exit;
915 }
916 }
937 917
938 ret = pinconf_generic_parse_dt_config(np, &configs, &nconfigs); 918 ret = pinconf_generic_parse_dt_config(np, &configs, &nconfigs);
939 if (nconfigs) 919 if (nconfigs)
940 has_config = 1; 920 has_config = 1;
941
942 np_config = of_parse_phandle(np, "ste,config", 0); 921 np_config = of_parse_phandle(np, "ste,config", 0);
943 if (np_config) { 922 if (np_config) {
944 ret = pinconf_generic_parse_dt_config(np_config, &configs, 923 ret = pinconf_generic_parse_dt_config(np_config, &configs,
@@ -947,28 +926,18 @@ static int abx500_dt_subnode_to_map(struct pinctrl_dev *pctldev,
947 goto exit; 926 goto exit;
948 has_config |= nconfigs; 927 has_config |= nconfigs;
949 } 928 }
929 if (has_config) {
930 ret = of_property_count_strings(np, "ste,pins");
931 if (ret < 0)
932 goto exit;
950 933
951 ret = of_property_count_strings(np, "ste,pins"); 934 ret = pinctrl_utils_reserve_map(pctldev, map,
952 if (ret < 0) 935 reserved_maps,
953 goto exit; 936 num_maps, ret);
954 937 if (ret < 0)
955 if (has_config) 938 goto exit;
956 reserve++;
957
958 reserve *= ret;
959
960 ret = abx500_dt_reserve_map(map, reserved_maps, num_maps, reserve);
961 if (ret < 0)
962 goto exit;
963 939
964 of_property_for_each_string(np, "ste,pins", prop, group) { 940 of_property_for_each_string(np, "ste,pins", prop, group) {
965 if (function) {
966 ret = abx500_dt_add_map_mux(map, reserved_maps,
967 num_maps, group, function);
968 if (ret < 0)
969 goto exit;
970 }
971 if (has_config) {
972 gpio_name = abx500_find_pin_name(pctldev, group); 941 gpio_name = abx500_find_pin_name(pctldev, group);
973 942
974 ret = abx500_dt_add_map_configs(map, reserved_maps, 943 ret = abx500_dt_add_map_configs(map, reserved_maps,
@@ -976,8 +945,8 @@ static int abx500_dt_subnode_to_map(struct pinctrl_dev *pctldev,
976 if (ret < 0) 945 if (ret < 0)
977 goto exit; 946 goto exit;
978 } 947 }
979
980 } 948 }
949
981exit: 950exit:
982 return ret; 951 return ret;
983} 952}
@@ -998,7 +967,7 @@ static int abx500_dt_node_to_map(struct pinctrl_dev *pctldev,
998 ret = abx500_dt_subnode_to_map(pctldev, np, map, 967 ret = abx500_dt_subnode_to_map(pctldev, np, map,
999 &reserved_maps, num_maps); 968 &reserved_maps, num_maps);
1000 if (ret < 0) { 969 if (ret < 0) {
1001 abx500_dt_free_map(pctldev, *map, *num_maps); 970 pinctrl_utils_dt_free_map(pctldev, *map, *num_maps);
1002 return ret; 971 return ret;
1003 } 972 }
1004 } 973 }
@@ -1012,7 +981,7 @@ static const struct pinctrl_ops abx500_pinctrl_ops = {
1012 .get_group_pins = abx500_get_group_pins, 981 .get_group_pins = abx500_get_group_pins,
1013 .pin_dbg_show = abx500_pin_dbg_show, 982 .pin_dbg_show = abx500_pin_dbg_show,
1014 .dt_node_to_map = abx500_dt_node_to_map, 983 .dt_node_to_map = abx500_dt_node_to_map,
1015 .dt_free_map = abx500_dt_free_map, 984 .dt_free_map = pinctrl_utils_dt_free_map,
1016}; 985};
1017 986
1018static int abx500_pin_config_get(struct pinctrl_dev *pctldev, 987static int abx500_pin_config_get(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
index e7cab07eef47..3c29d9187146 100644
--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
@@ -32,6 +32,7 @@
32#include <linux/pinctrl/consumer.h> 32#include <linux/pinctrl/consumer.h>
33#include "pinctrl-nomadik.h" 33#include "pinctrl-nomadik.h"
34#include "../core.h" 34#include "../core.h"
35#include "../pinctrl-utils.h"
35 36
36/* 37/*
37 * The GPIO module in the Nomadik family of Systems-on-Chip is an 38 * The GPIO module in the Nomadik family of Systems-on-Chip is an
@@ -985,6 +986,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
985 container_of(chip, struct nmk_gpio_chip, chip); 986 container_of(chip, struct nmk_gpio_chip, chip);
986 int mode; 987 int mode;
987 bool is_out; 988 bool is_out;
989 bool data_out;
988 bool pull; 990 bool pull;
989 u32 bit = 1 << offset; 991 u32 bit = 1 << offset;
990 const char *modes[] = { 992 const char *modes[] = {
@@ -997,28 +999,41 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
997 [NMK_GPIO_ALT_C+3] = "altC3", 999 [NMK_GPIO_ALT_C+3] = "altC3",
998 [NMK_GPIO_ALT_C+4] = "altC4", 1000 [NMK_GPIO_ALT_C+4] = "altC4",
999 }; 1001 };
1002 const char *pulls[] = {
1003 "none ",
1004 "pull down",
1005 "pull up ",
1006 };
1000 1007
1001 clk_enable(nmk_chip->clk); 1008 clk_enable(nmk_chip->clk);
1002 is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit); 1009 is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit);
1003 pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit); 1010 pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit);
1011 data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & bit);
1004 mode = nmk_gpio_get_mode(gpio); 1012 mode = nmk_gpio_get_mode(gpio);
1005 if ((mode == NMK_GPIO_ALT_C) && pctldev) 1013 if ((mode == NMK_GPIO_ALT_C) && pctldev)
1006 mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio); 1014 mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio);
1007 1015
1008 seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s", 1016 if (is_out) {
1009 gpio, label ?: "(none)", 1017 seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s",
1010 is_out ? "out" : "in ", 1018 gpio,
1011 chip->get 1019 label ?: "(none)",
1012 ? (chip->get(chip, offset) ? "hi" : "lo") 1020 data_out ? "hi" : "lo",
1013 : "? ", 1021 (mode < 0) ? "unknown" : modes[mode]);
1014 (mode < 0) ? "unknown" : modes[mode], 1022 } else {
1015 pull ? "pull" : "none");
1016
1017 if (!is_out) {
1018 int irq = gpio_to_irq(gpio); 1023 int irq = gpio_to_irq(gpio);
1019 struct irq_desc *desc = irq_to_desc(irq); 1024 struct irq_desc *desc = irq_to_desc(irq);
1025 int pullidx = 0;
1020 1026
1021 /* This races with request_irq(), set_irq_type(), 1027 if (pull)
1028 pullidx = data_out ? 1 : 2;
1029
1030 seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s",
1031 gpio,
1032 label ?: "(none)",
1033 pulls[pullidx],
1034 (mode < 0) ? "unknown" : modes[mode]);
1035 /*
1036 * This races with request_irq(), set_irq_type(),
1022 * and set_irq_wake() ... but those are "rare". 1037 * and set_irq_wake() ... but those are "rare".
1023 */ 1038 */
1024 if (irq > 0 && desc && desc->action) { 1039 if (irq > 0 && desc && desc->action) {
@@ -1338,39 +1353,6 @@ static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
1338 nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base, offset); 1353 nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base, offset);
1339} 1354}
1340 1355
1341static void nmk_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
1342 struct pinctrl_map *map, unsigned num_maps)
1343{
1344 int i;
1345
1346 for (i = 0; i < num_maps; i++)
1347 if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN)
1348 kfree(map[i].data.configs.configs);
1349 kfree(map);
1350}
1351
1352static int nmk_dt_reserve_map(struct pinctrl_map **map, unsigned *reserved_maps,
1353 unsigned *num_maps, unsigned reserve)
1354{
1355 unsigned old_num = *reserved_maps;
1356 unsigned new_num = *num_maps + reserve;
1357 struct pinctrl_map *new_map;
1358
1359 if (old_num >= new_num)
1360 return 0;
1361
1362 new_map = krealloc(*map, sizeof(*new_map) * new_num, GFP_KERNEL);
1363 if (!new_map)
1364 return -ENOMEM;
1365
1366 memset(new_map + old_num, 0, (new_num - old_num) * sizeof(*new_map));
1367
1368 *map = new_map;
1369 *reserved_maps = new_num;
1370
1371 return 0;
1372}
1373
1374static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps, 1356static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps,
1375 unsigned *num_maps, const char *group, 1357 unsigned *num_maps, const char *group,
1376 const char *function) 1358 const char *function)
@@ -1537,51 +1519,55 @@ static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
1537 const char *function = NULL; 1519 const char *function = NULL;
1538 unsigned long configs = 0; 1520 unsigned long configs = 0;
1539 bool has_config = 0; 1521 bool has_config = 0;
1540 unsigned reserve = 0;
1541 struct property *prop; 1522 struct property *prop;
1542 const char *group, *gpio_name; 1523 const char *group, *gpio_name;
1543 struct device_node *np_config; 1524 struct device_node *np_config;
1544 1525
1545 ret = of_property_read_string(np, "ste,function", &function); 1526 ret = of_property_read_string(np, "ste,function", &function);
1546 if (ret >= 0) 1527 if (ret >= 0) {
1547 reserve = 1; 1528 ret = of_property_count_strings(np, "ste,pins");
1548 1529 if (ret < 0)
1549 has_config = nmk_pinctrl_dt_get_config(np, &configs); 1530 goto exit;
1550 1531
1551 np_config = of_parse_phandle(np, "ste,config", 0); 1532 ret = pinctrl_utils_reserve_map(pctldev, map,
1552 if (np_config) 1533 reserved_maps,
1553 has_config |= nmk_pinctrl_dt_get_config(np_config, &configs); 1534 num_maps, ret);
1554 1535 if (ret < 0)
1555 ret = of_property_count_strings(np, "ste,pins"); 1536 goto exit;
1556 if (ret < 0) 1537
1557 goto exit; 1538 of_property_for_each_string(np, "ste,pins", prop, group) {
1558
1559 if (has_config)
1560 reserve++;
1561
1562 reserve *= ret;
1563
1564 ret = nmk_dt_reserve_map(map, reserved_maps, num_maps, reserve);
1565 if (ret < 0)
1566 goto exit;
1567
1568 of_property_for_each_string(np, "ste,pins", prop, group) {
1569 if (function) {
1570 ret = nmk_dt_add_map_mux(map, reserved_maps, num_maps, 1539 ret = nmk_dt_add_map_mux(map, reserved_maps, num_maps,
1571 group, function); 1540 group, function);
1572 if (ret < 0) 1541 if (ret < 0)
1573 goto exit; 1542 goto exit;
1574 } 1543 }
1575 if (has_config) { 1544 }
1545
1546 has_config = nmk_pinctrl_dt_get_config(np, &configs);
1547 np_config = of_parse_phandle(np, "ste,config", 0);
1548 if (np_config)
1549 has_config |= nmk_pinctrl_dt_get_config(np_config, &configs);
1550 if (has_config) {
1551 ret = of_property_count_strings(np, "ste,pins");
1552 if (ret < 0)
1553 goto exit;
1554 ret = pinctrl_utils_reserve_map(pctldev, map,
1555 reserved_maps,
1556 num_maps, ret);
1557 if (ret < 0)
1558 goto exit;
1559
1560 of_property_for_each_string(np, "ste,pins", prop, group) {
1576 gpio_name = nmk_find_pin_name(pctldev, group); 1561 gpio_name = nmk_find_pin_name(pctldev, group);
1577 1562
1578 ret = nmk_dt_add_map_configs(map, reserved_maps, num_maps, 1563 ret = nmk_dt_add_map_configs(map, reserved_maps,
1579 gpio_name, &configs, 1); 1564 num_maps,
1565 gpio_name, &configs, 1);
1580 if (ret < 0) 1566 if (ret < 0)
1581 goto exit; 1567 goto exit;
1582 } 1568 }
1583
1584 } 1569 }
1570
1585exit: 1571exit:
1586 return ret; 1572 return ret;
1587} 1573}
@@ -1602,7 +1588,7 @@ static int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
1602 ret = nmk_pinctrl_dt_subnode_to_map(pctldev, np, map, 1588 ret = nmk_pinctrl_dt_subnode_to_map(pctldev, np, map,
1603 &reserved_maps, num_maps); 1589 &reserved_maps, num_maps);
1604 if (ret < 0) { 1590 if (ret < 0) {
1605 nmk_pinctrl_dt_free_map(pctldev, *map, *num_maps); 1591 pinctrl_utils_dt_free_map(pctldev, *map, *num_maps);
1606 return ret; 1592 return ret;
1607 } 1593 }
1608 } 1594 }
@@ -1616,7 +1602,7 @@ static const struct pinctrl_ops nmk_pinctrl_ops = {
1616 .get_group_pins = nmk_get_group_pins, 1602 .get_group_pins = nmk_get_group_pins,
1617 .pin_dbg_show = nmk_pin_dbg_show, 1603 .pin_dbg_show = nmk_pin_dbg_show,
1618 .dt_node_to_map = nmk_pinctrl_dt_node_to_map, 1604 .dt_node_to_map = nmk_pinctrl_dt_node_to_map,
1619 .dt_free_map = nmk_pinctrl_dt_free_map, 1605 .dt_free_map = pinctrl_utils_dt_free_map,
1620}; 1606};
1621 1607
1622static int nmk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev) 1608static int nmk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev)
@@ -1647,8 +1633,8 @@ static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev,
1647 return 0; 1633 return 0;
1648} 1634}
1649 1635
1650static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, 1636static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function,
1651 unsigned group) 1637 unsigned group)
1652{ 1638{
1653 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 1639 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
1654 const struct nmk_pingroup *g; 1640 const struct nmk_pingroup *g;
@@ -1810,7 +1796,7 @@ static const struct pinmux_ops nmk_pinmux_ops = {
1810 .get_functions_count = nmk_pmx_get_funcs_cnt, 1796 .get_functions_count = nmk_pmx_get_funcs_cnt,
1811 .get_function_name = nmk_pmx_get_func_name, 1797 .get_function_name = nmk_pmx_get_func_name,
1812 .get_function_groups = nmk_pmx_get_func_groups, 1798 .get_function_groups = nmk_pmx_get_func_groups,
1813 .enable = nmk_pmx_enable, 1799 .set_mux = nmk_pmx_set,
1814 .gpio_request_enable = nmk_gpio_request_enable, 1800 .gpio_request_enable = nmk_gpio_request_enable,
1815 .gpio_disable_free = nmk_gpio_disable_free, 1801 .gpio_disable_free = nmk_gpio_disable_free,
1816}; 1802};
diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index b092b93c67a1..8434439c5017 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -619,8 +619,8 @@ static struct pinctrl_ops adi_pctrl_ops = {
619 .get_group_pins = adi_get_group_pins, 619 .get_group_pins = adi_get_group_pins,
620}; 620};
621 621
622static int adi_pinmux_enable(struct pinctrl_dev *pctldev, unsigned func_id, 622static int adi_pinmux_set(struct pinctrl_dev *pctldev, unsigned func_id,
623 unsigned group_id) 623 unsigned group_id)
624{ 624{
625 struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); 625 struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
626 struct gpio_port *port; 626 struct gpio_port *port;
@@ -698,7 +698,7 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev,
698} 698}
699 699
700static struct pinmux_ops adi_pinmux_ops = { 700static struct pinmux_ops adi_pinmux_ops = {
701 .enable = adi_pinmux_enable, 701 .set_mux = adi_pinmux_set,
702 .get_functions_count = adi_pinmux_get_funcs_count, 702 .get_functions_count = adi_pinmux_get_funcs_count,
703 .get_function_name = adi_pinmux_get_func_name, 703 .get_function_name = adi_pinmux_get_func_name,
704 .get_function_groups = adi_pinmux_get_groups, 704 .get_function_groups = adi_pinmux_get_groups,
@@ -1041,7 +1041,6 @@ static int adi_gpio_remove(struct platform_device *pdev)
1041 u8 offset; 1041 u8 offset;
1042 1042
1043 list_del(&port->node); 1043 list_del(&port->node);
1044 gpiochip_remove_pin_ranges(&port->chip);
1045 gpiochip_remove(&port->chip); 1044 gpiochip_remove(&port->chip);
1046 if (port->pint) { 1045 if (port->pint) {
1047 for (offset = 0; offset < port->width; offset++) 1046 for (offset = 0; offset < port->width; offset++)
diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 0e4ec91f4d49..1f790a4b83fe 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -230,7 +230,7 @@ static int as3722_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
230 return 0; 230 return 0;
231} 231}
232 232
233static int as3722_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function, 233static int as3722_pinctrl_set(struct pinctrl_dev *pctldev, unsigned function,
234 unsigned group) 234 unsigned group)
235{ 235{
236 struct as3722_pctrl_info *as_pci = pinctrl_dev_get_drvdata(pctldev); 236 struct as3722_pctrl_info *as_pci = pinctrl_dev_get_drvdata(pctldev);
@@ -327,7 +327,7 @@ static const struct pinmux_ops as3722_pinmux_ops = {
327 .get_functions_count = as3722_pinctrl_get_funcs_count, 327 .get_functions_count = as3722_pinctrl_get_funcs_count,
328 .get_function_name = as3722_pinctrl_get_func_name, 328 .get_function_name = as3722_pinctrl_get_func_name,
329 .get_function_groups = as3722_pinctrl_get_func_groups, 329 .get_function_groups = as3722_pinctrl_get_func_groups,
330 .enable = as3722_pinctrl_enable, 330 .set_mux = as3722_pinctrl_set,
331 .gpio_request_enable = as3722_pinctrl_gpio_request_enable, 331 .gpio_request_enable = as3722_pinctrl_gpio_request_enable,
332 .gpio_set_direction = as3722_pinctrl_gpio_set_direction, 332 .gpio_set_direction = as3722_pinctrl_gpio_set_direction,
333}; 333};
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 60464a2648aa..354a81d40925 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -58,11 +58,28 @@ static int gpio_banks;
58#define DEGLITCH (1 << 2) 58#define DEGLITCH (1 << 2)
59#define PULL_DOWN (1 << 3) 59#define PULL_DOWN (1 << 3)
60#define DIS_SCHMIT (1 << 4) 60#define DIS_SCHMIT (1 << 4)
61#define DRIVE_STRENGTH_SHIFT 5
62#define DRIVE_STRENGTH_MASK 0x3
63#define DRIVE_STRENGTH (DRIVE_STRENGTH_MASK << DRIVE_STRENGTH_SHIFT)
61#define DEBOUNCE (1 << 16) 64#define DEBOUNCE (1 << 16)
62#define DEBOUNCE_VAL_SHIFT 17 65#define DEBOUNCE_VAL_SHIFT 17
63#define DEBOUNCE_VAL (0x3fff << DEBOUNCE_VAL_SHIFT) 66#define DEBOUNCE_VAL (0x3fff << DEBOUNCE_VAL_SHIFT)
64 67
65/** 68/**
69 * These defines will translated the dt binding settings to our internal
70 * settings. They are not necessarily the same value as the register setting.
71 * The actual drive strength current of low, medium and high must be looked up
72 * from the corresponding device datasheet. This value is different for pins
73 * that are even in the same banks. It is also dependent on VCC.
74 * DRIVE_STRENGTH_DEFAULT is just a placeholder to avoid changing the drive
75 * strength when there is no dt config for it.
76 */
77#define DRIVE_STRENGTH_DEFAULT (0 << DRIVE_STRENGTH_SHIFT)
78#define DRIVE_STRENGTH_LOW (1 << DRIVE_STRENGTH_SHIFT)
79#define DRIVE_STRENGTH_MED (2 << DRIVE_STRENGTH_SHIFT)
80#define DRIVE_STRENGTH_HI (3 << DRIVE_STRENGTH_SHIFT)
81
82/**
66 * struct at91_pmx_func - describes AT91 pinmux functions 83 * struct at91_pmx_func - describes AT91 pinmux functions
67 * @name: the name of this specific function 84 * @name: the name of this specific function
68 * @groups: corresponding pin groups 85 * @groups: corresponding pin groups
@@ -148,6 +165,9 @@ struct at91_pinctrl_mux_ops {
148 void (*set_pulldown)(void __iomem *pio, unsigned mask, bool is_on); 165 void (*set_pulldown)(void __iomem *pio, unsigned mask, bool is_on);
149 bool (*get_schmitt_trig)(void __iomem *pio, unsigned pin); 166 bool (*get_schmitt_trig)(void __iomem *pio, unsigned pin);
150 void (*disable_schmitt_trig)(void __iomem *pio, unsigned mask); 167 void (*disable_schmitt_trig)(void __iomem *pio, unsigned mask);
168 unsigned (*get_drivestrength)(void __iomem *pio, unsigned pin);
169 void (*set_drivestrength)(void __iomem *pio, unsigned pin,
170 u32 strength);
151 /* irq */ 171 /* irq */
152 int (*irq_type)(struct irq_data *d, unsigned type); 172 int (*irq_type)(struct irq_data *d, unsigned type);
153}; 173};
@@ -315,6 +335,30 @@ static unsigned pin_to_mask(unsigned int pin)
315 return 1 << pin; 335 return 1 << pin;
316} 336}
317 337
338static unsigned two_bit_pin_value_shift_amount(unsigned int pin)
339{
340 /* return the shift value for a pin for "two bit" per pin registers,
341 * i.e. drive strength */
342 return 2*((pin >= MAX_NB_GPIO_PER_BANK/2)
343 ? pin - MAX_NB_GPIO_PER_BANK/2 : pin);
344}
345
346static unsigned sama5d3_get_drive_register(unsigned int pin)
347{
348 /* drive strength is split between two registers
349 * with two bits per pin */
350 return (pin >= MAX_NB_GPIO_PER_BANK/2)
351 ? SAMA5D3_PIO_DRIVER2 : SAMA5D3_PIO_DRIVER1;
352}
353
354static unsigned at91sam9x5_get_drive_register(unsigned int pin)
355{
356 /* drive strength is split between two registers
357 * with two bits per pin */
358 return (pin >= MAX_NB_GPIO_PER_BANK/2)
359 ? AT91SAM9X5_PIO_DRIVER2 : AT91SAM9X5_PIO_DRIVER1;
360}
361
318static void at91_mux_disable_interrupt(void __iomem *pio, unsigned mask) 362static void at91_mux_disable_interrupt(void __iomem *pio, unsigned mask)
319{ 363{
320 writel_relaxed(mask, pio + PIO_IDR); 364 writel_relaxed(mask, pio + PIO_IDR);
@@ -327,6 +371,9 @@ static unsigned at91_mux_get_pullup(void __iomem *pio, unsigned pin)
327 371
328static void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on) 372static void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on)
329{ 373{
374 if (on)
375 writel_relaxed(mask, pio + PIO_PPDDR);
376
330 writel_relaxed(mask, pio + (on ? PIO_PUER : PIO_PUDR)); 377 writel_relaxed(mask, pio + (on ? PIO_PUER : PIO_PUDR));
331} 378}
332 379
@@ -455,6 +502,9 @@ static bool at91_mux_pio3_get_pulldown(void __iomem *pio, unsigned pin)
455 502
456static void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, bool is_on) 503static void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, bool is_on)
457{ 504{
505 if (is_on)
506 __raw_writel(mask, pio + PIO_PUDR);
507
458 __raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR)); 508 __raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
459} 509}
460 510
@@ -468,6 +518,79 @@ static bool at91_mux_pio3_get_schmitt_trig(void __iomem *pio, unsigned pin)
468 return (__raw_readl(pio + PIO_SCHMITT) >> pin) & 0x1; 518 return (__raw_readl(pio + PIO_SCHMITT) >> pin) & 0x1;
469} 519}
470 520
521static inline u32 read_drive_strength(void __iomem *reg, unsigned pin)
522{
523 unsigned tmp = __raw_readl(reg);
524
525 tmp = tmp >> two_bit_pin_value_shift_amount(pin);
526
527 return tmp & DRIVE_STRENGTH_MASK;
528}
529
530static unsigned at91_mux_sama5d3_get_drivestrength(void __iomem *pio,
531 unsigned pin)
532{
533 unsigned tmp = read_drive_strength(pio +
534 sama5d3_get_drive_register(pin), pin);
535
536 /* SAMA5 strength is 1:1 with our defines,
537 * except 0 is equivalent to low per datasheet */
538 if (!tmp)
539 tmp = DRIVE_STRENGTH_LOW;
540
541 return tmp;
542}
543
544static unsigned at91_mux_sam9x5_get_drivestrength(void __iomem *pio,
545 unsigned pin)
546{
547 unsigned tmp = read_drive_strength(pio +
548 at91sam9x5_get_drive_register(pin), pin);
549
550 /* strength is inverse in SAM9x5s hardware with the pinctrl defines
551 * hardware: 0 = hi, 1 = med, 2 = low, 3 = rsvd */
552 tmp = DRIVE_STRENGTH_HI - tmp;
553
554 return tmp;
555}
556
557static void set_drive_strength(void __iomem *reg, unsigned pin, u32 strength)
558{
559 unsigned tmp = __raw_readl(reg);
560 unsigned shift = two_bit_pin_value_shift_amount(pin);
561
562 tmp &= ~(DRIVE_STRENGTH_MASK << shift);
563 tmp |= strength << shift;
564
565 __raw_writel(tmp, reg);
566}
567
568static void at91_mux_sama5d3_set_drivestrength(void __iomem *pio, unsigned pin,
569 u32 setting)
570{
571 /* do nothing if setting is zero */
572 if (!setting)
573 return;
574
575 /* strength is 1 to 1 with setting for SAMA5 */
576 set_drive_strength(pio + sama5d3_get_drive_register(pin), pin, setting);
577}
578
579static void at91_mux_sam9x5_set_drivestrength(void __iomem *pio, unsigned pin,
580 u32 setting)
581{
582 /* do nothing if setting is zero */
583 if (!setting)
584 return;
585
586 /* strength is inverse on SAM9x5s with our defines
587 * 0 = hi, 1 = med, 2 = low, 3 = rsvd */
588 setting = DRIVE_STRENGTH_HI - setting;
589
590 set_drive_strength(pio + at91sam9x5_get_drive_register(pin), pin,
591 setting);
592}
593
471static struct at91_pinctrl_mux_ops at91rm9200_ops = { 594static struct at91_pinctrl_mux_ops at91rm9200_ops = {
472 .get_periph = at91_mux_get_periph, 595 .get_periph = at91_mux_get_periph,
473 .mux_A_periph = at91_mux_set_A_periph, 596 .mux_A_periph = at91_mux_set_A_periph,
@@ -491,6 +614,27 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
491 .set_pulldown = at91_mux_pio3_set_pulldown, 614 .set_pulldown = at91_mux_pio3_set_pulldown,
492 .get_schmitt_trig = at91_mux_pio3_get_schmitt_trig, 615 .get_schmitt_trig = at91_mux_pio3_get_schmitt_trig,
493 .disable_schmitt_trig = at91_mux_pio3_disable_schmitt_trig, 616 .disable_schmitt_trig = at91_mux_pio3_disable_schmitt_trig,
617 .get_drivestrength = at91_mux_sam9x5_get_drivestrength,
618 .set_drivestrength = at91_mux_sam9x5_set_drivestrength,
619 .irq_type = alt_gpio_irq_type,
620};
621
622static struct at91_pinctrl_mux_ops sama5d3_ops = {
623 .get_periph = at91_mux_pio3_get_periph,
624 .mux_A_periph = at91_mux_pio3_set_A_periph,
625 .mux_B_periph = at91_mux_pio3_set_B_periph,
626 .mux_C_periph = at91_mux_pio3_set_C_periph,
627 .mux_D_periph = at91_mux_pio3_set_D_periph,
628 .get_deglitch = at91_mux_pio3_get_deglitch,
629 .set_deglitch = at91_mux_pio3_set_deglitch,
630 .get_debounce = at91_mux_pio3_get_debounce,
631 .set_debounce = at91_mux_pio3_set_debounce,
632 .get_pulldown = at91_mux_pio3_get_pulldown,
633 .set_pulldown = at91_mux_pio3_set_pulldown,
634 .get_schmitt_trig = at91_mux_pio3_get_schmitt_trig,
635 .disable_schmitt_trig = at91_mux_pio3_disable_schmitt_trig,
636 .get_drivestrength = at91_mux_sama5d3_get_drivestrength,
637 .set_drivestrength = at91_mux_sama5d3_set_drivestrength,
494 .irq_type = alt_gpio_irq_type, 638 .irq_type = alt_gpio_irq_type,
495}; 639};
496 640
@@ -554,8 +698,8 @@ static void at91_mux_gpio_enable(void __iomem *pio, unsigned mask, bool input)
554 writel_relaxed(mask, pio + (input ? PIO_ODR : PIO_OER)); 698 writel_relaxed(mask, pio + (input ? PIO_ODR : PIO_OER));
555} 699}
556 700
557static int at91_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, 701static int at91_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
558 unsigned group) 702 unsigned group)
559{ 703{
560 struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); 704 struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
561 const struct at91_pmx_pin *pins_conf = info->groups[group].pins_conf; 705 const struct at91_pmx_pin *pins_conf = info->groups[group].pins_conf;
@@ -684,7 +828,7 @@ static const struct pinmux_ops at91_pmx_ops = {
684 .get_functions_count = at91_pmx_get_funcs_count, 828 .get_functions_count = at91_pmx_get_funcs_count,
685 .get_function_name = at91_pmx_get_func_name, 829 .get_function_name = at91_pmx_get_func_name,
686 .get_function_groups = at91_pmx_get_groups, 830 .get_function_groups = at91_pmx_get_groups,
687 .enable = at91_pmx_enable, 831 .set_mux = at91_pmx_set,
688 .gpio_request_enable = at91_gpio_request_enable, 832 .gpio_request_enable = at91_gpio_request_enable,
689 .gpio_disable_free = at91_gpio_disable_free, 833 .gpio_disable_free = at91_gpio_disable_free,
690}; 834};
@@ -716,6 +860,9 @@ static int at91_pinconf_get(struct pinctrl_dev *pctldev,
716 *config |= PULL_DOWN; 860 *config |= PULL_DOWN;
717 if (info->ops->get_schmitt_trig && info->ops->get_schmitt_trig(pio, pin)) 861 if (info->ops->get_schmitt_trig && info->ops->get_schmitt_trig(pio, pin))
718 *config |= DIS_SCHMIT; 862 *config |= DIS_SCHMIT;
863 if (info->ops->get_drivestrength)
864 *config |= (info->ops->get_drivestrength(pio, pin)
865 << DRIVE_STRENGTH_SHIFT);
719 866
720 return 0; 867 return 0;
721} 868}
@@ -729,6 +876,7 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev,
729 void __iomem *pio; 876 void __iomem *pio;
730 int i; 877 int i;
731 unsigned long config; 878 unsigned long config;
879 unsigned pin;
732 880
733 for (i = 0; i < num_configs; i++) { 881 for (i = 0; i < num_configs; i++) {
734 config = configs[i]; 882 config = configs[i];
@@ -737,7 +885,8 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev,
737 "%s:%d, pin_id=%d, config=0x%lx", 885 "%s:%d, pin_id=%d, config=0x%lx",
738 __func__, __LINE__, pin_id, config); 886 __func__, __LINE__, pin_id, config);
739 pio = pin_to_controller(info, pin_to_bank(pin_id)); 887 pio = pin_to_controller(info, pin_to_bank(pin_id));
740 mask = pin_to_mask(pin_id % MAX_NB_GPIO_PER_BANK); 888 pin = pin_id % MAX_NB_GPIO_PER_BANK;
889 mask = pin_to_mask(pin);
741 890
742 if (config & PULL_UP && config & PULL_DOWN) 891 if (config & PULL_UP && config & PULL_DOWN)
743 return -EINVAL; 892 return -EINVAL;
@@ -753,6 +902,10 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev,
753 info->ops->set_pulldown(pio, mask, config & PULL_DOWN); 902 info->ops->set_pulldown(pio, mask, config & PULL_DOWN);
754 if (info->ops->disable_schmitt_trig && config & DIS_SCHMIT) 903 if (info->ops->disable_schmitt_trig && config & DIS_SCHMIT)
755 info->ops->disable_schmitt_trig(pio, mask); 904 info->ops->disable_schmitt_trig(pio, mask);
905 if (info->ops->set_drivestrength)
906 info->ops->set_drivestrength(pio, pin,
907 (config & DRIVE_STRENGTH)
908 >> DRIVE_STRENGTH_SHIFT);
756 909
757 } /* for each config */ 910 } /* for each config */
758 911
@@ -768,6 +921,15 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev,
768 } \ 921 } \
769} while (0) 922} while (0)
770 923
924#define DBG_SHOW_FLAG_MASKED(mask,flag) do { \
925 if ((config & mask) == flag) { \
926 if (num_conf) \
927 seq_puts(s, "|"); \
928 seq_puts(s, #flag); \
929 num_conf++; \
930 } \
931} while (0)
932
771static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev, 933static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
772 struct seq_file *s, unsigned pin_id) 934 struct seq_file *s, unsigned pin_id)
773{ 935{
@@ -781,6 +943,9 @@ static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
781 DBG_SHOW_FLAG(PULL_DOWN); 943 DBG_SHOW_FLAG(PULL_DOWN);
782 DBG_SHOW_FLAG(DIS_SCHMIT); 944 DBG_SHOW_FLAG(DIS_SCHMIT);
783 DBG_SHOW_FLAG(DEGLITCH); 945 DBG_SHOW_FLAG(DEGLITCH);
946 DBG_SHOW_FLAG_MASKED(DRIVE_STRENGTH, DRIVE_STRENGTH_LOW);
947 DBG_SHOW_FLAG_MASKED(DRIVE_STRENGTH, DRIVE_STRENGTH_MED);
948 DBG_SHOW_FLAG_MASKED(DRIVE_STRENGTH, DRIVE_STRENGTH_HI);
784 DBG_SHOW_FLAG(DEBOUNCE); 949 DBG_SHOW_FLAG(DEBOUNCE);
785 if (config & DEBOUNCE) { 950 if (config & DEBOUNCE) {
786 val = config >> DEBOUNCE_VAL_SHIFT; 951 val = config >> DEBOUNCE_VAL_SHIFT;
@@ -945,6 +1110,7 @@ static int at91_pinctrl_parse_functions(struct device_node *np,
945} 1110}
946 1111
947static struct of_device_id at91_pinctrl_of_match[] = { 1112static struct of_device_id at91_pinctrl_of_match[] = {
1113 { .compatible = "atmel,sama5d3-pinctrl", .data = &sama5d3_ops },
948 { .compatible = "atmel,at91sam9x5-pinctrl", .data = &at91sam9x5_ops }, 1114 { .compatible = "atmel,at91sam9x5-pinctrl", .data = &at91sam9x5_ops },
949 { .compatible = "atmel,at91rm9200-pinctrl", .data = &at91rm9200_ops }, 1115 { .compatible = "atmel,at91rm9200-pinctrl", .data = &at91rm9200_ops },
950 { /* sentinel */ } 1116 { /* sentinel */ }
@@ -1445,7 +1611,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
1445 /* now it may re-trigger */ 1611 /* now it may re-trigger */
1446} 1612}
1447 1613
1448static int at91_gpio_of_irq_setup(struct device_node *node, 1614static int at91_gpio_of_irq_setup(struct platform_device *pdev,
1449 struct at91_gpio_chip *at91_gpio) 1615 struct at91_gpio_chip *at91_gpio)
1450{ 1616{
1451 struct at91_gpio_chip *prev = NULL; 1617 struct at91_gpio_chip *prev = NULL;
@@ -1470,9 +1636,11 @@ static int at91_gpio_of_irq_setup(struct device_node *node,
1470 0, 1636 0,
1471 handle_edge_irq, 1637 handle_edge_irq,
1472 IRQ_TYPE_EDGE_BOTH); 1638 IRQ_TYPE_EDGE_BOTH);
1473 if (ret) 1639 if (ret) {
1474 panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n", 1640 dev_err(&pdev->dev, "at91_gpio.%d: Couldn't add irqchip to gpiochip.\n",
1475 at91_gpio->pioc_idx); 1641 at91_gpio->pioc_idx);
1642 return ret;
1643 }
1476 1644
1477 /* Setup chained handler */ 1645 /* Setup chained handler */
1478 if (at91_gpio->pioc_idx) 1646 if (at91_gpio->pioc_idx)
@@ -1575,19 +1743,22 @@ static int at91_gpio_probe(struct platform_device *pdev)
1575 at91_chip->pioc_virq = irq; 1743 at91_chip->pioc_virq = irq;
1576 at91_chip->pioc_idx = alias_idx; 1744 at91_chip->pioc_idx = alias_idx;
1577 1745
1578 at91_chip->clock = clk_get(&pdev->dev, NULL); 1746 at91_chip->clock = devm_clk_get(&pdev->dev, NULL);
1579 if (IS_ERR(at91_chip->clock)) { 1747 if (IS_ERR(at91_chip->clock)) {
1580 dev_err(&pdev->dev, "failed to get clock, ignoring.\n"); 1748 dev_err(&pdev->dev, "failed to get clock, ignoring.\n");
1749 ret = PTR_ERR(at91_chip->clock);
1581 goto err; 1750 goto err;
1582 } 1751 }
1583 1752
1584 if (clk_prepare(at91_chip->clock)) 1753 ret = clk_prepare(at91_chip->clock);
1585 goto clk_prep_err; 1754 if (ret)
1755 goto clk_prepare_err;
1586 1756
1587 /* enable PIO controller's clock */ 1757 /* enable PIO controller's clock */
1588 if (clk_enable(at91_chip->clock)) { 1758 ret = clk_enable(at91_chip->clock);
1759 if (ret) {
1589 dev_err(&pdev->dev, "failed to enable clock, ignoring.\n"); 1760 dev_err(&pdev->dev, "failed to enable clock, ignoring.\n");
1590 goto clk_err; 1761 goto clk_enable_err;
1591 } 1762 }
1592 1763
1593 at91_chip->chip = at91_gpio_template; 1764 at91_chip->chip = at91_gpio_template;
@@ -1612,7 +1783,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
1612 1783
1613 if (!names) { 1784 if (!names) {
1614 ret = -ENOMEM; 1785 ret = -ENOMEM;
1615 goto clk_err; 1786 goto clk_enable_err;
1616 } 1787 }
1617 1788
1618 for (i = 0; i < chip->ngpio; i++) 1789 for (i = 0; i < chip->ngpio; i++)
@@ -1630,23 +1801,28 @@ static int at91_gpio_probe(struct platform_device *pdev)
1630 1801
1631 ret = gpiochip_add(chip); 1802 ret = gpiochip_add(chip);
1632 if (ret) 1803 if (ret)
1633 goto clk_err; 1804 goto gpiochip_add_err;
1634 1805
1635 gpio_chips[alias_idx] = at91_chip; 1806 gpio_chips[alias_idx] = at91_chip;
1636 gpio_banks = max(gpio_banks, alias_idx + 1); 1807 gpio_banks = max(gpio_banks, alias_idx + 1);
1637 1808
1638 at91_gpio_probe_fixup(); 1809 at91_gpio_probe_fixup();
1639 1810
1640 at91_gpio_of_irq_setup(np, at91_chip); 1811 ret = at91_gpio_of_irq_setup(pdev, at91_chip);
1812 if (ret)
1813 goto irq_setup_err;
1641 1814
1642 dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase); 1815 dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase);
1643 1816
1644 return 0; 1817 return 0;
1645 1818
1646clk_err: 1819irq_setup_err:
1820 gpiochip_remove(chip);
1821gpiochip_add_err:
1822 clk_disable(at91_chip->clock);
1823clk_enable_err:
1647 clk_unprepare(at91_chip->clock); 1824 clk_unprepare(at91_chip->clock);
1648clk_prep_err: 1825clk_prepare_err:
1649 clk_put(at91_chip->clock);
1650err: 1826err:
1651 dev_err(&pdev->dev, "Failure %i for GPIO %i\n", ret, alias_idx); 1827 dev_err(&pdev->dev, "Failure %i for GPIO %i\n", ret, alias_idx);
1652 1828
diff --git a/drivers/pinctrl/pinctrl-bcm281xx.c b/drivers/pinctrl/pinctrl-bcm281xx.c
index c5ca9e633fff..a26e0c2ba33e 100644
--- a/drivers/pinctrl/pinctrl-bcm281xx.c
+++ b/drivers/pinctrl/pinctrl-bcm281xx.c
@@ -1055,9 +1055,9 @@ static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev,
1055 return 0; 1055 return 0;
1056} 1056}
1057 1057
1058static int bcm281xx_pinmux_enable(struct pinctrl_dev *pctldev, 1058static int bcm281xx_pinmux_set(struct pinctrl_dev *pctldev,
1059 unsigned function, 1059 unsigned function,
1060 unsigned group) 1060 unsigned group)
1061{ 1061{
1062 struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev); 1062 struct bcm281xx_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
1063 const struct bcm281xx_pin_function *f = &pdata->functions[function]; 1063 const struct bcm281xx_pin_function *f = &pdata->functions[function];
@@ -1084,7 +1084,7 @@ static struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = {
1084 .get_functions_count = bcm281xx_pinctrl_get_fcns_count, 1084 .get_functions_count = bcm281xx_pinctrl_get_fcns_count,
1085 .get_function_name = bcm281xx_pinctrl_get_fcn_name, 1085 .get_function_name = bcm281xx_pinctrl_get_fcn_name,
1086 .get_function_groups = bcm281xx_pinctrl_get_fcn_groups, 1086 .get_function_groups = bcm281xx_pinctrl_get_fcn_groups,
1087 .enable = bcm281xx_pinmux_enable, 1087 .set_mux = bcm281xx_pinmux_set,
1088}; 1088};
1089 1089
1090static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev, 1090static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index 5bcfd7ace0cd..eabba02f71f9 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -830,7 +830,7 @@ static int bcm2835_pmx_get_function_groups(struct pinctrl_dev *pctldev,
830 return 0; 830 return 0;
831} 831}
832 832
833static int bcm2835_pmx_enable(struct pinctrl_dev *pctldev, 833static int bcm2835_pmx_set(struct pinctrl_dev *pctldev,
834 unsigned func_selector, 834 unsigned func_selector,
835 unsigned group_selector) 835 unsigned group_selector)
836{ 836{
@@ -869,7 +869,7 @@ static const struct pinmux_ops bcm2835_pmx_ops = {
869 .get_functions_count = bcm2835_pmx_get_functions_count, 869 .get_functions_count = bcm2835_pmx_get_functions_count,
870 .get_function_name = bcm2835_pmx_get_function_name, 870 .get_function_name = bcm2835_pmx_get_function_name,
871 .get_function_groups = bcm2835_pmx_get_function_groups, 871 .get_function_groups = bcm2835_pmx_get_function_groups,
872 .enable = bcm2835_pmx_enable, 872 .set_mux = bcm2835_pmx_set,
873 .gpio_disable_free = bcm2835_pmx_gpio_disable_free, 873 .gpio_disable_free = bcm2835_pmx_gpio_disable_free,
874 .gpio_set_direction = bcm2835_pmx_gpio_set_direction, 874 .gpio_set_direction = bcm2835_pmx_gpio_set_direction,
875}; 875};
diff --git a/drivers/pinctrl/pinctrl-lantiq.c b/drivers/pinctrl/pinctrl-lantiq.c
index d22ca252b80d..296e5b37f768 100644
--- a/drivers/pinctrl/pinctrl-lantiq.c
+++ b/drivers/pinctrl/pinctrl-lantiq.c
@@ -257,9 +257,9 @@ static int match_group_mux(const struct ltq_pin_group *grp,
257 return ret; 257 return ret;
258} 258}
259 259
260static int ltq_pmx_enable(struct pinctrl_dev *pctrldev, 260static int ltq_pmx_set(struct pinctrl_dev *pctrldev,
261 unsigned func, 261 unsigned func,
262 unsigned group) 262 unsigned group)
263{ 263{
264 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); 264 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
265 const struct ltq_pin_group *pin_grp = &info->grps[group]; 265 const struct ltq_pin_group *pin_grp = &info->grps[group];
@@ -316,7 +316,7 @@ static const struct pinmux_ops ltq_pmx_ops = {
316 .get_functions_count = ltq_pmx_func_count, 316 .get_functions_count = ltq_pmx_func_count,
317 .get_function_name = ltq_pmx_func_name, 317 .get_function_name = ltq_pmx_func_name,
318 .get_function_groups = ltq_pmx_get_groups, 318 .get_function_groups = ltq_pmx_get_groups,
319 .enable = ltq_pmx_enable, 319 .set_mux = ltq_pmx_set,
320 .gpio_request_enable = ltq_pmx_gpio_request_enable, 320 .gpio_request_enable = ltq_pmx_gpio_request_enable,
321}; 321};
322 322
diff --git a/drivers/pinctrl/pinctrl-palmas.c b/drivers/pinctrl/pinctrl-palmas.c
index f13d0e78a41c..e3079d3d19fe 100644
--- a/drivers/pinctrl/pinctrl-palmas.c
+++ b/drivers/pinctrl/pinctrl-palmas.c
@@ -685,7 +685,8 @@ static int palmas_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
685 return 0; 685 return 0;
686} 686}
687 687
688static int palmas_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function, 688static int palmas_pinctrl_set_mux(struct pinctrl_dev *pctldev,
689 unsigned function,
689 unsigned group) 690 unsigned group)
690{ 691{
691 struct palmas_pctrl_chip_info *pci = pinctrl_dev_get_drvdata(pctldev); 692 struct palmas_pctrl_chip_info *pci = pinctrl_dev_get_drvdata(pctldev);
@@ -742,7 +743,7 @@ static const struct pinmux_ops palmas_pinmux_ops = {
742 .get_functions_count = palmas_pinctrl_get_funcs_count, 743 .get_functions_count = palmas_pinctrl_get_funcs_count,
743 .get_function_name = palmas_pinctrl_get_func_name, 744 .get_function_name = palmas_pinctrl_get_func_name,
744 .get_function_groups = palmas_pinctrl_get_func_groups, 745 .get_function_groups = palmas_pinctrl_get_func_groups,
745 .enable = palmas_pinctrl_enable, 746 .set_mux = palmas_pinctrl_set_mux,
746}; 747};
747 748
748static int palmas_pinconf_get(struct pinctrl_dev *pctldev, 749static int palmas_pinconf_get(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 0c372a300cb8..016f4578e494 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -816,8 +816,8 @@ static int rockchip_pmx_get_groups(struct pinctrl_dev *pctldev,
816 return 0; 816 return 0;
817} 817}
818 818
819static int rockchip_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, 819static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
820 unsigned group) 820 unsigned group)
821{ 821{
822 struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); 822 struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
823 const unsigned int *pins = info->groups[group].pins; 823 const unsigned int *pins = info->groups[group].pins;
@@ -892,7 +892,7 @@ static const struct pinmux_ops rockchip_pmx_ops = {
892 .get_functions_count = rockchip_pmx_get_funcs_count, 892 .get_functions_count = rockchip_pmx_get_funcs_count,
893 .get_function_name = rockchip_pmx_get_func_name, 893 .get_function_name = rockchip_pmx_get_func_name,
894 .get_function_groups = rockchip_pmx_get_groups, 894 .get_function_groups = rockchip_pmx_get_groups,
895 .enable = rockchip_pmx_enable, 895 .set_mux = rockchip_pmx_set,
896 .gpio_set_direction = rockchip_pmx_gpio_set_direction, 896 .gpio_set_direction = rockchip_pmx_gpio_set_direction,
897}; 897};
898 898
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 95dd9cf55cb3..fb94b772ad62 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -447,7 +447,7 @@ static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,
447 return 0; 447 return 0;
448} 448}
449 449
450static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector, 450static int pcs_set_mux(struct pinctrl_dev *pctldev, unsigned fselector,
451 unsigned group) 451 unsigned group)
452{ 452{
453 struct pcs_device *pcs; 453 struct pcs_device *pcs;
@@ -519,7 +519,7 @@ static const struct pinmux_ops pcs_pinmux_ops = {
519 .get_functions_count = pcs_get_functions_count, 519 .get_functions_count = pcs_get_functions_count,
520 .get_function_name = pcs_get_function_name, 520 .get_function_name = pcs_get_function_name,
521 .get_function_groups = pcs_get_function_groups, 521 .get_function_groups = pcs_get_function_groups,
522 .enable = pcs_enable, 522 .set_mux = pcs_set_mux,
523 .gpio_request_enable = pcs_request_gpio, 523 .gpio_request_enable = pcs_request_gpio,
524}; 524};
525 525
@@ -1981,6 +1981,18 @@ static const struct pcs_soc_data pinctrl_single_omap_wkup = {
1981 .irq_status_mask = (1 << 15), /* OMAP_WAKEUP_EVENT */ 1981 .irq_status_mask = (1 << 15), /* OMAP_WAKEUP_EVENT */
1982}; 1982};
1983 1983
1984static const struct pcs_soc_data pinctrl_single_dra7 = {
1985 .flags = PCS_QUIRK_SHARED_IRQ,
1986 .irq_enable_mask = (1 << 24), /* WAKEUPENABLE */
1987 .irq_status_mask = (1 << 25), /* WAKEUPEVENT */
1988};
1989
1990static const struct pcs_soc_data pinctrl_single_am437x = {
1991 .flags = PCS_QUIRK_SHARED_IRQ,
1992 .irq_enable_mask = (1 << 29), /* OMAP_WAKEUP_EN */
1993 .irq_status_mask = (1 << 30), /* OMAP_WAKEUP_EVENT */
1994};
1995
1984static const struct pcs_soc_data pinctrl_single = { 1996static const struct pcs_soc_data pinctrl_single = {
1985}; 1997};
1986 1998
@@ -1992,6 +2004,8 @@ static struct of_device_id pcs_of_match[] = {
1992 { .compatible = "ti,omap3-padconf", .data = &pinctrl_single_omap_wkup }, 2004 { .compatible = "ti,omap3-padconf", .data = &pinctrl_single_omap_wkup },
1993 { .compatible = "ti,omap4-padconf", .data = &pinctrl_single_omap_wkup }, 2005 { .compatible = "ti,omap4-padconf", .data = &pinctrl_single_omap_wkup },
1994 { .compatible = "ti,omap5-padconf", .data = &pinctrl_single_omap_wkup }, 2006 { .compatible = "ti,omap5-padconf", .data = &pinctrl_single_omap_wkup },
2007 { .compatible = "ti,dra7-padconf", .data = &pinctrl_single_dra7 },
2008 { .compatible = "ti,am437-padconf", .data = &pinctrl_single_am437x },
1995 { .compatible = "pinctrl-single", .data = &pinctrl_single }, 2009 { .compatible = "pinctrl-single", .data = &pinctrl_single },
1996 { .compatible = "pinconf-single", .data = &pinconf_single }, 2010 { .compatible = "pinconf-single", .data = &pinconf_single },
1997 { }, 2011 { },
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 5475374d803f..4b1792aad3d8 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -914,8 +914,8 @@ static struct st_pio_control *st_get_pio_control(
914 return &bank->pc; 914 return &bank->pc;
915} 915}
916 916
917static int st_pmx_enable(struct pinctrl_dev *pctldev, unsigned fselector, 917static int st_pmx_set_mux(struct pinctrl_dev *pctldev, unsigned fselector,
918 unsigned group) 918 unsigned group)
919{ 919{
920 struct st_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); 920 struct st_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
921 struct st_pinconf *conf = info->groups[group].pin_conf; 921 struct st_pinconf *conf = info->groups[group].pin_conf;
@@ -951,7 +951,7 @@ static struct pinmux_ops st_pmxops = {
951 .get_functions_count = st_pmx_get_funcs_count, 951 .get_functions_count = st_pmx_get_funcs_count,
952 .get_function_name = st_pmx_get_fname, 952 .get_function_name = st_pmx_get_fname,
953 .get_function_groups = st_pmx_get_groups, 953 .get_function_groups = st_pmx_get_groups,
954 .enable = st_pmx_enable, 954 .set_mux = st_pmx_set_mux,
955 .gpio_set_direction = st_pmx_set_gpio_direction, 955 .gpio_set_direction = st_pmx_set_gpio_direction,
956}; 956};
957 957
@@ -1517,6 +1517,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info,
1517 0, handle_simple_irq, 1517 0, handle_simple_irq,
1518 IRQ_TYPE_LEVEL_LOW); 1518 IRQ_TYPE_LEVEL_LOW);
1519 if (err) { 1519 if (err) {
1520 gpiochip_remove(&bank->gpio_chip);
1520 dev_info(dev, "could not add irqchip\n"); 1521 dev_info(dev, "could not add irqchip\n");
1521 return err; 1522 return err;
1522 } 1523 }
diff --git a/drivers/pinctrl/pinctrl-tb10x.c b/drivers/pinctrl/pinctrl-tb10x.c
index 71c5d4f0c538..3b9bfcf717ac 100644
--- a/drivers/pinctrl/pinctrl-tb10x.c
+++ b/drivers/pinctrl/pinctrl-tb10x.c
@@ -697,7 +697,7 @@ static void tb10x_gpio_disable_free(struct pinctrl_dev *pctl,
697 mutex_unlock(&state->mutex); 697 mutex_unlock(&state->mutex);
698} 698}
699 699
700static int tb10x_pctl_enable(struct pinctrl_dev *pctl, 700static int tb10x_pctl_set_mux(struct pinctrl_dev *pctl,
701 unsigned func_selector, unsigned group_selector) 701 unsigned func_selector, unsigned group_selector)
702{ 702{
703 struct tb10x_pinctrl *state = pinctrl_dev_get_drvdata(pctl); 703 struct tb10x_pinctrl *state = pinctrl_dev_get_drvdata(pctl);
@@ -744,7 +744,7 @@ static struct pinmux_ops tb10x_pinmux_ops = {
744 .get_function_groups = tb10x_get_function_groups, 744 .get_function_groups = tb10x_get_function_groups,
745 .gpio_request_enable = tb10x_gpio_request_enable, 745 .gpio_request_enable = tb10x_gpio_request_enable,
746 .gpio_disable_free = tb10x_gpio_disable_free, 746 .gpio_disable_free = tb10x_gpio_disable_free,
747 .enable = tb10x_pctl_enable, 747 .set_mux = tb10x_pctl_set_mux,
748}; 748};
749 749
750static struct pinctrl_desc tb10x_pindesc = { 750static struct pinctrl_desc tb10x_pindesc = {
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index e641b4226c42..1631ec94fb02 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -281,9 +281,9 @@ static int tegra_xusb_padctl_get_function_groups(struct pinctrl_dev *pinctrl,
281 return 0; 281 return 0;
282} 282}
283 283
284static int tegra_xusb_padctl_pinmux_enable(struct pinctrl_dev *pinctrl, 284static int tegra_xusb_padctl_pinmux_set(struct pinctrl_dev *pinctrl,
285 unsigned int function, 285 unsigned int function,
286 unsigned int group) 286 unsigned int group)
287{ 287{
288 struct tegra_xusb_padctl *padctl = pinctrl_dev_get_drvdata(pinctrl); 288 struct tegra_xusb_padctl *padctl = pinctrl_dev_get_drvdata(pinctrl);
289 const struct tegra_xusb_padctl_lane *lane; 289 const struct tegra_xusb_padctl_lane *lane;
@@ -311,7 +311,7 @@ static const struct pinmux_ops tegra_xusb_padctl_pinmux_ops = {
311 .get_functions_count = tegra_xusb_padctl_get_functions_count, 311 .get_functions_count = tegra_xusb_padctl_get_functions_count,
312 .get_function_name = tegra_xusb_padctl_get_function_name, 312 .get_function_name = tegra_xusb_padctl_get_function_name,
313 .get_function_groups = tegra_xusb_padctl_get_function_groups, 313 .get_function_groups = tegra_xusb_padctl_get_function_groups,
314 .enable = tegra_xusb_padctl_pinmux_enable, 314 .set_mux = tegra_xusb_padctl_pinmux_set,
315}; 315};
316 316
317static int tegra_xusb_padctl_pinconf_group_get(struct pinctrl_dev *pinctrl, 317static int tegra_xusb_padctl_pinconf_group_get(struct pinctrl_dev *pinctrl,
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
index 150af5503c09..e5949d51bc52 100644
--- a/drivers/pinctrl/pinctrl-tegra.c
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -262,8 +262,9 @@ static int tegra_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
262 return 0; 262 return 0;
263} 263}
264 264
265static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function, 265static int tegra_pinctrl_set_mux(struct pinctrl_dev *pctldev,
266 unsigned group) 266 unsigned function,
267 unsigned group)
267{ 268{
268 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); 269 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
269 const struct tegra_pingroup *g; 270 const struct tegra_pingroup *g;
@@ -294,7 +295,7 @@ static const struct pinmux_ops tegra_pinmux_ops = {
294 .get_functions_count = tegra_pinctrl_get_funcs_count, 295 .get_functions_count = tegra_pinctrl_get_funcs_count,
295 .get_function_name = tegra_pinctrl_get_func_name, 296 .get_function_name = tegra_pinctrl_get_func_name,
296 .get_function_groups = tegra_pinctrl_get_func_groups, 297 .get_function_groups = tegra_pinctrl_get_func_groups,
297 .enable = tegra_pinctrl_enable, 298 .set_mux = tegra_pinctrl_set_mux,
298}; 299};
299 300
300static int tegra_pinconf_reg(struct tegra_pmx *pmx, 301static int tegra_pinconf_reg(struct tegra_pmx *pmx,
diff --git a/drivers/pinctrl/pinctrl-tegra114.c b/drivers/pinctrl/pinctrl-tegra114.c
index 33614baab4c0..a3db85b0b75f 100644
--- a/drivers/pinctrl/pinctrl-tegra114.c
+++ b/drivers/pinctrl/pinctrl-tegra114.c
@@ -1850,7 +1850,7 @@ static int tegra114_pinctrl_probe(struct platform_device *pdev)
1850 return tegra_pinctrl_probe(pdev, &tegra114_pinctrl); 1850 return tegra_pinctrl_probe(pdev, &tegra114_pinctrl);
1851} 1851}
1852 1852
1853static struct of_device_id tegra114_pinctrl_of_match[] = { 1853static const struct of_device_id tegra114_pinctrl_of_match[] = {
1854 { .compatible = "nvidia,tegra114-pinmux", }, 1854 { .compatible = "nvidia,tegra114-pinmux", },
1855 { }, 1855 { },
1856}; 1856};
diff --git a/drivers/pinctrl/pinctrl-tegra124.c b/drivers/pinctrl/pinctrl-tegra124.c
index e80797e20017..2f9b75c14967 100644
--- a/drivers/pinctrl/pinctrl-tegra124.c
+++ b/drivers/pinctrl/pinctrl-tegra124.c
@@ -224,6 +224,16 @@
224#define TEGRA_PIN_OWR _PIN(5) 224#define TEGRA_PIN_OWR _PIN(5)
225#define TEGRA_PIN_CLK_32K_IN _PIN(6) 225#define TEGRA_PIN_CLK_32K_IN _PIN(6)
226#define TEGRA_PIN_JTAG_RTCK _PIN(7) 226#define TEGRA_PIN_JTAG_RTCK _PIN(7)
227#define TEGRA_PIN_DSI_B_CLK_P _PIN(8)
228#define TEGRA_PIN_DSI_B_CLK_N _PIN(9)
229#define TEGRA_PIN_DSI_B_D0_P _PIN(10)
230#define TEGRA_PIN_DSI_B_D0_N _PIN(11)
231#define TEGRA_PIN_DSI_B_D1_P _PIN(12)
232#define TEGRA_PIN_DSI_B_D1_N _PIN(13)
233#define TEGRA_PIN_DSI_B_D2_P _PIN(14)
234#define TEGRA_PIN_DSI_B_D2_N _PIN(15)
235#define TEGRA_PIN_DSI_B_D3_P _PIN(16)
236#define TEGRA_PIN_DSI_B_D3_N _PIN(17)
227 237
228static const struct pinctrl_pin_desc tegra124_pins[] = { 238static const struct pinctrl_pin_desc tegra124_pins[] = {
229 PINCTRL_PIN(TEGRA_PIN_CLK_32K_OUT_PA0, "CLK_32K_OUT PA0"), 239 PINCTRL_PIN(TEGRA_PIN_CLK_32K_OUT_PA0, "CLK_32K_OUT PA0"),
@@ -417,6 +427,16 @@ static const struct pinctrl_pin_desc tegra124_pins[] = {
417 PINCTRL_PIN(TEGRA_PIN_OWR, "OWR"), 427 PINCTRL_PIN(TEGRA_PIN_OWR, "OWR"),
418 PINCTRL_PIN(TEGRA_PIN_CLK_32K_IN, "CLK_32K_IN"), 428 PINCTRL_PIN(TEGRA_PIN_CLK_32K_IN, "CLK_32K_IN"),
419 PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK, "JTAG_RTCK"), 429 PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK, "JTAG_RTCK"),
430 PINCTRL_PIN(TEGRA_PIN_DSI_B_CLK_P, "DSI_B_CLK_P"),
431 PINCTRL_PIN(TEGRA_PIN_DSI_B_CLK_N, "DSI_B_CLK_N"),
432 PINCTRL_PIN(TEGRA_PIN_DSI_B_D0_P, "DSI_B_D0_P"),
433 PINCTRL_PIN(TEGRA_PIN_DSI_B_D0_N, "DSI_B_D0_N"),
434 PINCTRL_PIN(TEGRA_PIN_DSI_B_D1_P, "DSI_B_D1_P"),
435 PINCTRL_PIN(TEGRA_PIN_DSI_B_D1_N, "DSI_B_D1_N"),
436 PINCTRL_PIN(TEGRA_PIN_DSI_B_D2_P, "DSI_B_D2_P"),
437 PINCTRL_PIN(TEGRA_PIN_DSI_B_D2_N, "DSI_B_D2_N"),
438 PINCTRL_PIN(TEGRA_PIN_DSI_B_D3_P, "DSI_B_D3_P"),
439 PINCTRL_PIN(TEGRA_PIN_DSI_B_D3_N, "DSI_B_D3_N"),
420}; 440};
421 441
422static const unsigned clk_32k_out_pa0_pins[] = { 442static const unsigned clk_32k_out_pa0_pins[] = {
@@ -1495,6 +1515,19 @@ static const unsigned drive_ao4_pins[] = {
1495 TEGRA_PIN_JTAG_RTCK, 1515 TEGRA_PIN_JTAG_RTCK,
1496}; 1516};
1497 1517
1518static const unsigned mipi_pad_ctrl_dsi_b_pins[] = {
1519 TEGRA_PIN_DSI_B_CLK_P,
1520 TEGRA_PIN_DSI_B_CLK_N,
1521 TEGRA_PIN_DSI_B_D0_P,
1522 TEGRA_PIN_DSI_B_D0_N,
1523 TEGRA_PIN_DSI_B_D1_P,
1524 TEGRA_PIN_DSI_B_D1_N,
1525 TEGRA_PIN_DSI_B_D2_P,
1526 TEGRA_PIN_DSI_B_D2_N,
1527 TEGRA_PIN_DSI_B_D3_P,
1528 TEGRA_PIN_DSI_B_D3_N,
1529};
1530
1498enum tegra_mux { 1531enum tegra_mux {
1499 TEGRA_MUX_BLINK, 1532 TEGRA_MUX_BLINK,
1500 TEGRA_MUX_CCLA, 1533 TEGRA_MUX_CCLA,
@@ -1580,6 +1613,8 @@ enum tegra_mux {
1580 TEGRA_MUX_VI_ALT3, 1613 TEGRA_MUX_VI_ALT3,
1581 TEGRA_MUX_VIMCLK2, 1614 TEGRA_MUX_VIMCLK2,
1582 TEGRA_MUX_VIMCLK2_ALT, 1615 TEGRA_MUX_VIMCLK2_ALT,
1616 TEGRA_MUX_CSI,
1617 TEGRA_MUX_DSI_B,
1583}; 1618};
1584 1619
1585#define FUNCTION(fname) \ 1620#define FUNCTION(fname) \
@@ -1672,10 +1707,13 @@ static struct tegra_function tegra124_functions[] = {
1672 FUNCTION(vi_alt3), 1707 FUNCTION(vi_alt3),
1673 FUNCTION(vimclk2), 1708 FUNCTION(vimclk2),
1674 FUNCTION(vimclk2_alt), 1709 FUNCTION(vimclk2_alt),
1710 FUNCTION(csi),
1711 FUNCTION(dsi_b),
1675}; 1712};
1676 1713
1677#define DRV_PINGROUP_REG_A 0x868 /* bank 0 */ 1714#define DRV_PINGROUP_REG_A 0x868 /* bank 0 */
1678#define PINGROUP_REG_A 0x3000 /* bank 1 */ 1715#define PINGROUP_REG_A 0x3000 /* bank 1 */
1716#define MIPI_PAD_CTRL_PINGROUP_REG_A 0x820 /* bank 2 */
1679 1717
1680#define PINGROUP_REG(r) ((r) - PINGROUP_REG_A) 1718#define PINGROUP_REG(r) ((r) - PINGROUP_REG_A)
1681 1719
@@ -1744,6 +1782,32 @@ static struct tegra_function tegra124_functions[] = {
1744 .drvtype_bit = PINGROUP_BIT_##drvtype(6), \ 1782 .drvtype_bit = PINGROUP_BIT_##drvtype(6), \
1745 } 1783 }
1746 1784
1785#define MIPI_PAD_CTRL_PINGROUP_REG_Y(r) ((r) - MIPI_PAD_CTRL_PINGROUP_REG_A)
1786
1787#define MIPI_PAD_CTRL_PINGROUP(pg_name, r, b, f0, f1) \
1788 { \
1789 .name = "mipi_pad_ctrl_" #pg_name, \
1790 .pins = mipi_pad_ctrl_##pg_name##_pins, \
1791 .npins = ARRAY_SIZE(mipi_pad_ctrl_##pg_name##_pins), \
1792 .funcs = { \
1793 TEGRA_MUX_ ## f0, \
1794 TEGRA_MUX_ ## f1, \
1795 TEGRA_MUX_RSVD3, \
1796 TEGRA_MUX_RSVD4, \
1797 }, \
1798 .mux_reg = MIPI_PAD_CTRL_PINGROUP_REG_Y(r), \
1799 .mux_bank = 2, \
1800 .mux_bit = b, \
1801 .pupd_reg = -1, \
1802 .tri_reg = -1, \
1803 .einput_bit = -1, \
1804 .odrain_bit = -1, \
1805 .lock_bit = -1, \
1806 .ioreset_bit = -1, \
1807 .rcv_sel_bit = -1, \
1808 .drv_reg = -1, \
1809 }
1810
1747static const struct tegra_pingroup tegra124_groups[] = { 1811static const struct tegra_pingroup tegra124_groups[] = {
1748 /* pg_name, f0, f1, f2, f3, r, od, ior, rcv_sel */ 1812 /* pg_name, f0, f1, f2, f3, r, od, ior, rcv_sel */
1749 PINGROUP(ulpi_data0_po1, SPI3, HSI, UARTA, ULPI, 0x3000, N, N, N), 1813 PINGROUP(ulpi_data0_po1, SPI3, HSI, UARTA, ULPI, 0x3000, N, N, N),
@@ -1979,6 +2043,9 @@ static const struct tegra_pingroup tegra124_groups[] = {
1979 DRV_PINGROUP(hv0, 0x9b4, 2, 3, 4, 12, 5, -1, -1, 28, 2, -1, -1, N), 2043 DRV_PINGROUP(hv0, 0x9b4, 2, 3, 4, 12, 5, -1, -1, 28, 2, -1, -1, N),
1980 DRV_PINGROUP(sdio4, 0x9c4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2, N), 2044 DRV_PINGROUP(sdio4, 0x9c4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2, N),
1981 DRV_PINGROUP(ao4, 0x9c8, 2, 3, 4, 12, 7, 20, 7, 28, 2, 30, 2, Y), 2045 DRV_PINGROUP(ao4, 0x9c8, 2, 3, 4, 12, 7, 20, 7, 28, 2, 30, 2, Y),
2046
2047 /* pg_name, r b f0, f1 */
2048 MIPI_PAD_CTRL_PINGROUP(dsi_b, 0x820, 1, CSI, DSI_B)
1982}; 2049};
1983 2050
1984static const struct tegra_pinctrl_soc_data tegra124_pinctrl = { 2051static const struct tegra_pinctrl_soc_data tegra124_pinctrl = {
@@ -1996,7 +2063,7 @@ static int tegra124_pinctrl_probe(struct platform_device *pdev)
1996 return tegra_pinctrl_probe(pdev, &tegra124_pinctrl); 2063 return tegra_pinctrl_probe(pdev, &tegra124_pinctrl);
1997} 2064}
1998 2065
1999static struct of_device_id tegra124_pinctrl_of_match[] = { 2066static const struct of_device_id tegra124_pinctrl_of_match[] = {
2000 { .compatible = "nvidia,tegra124-pinmux", }, 2067 { .compatible = "nvidia,tegra124-pinmux", },
2001 { }, 2068 { },
2002}; 2069};
diff --git a/drivers/pinctrl/pinctrl-tegra20.c b/drivers/pinctrl/pinctrl-tegra20.c
index 7563ebc9c791..c9805d2e71b0 100644
--- a/drivers/pinctrl/pinctrl-tegra20.c
+++ b/drivers/pinctrl/pinctrl-tegra20.c
@@ -2228,7 +2228,7 @@ static int tegra20_pinctrl_probe(struct platform_device *pdev)
2228 return tegra_pinctrl_probe(pdev, &tegra20_pinctrl); 2228 return tegra_pinctrl_probe(pdev, &tegra20_pinctrl);
2229} 2229}
2230 2230
2231static struct of_device_id tegra20_pinctrl_of_match[] = { 2231static const struct of_device_id tegra20_pinctrl_of_match[] = {
2232 { .compatible = "nvidia,tegra20-pinmux", }, 2232 { .compatible = "nvidia,tegra20-pinmux", },
2233 { }, 2233 { },
2234}; 2234};
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c
index fe2d2cf78ad9..e7b72e916558 100644
--- a/drivers/pinctrl/pinctrl-tegra30.c
+++ b/drivers/pinctrl/pinctrl-tegra30.c
@@ -2484,7 +2484,7 @@ static int tegra30_pinctrl_probe(struct platform_device *pdev)
2484 return tegra_pinctrl_probe(pdev, &tegra30_pinctrl); 2484 return tegra_pinctrl_probe(pdev, &tegra30_pinctrl);
2485} 2485}
2486 2486
2487static struct of_device_id tegra30_pinctrl_of_match[] = { 2487static const struct of_device_id tegra30_pinctrl_of_match[] = {
2488 { .compatible = "nvidia,tegra30-pinmux", }, 2488 { .compatible = "nvidia,tegra30-pinmux", },
2489 { }, 2489 { },
2490}; 2490};
diff --git a/drivers/pinctrl/pinctrl-tz1090-pdc.c b/drivers/pinctrl/pinctrl-tz1090-pdc.c
index 41e81a35cabb..3bb6a3b78864 100644
--- a/drivers/pinctrl/pinctrl-tz1090-pdc.c
+++ b/drivers/pinctrl/pinctrl-tz1090-pdc.c
@@ -547,8 +547,9 @@ static void tz1090_pdc_pinctrl_mux(struct tz1090_pdc_pmx *pmx,
547 __global_unlock2(flags); 547 __global_unlock2(flags);
548} 548}
549 549
550static int tz1090_pdc_pinctrl_enable(struct pinctrl_dev *pctldev, 550static int tz1090_pdc_pinctrl_set_mux(struct pinctrl_dev *pctldev,
551 unsigned int function, unsigned int group) 551 unsigned int function,
552 unsigned int group)
552{ 553{
553 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); 554 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
554 const struct tz1090_pdc_pingroup *grp = &tz1090_pdc_groups[group]; 555 const struct tz1090_pdc_pingroup *grp = &tz1090_pdc_groups[group];
@@ -634,7 +635,7 @@ static struct pinmux_ops tz1090_pdc_pinmux_ops = {
634 .get_functions_count = tz1090_pdc_pinctrl_get_funcs_count, 635 .get_functions_count = tz1090_pdc_pinctrl_get_funcs_count,
635 .get_function_name = tz1090_pdc_pinctrl_get_func_name, 636 .get_function_name = tz1090_pdc_pinctrl_get_func_name,
636 .get_function_groups = tz1090_pdc_pinctrl_get_func_groups, 637 .get_function_groups = tz1090_pdc_pinctrl_get_func_groups,
637 .enable = tz1090_pdc_pinctrl_enable, 638 .set_mux = tz1090_pdc_pinctrl_set_mux,
638 .gpio_request_enable = tz1090_pdc_pinctrl_gpio_request_enable, 639 .gpio_request_enable = tz1090_pdc_pinctrl_gpio_request_enable,
639 .gpio_disable_free = tz1090_pdc_pinctrl_gpio_disable_free, 640 .gpio_disable_free = tz1090_pdc_pinctrl_gpio_disable_free,
640}; 641};
diff --git a/drivers/pinctrl/pinctrl-tz1090.c b/drivers/pinctrl/pinctrl-tz1090.c
index 24082216842e..48d36413b99f 100644
--- a/drivers/pinctrl/pinctrl-tz1090.c
+++ b/drivers/pinctrl/pinctrl-tz1090.c
@@ -1415,8 +1415,8 @@ found_mux:
1415 * the effect is the same as enabling the function on each individual pin in the 1415 * the effect is the same as enabling the function on each individual pin in the
1416 * group. 1416 * group.
1417 */ 1417 */
1418static int tz1090_pinctrl_enable(struct pinctrl_dev *pctldev, 1418static int tz1090_pinctrl_set_mux(struct pinctrl_dev *pctldev,
1419 unsigned int function, unsigned int group) 1419 unsigned int function, unsigned int group)
1420{ 1420{
1421 struct tz1090_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); 1421 struct tz1090_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
1422 struct tz1090_pingroup *grp; 1422 struct tz1090_pingroup *grp;
@@ -1517,7 +1517,7 @@ static struct pinmux_ops tz1090_pinmux_ops = {
1517 .get_functions_count = tz1090_pinctrl_get_funcs_count, 1517 .get_functions_count = tz1090_pinctrl_get_funcs_count,
1518 .get_function_name = tz1090_pinctrl_get_func_name, 1518 .get_function_name = tz1090_pinctrl_get_func_name,
1519 .get_function_groups = tz1090_pinctrl_get_func_groups, 1519 .get_function_groups = tz1090_pinctrl_get_func_groups,
1520 .enable = tz1090_pinctrl_enable, 1520 .set_mux = tz1090_pinctrl_set_mux,
1521 .gpio_request_enable = tz1090_pinctrl_gpio_request_enable, 1521 .gpio_request_enable = tz1090_pinctrl_gpio_request_enable,
1522 .gpio_disable_free = tz1090_pinctrl_gpio_disable_free, 1522 .gpio_disable_free = tz1090_pinctrl_gpio_disable_free,
1523}; 1523};
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index 0959bb36450f..e9c7113d81f2 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -955,8 +955,8 @@ static void u300_pmx_endisable(struct u300_pmx *upmx, unsigned selector,
955 } 955 }
956} 956}
957 957
958static int u300_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, 958static int u300_pmx_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
959 unsigned group) 959 unsigned group)
960{ 960{
961 struct u300_pmx *upmx; 961 struct u300_pmx *upmx;
962 962
@@ -994,7 +994,7 @@ static const struct pinmux_ops u300_pmx_ops = {
994 .get_functions_count = u300_pmx_get_funcs_count, 994 .get_functions_count = u300_pmx_get_funcs_count,
995 .get_function_name = u300_pmx_get_func_name, 995 .get_function_name = u300_pmx_get_func_name,
996 .get_function_groups = u300_pmx_get_groups, 996 .get_function_groups = u300_pmx_get_groups,
997 .enable = u300_pmx_enable, 997 .set_mux = u300_pmx_set_mux,
998}; 998};
999 999
1000static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin, 1000static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin,
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index e66f4cae7633..37040ab42890 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -801,6 +801,7 @@ static int pinmux_xway_probe(struct platform_device *pdev)
801 of_gpiochip_add(&xway_chip); 801 of_gpiochip_add(&xway_chip);
802 ret = gpiochip_add(&xway_chip); 802 ret = gpiochip_add(&xway_chip);
803 if (ret) { 803 if (ret) {
804 of_gpiochip_remove(&xway_chip);
804 dev_err(&pdev->dev, "Failed to register gpio chip\n"); 805 dev_err(&pdev->dev, "Failed to register gpio chip\n");
805 return ret; 806 return ret;
806 } 807 }
@@ -822,6 +823,7 @@ static int pinmux_xway_probe(struct platform_device *pdev)
822 /* register with the generic lantiq layer */ 823 /* register with the generic lantiq layer */
823 ret = ltq_pinctrl_register(pdev, &xway_info); 824 ret = ltq_pinctrl_register(pdev, &xway_info);
824 if (ret) { 825 if (ret) {
826 gpiochip_remove(&xway_chip);
825 dev_err(&pdev->dev, "Failed to register pinctrl driver\n"); 827 dev_err(&pdev->dev, "Failed to register pinctrl driver\n");
826 return ret; 828 return ret;
827 } 829 }
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index c055daf9a80f..b874458dcb88 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -41,7 +41,7 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev)
41 !ops->get_functions_count || 41 !ops->get_functions_count ||
42 !ops->get_function_name || 42 !ops->get_function_name ||
43 !ops->get_function_groups || 43 !ops->get_function_groups ||
44 !ops->enable) { 44 !ops->set_mux) {
45 dev_err(pctldev->dev, "pinmux ops lacks necessary functions\n"); 45 dev_err(pctldev->dev, "pinmux ops lacks necessary functions\n");
46 return -EINVAL; 46 return -EINVAL;
47 } 47 }
@@ -445,15 +445,15 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting)
445 desc->mux_setting = &(setting->data.mux); 445 desc->mux_setting = &(setting->data.mux);
446 } 446 }
447 447
448 ret = ops->enable(pctldev, setting->data.mux.func, 448 ret = ops->set_mux(pctldev, setting->data.mux.func,
449 setting->data.mux.group); 449 setting->data.mux.group);
450 450
451 if (ret) 451 if (ret)
452 goto err_enable; 452 goto err_set_mux;
453 453
454 return 0; 454 return 0;
455 455
456err_enable: 456err_set_mux:
457 for (i = 0; i < num_pins; i++) { 457 for (i = 0; i < num_pins; i++) {
458 desc = pin_desc_get(pctldev, pins[i]); 458 desc = pin_desc_get(pctldev, pins[i]);
459 if (desc) 459 if (desc)
diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig
index d160a710d704..81275af9638b 100644
--- a/drivers/pinctrl/qcom/Kconfig
+++ b/drivers/pinctrl/qcom/Kconfig
@@ -15,6 +15,14 @@ config PINCTRL_APQ8064
15 This is the pinctrl, pinmux, pinconf and gpiolib driver for the 15 This is the pinctrl, pinmux, pinconf and gpiolib driver for the
16 Qualcomm TLMM block found in the Qualcomm APQ8064 platform. 16 Qualcomm TLMM block found in the Qualcomm APQ8064 platform.
17 17
18config PINCTRL_APQ8084
19 tristate "Qualcomm APQ8084 pin controller driver"
20 depends on GPIOLIB && OF
21 select PINCTRL_MSM
22 help
23 This is the pinctrl, pinmux, pinconf and gpiolib driver for the
24 Qualcomm TLMM block found in the Qualcomm APQ8084 platform.
25
18config PINCTRL_IPQ8064 26config PINCTRL_IPQ8064
19 tristate "Qualcomm IPQ8064 pin controller driver" 27 tristate "Qualcomm IPQ8064 pin controller driver"
20 depends on GPIOLIB && OF 28 depends on GPIOLIB && OF
diff --git a/drivers/pinctrl/qcom/Makefile b/drivers/pinctrl/qcom/Makefile
index 2a02602d715c..ba8519fcd8d3 100644
--- a/drivers/pinctrl/qcom/Makefile
+++ b/drivers/pinctrl/qcom/Makefile
@@ -1,6 +1,7 @@
1# Qualcomm pin control drivers 1# Qualcomm pin control drivers
2obj-$(CONFIG_PINCTRL_MSM) += pinctrl-msm.o 2obj-$(CONFIG_PINCTRL_MSM) += pinctrl-msm.o
3obj-$(CONFIG_PINCTRL_APQ8064) += pinctrl-apq8064.o 3obj-$(CONFIG_PINCTRL_APQ8064) += pinctrl-apq8064.o
4obj-$(CONFIG_PINCTRL_APQ8084) += pinctrl-apq8084.o
4obj-$(CONFIG_PINCTRL_IPQ8064) += pinctrl-ipq8064.o 5obj-$(CONFIG_PINCTRL_IPQ8064) += pinctrl-ipq8064.o
5obj-$(CONFIG_PINCTRL_MSM8960) += pinctrl-msm8960.o 6obj-$(CONFIG_PINCTRL_MSM8960) += pinctrl-msm8960.o
6obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o 7obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index feb6f152f9b7..c832d7d6b912 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -258,6 +258,7 @@ static const unsigned int sdc3_data_pins[] = { 95 };
258 .intr_status_bit = 0, \ 258 .intr_status_bit = 0, \
259 .intr_ack_high = 1, \ 259 .intr_ack_high = 1, \
260 .intr_target_bit = 0, \ 260 .intr_target_bit = 0, \
261 .intr_target_kpss_val = 4, \
261 .intr_raw_status_bit = 3, \ 262 .intr_raw_status_bit = 3, \
262 .intr_polarity_bit = 1, \ 263 .intr_polarity_bit = 1, \
263 .intr_detection_bit = 2, \ 264 .intr_detection_bit = 2, \
@@ -283,6 +284,7 @@ static const unsigned int sdc3_data_pins[] = { 95 };
283 .intr_enable_bit = -1, \ 284 .intr_enable_bit = -1, \
284 .intr_status_bit = -1, \ 285 .intr_status_bit = -1, \
285 .intr_target_bit = -1, \ 286 .intr_target_bit = -1, \
287 .intr_target_kpss_val = -1, \
286 .intr_raw_status_bit = -1, \ 288 .intr_raw_status_bit = -1, \
287 .intr_polarity_bit = -1, \ 289 .intr_polarity_bit = -1, \
288 .intr_detection_bit = -1, \ 290 .intr_detection_bit = -1, \
@@ -324,6 +326,7 @@ enum apq8064_functions {
324 APQ_MUX_tsif1, 326 APQ_MUX_tsif1,
325 APQ_MUX_tsif2, 327 APQ_MUX_tsif2,
326 APQ_MUX_usb2_hsic, 328 APQ_MUX_usb2_hsic,
329 APQ_MUX_ps_hold,
327 APQ_MUX_NA, 330 APQ_MUX_NA,
328}; 331};
329 332
@@ -351,6 +354,9 @@ static const char * const gpio_groups[] = {
351 "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84", 354 "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
352 "gpio85", "gpio86", "gpio87", "gpio88", "gpio89" 355 "gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
353}; 356};
357static const char * const ps_hold_groups[] = {
358 "gpio78"
359};
354static const char * const gsbi1_groups[] = { 360static const char * const gsbi1_groups[] = {
355 "gpio18", "gpio19", "gpio20", "gpio21" 361 "gpio18", "gpio19", "gpio20", "gpio21"
356}; 362};
@@ -477,6 +483,7 @@ static const struct msm_function apq8064_functions[] = {
477 FUNCTION(tsif1), 483 FUNCTION(tsif1),
478 FUNCTION(tsif2), 484 FUNCTION(tsif2),
479 FUNCTION(usb2_hsic), 485 FUNCTION(usb2_hsic),
486 FUNCTION(ps_hold),
480}; 487};
481 488
482static const struct msm_pingroup apq8064_groups[] = { 489static const struct msm_pingroup apq8064_groups[] = {
@@ -558,7 +565,7 @@ static const struct msm_pingroup apq8064_groups[] = {
558 PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 565 PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
559 PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 566 PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
560 PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 567 PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
561 PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 568 PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
562 PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 569 PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
563 PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 570 PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
564 PINGROUP(81, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 571 PINGROUP(81, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8084.c b/drivers/pinctrl/qcom/pinctrl-apq8084.c
new file mode 100644
index 000000000000..138cbf6134a5
--- /dev/null
+++ b/drivers/pinctrl/qcom/pinctrl-apq8084.c
@@ -0,0 +1,1245 @@
1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#include <linux/module.h>
16#include <linux/of.h>
17#include <linux/platform_device.h>
18#include <linux/pinctrl/pinctrl.h>
19
20#include "pinctrl-msm.h"
21
22static const struct pinctrl_pin_desc apq8084_pins[] = {
23 PINCTRL_PIN(0, "GPIO_0"),
24 PINCTRL_PIN(1, "GPIO_1"),
25 PINCTRL_PIN(2, "GPIO_2"),
26 PINCTRL_PIN(3, "GPIO_3"),
27 PINCTRL_PIN(4, "GPIO_4"),
28 PINCTRL_PIN(5, "GPIO_5"),
29 PINCTRL_PIN(6, "GPIO_6"),
30 PINCTRL_PIN(7, "GPIO_7"),
31 PINCTRL_PIN(8, "GPIO_8"),
32 PINCTRL_PIN(9, "GPIO_9"),
33 PINCTRL_PIN(10, "GPIO_10"),
34 PINCTRL_PIN(11, "GPIO_11"),
35 PINCTRL_PIN(12, "GPIO_12"),
36 PINCTRL_PIN(13, "GPIO_13"),
37 PINCTRL_PIN(14, "GPIO_14"),
38 PINCTRL_PIN(15, "GPIO_15"),
39 PINCTRL_PIN(16, "GPIO_16"),
40 PINCTRL_PIN(17, "GPIO_17"),
41 PINCTRL_PIN(18, "GPIO_18"),
42 PINCTRL_PIN(19, "GPIO_19"),
43 PINCTRL_PIN(20, "GPIO_20"),
44 PINCTRL_PIN(21, "GPIO_21"),
45 PINCTRL_PIN(22, "GPIO_22"),
46 PINCTRL_PIN(23, "GPIO_23"),
47 PINCTRL_PIN(24, "GPIO_24"),
48 PINCTRL_PIN(25, "GPIO_25"),
49 PINCTRL_PIN(26, "GPIO_26"),
50 PINCTRL_PIN(27, "GPIO_27"),
51 PINCTRL_PIN(28, "GPIO_28"),
52 PINCTRL_PIN(29, "GPIO_29"),
53 PINCTRL_PIN(30, "GPIO_30"),
54 PINCTRL_PIN(31, "GPIO_31"),
55 PINCTRL_PIN(32, "GPIO_32"),
56 PINCTRL_PIN(33, "GPIO_33"),
57 PINCTRL_PIN(34, "GPIO_34"),
58 PINCTRL_PIN(35, "GPIO_35"),
59 PINCTRL_PIN(36, "GPIO_36"),
60 PINCTRL_PIN(37, "GPIO_37"),
61 PINCTRL_PIN(38, "GPIO_38"),
62 PINCTRL_PIN(39, "GPIO_39"),
63 PINCTRL_PIN(40, "GPIO_40"),
64 PINCTRL_PIN(41, "GPIO_41"),
65 PINCTRL_PIN(42, "GPIO_42"),
66 PINCTRL_PIN(43, "GPIO_43"),
67 PINCTRL_PIN(44, "GPIO_44"),
68 PINCTRL_PIN(45, "GPIO_45"),
69 PINCTRL_PIN(46, "GPIO_46"),
70 PINCTRL_PIN(47, "GPIO_47"),
71 PINCTRL_PIN(48, "GPIO_48"),
72 PINCTRL_PIN(49, "GPIO_49"),
73 PINCTRL_PIN(50, "GPIO_50"),
74 PINCTRL_PIN(51, "GPIO_51"),
75 PINCTRL_PIN(52, "GPIO_52"),
76 PINCTRL_PIN(53, "GPIO_53"),
77 PINCTRL_PIN(54, "GPIO_54"),
78 PINCTRL_PIN(55, "GPIO_55"),
79 PINCTRL_PIN(56, "GPIO_56"),
80 PINCTRL_PIN(57, "GPIO_57"),
81 PINCTRL_PIN(58, "GPIO_58"),
82 PINCTRL_PIN(59, "GPIO_59"),
83 PINCTRL_PIN(60, "GPIO_60"),
84 PINCTRL_PIN(61, "GPIO_61"),
85 PINCTRL_PIN(62, "GPIO_62"),
86 PINCTRL_PIN(63, "GPIO_63"),
87 PINCTRL_PIN(64, "GPIO_64"),
88 PINCTRL_PIN(65, "GPIO_65"),
89 PINCTRL_PIN(66, "GPIO_66"),
90 PINCTRL_PIN(67, "GPIO_67"),
91 PINCTRL_PIN(68, "GPIO_68"),
92 PINCTRL_PIN(69, "GPIO_69"),
93 PINCTRL_PIN(70, "GPIO_70"),
94 PINCTRL_PIN(71, "GPIO_71"),
95 PINCTRL_PIN(72, "GPIO_72"),
96 PINCTRL_PIN(73, "GPIO_73"),
97 PINCTRL_PIN(74, "GPIO_74"),
98 PINCTRL_PIN(75, "GPIO_75"),
99 PINCTRL_PIN(76, "GPIO_76"),
100 PINCTRL_PIN(77, "GPIO_77"),
101 PINCTRL_PIN(78, "GPIO_78"),
102 PINCTRL_PIN(79, "GPIO_79"),
103 PINCTRL_PIN(80, "GPIO_80"),
104 PINCTRL_PIN(81, "GPIO_81"),
105 PINCTRL_PIN(82, "GPIO_82"),
106 PINCTRL_PIN(83, "GPIO_83"),
107 PINCTRL_PIN(84, "GPIO_84"),
108 PINCTRL_PIN(85, "GPIO_85"),
109 PINCTRL_PIN(86, "GPIO_86"),
110 PINCTRL_PIN(87, "GPIO_87"),
111 PINCTRL_PIN(88, "GPIO_88"),
112 PINCTRL_PIN(89, "GPIO_89"),
113 PINCTRL_PIN(90, "GPIO_90"),
114 PINCTRL_PIN(91, "GPIO_91"),
115 PINCTRL_PIN(92, "GPIO_92"),
116 PINCTRL_PIN(93, "GPIO_93"),
117 PINCTRL_PIN(94, "GPIO_94"),
118 PINCTRL_PIN(95, "GPIO_95"),
119 PINCTRL_PIN(96, "GPIO_96"),
120 PINCTRL_PIN(97, "GPIO_97"),
121 PINCTRL_PIN(98, "GPIO_98"),
122 PINCTRL_PIN(99, "GPIO_99"),
123 PINCTRL_PIN(100, "GPIO_100"),
124 PINCTRL_PIN(101, "GPIO_101"),
125 PINCTRL_PIN(102, "GPIO_102"),
126 PINCTRL_PIN(103, "GPIO_103"),
127 PINCTRL_PIN(104, "GPIO_104"),
128 PINCTRL_PIN(105, "GPIO_105"),
129 PINCTRL_PIN(106, "GPIO_106"),
130 PINCTRL_PIN(107, "GPIO_107"),
131 PINCTRL_PIN(108, "GPIO_108"),
132 PINCTRL_PIN(109, "GPIO_109"),
133 PINCTRL_PIN(110, "GPIO_110"),
134 PINCTRL_PIN(111, "GPIO_111"),
135 PINCTRL_PIN(112, "GPIO_112"),
136 PINCTRL_PIN(113, "GPIO_113"),
137 PINCTRL_PIN(114, "GPIO_114"),
138 PINCTRL_PIN(115, "GPIO_115"),
139 PINCTRL_PIN(116, "GPIO_116"),
140 PINCTRL_PIN(117, "GPIO_117"),
141 PINCTRL_PIN(118, "GPIO_118"),
142 PINCTRL_PIN(119, "GPIO_119"),
143 PINCTRL_PIN(120, "GPIO_120"),
144 PINCTRL_PIN(121, "GPIO_121"),
145 PINCTRL_PIN(122, "GPIO_122"),
146 PINCTRL_PIN(123, "GPIO_123"),
147 PINCTRL_PIN(124, "GPIO_124"),
148 PINCTRL_PIN(125, "GPIO_125"),
149 PINCTRL_PIN(126, "GPIO_126"),
150 PINCTRL_PIN(127, "GPIO_127"),
151 PINCTRL_PIN(128, "GPIO_128"),
152 PINCTRL_PIN(129, "GPIO_129"),
153 PINCTRL_PIN(130, "GPIO_130"),
154 PINCTRL_PIN(131, "GPIO_131"),
155 PINCTRL_PIN(132, "GPIO_132"),
156 PINCTRL_PIN(133, "GPIO_133"),
157 PINCTRL_PIN(134, "GPIO_134"),
158 PINCTRL_PIN(135, "GPIO_135"),
159 PINCTRL_PIN(136, "GPIO_136"),
160 PINCTRL_PIN(137, "GPIO_137"),
161 PINCTRL_PIN(138, "GPIO_138"),
162 PINCTRL_PIN(139, "GPIO_139"),
163 PINCTRL_PIN(140, "GPIO_140"),
164 PINCTRL_PIN(141, "GPIO_141"),
165 PINCTRL_PIN(142, "GPIO_142"),
166 PINCTRL_PIN(143, "GPIO_143"),
167 PINCTRL_PIN(144, "GPIO_144"),
168 PINCTRL_PIN(145, "GPIO_145"),
169 PINCTRL_PIN(146, "GPIO_146"),
170
171 PINCTRL_PIN(147, "SDC1_CLK"),
172 PINCTRL_PIN(148, "SDC1_CMD"),
173 PINCTRL_PIN(149, "SDC1_DATA"),
174 PINCTRL_PIN(150, "SDC2_CLK"),
175 PINCTRL_PIN(151, "SDC2_CMD"),
176 PINCTRL_PIN(152, "SDC2_DATA"),
177};
178
179#define DECLARE_APQ_GPIO_PINS(pin) static const unsigned int gpio##pin##_pins[] = { pin }
180
181DECLARE_APQ_GPIO_PINS(0);
182DECLARE_APQ_GPIO_PINS(1);
183DECLARE_APQ_GPIO_PINS(2);
184DECLARE_APQ_GPIO_PINS(3);
185DECLARE_APQ_GPIO_PINS(4);
186DECLARE_APQ_GPIO_PINS(5);
187DECLARE_APQ_GPIO_PINS(6);
188DECLARE_APQ_GPIO_PINS(7);
189DECLARE_APQ_GPIO_PINS(8);
190DECLARE_APQ_GPIO_PINS(9);
191DECLARE_APQ_GPIO_PINS(10);
192DECLARE_APQ_GPIO_PINS(11);
193DECLARE_APQ_GPIO_PINS(12);
194DECLARE_APQ_GPIO_PINS(13);
195DECLARE_APQ_GPIO_PINS(14);
196DECLARE_APQ_GPIO_PINS(15);
197DECLARE_APQ_GPIO_PINS(16);
198DECLARE_APQ_GPIO_PINS(17);
199DECLARE_APQ_GPIO_PINS(18);
200DECLARE_APQ_GPIO_PINS(19);
201DECLARE_APQ_GPIO_PINS(20);
202DECLARE_APQ_GPIO_PINS(21);
203DECLARE_APQ_GPIO_PINS(22);
204DECLARE_APQ_GPIO_PINS(23);
205DECLARE_APQ_GPIO_PINS(24);
206DECLARE_APQ_GPIO_PINS(25);
207DECLARE_APQ_GPIO_PINS(26);
208DECLARE_APQ_GPIO_PINS(27);
209DECLARE_APQ_GPIO_PINS(28);
210DECLARE_APQ_GPIO_PINS(29);
211DECLARE_APQ_GPIO_PINS(30);
212DECLARE_APQ_GPIO_PINS(31);
213DECLARE_APQ_GPIO_PINS(32);
214DECLARE_APQ_GPIO_PINS(33);
215DECLARE_APQ_GPIO_PINS(34);
216DECLARE_APQ_GPIO_PINS(35);
217DECLARE_APQ_GPIO_PINS(36);
218DECLARE_APQ_GPIO_PINS(37);
219DECLARE_APQ_GPIO_PINS(38);
220DECLARE_APQ_GPIO_PINS(39);
221DECLARE_APQ_GPIO_PINS(40);
222DECLARE_APQ_GPIO_PINS(41);
223DECLARE_APQ_GPIO_PINS(42);
224DECLARE_APQ_GPIO_PINS(43);
225DECLARE_APQ_GPIO_PINS(44);
226DECLARE_APQ_GPIO_PINS(45);
227DECLARE_APQ_GPIO_PINS(46);
228DECLARE_APQ_GPIO_PINS(47);
229DECLARE_APQ_GPIO_PINS(48);
230DECLARE_APQ_GPIO_PINS(49);
231DECLARE_APQ_GPIO_PINS(50);
232DECLARE_APQ_GPIO_PINS(51);
233DECLARE_APQ_GPIO_PINS(52);
234DECLARE_APQ_GPIO_PINS(53);
235DECLARE_APQ_GPIO_PINS(54);
236DECLARE_APQ_GPIO_PINS(55);
237DECLARE_APQ_GPIO_PINS(56);
238DECLARE_APQ_GPIO_PINS(57);
239DECLARE_APQ_GPIO_PINS(58);
240DECLARE_APQ_GPIO_PINS(59);
241DECLARE_APQ_GPIO_PINS(60);
242DECLARE_APQ_GPIO_PINS(61);
243DECLARE_APQ_GPIO_PINS(62);
244DECLARE_APQ_GPIO_PINS(63);
245DECLARE_APQ_GPIO_PINS(64);
246DECLARE_APQ_GPIO_PINS(65);
247DECLARE_APQ_GPIO_PINS(66);
248DECLARE_APQ_GPIO_PINS(67);
249DECLARE_APQ_GPIO_PINS(68);
250DECLARE_APQ_GPIO_PINS(69);
251DECLARE_APQ_GPIO_PINS(70);
252DECLARE_APQ_GPIO_PINS(71);
253DECLARE_APQ_GPIO_PINS(72);
254DECLARE_APQ_GPIO_PINS(73);
255DECLARE_APQ_GPIO_PINS(74);
256DECLARE_APQ_GPIO_PINS(75);
257DECLARE_APQ_GPIO_PINS(76);
258DECLARE_APQ_GPIO_PINS(77);
259DECLARE_APQ_GPIO_PINS(78);
260DECLARE_APQ_GPIO_PINS(79);
261DECLARE_APQ_GPIO_PINS(80);
262DECLARE_APQ_GPIO_PINS(81);
263DECLARE_APQ_GPIO_PINS(82);
264DECLARE_APQ_GPIO_PINS(83);
265DECLARE_APQ_GPIO_PINS(84);
266DECLARE_APQ_GPIO_PINS(85);
267DECLARE_APQ_GPIO_PINS(86);
268DECLARE_APQ_GPIO_PINS(87);
269DECLARE_APQ_GPIO_PINS(88);
270DECLARE_APQ_GPIO_PINS(89);
271DECLARE_APQ_GPIO_PINS(90);
272DECLARE_APQ_GPIO_PINS(91);
273DECLARE_APQ_GPIO_PINS(92);
274DECLARE_APQ_GPIO_PINS(93);
275DECLARE_APQ_GPIO_PINS(94);
276DECLARE_APQ_GPIO_PINS(95);
277DECLARE_APQ_GPIO_PINS(96);
278DECLARE_APQ_GPIO_PINS(97);
279DECLARE_APQ_GPIO_PINS(98);
280DECLARE_APQ_GPIO_PINS(99);
281DECLARE_APQ_GPIO_PINS(100);
282DECLARE_APQ_GPIO_PINS(101);
283DECLARE_APQ_GPIO_PINS(102);
284DECLARE_APQ_GPIO_PINS(103);
285DECLARE_APQ_GPIO_PINS(104);
286DECLARE_APQ_GPIO_PINS(105);
287DECLARE_APQ_GPIO_PINS(106);
288DECLARE_APQ_GPIO_PINS(107);
289DECLARE_APQ_GPIO_PINS(108);
290DECLARE_APQ_GPIO_PINS(109);
291DECLARE_APQ_GPIO_PINS(110);
292DECLARE_APQ_GPIO_PINS(111);
293DECLARE_APQ_GPIO_PINS(112);
294DECLARE_APQ_GPIO_PINS(113);
295DECLARE_APQ_GPIO_PINS(114);
296DECLARE_APQ_GPIO_PINS(115);
297DECLARE_APQ_GPIO_PINS(116);
298DECLARE_APQ_GPIO_PINS(117);
299DECLARE_APQ_GPIO_PINS(118);
300DECLARE_APQ_GPIO_PINS(119);
301DECLARE_APQ_GPIO_PINS(120);
302DECLARE_APQ_GPIO_PINS(121);
303DECLARE_APQ_GPIO_PINS(122);
304DECLARE_APQ_GPIO_PINS(123);
305DECLARE_APQ_GPIO_PINS(124);
306DECLARE_APQ_GPIO_PINS(125);
307DECLARE_APQ_GPIO_PINS(126);
308DECLARE_APQ_GPIO_PINS(127);
309DECLARE_APQ_GPIO_PINS(128);
310DECLARE_APQ_GPIO_PINS(129);
311DECLARE_APQ_GPIO_PINS(130);
312DECLARE_APQ_GPIO_PINS(131);
313DECLARE_APQ_GPIO_PINS(132);
314DECLARE_APQ_GPIO_PINS(133);
315DECLARE_APQ_GPIO_PINS(134);
316DECLARE_APQ_GPIO_PINS(135);
317DECLARE_APQ_GPIO_PINS(136);
318DECLARE_APQ_GPIO_PINS(137);
319DECLARE_APQ_GPIO_PINS(138);
320DECLARE_APQ_GPIO_PINS(139);
321DECLARE_APQ_GPIO_PINS(140);
322DECLARE_APQ_GPIO_PINS(141);
323DECLARE_APQ_GPIO_PINS(142);
324DECLARE_APQ_GPIO_PINS(143);
325DECLARE_APQ_GPIO_PINS(144);
326DECLARE_APQ_GPIO_PINS(145);
327DECLARE_APQ_GPIO_PINS(146);
328
329static const unsigned int sdc1_clk_pins[] = { 147 };
330static const unsigned int sdc1_cmd_pins[] = { 148 };
331static const unsigned int sdc1_data_pins[] = { 149 };
332static const unsigned int sdc2_clk_pins[] = { 150 };
333static const unsigned int sdc2_cmd_pins[] = { 151 };
334static const unsigned int sdc2_data_pins[] = { 152 };
335
336#define FUNCTION(fname) \
337 [APQ_MUX_##fname] = { \
338 .name = #fname, \
339 .groups = fname##_groups, \
340 .ngroups = ARRAY_SIZE(fname##_groups), \
341 }
342
343#define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7) \
344 { \
345 .name = "gpio" #id, \
346 .pins = gpio##id##_pins, \
347 .npins = ARRAY_SIZE(gpio##id##_pins), \
348 .funcs = (int[]){ \
349 APQ_MUX_gpio, \
350 APQ_MUX_##f1, \
351 APQ_MUX_##f2, \
352 APQ_MUX_##f3, \
353 APQ_MUX_##f4, \
354 APQ_MUX_##f5, \
355 APQ_MUX_##f6, \
356 APQ_MUX_##f7 \
357 }, \
358 .nfuncs = 8, \
359 .ctl_reg = 0x1000 + 0x10 * id, \
360 .io_reg = 0x1004 + 0x10 * id, \
361 .intr_cfg_reg = 0x1008 + 0x10 * id, \
362 .intr_status_reg = 0x100c + 0x10 * id, \
363 .intr_target_reg = 0x1008 + 0x10 * id, \
364 .mux_bit = 2, \
365 .pull_bit = 0, \
366 .drv_bit = 6, \
367 .oe_bit = 9, \
368 .in_bit = 0, \
369 .out_bit = 1, \
370 .intr_enable_bit = 0, \
371 .intr_status_bit = 0, \
372 .intr_ack_high = 0, \
373 .intr_target_bit = 5, \
374 .intr_target_kpss_val = 3, \
375 .intr_raw_status_bit = 4, \
376 .intr_polarity_bit = 1, \
377 .intr_detection_bit = 2, \
378 .intr_detection_width = 2, \
379 }
380
381#define SDC_PINGROUP(pg_name, ctl, pull, drv) \
382 { \
383 .name = #pg_name, \
384 .pins = pg_name##_pins, \
385 .npins = ARRAY_SIZE(pg_name##_pins), \
386 .ctl_reg = ctl, \
387 .io_reg = 0, \
388 .intr_cfg_reg = 0, \
389 .intr_status_reg = 0, \
390 .intr_target_reg = 0, \
391 .mux_bit = -1, \
392 .pull_bit = pull, \
393 .drv_bit = drv, \
394 .oe_bit = -1, \
395 .in_bit = -1, \
396 .out_bit = -1, \
397 .intr_enable_bit = -1, \
398 .intr_status_bit = -1, \
399 .intr_target_bit = -1, \
400 .intr_target_kpss_val = -1, \
401 .intr_raw_status_bit = -1, \
402 .intr_polarity_bit = -1, \
403 .intr_detection_bit = -1, \
404 .intr_detection_width = -1, \
405 }
406
407enum apq8084_functions {
408 APQ_MUX_adsp_ext,
409 APQ_MUX_audio_ref,
410 APQ_MUX_blsp_i2c1,
411 APQ_MUX_blsp_i2c2,
412 APQ_MUX_blsp_i2c3,
413 APQ_MUX_blsp_i2c4,
414 APQ_MUX_blsp_i2c5,
415 APQ_MUX_blsp_i2c6,
416 APQ_MUX_blsp_i2c7,
417 APQ_MUX_blsp_i2c8,
418 APQ_MUX_blsp_i2c9,
419 APQ_MUX_blsp_i2c10,
420 APQ_MUX_blsp_i2c11,
421 APQ_MUX_blsp_i2c12,
422 APQ_MUX_blsp_spi1,
423 APQ_MUX_blsp_spi1_cs1,
424 APQ_MUX_blsp_spi1_cs2,
425 APQ_MUX_blsp_spi1_cs3,
426 APQ_MUX_blsp_spi2,
427 APQ_MUX_blsp_spi3,
428 APQ_MUX_blsp_spi3_cs1,
429 APQ_MUX_blsp_spi3_cs2,
430 APQ_MUX_blsp_spi3_cs3,
431 APQ_MUX_blsp_spi4,
432 APQ_MUX_blsp_spi5,
433 APQ_MUX_blsp_spi6,
434 APQ_MUX_blsp_spi7,
435 APQ_MUX_blsp_spi8,
436 APQ_MUX_blsp_spi9,
437 APQ_MUX_blsp_spi10,
438 APQ_MUX_blsp_spi10_cs1,
439 APQ_MUX_blsp_spi10_cs2,
440 APQ_MUX_blsp_spi10_cs3,
441 APQ_MUX_blsp_spi11,
442 APQ_MUX_blsp_spi12,
443 APQ_MUX_blsp_uart1,
444 APQ_MUX_blsp_uart2,
445 APQ_MUX_blsp_uart3,
446 APQ_MUX_blsp_uart4,
447 APQ_MUX_blsp_uart5,
448 APQ_MUX_blsp_uart6,
449 APQ_MUX_blsp_uart7,
450 APQ_MUX_blsp_uart8,
451 APQ_MUX_blsp_uart9,
452 APQ_MUX_blsp_uart10,
453 APQ_MUX_blsp_uart11,
454 APQ_MUX_blsp_uart12,
455 APQ_MUX_blsp_uim1,
456 APQ_MUX_blsp_uim2,
457 APQ_MUX_blsp_uim3,
458 APQ_MUX_blsp_uim4,
459 APQ_MUX_blsp_uim5,
460 APQ_MUX_blsp_uim6,
461 APQ_MUX_blsp_uim7,
462 APQ_MUX_blsp_uim8,
463 APQ_MUX_blsp_uim9,
464 APQ_MUX_blsp_uim10,
465 APQ_MUX_blsp_uim11,
466 APQ_MUX_blsp_uim12,
467 APQ_MUX_cam_mclk0,
468 APQ_MUX_cam_mclk1,
469 APQ_MUX_cam_mclk2,
470 APQ_MUX_cam_mclk3,
471 APQ_MUX_cci_async,
472 APQ_MUX_cci_async_in0,
473 APQ_MUX_cci_i2c0,
474 APQ_MUX_cci_i2c1,
475 APQ_MUX_cci_timer0,
476 APQ_MUX_cci_timer1,
477 APQ_MUX_cci_timer2,
478 APQ_MUX_cci_timer3,
479 APQ_MUX_cci_timer4,
480 APQ_MUX_edp_hpd,
481 APQ_MUX_gcc_gp1,
482 APQ_MUX_gcc_gp2,
483 APQ_MUX_gcc_gp3,
484 APQ_MUX_gcc_obt,
485 APQ_MUX_gcc_vtt,
486 APQ_MUX_gp_mn,
487 APQ_MUX_gp_pdm0,
488 APQ_MUX_gp_pdm1,
489 APQ_MUX_gp_pdm2,
490 APQ_MUX_gp0_clk,
491 APQ_MUX_gp1_clk,
492 APQ_MUX_gpio,
493 APQ_MUX_hdmi_cec,
494 APQ_MUX_hdmi_ddc,
495 APQ_MUX_hdmi_dtest,
496 APQ_MUX_hdmi_hpd,
497 APQ_MUX_hdmi_rcv,
498 APQ_MUX_hsic,
499 APQ_MUX_ldo_en,
500 APQ_MUX_ldo_update,
501 APQ_MUX_mdp_vsync,
502 APQ_MUX_pci_e0,
503 APQ_MUX_pci_e0_n,
504 APQ_MUX_pci_e0_rst,
505 APQ_MUX_pci_e1,
506 APQ_MUX_pci_e1_rst,
507 APQ_MUX_pci_e1_rst_n,
508 APQ_MUX_pci_e1_clkreq_n,
509 APQ_MUX_pri_mi2s,
510 APQ_MUX_qua_mi2s,
511 APQ_MUX_sata_act,
512 APQ_MUX_sata_devsleep,
513 APQ_MUX_sata_devsleep_n,
514 APQ_MUX_sd_write,
515 APQ_MUX_sdc_emmc_mode,
516 APQ_MUX_sdc3,
517 APQ_MUX_sdc4,
518 APQ_MUX_sec_mi2s,
519 APQ_MUX_slimbus,
520 APQ_MUX_spdif_tx,
521 APQ_MUX_spkr_i2s,
522 APQ_MUX_spkr_i2s_ws,
523 APQ_MUX_spss_geni,
524 APQ_MUX_ter_mi2s,
525 APQ_MUX_tsif1,
526 APQ_MUX_tsif2,
527 APQ_MUX_uim,
528 APQ_MUX_uim_batt_alarm,
529 APQ_MUX_NA,
530};
531
532static const char * const gpio_groups[] = {
533 "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
534 "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
535 "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
536 "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
537 "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
538 "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
539 "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
540 "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
541 "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
542 "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
543 "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
544 "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
545 "gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
546 "gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
547 "gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
548 "gpio105", "gpio106", "gpio107", "gpio108", "gpio109", "gpio110",
549 "gpio111", "gpio112", "gpio113", "gpio114", "gpio115", "gpio116",
550 "gpio117", "gpio118", "gpio119", "gpio120", "gpio121", "gpio122",
551 "gpio123", "gpio124", "gpio125", "gpio126", "gpio127", "gpio128",
552 "gpio129", "gpio130", "gpio131", "gpio132", "gpio133", "gpio134",
553 "gpio135", "gpio136", "gpio137", "gpio138", "gpio139", "gpio140",
554 "gpio141", "gpio142", "gpio143", "gpio144", "gpio145", "gpio146"
555};
556
557static const char * const adsp_ext_groups[] = {
558 "gpio34"
559};
560static const char * const audio_ref_groups[] = {
561 "gpio100"
562};
563static const char * const blsp_i2c1_groups[] = {
564 "gpio2", "gpio3"
565};
566static const char * const blsp_i2c2_groups[] = {
567 "gpio6", "gpio7"
568};
569static const char * const blsp_i2c3_groups[] = {
570 "gpio10", "gpio11"
571};
572static const char * const blsp_i2c4_groups[] = {
573 "gpio29", "gpio30"
574};
575static const char * const blsp_i2c5_groups[] = {
576 "gpio41", "gpio42"
577};
578static const char * const blsp_i2c6_groups[] = {
579 "gpio45", "gpio46"
580};
581static const char * const blsp_i2c7_groups[] = {
582 "gpio132", "gpio133"
583};
584static const char * const blsp_i2c8_groups[] = {
585 "gpio53", "gpio54"
586};
587static const char * const blsp_i2c9_groups[] = {
588 "gpio57", "gpio58"
589};
590static const char * const blsp_i2c10_groups[] = {
591 "gpio61", "gpio62"
592};
593static const char * const blsp_i2c11_groups[] = {
594 "gpio65", "gpio66"
595};
596static const char * const blsp_i2c12_groups[] = {
597 "gpio49", "gpio50"
598};
599static const char * const blsp_spi1_groups[] = {
600 "gpio0", "gpio1", "gpio2", "gpio3"
601};
602static const char * const blsp_spi2_groups[] = {
603 "gpio4", "gpio5", "gpio6", "gpio7"
604};
605static const char * const blsp_spi3_groups[] = {
606 "gpio8", "gpio9", "gpio10", "gpio11"
607};
608static const char * const blsp_spi4_groups[] = {
609 "gpio27", "gpio28", "gpio29", "gpio30"
610};
611static const char * const blsp_spi5_groups[] = {
612 "gpio39", "gpio40", "gpio41", "gpio42"
613};
614static const char * const blsp_spi6_groups[] = {
615 "gpio43", "gpio44", "gpio45", "gpio46"
616};
617static const char * const blsp_spi7_groups[] = {
618 "gpio130", "gpio131", "gpio132", "gpio133"
619};
620static const char * const blsp_spi8_groups[] = {
621 "gpio51", "gpio52", "gpio53", "gpio54"
622};
623static const char * const blsp_spi9_groups[] = {
624 "gpio55", "gpio56", "gpio57", "gpio58"
625};
626static const char * const blsp_spi10_groups[] = {
627 "gpio59", "gpio60", "gpio61", "gpio62"
628};
629static const char * const blsp_spi11_groups[] = {
630 "gpio63", "gpio64", "gpio65", "gpio66"
631};
632static const char * const blsp_spi12_groups[] = {
633 "gpio47", "gpio48", "gpio49", "gpio50"
634};
635static const char * const blsp_uart1_groups[] = {
636 "gpio0", "gpio1", "gpio2", "gpio3"
637};
638static const char * const blsp_uart2_groups[] = {
639 "gpio4", "gpio5", "gpio6", "gpio7"
640};
641static const char * const blsp_uart3_groups[] = {
642 "gpio8"
643};
644static const char * const blsp_uart4_groups[] = {
645 "gpio27", "gpio28", "gpio29", "gpio30"
646};
647static const char * const blsp_uart5_groups[] = {
648 "gpio39", "gpio40", "gpio41", "gpio42"
649};
650static const char * const blsp_uart6_groups[] = {
651 "gpio43", "gpio44", "gpio45", "gpio46"
652};
653static const char * const blsp_uart7_groups[] = {
654 "gpio130", "gpio131", "gpio132", "gpio133"
655};
656static const char * const blsp_uart8_groups[] = {
657 "gpio51", "gpio52", "gpio53", "gpio54"
658};
659static const char * const blsp_uart9_groups[] = {
660 "gpio55", "gpio56", "gpio57", "gpio58"
661};
662static const char * const blsp_uart10_groups[] = {
663 "gpio59", "gpio60", "gpio61", "gpio62"
664};
665static const char * const blsp_uart11_groups[] = {
666 "gpio63", "gpio64", "gpio65", "gpio66"
667};
668static const char * const blsp_uart12_groups[] = {
669 "gpio47", "gpio48", "gpio49", "gpio50"
670};
671static const char * const blsp_uim1_groups[] = {
672 "gpio0", "gpio1"
673};
674static const char * const blsp_uim2_groups[] = {
675 "gpio4", "gpio5"
676};
677static const char * const blsp_uim3_groups[] = {
678 "gpio8", "gpio9"
679};
680static const char * const blsp_uim4_groups[] = {
681 "gpio27", "gpio28"
682};
683static const char * const blsp_uim5_groups[] = {
684 "gpio39", "gpio40"
685};
686static const char * const blsp_uim6_groups[] = {
687 "gpio43", "gpio44"
688};
689static const char * const blsp_uim7_groups[] = {
690 "gpio130", "gpio131"
691};
692static const char * const blsp_uim8_groups[] = {
693 "gpio51", "gpio52"
694};
695static const char * const blsp_uim9_groups[] = {
696 "gpio55", "gpio56"
697};
698static const char * const blsp_uim10_groups[] = {
699 "gpio59", "gpio60"
700};
701static const char * const blsp_uim11_groups[] = {
702 "gpio63", "gpio64"
703};
704static const char * const blsp_uim12_groups[] = {
705 "gpio47", "gpio48"
706};
707static const char * const blsp_spi1_cs1_groups[] = {
708 "gpio116"
709};
710static const char * const blsp_spi1_cs2_groups[] = {
711 "gpio117"
712};
713static const char * const blsp_spi1_cs3_groups[] = {
714 "gpio118"
715};
716static const char * const blsp_spi3_cs1_groups[] = {
717 "gpio67"
718};
719static const char * const blsp_spi3_cs2_groups[] = {
720 "gpio71"
721};
722static const char * const blsp_spi3_cs3_groups[] = {
723 "gpio72"
724};
725static const char * const blsp_spi10_cs1_groups[] = {
726 "gpio106"
727};
728static const char * const blsp_spi10_cs2_groups[] = {
729 "gpio111"
730};
731static const char * const blsp_spi10_cs3_groups[] = {
732 "gpio128"
733};
734static const char * const cam_mclk0_groups[] = {
735 "gpio15"
736};
737static const char * const cam_mclk1_groups[] = {
738 "gpio16"
739};
740static const char * const cam_mclk2_groups[] = {
741 "gpio17"
742};
743static const char * const cam_mclk3_groups[] = {
744 "gpio18"
745};
746static const char * const cci_async_groups[] = {
747 "gpio26", "gpio119"
748};
749static const char * const cci_async_in0_groups[] = {
750 "gpio120"
751};
752static const char * const cci_i2c0_groups[] = {
753 "gpio19", "gpio20"
754};
755static const char * const cci_i2c1_groups[] = {
756 "gpio21", "gpio22"
757};
758static const char * const cci_timer0_groups[] = {
759 "gpio23"
760};
761static const char * const cci_timer1_groups[] = {
762 "gpio24"
763};
764static const char * const cci_timer2_groups[] = {
765 "gpio25"
766};
767static const char * const cci_timer3_groups[] = {
768 "gpio26"
769};
770static const char * const cci_timer4_groups[] = {
771 "gpio119"
772};
773static const char * const edp_hpd_groups[] = {
774 "gpio103"
775};
776static const char * const gcc_gp1_groups[] = {
777 "gpio37"
778};
779static const char * const gcc_gp2_groups[] = {
780 "gpio38"
781};
782static const char * const gcc_gp3_groups[] = {
783 "gpio86"
784};
785static const char * const gcc_obt_groups[] = {
786 "gpio127"
787};
788static const char * const gcc_vtt_groups[] = {
789 "gpio126"
790};
791static const char * const gp_mn_groups[] = {
792 "gpio29"
793};
794static const char * const gp_pdm0_groups[] = {
795 "gpio48", "gpio83"
796};
797static const char * const gp_pdm1_groups[] = {
798 "gpio84", "gpio101"
799};
800static const char * const gp_pdm2_groups[] = {
801 "gpio85", "gpio110"
802};
803static const char * const gp0_clk_groups[] = {
804 "gpio25"
805};
806static const char * const gp1_clk_groups[] = {
807 "gpio26"
808};
809static const char * const hdmi_cec_groups[] = {
810 "gpio31"
811};
812static const char * const hdmi_ddc_groups[] = {
813 "gpio32", "gpio33"
814};
815static const char * const hdmi_dtest_groups[] = {
816 "gpio123"
817};
818static const char * const hdmi_hpd_groups[] = {
819 "gpio34"
820};
821static const char * const hdmi_rcv_groups[] = {
822 "gpio125"
823};
824static const char * const hsic_groups[] = {
825 "gpio134", "gpio135"
826};
827static const char * const ldo_en_groups[] = {
828 "gpio124"
829};
830static const char * const ldo_update_groups[] = {
831 "gpio125"
832};
833static const char * const mdp_vsync_groups[] = {
834 "gpio12", "gpio13", "gpio14"
835};
836static const char * const pci_e0_groups[] = {
837 "gpio68", "gpio70"
838};
839static const char * const pci_e0_n_groups[] = {
840 "gpio68", "gpio70"
841};
842static const char * const pci_e0_rst_groups[] = {
843 "gpio70"
844};
845static const char * const pci_e1_groups[] = {
846 "gpio140"
847};
848static const char * const pci_e1_rst_groups[] = {
849 "gpio140"
850};
851static const char * const pci_e1_rst_n_groups[] = {
852 "gpio140"
853};
854static const char * const pci_e1_clkreq_n_groups[] = {
855 "gpio141"
856};
857static const char * const pri_mi2s_groups[] = {
858 "gpio76", "gpio77", "gpio78", "gpio79", "gpio80"
859};
860static const char * const qua_mi2s_groups[] = {
861 "gpio91", "gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97"
862};
863static const char * const sata_act_groups[] = {
864 "gpio129"
865};
866static const char * const sata_devsleep_groups[] = {
867 "gpio119"
868};
869static const char * const sata_devsleep_n_groups[] = {
870 "gpio119"
871};
872static const char * const sd_write_groups[] = {
873 "gpio75"
874};
875static const char * const sdc_emmc_mode_groups[] = {
876 "gpio146"
877};
878static const char * const sdc3_groups[] = {
879 "gpio67", "gpio68", "gpio69", "gpio70", "gpio71", "gpio72"
880};
881static const char * const sdc4_groups[] = {
882 "gpio82", "gpio83", "gpio84", "gpio85", "gpio86",
883 "gpio91", "gpio95", "gpio96", "gpio97", "gpio101"
884};
885static const char * const sec_mi2s_groups[] = {
886 "gpio81", "gpio82", "gpio83", "gpio84", "gpio85"
887};
888static const char * const slimbus_groups[] = {
889 "gpio98", "gpio99"
890};
891static const char * const spdif_tx_groups[] = {
892 "gpio124", "gpio136", "gpio142"
893};
894static const char * const spkr_i2s_groups[] = {
895 "gpio98", "gpio99", "gpio100"
896};
897static const char * const spkr_i2s_ws_groups[] = {
898 "gpio104"
899};
900static const char * const spss_geni_groups[] = {
901 "gpio8", "gpio9"
902};
903static const char * const ter_mi2s_groups[] = {
904 "gpio86", "gpio87", "gpio88", "gpio89", "gpio90"
905};
906static const char * const tsif1_groups[] = {
907 "gpio82", "gpio83", "gpio84", "gpio85", "gpio86"
908};
909static const char * const tsif2_groups[] = {
910 "gpio91", "gpio95", "gpio96", "gpio97", "gpio101"
911};
912static const char * const uim_groups[] = {
913 "gpio130", "gpio131", "gpio132", "gpio133"
914};
915static const char * const uim_batt_alarm_groups[] = {
916 "gpio102"
917};
918static const struct msm_function apq8084_functions[] = {
919 FUNCTION(adsp_ext),
920 FUNCTION(audio_ref),
921 FUNCTION(blsp_i2c1),
922 FUNCTION(blsp_i2c2),
923 FUNCTION(blsp_i2c3),
924 FUNCTION(blsp_i2c4),
925 FUNCTION(blsp_i2c5),
926 FUNCTION(blsp_i2c6),
927 FUNCTION(blsp_i2c7),
928 FUNCTION(blsp_i2c8),
929 FUNCTION(blsp_i2c9),
930 FUNCTION(blsp_i2c10),
931 FUNCTION(blsp_i2c11),
932 FUNCTION(blsp_i2c12),
933 FUNCTION(blsp_spi1),
934 FUNCTION(blsp_spi1_cs1),
935 FUNCTION(blsp_spi1_cs2),
936 FUNCTION(blsp_spi1_cs3),
937 FUNCTION(blsp_spi2),
938 FUNCTION(blsp_spi3),
939 FUNCTION(blsp_spi3_cs1),
940 FUNCTION(blsp_spi3_cs2),
941 FUNCTION(blsp_spi3_cs3),
942 FUNCTION(blsp_spi4),
943 FUNCTION(blsp_spi5),
944 FUNCTION(blsp_spi6),
945 FUNCTION(blsp_spi7),
946 FUNCTION(blsp_spi8),
947 FUNCTION(blsp_spi9),
948 FUNCTION(blsp_spi10),
949 FUNCTION(blsp_spi10_cs1),
950 FUNCTION(blsp_spi10_cs2),
951 FUNCTION(blsp_spi10_cs3),
952 FUNCTION(blsp_spi11),
953 FUNCTION(blsp_spi12),
954 FUNCTION(blsp_uart1),
955 FUNCTION(blsp_uart2),
956 FUNCTION(blsp_uart3),
957 FUNCTION(blsp_uart4),
958 FUNCTION(blsp_uart5),
959 FUNCTION(blsp_uart6),
960 FUNCTION(blsp_uart7),
961 FUNCTION(blsp_uart8),
962 FUNCTION(blsp_uart9),
963 FUNCTION(blsp_uart10),
964 FUNCTION(blsp_uart11),
965 FUNCTION(blsp_uart12),
966 FUNCTION(blsp_uim1),
967 FUNCTION(blsp_uim2),
968 FUNCTION(blsp_uim3),
969 FUNCTION(blsp_uim4),
970 FUNCTION(blsp_uim5),
971 FUNCTION(blsp_uim6),
972 FUNCTION(blsp_uim7),
973 FUNCTION(blsp_uim8),
974 FUNCTION(blsp_uim9),
975 FUNCTION(blsp_uim10),
976 FUNCTION(blsp_uim11),
977 FUNCTION(blsp_uim12),
978 FUNCTION(cam_mclk0),
979 FUNCTION(cam_mclk1),
980 FUNCTION(cam_mclk2),
981 FUNCTION(cam_mclk3),
982 FUNCTION(cci_async),
983 FUNCTION(cci_async_in0),
984 FUNCTION(cci_i2c0),
985 FUNCTION(cci_i2c1),
986 FUNCTION(cci_timer0),
987 FUNCTION(cci_timer1),
988 FUNCTION(cci_timer2),
989 FUNCTION(cci_timer3),
990 FUNCTION(cci_timer4),
991 FUNCTION(edp_hpd),
992 FUNCTION(gcc_gp1),
993 FUNCTION(gcc_gp2),
994 FUNCTION(gcc_gp3),
995 FUNCTION(gcc_obt),
996 FUNCTION(gcc_vtt),
997 FUNCTION(gp_mn),
998 FUNCTION(gp_pdm0),
999 FUNCTION(gp_pdm1),
1000 FUNCTION(gp_pdm2),
1001 FUNCTION(gp0_clk),
1002 FUNCTION(gp1_clk),
1003 FUNCTION(gpio),
1004 FUNCTION(hdmi_cec),
1005 FUNCTION(hdmi_ddc),
1006 FUNCTION(hdmi_dtest),
1007 FUNCTION(hdmi_hpd),
1008 FUNCTION(hdmi_rcv),
1009 FUNCTION(hsic),
1010 FUNCTION(ldo_en),
1011 FUNCTION(ldo_update),
1012 FUNCTION(mdp_vsync),
1013 FUNCTION(pci_e0),
1014 FUNCTION(pci_e0_n),
1015 FUNCTION(pci_e0_rst),
1016 FUNCTION(pci_e1),
1017 FUNCTION(pci_e1_rst),
1018 FUNCTION(pci_e1_rst_n),
1019 FUNCTION(pci_e1_clkreq_n),
1020 FUNCTION(pri_mi2s),
1021 FUNCTION(qua_mi2s),
1022 FUNCTION(sata_act),
1023 FUNCTION(sata_devsleep),
1024 FUNCTION(sata_devsleep_n),
1025 FUNCTION(sd_write),
1026 FUNCTION(sdc_emmc_mode),
1027 FUNCTION(sdc3),
1028 FUNCTION(sdc4),
1029 FUNCTION(sec_mi2s),
1030 FUNCTION(slimbus),
1031 FUNCTION(spdif_tx),
1032 FUNCTION(spkr_i2s),
1033 FUNCTION(spkr_i2s_ws),
1034 FUNCTION(spss_geni),
1035 FUNCTION(ter_mi2s),
1036 FUNCTION(tsif1),
1037 FUNCTION(tsif2),
1038 FUNCTION(uim),
1039 FUNCTION(uim_batt_alarm),
1040};
1041
1042static const struct msm_pingroup apq8084_groups[] = {
1043 PINGROUP(0, blsp_spi1, blsp_uart1, blsp_uim1, NA, NA, NA, NA),
1044 PINGROUP(1, blsp_spi1, blsp_uart1, blsp_uim1, NA, NA, NA, NA),
1045 PINGROUP(2, blsp_spi1, blsp_uart1, blsp_i2c1, NA, NA, NA, NA),
1046 PINGROUP(3, blsp_spi1, blsp_uart1, blsp_i2c1, NA, NA, NA, NA),
1047 PINGROUP(4, blsp_spi2, blsp_uart2, blsp_uim2, NA, NA, NA, NA),
1048 PINGROUP(5, blsp_spi2, blsp_uart2, blsp_uim2, NA, NA, NA, NA),
1049 PINGROUP(6, blsp_spi2, blsp_uart2, blsp_i2c2, NA, NA, NA, NA),
1050 PINGROUP(7, blsp_spi2, blsp_uart2, blsp_i2c2, NA, NA, NA, NA),
1051 PINGROUP(8, blsp_spi3, blsp_uart3, blsp_uim3, spss_geni, NA, NA, NA),
1052 PINGROUP(9, blsp_spi3, blsp_uim3, blsp_uart3, spss_geni, NA, NA, NA),
1053 PINGROUP(10, blsp_spi3, blsp_uart3, blsp_i2c3, NA, NA, NA, NA),
1054 PINGROUP(11, blsp_spi3, blsp_uart3, blsp_i2c3, NA, NA, NA, NA),
1055 PINGROUP(12, mdp_vsync, NA, NA, NA, NA, NA, NA),
1056 PINGROUP(13, mdp_vsync, NA, NA, NA, NA, NA, NA),
1057 PINGROUP(14, mdp_vsync, NA, NA, NA, NA, NA, NA),
1058 PINGROUP(15, cam_mclk0, NA, NA, NA, NA, NA, NA),
1059 PINGROUP(16, cam_mclk1, NA, NA, NA, NA, NA, NA),
1060 PINGROUP(17, cam_mclk2, NA, NA, NA, NA, NA, NA),
1061 PINGROUP(18, cam_mclk3, NA, NA, NA, NA, NA, NA),
1062 PINGROUP(19, cci_i2c0, NA, NA, NA, NA, NA, NA),
1063 PINGROUP(20, cci_i2c0, NA, NA, NA, NA, NA, NA),
1064 PINGROUP(21, cci_i2c1, NA, NA, NA, NA, NA, NA),
1065 PINGROUP(22, cci_i2c1, NA, NA, NA, NA, NA, NA),
1066 PINGROUP(23, cci_timer0, NA, NA, NA, NA, NA, NA),
1067 PINGROUP(24, cci_timer1, NA, NA, NA, NA, NA, NA),
1068 PINGROUP(25, cci_timer2, gp0_clk, NA, NA, NA, NA, NA),
1069 PINGROUP(26, cci_timer3, cci_async, gp1_clk, NA, NA, NA, NA),
1070 PINGROUP(27, blsp_spi4, blsp_uart4, blsp_uim4, NA, NA, NA, NA),
1071 PINGROUP(28, blsp_spi4, blsp_uart4, blsp_uim4, NA, NA, NA, NA),
1072 PINGROUP(29, blsp_spi4, blsp_uart4, blsp_i2c4, gp_mn, NA, NA, NA),
1073 PINGROUP(30, blsp_spi4, blsp_uart4, blsp_i2c4, NA, NA, NA, NA),
1074 PINGROUP(31, hdmi_cec, NA, NA, NA, NA, NA, NA),
1075 PINGROUP(32, hdmi_ddc, NA, NA, NA, NA, NA, NA),
1076 PINGROUP(33, hdmi_ddc, NA, NA, NA, NA, NA, NA),
1077 PINGROUP(34, hdmi_hpd, NA, adsp_ext, NA, NA, NA, NA),
1078 PINGROUP(35, NA, NA, NA, NA, NA, NA, NA),
1079 PINGROUP(36, NA, NA, NA, NA, NA, NA, NA),
1080 PINGROUP(37, gcc_gp1, NA, NA, NA, NA, NA, NA),
1081 PINGROUP(38, gcc_gp2, NA, NA, NA, NA, NA, NA),
1082 PINGROUP(39, blsp_spi5, blsp_uart5, blsp_uim5, NA, NA, NA, NA),
1083 PINGROUP(40, blsp_spi5, blsp_uart5, blsp_uim5, NA, NA, NA, NA),
1084 PINGROUP(41, blsp_spi5, blsp_uart5, blsp_i2c5, NA, NA, NA, NA),
1085 PINGROUP(42, blsp_spi5, blsp_uart5, blsp_i2c5, NA, NA, NA, NA),
1086 PINGROUP(43, blsp_spi6, blsp_uart6, blsp_uim6, NA, NA, NA, NA),
1087 PINGROUP(44, blsp_spi6, blsp_uart6, blsp_uim6, NA, NA, NA, NA),
1088 PINGROUP(45, blsp_spi6, blsp_uart6, blsp_i2c6, NA, NA, NA, NA),
1089 PINGROUP(46, blsp_spi6, blsp_uart6, blsp_i2c6, NA, NA, NA, NA),
1090 PINGROUP(47, blsp_spi12, blsp_uart12, blsp_uim12, NA, NA, NA, NA),
1091 PINGROUP(48, blsp_spi12, blsp_uart12, blsp_uim12, gp_pdm0, NA, NA, NA),
1092 PINGROUP(49, blsp_spi12, blsp_uart12, blsp_i2c12, NA, NA, NA, NA),
1093 PINGROUP(50, blsp_spi12, blsp_uart12, blsp_i2c12, NA, NA, NA, NA),
1094 PINGROUP(51, blsp_spi8, blsp_uart8, blsp_uim8, NA, NA, NA, NA),
1095 PINGROUP(52, blsp_spi8, blsp_uart8, blsp_uim8, NA, NA, NA, NA),
1096 PINGROUP(53, blsp_spi8, blsp_uart8, blsp_i2c8, NA, NA, NA, NA),
1097 PINGROUP(54, blsp_spi8, blsp_uart8, blsp_i2c8, NA, NA, NA, NA),
1098 PINGROUP(55, blsp_spi9, blsp_uart9, blsp_uim9, NA, NA, NA, NA),
1099 PINGROUP(56, blsp_spi9, blsp_uart9, blsp_uim9, NA, NA, NA, NA),
1100 PINGROUP(57, blsp_spi9, blsp_uart9, blsp_i2c9, NA, NA, NA, NA),
1101 PINGROUP(58, blsp_spi9, blsp_uart9, blsp_i2c9, NA, NA, NA, NA),
1102 PINGROUP(59, blsp_spi10, blsp_uart10, blsp_uim10, NA, NA, NA, NA),
1103 PINGROUP(60, blsp_spi10, blsp_uart10, blsp_uim10, NA, NA, NA, NA),
1104 PINGROUP(61, blsp_spi10, blsp_uart10, blsp_i2c10, NA, NA, NA, NA),
1105 PINGROUP(62, blsp_spi10, blsp_uart10, blsp_i2c10, NA, NA, NA, NA),
1106 PINGROUP(63, blsp_spi11, blsp_uart11, blsp_uim11, NA, NA, NA, NA),
1107 PINGROUP(64, blsp_spi11, blsp_uart11, blsp_uim11, NA, NA, NA, NA),
1108 PINGROUP(65, blsp_spi11, blsp_uart11, blsp_i2c11, NA, NA, NA, NA),
1109 PINGROUP(66, blsp_spi11, blsp_uart11, blsp_i2c11, NA, NA, NA, NA),
1110 PINGROUP(67, sdc3, blsp_spi3_cs1, NA, NA, NA, NA, NA),
1111 PINGROUP(68, sdc3, pci_e0, NA, NA, NA, NA, NA),
1112 PINGROUP(69, sdc3, NA, NA, NA, NA, NA, NA),
1113 PINGROUP(70, sdc3, pci_e0_n, pci_e0, NA, NA, NA, NA),
1114 PINGROUP(71, sdc3, blsp_spi3_cs2, NA, NA, NA, NA, NA),
1115 PINGROUP(72, sdc3, blsp_spi3_cs3, NA, NA, NA, NA, NA),
1116 PINGROUP(73, NA, NA, NA, NA, NA, NA, NA),
1117 PINGROUP(74, NA, NA, NA, NA, NA, NA, NA),
1118 PINGROUP(75, sd_write, NA, NA, NA, NA, NA, NA),
1119 PINGROUP(76, pri_mi2s, NA, NA, NA, NA, NA, NA),
1120 PINGROUP(77, pri_mi2s, NA, NA, NA, NA, NA, NA),
1121 PINGROUP(78, pri_mi2s, NA, NA, NA, NA, NA, NA),
1122 PINGROUP(79, pri_mi2s, NA, NA, NA, NA, NA, NA),
1123 PINGROUP(80, pri_mi2s, NA, NA, NA, NA, NA, NA),
1124 PINGROUP(81, sec_mi2s, NA, NA, NA, NA, NA, NA),
1125 PINGROUP(82, sec_mi2s, sdc4, tsif1, NA, NA, NA, NA),
1126 PINGROUP(83, sec_mi2s, sdc4, tsif1, NA, NA, NA, gp_pdm0),
1127 PINGROUP(84, sec_mi2s, sdc4, tsif1, NA, NA, NA, gp_pdm1),
1128 PINGROUP(85, sec_mi2s, sdc4, tsif1, NA, gp_pdm2, NA, NA),
1129 PINGROUP(86, ter_mi2s, sdc4, tsif1, NA, NA, NA, gcc_gp3),
1130 PINGROUP(87, ter_mi2s, NA, NA, NA, NA, NA, NA),
1131 PINGROUP(88, ter_mi2s, NA, NA, NA, NA, NA, NA),
1132 PINGROUP(89, ter_mi2s, NA, NA, NA, NA, NA, NA),
1133 PINGROUP(90, ter_mi2s, NA, NA, NA, NA, NA, NA),
1134 PINGROUP(91, qua_mi2s, sdc4, tsif2, NA, NA, NA, NA),
1135 PINGROUP(92, qua_mi2s, NA, NA, NA, NA, NA, NA),
1136 PINGROUP(93, qua_mi2s, NA, NA, NA, NA, NA, NA),
1137 PINGROUP(94, qua_mi2s, NA, NA, NA, NA, NA, NA),
1138 PINGROUP(95, qua_mi2s, sdc4, tsif2, NA, NA, NA, gcc_gp1),
1139 PINGROUP(96, qua_mi2s, sdc4, tsif2, NA, NA, NA, gcc_gp2),
1140 PINGROUP(97, qua_mi2s, sdc4, tsif2, NA, gcc_gp3, NA, NA),
1141 PINGROUP(98, slimbus, spkr_i2s, NA, NA, NA, NA, NA),
1142 PINGROUP(99, slimbus, spkr_i2s, NA, NA, NA, NA, NA),
1143 PINGROUP(100, audio_ref, spkr_i2s, NA, NA, NA, NA, NA),
1144 PINGROUP(101, sdc4, tsif2, gp_pdm1, NA, NA, NA, NA),
1145 PINGROUP(102, uim_batt_alarm, NA, NA, NA, NA, NA, NA),
1146 PINGROUP(103, edp_hpd, NA, NA, NA, NA, NA, NA),
1147 PINGROUP(104, spkr_i2s, NA, NA, NA, NA, NA, NA),
1148 PINGROUP(105, NA, NA, NA, NA, NA, NA, NA),
1149 PINGROUP(106, blsp_spi10_cs1, NA, NA, NA, NA, NA, NA),
1150 PINGROUP(107, NA, NA, NA, NA, NA, NA, NA),
1151 PINGROUP(108, NA, NA, NA, NA, NA, NA, NA),
1152 PINGROUP(109, NA, NA, NA, NA, NA, NA, NA),
1153 PINGROUP(110, gp_pdm2, NA, NA, NA, NA, NA, NA),
1154 PINGROUP(111, blsp_spi10_cs2, NA, NA, NA, NA, NA, NA),
1155 PINGROUP(112, NA, NA, NA, NA, NA, NA, NA),
1156 PINGROUP(113, NA, NA, NA, NA, NA, NA, NA),
1157 PINGROUP(114, NA, NA, NA, NA, NA, NA, NA),
1158 PINGROUP(115, NA, NA, NA, NA, NA, NA, NA),
1159 PINGROUP(116, blsp_spi1_cs1, NA, NA, NA, NA, NA, NA),
1160 PINGROUP(117, blsp_spi1_cs2, NA, NA, NA, NA, NA, NA),
1161 PINGROUP(118, blsp_spi1_cs3, NA, NA, NA, NA, NA, NA),
1162 PINGROUP(119, cci_timer4, cci_async, sata_devsleep, sata_devsleep_n, NA, NA, NA),
1163 PINGROUP(120, cci_async, NA, NA, NA, NA, NA, NA),
1164 PINGROUP(121, NA, NA, NA, NA, NA, NA, NA),
1165 PINGROUP(122, NA, NA, NA, NA, NA, NA, NA),
1166 PINGROUP(123, hdmi_dtest, NA, NA, NA, NA, NA, NA),
1167 PINGROUP(124, spdif_tx, ldo_en, NA, NA, NA, NA, NA),
1168 PINGROUP(125, ldo_update, hdmi_rcv, NA, NA, NA, NA, NA),
1169 PINGROUP(126, gcc_vtt, NA, NA, NA, NA, NA, NA),
1170 PINGROUP(127, gcc_obt, NA, NA, NA, NA, NA, NA),
1171 PINGROUP(128, blsp_spi10_cs3, NA, NA, NA, NA, NA, NA),
1172 PINGROUP(129, sata_act, NA, NA, NA, NA, NA, NA),
1173 PINGROUP(130, uim, blsp_spi7, blsp_uart7, blsp_uim7, NA, NA, NA),
1174 PINGROUP(131, uim, blsp_spi7, blsp_uart7, blsp_uim7, NA, NA, NA),
1175 PINGROUP(132, uim, blsp_spi7, blsp_uart7, blsp_i2c7, NA, NA, NA),
1176 PINGROUP(133, uim, blsp_spi7, blsp_uart7, blsp_i2c7, NA, NA, NA),
1177 PINGROUP(134, hsic, NA, NA, NA, NA, NA, NA),
1178 PINGROUP(135, hsic, NA, NA, NA, NA, NA, NA),
1179 PINGROUP(136, spdif_tx, NA, NA, NA, NA, NA, NA),
1180 PINGROUP(137, NA, NA, NA, NA, NA, NA, NA),
1181 PINGROUP(138, NA, NA, NA, NA, NA, NA, NA),
1182 PINGROUP(139, NA, NA, NA, NA, NA, NA, NA),
1183 PINGROUP(140, pci_e1_rst_n, pci_e1_rst, NA, NA, NA, NA, NA),
1184 PINGROUP(141, pci_e1_clkreq_n, NA, NA, NA, NA, NA, NA),
1185 PINGROUP(142, spdif_tx, NA, NA, NA, NA, NA, NA),
1186 PINGROUP(143, NA, NA, NA, NA, NA, NA, NA),
1187 PINGROUP(144, NA, NA, NA, NA, NA, NA, NA),
1188 PINGROUP(145, NA, NA, NA, NA, NA, NA, NA),
1189 PINGROUP(146, sdc_emmc_mode, NA, NA, NA, NA, NA, NA),
1190
1191 SDC_PINGROUP(sdc1_clk, 0x2044, 13, 6),
1192 SDC_PINGROUP(sdc1_cmd, 0x2044, 11, 3),
1193 SDC_PINGROUP(sdc1_data, 0x2044, 9, 0),
1194 SDC_PINGROUP(sdc2_clk, 0x2048, 14, 6),
1195 SDC_PINGROUP(sdc2_cmd, 0x2048, 11, 3),
1196 SDC_PINGROUP(sdc2_data, 0x2048, 9, 0),
1197};
1198
1199#define NUM_GPIO_PINGROUPS 147
1200
1201static const struct msm_pinctrl_soc_data apq8084_pinctrl = {
1202 .pins = apq8084_pins,
1203 .npins = ARRAY_SIZE(apq8084_pins),
1204 .functions = apq8084_functions,
1205 .nfunctions = ARRAY_SIZE(apq8084_functions),
1206 .groups = apq8084_groups,
1207 .ngroups = ARRAY_SIZE(apq8084_groups),
1208 .ngpios = NUM_GPIO_PINGROUPS,
1209};
1210
1211static int apq8084_pinctrl_probe(struct platform_device *pdev)
1212{
1213 return msm_pinctrl_probe(pdev, &apq8084_pinctrl);
1214}
1215
1216static const struct of_device_id apq8084_pinctrl_of_match[] = {
1217 { .compatible = "qcom,apq8084-pinctrl", },
1218 { },
1219};
1220
1221static struct platform_driver apq8084_pinctrl_driver = {
1222 .driver = {
1223 .name = "apq8084-pinctrl",
1224 .owner = THIS_MODULE,
1225 .of_match_table = apq8084_pinctrl_of_match,
1226 },
1227 .probe = apq8084_pinctrl_probe,
1228 .remove = msm_pinctrl_remove,
1229};
1230
1231static int __init apq8084_pinctrl_init(void)
1232{
1233 return platform_driver_register(&apq8084_pinctrl_driver);
1234}
1235arch_initcall(apq8084_pinctrl_init);
1236
1237static void __exit apq8084_pinctrl_exit(void)
1238{
1239 platform_driver_unregister(&apq8084_pinctrl_driver);
1240}
1241module_exit(apq8084_pinctrl_exit);
1242
1243MODULE_DESCRIPTION("Qualcomm APQ8084 pinctrl driver");
1244MODULE_LICENSE("GPL v2");
1245MODULE_DEVICE_TABLE(of, apq8084_pinctrl_of_match);
diff --git a/drivers/pinctrl/qcom/pinctrl-ipq8064.c b/drivers/pinctrl/qcom/pinctrl-ipq8064.c
index 767cf1120b20..81f49a9b4dbe 100644
--- a/drivers/pinctrl/qcom/pinctrl-ipq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-ipq8064.c
@@ -211,6 +211,7 @@ static const unsigned int sdc3_data_pins[] = { 71 };
211 .intr_status_bit = 0, \ 211 .intr_status_bit = 0, \
212 .intr_ack_high = 1, \ 212 .intr_ack_high = 1, \
213 .intr_target_bit = 0, \ 213 .intr_target_bit = 0, \
214 .intr_target_kpss_val = 4, \
214 .intr_raw_status_bit = 3, \ 215 .intr_raw_status_bit = 3, \
215 .intr_polarity_bit = 1, \ 216 .intr_polarity_bit = 1, \
216 .intr_detection_bit = 2, \ 217 .intr_detection_bit = 2, \
@@ -236,6 +237,7 @@ static const unsigned int sdc3_data_pins[] = { 71 };
236 .intr_enable_bit = -1, \ 237 .intr_enable_bit = -1, \
237 .intr_status_bit = -1, \ 238 .intr_status_bit = -1, \
238 .intr_target_bit = -1, \ 239 .intr_target_bit = -1, \
240 .intr_target_kpss_val = -1, \
239 .intr_raw_status_bit = -1, \ 241 .intr_raw_status_bit = -1, \
240 .intr_polarity_bit = -1, \ 242 .intr_polarity_bit = -1, \
241 .intr_detection_bit = -1, \ 243 .intr_detection_bit = -1, \
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 2738108caff2..d30dddd21323 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -12,6 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 */ 13 */
14 14
15#include <linux/delay.h>
15#include <linux/err.h> 16#include <linux/err.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <linux/module.h> 18#include <linux/module.h>
@@ -26,6 +27,7 @@
26#include <linux/gpio.h> 27#include <linux/gpio.h>
27#include <linux/interrupt.h> 28#include <linux/interrupt.h>
28#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/reboot.h>
29 31
30#include "../core.h" 32#include "../core.h"
31#include "../pinconf.h" 33#include "../pinconf.h"
@@ -33,12 +35,14 @@
33#include "../pinctrl-utils.h" 35#include "../pinctrl-utils.h"
34 36
35#define MAX_NR_GPIO 300 37#define MAX_NR_GPIO 300
38#define PS_HOLD_OFFSET 0x820
36 39
37/** 40/**
38 * struct msm_pinctrl - state for a pinctrl-msm device 41 * struct msm_pinctrl - state for a pinctrl-msm device
39 * @dev: device handle. 42 * @dev: device handle.
40 * @pctrl: pinctrl handle. 43 * @pctrl: pinctrl handle.
41 * @chip: gpiochip handle. 44 * @chip: gpiochip handle.
45 * @restart_nb: restart notifier block.
42 * @irq: parent irq for the TLMM irq_chip. 46 * @irq: parent irq for the TLMM irq_chip.
43 * @lock: Spinlock to protect register resources as well 47 * @lock: Spinlock to protect register resources as well
44 * as msm_pinctrl data structures. 48 * as msm_pinctrl data structures.
@@ -52,6 +56,7 @@ struct msm_pinctrl {
52 struct device *dev; 56 struct device *dev;
53 struct pinctrl_dev *pctrl; 57 struct pinctrl_dev *pctrl;
54 struct gpio_chip chip; 58 struct gpio_chip chip;
59 struct notifier_block restart_nb;
55 int irq; 60 int irq;
56 61
57 spinlock_t lock; 62 spinlock_t lock;
@@ -130,9 +135,9 @@ static int msm_get_function_groups(struct pinctrl_dev *pctldev,
130 return 0; 135 return 0;
131} 136}
132 137
133static int msm_pinmux_enable(struct pinctrl_dev *pctldev, 138static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev,
134 unsigned function, 139 unsigned function,
135 unsigned group) 140 unsigned group)
136{ 141{
137 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 142 struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
138 const struct msm_pingroup *g; 143 const struct msm_pingroup *g;
@@ -166,7 +171,7 @@ static const struct pinmux_ops msm_pinmux_ops = {
166 .get_functions_count = msm_get_functions_count, 171 .get_functions_count = msm_get_functions_count,
167 .get_function_name = msm_get_function_name, 172 .get_function_name = msm_get_function_name,
168 .get_function_groups = msm_get_function_groups, 173 .get_function_groups = msm_get_function_groups,
169 .enable = msm_pinmux_enable, 174 .set_mux = msm_pinmux_set_mux,
170}; 175};
171 176
172static int msm_config_reg(struct msm_pinctrl *pctrl, 177static int msm_config_reg(struct msm_pinctrl *pctrl,
@@ -649,8 +654,6 @@ static void msm_gpio_irq_ack(struct irq_data *d)
649 spin_unlock_irqrestore(&pctrl->lock, flags); 654 spin_unlock_irqrestore(&pctrl->lock, flags);
650} 655}
651 656
652#define INTR_TARGET_PROC_APPS 4
653
654static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) 657static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
655{ 658{
656 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 659 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -674,7 +677,7 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
674 /* Route interrupts to application cpu */ 677 /* Route interrupts to application cpu */
675 val = readl(pctrl->regs + g->intr_target_reg); 678 val = readl(pctrl->regs + g->intr_target_reg);
676 val &= ~(7 << g->intr_target_bit); 679 val &= ~(7 << g->intr_target_bit);
677 val |= INTR_TARGET_PROC_APPS << g->intr_target_bit; 680 val |= g->intr_target_kpss_val << g->intr_target_bit;
678 writel(val, pctrl->regs + g->intr_target_reg); 681 writel(val, pctrl->regs + g->intr_target_reg);
679 682
680 /* Update configuration for gpio. 683 /* Update configuration for gpio.
@@ -829,6 +832,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
829 ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio); 832 ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
830 if (ret) { 833 if (ret) {
831 dev_err(pctrl->dev, "Failed to add pin range\n"); 834 dev_err(pctrl->dev, "Failed to add pin range\n");
835 gpiochip_remove(&pctrl->chip);
832 return ret; 836 return ret;
833 } 837 }
834 838
@@ -839,6 +843,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
839 IRQ_TYPE_NONE); 843 IRQ_TYPE_NONE);
840 if (ret) { 844 if (ret) {
841 dev_err(pctrl->dev, "Failed to add irqchip to gpiochip\n"); 845 dev_err(pctrl->dev, "Failed to add irqchip to gpiochip\n");
846 gpiochip_remove(&pctrl->chip);
842 return -ENOSYS; 847 return -ENOSYS;
843 } 848 }
844 849
@@ -848,6 +853,32 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
848 return 0; 853 return 0;
849} 854}
850 855
856static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action,
857 void *data)
858{
859 struct msm_pinctrl *pctrl = container_of(nb, struct msm_pinctrl, restart_nb);
860
861 writel(0, pctrl->regs + PS_HOLD_OFFSET);
862 mdelay(1000);
863 return NOTIFY_DONE;
864}
865
866static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
867{
868 int i = 0;
869 const struct msm_function *func = pctrl->soc->functions;
870
871 for (; i <= pctrl->soc->nfunctions; i++)
872 if (!strcmp(func[i].name, "ps_hold")) {
873 pctrl->restart_nb.notifier_call = msm_ps_hold_restart;
874 pctrl->restart_nb.priority = 128;
875 if (register_restart_handler(&pctrl->restart_nb))
876 dev_err(pctrl->dev,
877 "failed to setup restart handler.\n");
878 break;
879 }
880}
881
851int msm_pinctrl_probe(struct platform_device *pdev, 882int msm_pinctrl_probe(struct platform_device *pdev,
852 const struct msm_pinctrl_soc_data *soc_data) 883 const struct msm_pinctrl_soc_data *soc_data)
853{ 884{
@@ -871,6 +902,8 @@ int msm_pinctrl_probe(struct platform_device *pdev,
871 if (IS_ERR(pctrl->regs)) 902 if (IS_ERR(pctrl->regs))
872 return PTR_ERR(pctrl->regs); 903 return PTR_ERR(pctrl->regs);
873 904
905 msm_pinctrl_setup_pm_reset(pctrl);
906
874 pctrl->irq = platform_get_irq(pdev, 0); 907 pctrl->irq = platform_get_irq(pdev, 0);
875 if (pctrl->irq < 0) { 908 if (pctrl->irq < 0) {
876 dev_err(&pdev->dev, "No interrupt defined for msmgpio\n"); 909 dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");
@@ -913,6 +946,8 @@ int msm_pinctrl_remove(struct platform_device *pdev)
913 946
914 pinctrl_unregister(pctrl->pctrl); 947 pinctrl_unregister(pctrl->pctrl);
915 948
949 unregister_restart_handler(&pctrl->restart_nb);
950
916 return 0; 951 return 0;
917} 952}
918EXPORT_SYMBOL(msm_pinctrl_remove); 953EXPORT_SYMBOL(msm_pinctrl_remove);
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h
index 7b2a227a590a..b952c4b4a8e9 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.h
+++ b/drivers/pinctrl/qcom/pinctrl-msm.h
@@ -53,6 +53,8 @@ struct msm_function {
53 * @intr_status_bit: Offset in @intr_status_reg for reading and acking the interrupt 53 * @intr_status_bit: Offset in @intr_status_reg for reading and acking the interrupt
54 * status. 54 * status.
55 * @intr_target_bit: Offset in @intr_target_reg for configuring the interrupt routing. 55 * @intr_target_bit: Offset in @intr_target_reg for configuring the interrupt routing.
56 * @intr_target_kpss_val: Value in @intr_target_bit for specifying that the interrupt from
57 * this gpio should get routed to the KPSS processor.
56 * @intr_raw_status_bit: Offset in @intr_cfg_reg for the raw status bit. 58 * @intr_raw_status_bit: Offset in @intr_cfg_reg for the raw status bit.
57 * @intr_polarity_bit: Offset in @intr_cfg_reg for specifying polarity of the interrupt. 59 * @intr_polarity_bit: Offset in @intr_cfg_reg for specifying polarity of the interrupt.
58 * @intr_detection_bit: Offset in @intr_cfg_reg for specifying interrupt type. 60 * @intr_detection_bit: Offset in @intr_cfg_reg for specifying interrupt type.
@@ -88,6 +90,7 @@ struct msm_pingroup {
88 unsigned intr_ack_high:1; 90 unsigned intr_ack_high:1;
89 91
90 unsigned intr_target_bit:5; 92 unsigned intr_target_bit:5;
93 unsigned intr_target_kpss_val:5;
91 unsigned intr_raw_status_bit:5; 94 unsigned intr_raw_status_bit:5;
92 unsigned intr_polarity_bit:5; 95 unsigned intr_polarity_bit:5;
93 unsigned intr_detection_bit:5; 96 unsigned intr_detection_bit:5;
diff --git a/drivers/pinctrl/qcom/pinctrl-msm8960.c b/drivers/pinctrl/qcom/pinctrl-msm8960.c
index 35047036a053..2ab21ce5575a 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm8960.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm8960.c
@@ -384,6 +384,7 @@ static const unsigned int sdc3_data_pins[] = { 157 };
384 .intr_status_bit = 0, \ 384 .intr_status_bit = 0, \
385 .intr_ack_high = 1, \ 385 .intr_ack_high = 1, \
386 .intr_target_bit = 0, \ 386 .intr_target_bit = 0, \
387 .intr_target_kpss_val = 4, \
387 .intr_raw_status_bit = 3, \ 388 .intr_raw_status_bit = 3, \
388 .intr_polarity_bit = 1, \ 389 .intr_polarity_bit = 1, \
389 .intr_detection_bit = 2, \ 390 .intr_detection_bit = 2, \
@@ -409,6 +410,7 @@ static const unsigned int sdc3_data_pins[] = { 157 };
409 .intr_enable_bit = -1, \ 410 .intr_enable_bit = -1, \
410 .intr_status_bit = -1, \ 411 .intr_status_bit = -1, \
411 .intr_target_bit = -1, \ 412 .intr_target_bit = -1, \
413 .intr_target_kpss_val = -1, \
412 .intr_raw_status_bit = -1, \ 414 .intr_raw_status_bit = -1, \
413 .intr_polarity_bit = -1, \ 415 .intr_polarity_bit = -1, \
414 .intr_detection_bit = -1, \ 416 .intr_detection_bit = -1, \
diff --git a/drivers/pinctrl/qcom/pinctrl-msm8x74.c b/drivers/pinctrl/qcom/pinctrl-msm8x74.c
index 8c9720154d1e..3c858384d041 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm8x74.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm8x74.c
@@ -366,6 +366,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
366 .intr_enable_bit = 0, \ 366 .intr_enable_bit = 0, \
367 .intr_status_bit = 0, \ 367 .intr_status_bit = 0, \
368 .intr_target_bit = 5, \ 368 .intr_target_bit = 5, \
369 .intr_target_kpss_val = 4, \
369 .intr_raw_status_bit = 4, \ 370 .intr_raw_status_bit = 4, \
370 .intr_polarity_bit = 1, \ 371 .intr_polarity_bit = 1, \
371 .intr_detection_bit = 2, \ 372 .intr_detection_bit = 2, \
@@ -391,6 +392,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
391 .intr_enable_bit = -1, \ 392 .intr_enable_bit = -1, \
392 .intr_status_bit = -1, \ 393 .intr_status_bit = -1, \
393 .intr_target_bit = -1, \ 394 .intr_target_bit = -1, \
395 .intr_target_kpss_val = -1, \
394 .intr_raw_status_bit = -1, \ 396 .intr_raw_status_bit = -1, \
395 .intr_polarity_bit = -1, \ 397 .intr_polarity_bit = -1, \
396 .intr_detection_bit = -1, \ 398 .intr_detection_bit = -1, \
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
index 603da2f9dd95..b995ec2c5d16 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
@@ -364,8 +364,9 @@ static void exynos5440_pinmux_setup(struct pinctrl_dev *pctldev, unsigned select
364} 364}
365 365
366/* enable a specified pinmux by writing to registers */ 366/* enable a specified pinmux by writing to registers */
367static int exynos5440_pinmux_enable(struct pinctrl_dev *pctldev, unsigned selector, 367static int exynos5440_pinmux_set_mux(struct pinctrl_dev *pctldev,
368 unsigned group) 368 unsigned selector,
369 unsigned group)
369{ 370{
370 exynos5440_pinmux_setup(pctldev, selector, group, true); 371 exynos5440_pinmux_setup(pctldev, selector, group, true);
371 return 0; 372 return 0;
@@ -387,7 +388,7 @@ static const struct pinmux_ops exynos5440_pinmux_ops = {
387 .get_functions_count = exynos5440_get_functions_count, 388 .get_functions_count = exynos5440_get_functions_count,
388 .get_function_name = exynos5440_pinmux_get_fname, 389 .get_function_name = exynos5440_pinmux_get_fname,
389 .get_function_groups = exynos5440_pinmux_get_groups, 390 .get_function_groups = exynos5440_pinmux_get_groups,
390 .enable = exynos5440_pinmux_enable, 391 .set_mux = exynos5440_pinmux_set_mux,
391 .gpio_set_direction = exynos5440_pinmux_gpio_set_direction, 392 .gpio_set_direction = exynos5440_pinmux_gpio_set_direction,
392}; 393};
393 394
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index b07406da333c..4a47691c32b1 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -401,8 +401,9 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector,
401} 401}
402 402
403/* enable a specified pinmux by writing to registers */ 403/* enable a specified pinmux by writing to registers */
404static int samsung_pinmux_enable(struct pinctrl_dev *pctldev, unsigned selector, 404static int samsung_pinmux_set_mux(struct pinctrl_dev *pctldev,
405 unsigned group) 405 unsigned selector,
406 unsigned group)
406{ 407{
407 samsung_pinmux_setup(pctldev, selector, group, true); 408 samsung_pinmux_setup(pctldev, selector, group, true);
408 return 0; 409 return 0;
@@ -413,7 +414,7 @@ static const struct pinmux_ops samsung_pinmux_ops = {
413 .get_functions_count = samsung_get_functions_count, 414 .get_functions_count = samsung_get_functions_count,
414 .get_function_name = samsung_pinmux_get_fname, 415 .get_function_name = samsung_pinmux_get_fname,
415 .get_function_groups = samsung_pinmux_get_groups, 416 .get_function_groups = samsung_pinmux_get_groups,
416 .enable = samsung_pinmux_enable, 417 .set_mux = samsung_pinmux_set_mux,
417}; 418};
418 419
419/* set or get the pin config settings for a specified pin */ 420/* set or get the pin config settings for a specified pin */
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index b9b464d0578c..6572c233f73d 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -542,7 +542,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
542 */ 542 */
543 ret = sh_pfc_register_pinctrl(pfc); 543 ret = sh_pfc_register_pinctrl(pfc);
544 if (unlikely(ret != 0)) 544 if (unlikely(ret != 0))
545 goto error; 545 return ret;
546 546
547#ifdef CONFIG_GPIO_SH_PFC 547#ifdef CONFIG_GPIO_SH_PFC
548 /* 548 /*
@@ -564,11 +564,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
564 dev_info(pfc->dev, "%s support registered\n", info->name); 564 dev_info(pfc->dev, "%s support registered\n", info->name);
565 565
566 return 0; 566 return 0;
567
568error:
569 if (info->ops && info->ops->exit)
570 info->ops->exit(pfc);
571 return ret;
572} 567}
573 568
574static int sh_pfc_remove(struct platform_device *pdev) 569static int sh_pfc_remove(struct platform_device *pdev)
@@ -580,9 +575,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
580#endif 575#endif
581 sh_pfc_unregister_pinctrl(pfc); 576 sh_pfc_unregister_pinctrl(pfc);
582 577
583 if (pfc->info->ops && pfc->info->ops->exit)
584 pfc->info->ops->exit(pfc);
585
586 return 0; 578 return 0;
587} 579}
588 580
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index b7b0e6ccf305..3daaa5241c47 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -33,7 +33,6 @@ struct sh_pfc_pin_range {
33struct sh_pfc { 33struct sh_pfc {
34 struct device *dev; 34 struct device *dev;
35 const struct sh_pfc_soc_info *info; 35 const struct sh_pfc_soc_info *info;
36 void *soc_data;
37 spinlock_t lock; 36 spinlock_t lock;
38 37
39 unsigned int num_windows; 38 unsigned int num_windows;
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
index ce9fb7aa8ba3..280a56f97786 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
@@ -2717,14 +2717,14 @@ static void r8a73a4_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
2717 iowrite8(value, addr); 2717 iowrite8(value, addr);
2718} 2718}
2719 2719
2720static const struct sh_pfc_soc_operations r8a73a4_pinmux_ops = { 2720static const struct sh_pfc_soc_operations r8a73a4_pfc_ops = {
2721 .get_bias = r8a73a4_pinmux_get_bias, 2721 .get_bias = r8a73a4_pinmux_get_bias,
2722 .set_bias = r8a73a4_pinmux_set_bias, 2722 .set_bias = r8a73a4_pinmux_set_bias,
2723}; 2723};
2724 2724
2725const struct sh_pfc_soc_info r8a73a4_pinmux_info = { 2725const struct sh_pfc_soc_info r8a73a4_pinmux_info = {
2726 .name = "r8a73a4_pfc", 2726 .name = "r8a73a4_pfc",
2727 .ops = &r8a73a4_pinmux_ops, 2727 .ops = &r8a73a4_pfc_ops,
2728 2728
2729 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 2729 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2730 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 2730 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
index e4c1ef477053..b486e9d20cc2 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
@@ -3752,14 +3752,14 @@ static void r8a7740_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
3752 iowrite8(value, addr); 3752 iowrite8(value, addr);
3753} 3753}
3754 3754
3755static const struct sh_pfc_soc_operations r8a7740_pinmux_ops = { 3755static const struct sh_pfc_soc_operations r8a7740_pfc_ops = {
3756 .get_bias = r8a7740_pinmux_get_bias, 3756 .get_bias = r8a7740_pinmux_get_bias,
3757 .set_bias = r8a7740_pinmux_set_bias, 3757 .set_bias = r8a7740_pinmux_set_bias,
3758}; 3758};
3759 3759
3760const struct sh_pfc_soc_info r8a7740_pinmux_info = { 3760const struct sh_pfc_soc_info r8a7740_pinmux_info = {
3761 .name = "r8a7740_pfc", 3761 .name = "r8a7740_pfc",
3762 .ops = &r8a7740_pinmux_ops, 3762 .ops = &r8a7740_pfc_ops,
3763 3763
3764 .input = { PINMUX_INPUT_BEGIN, 3764 .input = { PINMUX_INPUT_BEGIN,
3765 PINMUX_INPUT_END }, 3765 PINMUX_INPUT_END },
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7372.c b/drivers/pinctrl/sh-pfc/pfc-sh7372.c
index d9158b3b2919..8211f66a2f68 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh7372.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh7372.c
@@ -2614,14 +2614,14 @@ static void sh7372_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
2614 iowrite8(value, addr); 2614 iowrite8(value, addr);
2615} 2615}
2616 2616
2617static const struct sh_pfc_soc_operations sh7372_pinmux_ops = { 2617static const struct sh_pfc_soc_operations sh7372_pfc_ops = {
2618 .get_bias = sh7372_pinmux_get_bias, 2618 .get_bias = sh7372_pinmux_get_bias,
2619 .set_bias = sh7372_pinmux_set_bias, 2619 .set_bias = sh7372_pinmux_set_bias,
2620}; 2620};
2621 2621
2622const struct sh_pfc_soc_info sh7372_pinmux_info = { 2622const struct sh_pfc_soc_info sh7372_pinmux_info = {
2623 .name = "sh7372_pfc", 2623 .name = "sh7372_pfc",
2624 .ops = &sh7372_pinmux_ops, 2624 .ops = &sh7372_pfc_ops,
2625 2625
2626 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 2626 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
2627 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 2627 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
index 0bd8f4401b42..d2efbfb776ac 100644
--- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
+++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
@@ -3824,39 +3824,28 @@ static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
3824 * SoC information 3824 * SoC information
3825 */ 3825 */
3826 3826
3827struct sh73a0_pinmux_data {
3828 struct regulator_dev *vccq_mc0;
3829};
3830
3831static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc) 3827static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
3832{ 3828{
3833 struct sh73a0_pinmux_data *data;
3834 struct regulator_config cfg = { }; 3829 struct regulator_config cfg = { };
3830 struct regulator_dev *vccq;
3835 int ret; 3831 int ret;
3836 3832
3837 data = devm_kzalloc(pfc->dev, sizeof(*data), GFP_KERNEL);
3838 if (data == NULL)
3839 return -ENOMEM;
3840
3841 cfg.dev = pfc->dev; 3833 cfg.dev = pfc->dev;
3842 cfg.init_data = &sh73a0_vccq_mc0_init_data; 3834 cfg.init_data = &sh73a0_vccq_mc0_init_data;
3843 cfg.driver_data = pfc; 3835 cfg.driver_data = pfc;
3844 3836
3845 data->vccq_mc0 = devm_regulator_register(pfc->dev, 3837 vccq = devm_regulator_register(pfc->dev, &sh73a0_vccq_mc0_desc, &cfg);
3846 &sh73a0_vccq_mc0_desc, &cfg); 3838 if (IS_ERR(vccq)) {
3847 if (IS_ERR(data->vccq_mc0)) { 3839 ret = PTR_ERR(vccq);
3848 ret = PTR_ERR(data->vccq_mc0);
3849 dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n", 3840 dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n",
3850 ret); 3841 ret);
3851 return ret; 3842 return ret;
3852 } 3843 }
3853 3844
3854 pfc->soc_data = data;
3855
3856 return 0; 3845 return 0;
3857} 3846}
3858 3847
3859static const struct sh_pfc_soc_operations sh73a0_pinmux_ops = { 3848static const struct sh_pfc_soc_operations sh73a0_pfc_ops = {
3860 .init = sh73a0_pinmux_soc_init, 3849 .init = sh73a0_pinmux_soc_init,
3861 .get_bias = sh73a0_pinmux_get_bias, 3850 .get_bias = sh73a0_pinmux_get_bias,
3862 .set_bias = sh73a0_pinmux_set_bias, 3851 .set_bias = sh73a0_pinmux_set_bias,
@@ -3864,7 +3853,7 @@ static const struct sh_pfc_soc_operations sh73a0_pinmux_ops = {
3864 3853
3865const struct sh_pfc_soc_info sh73a0_pinmux_info = { 3854const struct sh_pfc_soc_info sh73a0_pinmux_info = {
3866 .name = "sh73a0_pfc", 3855 .name = "sh73a0_pfc",
3867 .ops = &sh73a0_pinmux_ops, 3856 .ops = &sh73a0_pfc_ops,
3868 3857
3869 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END }, 3858 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
3870 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END }, 3859 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index 11db3ee39d40..910deaefa0ac 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -312,8 +312,8 @@ static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev,
312 return 0; 312 return 0;
313} 313}
314 314
315static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector, 315static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
316 unsigned group) 316 unsigned group)
317{ 317{
318 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 318 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
319 struct sh_pfc *pfc = pmx->pfc; 319 struct sh_pfc *pfc = pmx->pfc;
@@ -442,7 +442,7 @@ static const struct pinmux_ops sh_pfc_pinmux_ops = {
442 .get_functions_count = sh_pfc_get_functions_count, 442 .get_functions_count = sh_pfc_get_functions_count,
443 .get_function_name = sh_pfc_get_function_name, 443 .get_function_name = sh_pfc_get_function_name,
444 .get_function_groups = sh_pfc_get_function_groups, 444 .get_function_groups = sh_pfc_get_function_groups,
445 .enable = sh_pfc_func_enable, 445 .set_mux = sh_pfc_func_set_mux,
446 .gpio_request_enable = sh_pfc_gpio_request_enable, 446 .gpio_request_enable = sh_pfc_gpio_request_enable,
447 .gpio_disable_free = sh_pfc_gpio_disable_free, 447 .gpio_disable_free = sh_pfc_gpio_disable_free,
448 .gpio_set_direction = sh_pfc_gpio_set_direction, 448 .gpio_set_direction = sh_pfc_gpio_set_direction,
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index d482c40b012a..5b7283182c1e 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -116,7 +116,6 @@ struct sh_pfc;
116 116
117struct sh_pfc_soc_operations { 117struct sh_pfc_soc_operations {
118 int (*init)(struct sh_pfc *pfc); 118 int (*init)(struct sh_pfc *pfc);
119 void (*exit)(struct sh_pfc *pfc);
120 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin); 119 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
121 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin, 120 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
122 unsigned int bias); 121 unsigned int bias);
diff --git a/drivers/pinctrl/sirf/pinctrl-atlas6.c b/drivers/pinctrl/sirf/pinctrl-atlas6.c
index c4dd3d5cf9c3..45f8391ddb34 100644
--- a/drivers/pinctrl/sirf/pinctrl-atlas6.c
+++ b/drivers/pinctrl/sirf/pinctrl-atlas6.c
@@ -134,8 +134,9 @@ static const struct sirfsoc_muxmask lcd_16bits_sirfsoc_muxmask[] = {
134 .mask = BIT(30) | BIT(31), 134 .mask = BIT(30) | BIT(31),
135 }, { 135 }, {
136 .group = 2, 136 .group = 2,
137 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | 137 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) |
138 BIT(12) | BIT(13) | BIT(15) | BIT(16) | BIT(17) | BIT(18) | BIT(19) | 138 BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(15) |
139 BIT(16) | BIT(17) | BIT(18) | BIT(19) |
139 BIT(20) | BIT(21) | BIT(22) | BIT(31), 140 BIT(20) | BIT(21) | BIT(22) | BIT(31),
140 }, 141 },
141}; 142};
@@ -148,14 +149,15 @@ static const struct sirfsoc_padmux lcd_16bits_padmux = {
148 .funcval = 0, 149 .funcval = 0,
149}; 150};
150 151
151static const unsigned lcd_16bits_pins[] = { 62, 63, 65, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 152static const unsigned lcd_16bits_pins[] = { 62, 63, 65, 70, 71, 72, 73, 74, 75,
152 84, 85, 86, 95 }; 153 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 95 };
153 154
154static const struct sirfsoc_muxmask lcd_18bits_muxmask[] = { 155static const struct sirfsoc_muxmask lcd_18bits_muxmask[] = {
155 { 156 {
156 .group = 2, 157 .group = 2,
157 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | 158 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) |
158 BIT(12) | BIT(13) | BIT(15) | BIT(16) | BIT(17) | BIT(18) | BIT(19) | 159 BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(15) |
160 BIT(16) | BIT(17) | BIT(18) | BIT(19) |
159 BIT(20) | BIT(21) | BIT(22) | BIT(31), 161 BIT(20) | BIT(21) | BIT(22) | BIT(31),
160 }, { 162 }, {
161 .group = 1, 163 .group = 1,
@@ -174,21 +176,23 @@ static const struct sirfsoc_padmux lcd_18bits_padmux = {
174 .funcval = 0, 176 .funcval = 0,
175}; 177};
176 178
177static const unsigned lcd_18bits_pins[] = { 16, 17, 62, 63, 65, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 179static const unsigned lcd_18bits_pins[] = { 16, 17, 62, 63, 65, 70, 71, 72, 73,
178 84, 85, 86, 95 }; 180 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 95 };
179 181
180static const struct sirfsoc_muxmask lcd_24bits_muxmask[] = { 182static const struct sirfsoc_muxmask lcd_24bits_muxmask[] = {
181 { 183 {
182 .group = 2, 184 .group = 2,
183 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | 185 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) |
184 BIT(12) | BIT(13) | BIT(15) | BIT(16) | BIT(17) | BIT(18) | BIT(19) | 186 BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(15) |
187 BIT(16) | BIT(17) | BIT(18) | BIT(19) |
185 BIT(20) | BIT(21) | BIT(22) | BIT(31), 188 BIT(20) | BIT(21) | BIT(22) | BIT(31),
186 }, { 189 }, {
187 .group = 1, 190 .group = 1,
188 .mask = BIT(30) | BIT(31), 191 .mask = BIT(30) | BIT(31),
189 }, { 192 }, {
190 .group = 0, 193 .group = 0,
191 .mask = BIT(16) | BIT(17) | BIT(18) | BIT(19) | BIT(20) | BIT(21) | BIT(22) | BIT(23), 194 .mask = BIT(16) | BIT(17) | BIT(18) | BIT(19) | BIT(20) |
195 BIT(21) | BIT(22) | BIT(23),
192 }, 196 },
193}; 197};
194 198
@@ -200,14 +204,16 @@ static const struct sirfsoc_padmux lcd_24bits_padmux = {
200 .funcval = 0, 204 .funcval = 0,
201}; 205};
202 206
203static const unsigned lcd_24bits_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23, 62, 63, 65, 70, 71, 72, 73, 74, 75, 76, 77, 79, 207static const unsigned lcd_24bits_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23, 62,
204 80, 81, 82, 83, 84, 85, 86, 95}; 208 63, 65, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84,
209 85, 86, 95};
205 210
206static const struct sirfsoc_muxmask lcdrom_muxmask[] = { 211static const struct sirfsoc_muxmask lcdrom_muxmask[] = {
207 { 212 {
208 .group = 2, 213 .group = 2,
209 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | 214 .mask = BIT(1) | BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) |
210 BIT(12) | BIT(13) | BIT(15) | BIT(16) | BIT(17) | BIT(18) | BIT(19) | 215 BIT(11) | BIT(12) | BIT(13) | BIT(15) | BIT(16) |
216 BIT(17) | BIT(18) | BIT(19) |
211 BIT(20) | BIT(21) | BIT(22) | BIT(31), 217 BIT(20) | BIT(21) | BIT(22) | BIT(31),
212 }, { 218 }, {
213 .group = 1, 219 .group = 1,
@@ -226,8 +232,8 @@ static const struct sirfsoc_padmux lcdrom_padmux = {
226 .funcval = BIT(4), 232 .funcval = BIT(4),
227}; 233};
228 234
229static const unsigned lcdrom_pins[] = { 8, 62, 63, 65, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 235static const unsigned lcdrom_pins[] = { 8, 62, 63, 65, 70, 71, 72, 73, 74, 75,
230 84, 85, 86, 95}; 236 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 95};
231 237
232static const struct sirfsoc_muxmask uart0_muxmask[] = { 238static const struct sirfsoc_muxmask uart0_muxmask[] = {
233 { 239 {
@@ -371,11 +377,42 @@ static const struct sirfsoc_padmux cko1_padmux = {
371 377
372static const unsigned cko1_pins[] = { 42 }; 378static const unsigned cko1_pins[] = { 42 };
373 379
374static const struct sirfsoc_muxmask i2s_muxmask[] = { 380static const struct sirfsoc_muxmask i2s_mclk_muxmask[] = {
375 { 381 {
376 .group = 1, 382 .group = 1,
377 .mask = BIT(10), 383 .mask = BIT(10),
378 }, { 384 },
385};
386
387static const struct sirfsoc_padmux i2s_mclk_padmux = {
388 .muxmask_counts = ARRAY_SIZE(i2s_mclk_muxmask),
389 .muxmask = i2s_mclk_muxmask,
390 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
391 .funcmask = BIT(3),
392 .funcval = BIT(3),
393};
394
395static const unsigned i2s_mclk_pins[] = { 42 };
396
397static const struct sirfsoc_muxmask i2s_ext_clk_input_muxmask[] = {
398 {
399 .group = 1,
400 .mask = BIT(19),
401 },
402};
403
404static const struct sirfsoc_padmux i2s_ext_clk_input_padmux = {
405 .muxmask_counts = ARRAY_SIZE(i2s_ext_clk_input_muxmask),
406 .muxmask = i2s_ext_clk_input_muxmask,
407 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
408 .funcmask = BIT(2),
409 .funcval = BIT(2),
410};
411
412static const unsigned i2s_ext_clk_input_pins[] = { 51 };
413
414static const struct sirfsoc_muxmask i2s_muxmask[] = {
415 {
379 .group = 3, 416 .group = 3,
380 .mask = BIT(2) | BIT(3) | BIT(4) | BIT(5), 417 .mask = BIT(2) | BIT(3) | BIT(4) | BIT(5),
381 }, 418 },
@@ -385,17 +422,12 @@ static const struct sirfsoc_padmux i2s_padmux = {
385 .muxmask_counts = ARRAY_SIZE(i2s_muxmask), 422 .muxmask_counts = ARRAY_SIZE(i2s_muxmask),
386 .muxmask = i2s_muxmask, 423 .muxmask = i2s_muxmask,
387 .ctrlreg = SIRFSOC_RSC_PIN_MUX, 424 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
388 .funcmask = BIT(3),
389 .funcval = BIT(3),
390}; 425};
391 426
392static const unsigned i2s_pins[] = { 42, 98, 99, 100, 101 }; 427static const unsigned i2s_pins[] = { 98, 99, 100, 101 };
393 428
394static const struct sirfsoc_muxmask i2s_no_din_muxmask[] = { 429static const struct sirfsoc_muxmask i2s_no_din_muxmask[] = {
395 { 430 {
396 .group = 1,
397 .mask = BIT(10),
398 }, {
399 .group = 3, 431 .group = 3,
400 .mask = BIT(2) | BIT(3) | BIT(4), 432 .mask = BIT(2) | BIT(3) | BIT(4),
401 }, 433 },
@@ -405,17 +437,12 @@ static const struct sirfsoc_padmux i2s_no_din_padmux = {
405 .muxmask_counts = ARRAY_SIZE(i2s_no_din_muxmask), 437 .muxmask_counts = ARRAY_SIZE(i2s_no_din_muxmask),
406 .muxmask = i2s_no_din_muxmask, 438 .muxmask = i2s_no_din_muxmask,
407 .ctrlreg = SIRFSOC_RSC_PIN_MUX, 439 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
408 .funcmask = BIT(3),
409 .funcval = BIT(3),
410}; 440};
411 441
412static const unsigned i2s_no_din_pins[] = { 42, 98, 99, 100 }; 442static const unsigned i2s_no_din_pins[] = { 98, 99, 100 };
413 443
414static const struct sirfsoc_muxmask i2s_6chn_muxmask[] = { 444static const struct sirfsoc_muxmask i2s_6chn_muxmask[] = {
415 { 445 {
416 .group = 1,
417 .mask = BIT(10) | BIT(20) | BIT(23),
418 }, {
419 .group = 3, 446 .group = 3,
420 .mask = BIT(2) | BIT(3) | BIT(4) | BIT(5), 447 .mask = BIT(2) | BIT(3) | BIT(4) | BIT(5),
421 }, 448 },
@@ -425,11 +452,11 @@ static const struct sirfsoc_padmux i2s_6chn_padmux = {
425 .muxmask_counts = ARRAY_SIZE(i2s_6chn_muxmask), 452 .muxmask_counts = ARRAY_SIZE(i2s_6chn_muxmask),
426 .muxmask = i2s_6chn_muxmask, 453 .muxmask = i2s_6chn_muxmask,
427 .ctrlreg = SIRFSOC_RSC_PIN_MUX, 454 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
428 .funcmask = BIT(1) | BIT(3) | BIT(9), 455 .funcmask = BIT(1) | BIT(9),
429 .funcval = BIT(1) | BIT(3) | BIT(9), 456 .funcval = BIT(1) | BIT(9),
430}; 457};
431 458
432static const unsigned i2s_6chn_pins[] = { 42, 52, 55, 98, 99, 100, 101 }; 459static const unsigned i2s_6chn_pins[] = { 52, 55, 98, 99, 100, 101 };
433 460
434static const struct sirfsoc_muxmask ac97_muxmask[] = { 461static const struct sirfsoc_muxmask ac97_muxmask[] = {
435 { 462 {
@@ -716,7 +743,8 @@ static const struct sirfsoc_padmux vip_padmux = {
716 .funcval = BIT(18), 743 .funcval = BIT(18),
717}; 744};
718 745
719static const unsigned vip_pins[] = { 36, 37, 38, 40, 41, 56, 57, 58, 59, 60, 61 }; 746static const unsigned vip_pins[] = { 36, 37, 38, 40, 41, 56, 57, 58, 59,
747 60, 61 };
720 748
721static const struct sirfsoc_muxmask vip_noupli_muxmask[] = { 749static const struct sirfsoc_muxmask vip_noupli_muxmask[] = {
722 { 750 {
@@ -737,7 +765,8 @@ static const struct sirfsoc_padmux vip_noupli_padmux = {
737 .funcval = BIT(15), 765 .funcval = BIT(15),
738}; 766};
739 767
740static const unsigned vip_noupli_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23, 87, 88, 89 }; 768static const unsigned vip_noupli_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23,
769 87, 88, 89 };
741 770
742static const struct sirfsoc_muxmask i2c0_muxmask[] = { 771static const struct sirfsoc_muxmask i2c0_muxmask[] = {
743 { 772 {
@@ -876,7 +905,8 @@ static const struct sirfsoc_padmux usb0_upli_drvbus_padmux = {
876 .funcval = 0, 905 .funcval = 0,
877}; 906};
878 907
879static const unsigned usb0_upli_drvbus_pins[] = { 36, 37, 38, 39, 40, 41, 56, 57, 58, 59, 60, 61 }; 908static const unsigned usb0_upli_drvbus_pins[] = { 36, 37, 38, 39, 40,
909 41, 56, 57, 58, 59, 60, 61 };
880 910
881static const struct sirfsoc_muxmask usb1_utmi_drvbus_muxmask[] = { 911static const struct sirfsoc_muxmask usb1_utmi_drvbus_muxmask[] = {
882 { 912 {
@@ -968,6 +998,8 @@ static const struct sirfsoc_pin_group sirfsoc_pin_groups[] = {
968 SIRFSOC_PIN_GROUP("usb1_dp_dngrp", usb1_dp_dn_pins), 998 SIRFSOC_PIN_GROUP("usb1_dp_dngrp", usb1_dp_dn_pins),
969 SIRFSOC_PIN_GROUP("uart1_route_io_usb1grp", uart1_route_io_usb1_pins), 999 SIRFSOC_PIN_GROUP("uart1_route_io_usb1grp", uart1_route_io_usb1_pins),
970 SIRFSOC_PIN_GROUP("pulse_countgrp", pulse_count_pins), 1000 SIRFSOC_PIN_GROUP("pulse_countgrp", pulse_count_pins),
1001 SIRFSOC_PIN_GROUP("i2smclkgrp", i2s_mclk_pins),
1002 SIRFSOC_PIN_GROUP("i2s_ext_clk_inputgrp", i2s_ext_clk_input_pins),
971 SIRFSOC_PIN_GROUP("i2sgrp", i2s_pins), 1003 SIRFSOC_PIN_GROUP("i2sgrp", i2s_pins),
972 SIRFSOC_PIN_GROUP("i2s_no_dingrp", i2s_no_din_pins), 1004 SIRFSOC_PIN_GROUP("i2s_no_dingrp", i2s_no_din_pins),
973 SIRFSOC_PIN_GROUP("i2s_6chngrp", i2s_6chn_pins), 1005 SIRFSOC_PIN_GROUP("i2s_6chngrp", i2s_6chn_pins),
@@ -1017,8 +1049,11 @@ static const char * const sdmmc2_nowpgrp[] = { "sdmmc2_nowpgrp" };
1017static const char * const usb0_upli_drvbusgrp[] = { "usb0_upli_drvbusgrp" }; 1049static const char * const usb0_upli_drvbusgrp[] = { "usb0_upli_drvbusgrp" };
1018static const char * const usb1_utmi_drvbusgrp[] = { "usb1_utmi_drvbusgrp" }; 1050static const char * const usb1_utmi_drvbusgrp[] = { "usb1_utmi_drvbusgrp" };
1019static const char * const usb1_dp_dngrp[] = { "usb1_dp_dngrp" }; 1051static const char * const usb1_dp_dngrp[] = { "usb1_dp_dngrp" };
1020static const char * const uart1_route_io_usb1grp[] = { "uart1_route_io_usb1grp" }; 1052static const char * const
1053 uart1_route_io_usb1grp[] = { "uart1_route_io_usb1grp" };
1021static const char * const pulse_countgrp[] = { "pulse_countgrp" }; 1054static const char * const pulse_countgrp[] = { "pulse_countgrp" };
1055static const char * const i2smclkgrp[] = { "i2smclkgrp" };
1056static const char * const i2s_ext_clk_inputgrp[] = { "i2s_ext_clk_inputgrp" };
1022static const char * const i2sgrp[] = { "i2sgrp" }; 1057static const char * const i2sgrp[] = { "i2sgrp" };
1023static const char * const i2s_no_dingrp[] = { "i2s_no_dingrp" }; 1058static const char * const i2s_no_dingrp[] = { "i2s_no_dingrp" };
1024static const char * const i2s_6chngrp[] = { "i2s_6chngrp" }; 1059static const char * const i2s_6chngrp[] = { "i2s_6chngrp" };
@@ -1038,7 +1073,8 @@ static const struct sirfsoc_pmx_func sirfsoc_pmx_functions[] = {
1038 uart0_nostreamctrl_padmux), 1073 uart0_nostreamctrl_padmux),
1039 SIRFSOC_PMX_FUNCTION("uart1", uart1grp, uart1_padmux), 1074 SIRFSOC_PMX_FUNCTION("uart1", uart1grp, uart1_padmux),
1040 SIRFSOC_PMX_FUNCTION("uart2", uart2grp, uart2_padmux), 1075 SIRFSOC_PMX_FUNCTION("uart2", uart2grp, uart2_padmux),
1041 SIRFSOC_PMX_FUNCTION("uart2_nostreamctrl", uart2_nostreamctrlgrp, uart2_nostreamctrl_padmux), 1076 SIRFSOC_PMX_FUNCTION("uart2_nostreamctrl",
1077 uart2_nostreamctrlgrp, uart2_nostreamctrl_padmux),
1042 SIRFSOC_PMX_FUNCTION("usp0", usp0grp, usp0_padmux), 1078 SIRFSOC_PMX_FUNCTION("usp0", usp0grp, usp0_padmux),
1043 SIRFSOC_PMX_FUNCTION("usp0_uart_nostreamctrl", 1079 SIRFSOC_PMX_FUNCTION("usp0_uart_nostreamctrl",
1044 usp0_uart_nostreamctrl_grp, 1080 usp0_uart_nostreamctrl_grp,
@@ -1068,12 +1104,19 @@ static const struct sirfsoc_pmx_func sirfsoc_pmx_functions[] = {
1068 SIRFSOC_PMX_FUNCTION("sdmmc2", sdmmc2grp, sdmmc2_padmux), 1104 SIRFSOC_PMX_FUNCTION("sdmmc2", sdmmc2grp, sdmmc2_padmux),
1069 SIRFSOC_PMX_FUNCTION("sdmmc3", sdmmc3grp, sdmmc3_padmux), 1105 SIRFSOC_PMX_FUNCTION("sdmmc3", sdmmc3grp, sdmmc3_padmux),
1070 SIRFSOC_PMX_FUNCTION("sdmmc5", sdmmc5grp, sdmmc5_padmux), 1106 SIRFSOC_PMX_FUNCTION("sdmmc5", sdmmc5grp, sdmmc5_padmux),
1071 SIRFSOC_PMX_FUNCTION("sdmmc2_nowp", sdmmc2_nowpgrp, sdmmc2_nowp_padmux), 1107 SIRFSOC_PMX_FUNCTION("sdmmc2_nowp",
1072 SIRFSOC_PMX_FUNCTION("usb0_upli_drvbus", usb0_upli_drvbusgrp, usb0_upli_drvbus_padmux), 1108 sdmmc2_nowpgrp, sdmmc2_nowp_padmux),
1073 SIRFSOC_PMX_FUNCTION("usb1_utmi_drvbus", usb1_utmi_drvbusgrp, usb1_utmi_drvbus_padmux), 1109 SIRFSOC_PMX_FUNCTION("usb0_upli_drvbus",
1110 usb0_upli_drvbusgrp, usb0_upli_drvbus_padmux),
1111 SIRFSOC_PMX_FUNCTION("usb1_utmi_drvbus",
1112 usb1_utmi_drvbusgrp, usb1_utmi_drvbus_padmux),
1074 SIRFSOC_PMX_FUNCTION("usb1_dp_dn", usb1_dp_dngrp, usb1_dp_dn_padmux), 1113 SIRFSOC_PMX_FUNCTION("usb1_dp_dn", usb1_dp_dngrp, usb1_dp_dn_padmux),
1075 SIRFSOC_PMX_FUNCTION("uart1_route_io_usb1", uart1_route_io_usb1grp, uart1_route_io_usb1_padmux), 1114 SIRFSOC_PMX_FUNCTION("uart1_route_io_usb1",
1115 uart1_route_io_usb1grp, uart1_route_io_usb1_padmux),
1076 SIRFSOC_PMX_FUNCTION("pulse_count", pulse_countgrp, pulse_count_padmux), 1116 SIRFSOC_PMX_FUNCTION("pulse_count", pulse_countgrp, pulse_count_padmux),
1117 SIRFSOC_PMX_FUNCTION("i2s_mclk", i2smclkgrp, i2s_mclk_padmux),
1118 SIRFSOC_PMX_FUNCTION("i2s_ext_clk_input", i2s_ext_clk_inputgrp,
1119 i2s_ext_clk_input_padmux),
1077 SIRFSOC_PMX_FUNCTION("i2s", i2sgrp, i2s_padmux), 1120 SIRFSOC_PMX_FUNCTION("i2s", i2sgrp, i2s_padmux),
1078 SIRFSOC_PMX_FUNCTION("i2s_no_din", i2s_no_dingrp, i2s_no_din_padmux), 1121 SIRFSOC_PMX_FUNCTION("i2s_no_din", i2s_no_dingrp, i2s_no_din_padmux),
1079 SIRFSOC_PMX_FUNCTION("i2s_6chn", i2s_6chngrp, i2s_6chn_padmux), 1122 SIRFSOC_PMX_FUNCTION("i2s_6chn", i2s_6chngrp, i2s_6chn_padmux),
diff --git a/drivers/pinctrl/sirf/pinctrl-prima2.c b/drivers/pinctrl/sirf/pinctrl-prima2.c
index 8aa76f0776d7..357678ee28e3 100644
--- a/drivers/pinctrl/sirf/pinctrl-prima2.c
+++ b/drivers/pinctrl/sirf/pinctrl-prima2.c
@@ -135,8 +135,9 @@ static const struct pinctrl_pin_desc sirfsoc_pads[] = {
135static const struct sirfsoc_muxmask lcd_16bits_sirfsoc_muxmask[] = { 135static const struct sirfsoc_muxmask lcd_16bits_sirfsoc_muxmask[] = {
136 { 136 {
137 .group = 3, 137 .group = 3,
138 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7) | BIT(8) | 138 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) |
139 BIT(9) | BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) | 139 BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) |
140 BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) |
140 BIT(17) | BIT(18), 141 BIT(17) | BIT(18),
141 }, { 142 }, {
142 .group = 2, 143 .group = 2,
@@ -152,14 +153,15 @@ static const struct sirfsoc_padmux lcd_16bits_padmux = {
152 .funcval = 0, 153 .funcval = 0,
153}; 154};
154 155
155static const unsigned lcd_16bits_pins[] = { 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 156static const unsigned lcd_16bits_pins[] = { 95, 96, 97, 98, 99, 100, 101, 102,
156 105, 106, 107, 108, 109, 110, 111, 112, 113, 114 }; 157 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114 };
157 158
158static const struct sirfsoc_muxmask lcd_18bits_muxmask[] = { 159static const struct sirfsoc_muxmask lcd_18bits_muxmask[] = {
159 { 160 {
160 .group = 3, 161 .group = 3,
161 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7) | BIT(8) | 162 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) |
162 BIT(9) | BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) | 163 BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) |
164 BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) |
163 BIT(17) | BIT(18), 165 BIT(17) | BIT(18),
164 }, { 166 }, {
165 .group = 2, 167 .group = 2,
@@ -178,21 +180,23 @@ static const struct sirfsoc_padmux lcd_18bits_padmux = {
178 .funcval = 0, 180 .funcval = 0,
179}; 181};
180 182
181static const unsigned lcd_18bits_pins[] = { 16, 17, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 183static const unsigned lcd_18bits_pins[] = { 16, 17, 95, 96, 97, 98, 99, 100,
182 105, 106, 107, 108, 109, 110, 111, 112, 113, 114}; 184 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114};
183 185
184static const struct sirfsoc_muxmask lcd_24bits_muxmask[] = { 186static const struct sirfsoc_muxmask lcd_24bits_muxmask[] = {
185 { 187 {
186 .group = 3, 188 .group = 3,
187 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7) | BIT(8) | 189 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) |
188 BIT(9) | BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) | 190 BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) |
191 BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) |
189 BIT(17) | BIT(18), 192 BIT(17) | BIT(18),
190 }, { 193 }, {
191 .group = 2, 194 .group = 2,
192 .mask = BIT(31), 195 .mask = BIT(31),
193 }, { 196 }, {
194 .group = 0, 197 .group = 0,
195 .mask = BIT(16) | BIT(17) | BIT(18) | BIT(19) | BIT(20) | BIT(21) | BIT(22) | BIT(23), 198 .mask = BIT(16) | BIT(17) | BIT(18) | BIT(19) | BIT(20) |
199 BIT(21) | BIT(22) | BIT(23),
196 }, 200 },
197}; 201};
198 202
@@ -204,14 +208,16 @@ static const struct sirfsoc_padmux lcd_24bits_padmux = {
204 .funcval = 0, 208 .funcval = 0,
205}; 209};
206 210
207static const unsigned lcd_24bits_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 211static const unsigned lcd_24bits_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23,
208 105, 106, 107, 108, 109, 110, 111, 112, 113, 114 }; 212 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
213 110, 111, 112, 113, 114 };
209 214
210static const struct sirfsoc_muxmask lcdrom_muxmask[] = { 215static const struct sirfsoc_muxmask lcdrom_muxmask[] = {
211 { 216 {
212 .group = 3, 217 .group = 3,
213 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7) | BIT(8) | 218 .mask = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) |
214 BIT(9) | BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) | 219 BIT(6) | BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) |
220 BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16) |
215 BIT(17) | BIT(18), 221 BIT(17) | BIT(18),
216 }, { 222 }, {
217 .group = 2, 223 .group = 2,
@@ -230,8 +236,8 @@ static const struct sirfsoc_padmux lcdrom_padmux = {
230 .funcval = BIT(4), 236 .funcval = BIT(4),
231}; 237};
232 238
233static const unsigned lcdrom_pins[] = { 23, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 239static const unsigned lcdrom_pins[] = { 23, 95, 96, 97, 98, 99, 100, 101, 102,
234 105, 106, 107, 108, 109, 110, 111, 112, 113, 114 }; 240 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114 };
235 241
236static const struct sirfsoc_muxmask uart0_muxmask[] = { 242static const struct sirfsoc_muxmask uart0_muxmask[] = {
237 { 243 {
@@ -380,12 +386,44 @@ static const struct sirfsoc_padmux cko1_padmux = {
380 386
381static const unsigned cko1_pins[] = { 42 }; 387static const unsigned cko1_pins[] = { 42 };
382 388
389static const struct sirfsoc_muxmask i2s_mclk_muxmask[] = {
390 {
391 .group = 1,
392 .mask = BIT(10),
393 },
394};
395
396static const struct sirfsoc_padmux i2s_mclk_padmux = {
397 .muxmask_counts = ARRAY_SIZE(i2s_mclk_muxmask),
398 .muxmask = i2s_mclk_muxmask,
399 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
400 .funcmask = BIT(3),
401 .funcval = BIT(3),
402};
403
404static const unsigned i2s_mclk_pins[] = { 42 };
405
406static const struct sirfsoc_muxmask i2s_ext_clk_input_muxmask[] = {
407 {
408 .group = 1,
409 .mask = BIT(19),
410 },
411};
412
413static const struct sirfsoc_padmux i2s_ext_clk_input_padmux = {
414 .muxmask_counts = ARRAY_SIZE(i2s_ext_clk_input_muxmask),
415 .muxmask = i2s_ext_clk_input_muxmask,
416 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
417 .funcmask = BIT(2),
418 .funcval = BIT(2),
419};
420
421static const unsigned i2s_ext_clk_input_pins[] = { 51 };
422
383static const struct sirfsoc_muxmask i2s_muxmask[] = { 423static const struct sirfsoc_muxmask i2s_muxmask[] = {
384 { 424 {
385 .group = 1, 425 .group = 1,
386 .mask = 426 .mask = BIT(11) | BIT(12) | BIT(13) | BIT(14),
387 BIT(10) | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(19)
388 | BIT(23) | BIT(28),
389 }, 427 },
390}; 428};
391 429
@@ -393,11 +431,42 @@ static const struct sirfsoc_padmux i2s_padmux = {
393 .muxmask_counts = ARRAY_SIZE(i2s_muxmask), 431 .muxmask_counts = ARRAY_SIZE(i2s_muxmask),
394 .muxmask = i2s_muxmask, 432 .muxmask = i2s_muxmask,
395 .ctrlreg = SIRFSOC_RSC_PIN_MUX, 433 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
396 .funcmask = BIT(3) | BIT(9),
397 .funcval = BIT(3),
398}; 434};
399 435
400static const unsigned i2s_pins[] = { 42, 43, 44, 45, 46, 51, 55, 60 }; 436static const unsigned i2s_pins[] = { 43, 44, 45, 46 };
437
438static const struct sirfsoc_muxmask i2s_no_din_muxmask[] = {
439 {
440 .group = 1,
441 .mask = BIT(11) | BIT(12) | BIT(14),
442 },
443};
444
445static const struct sirfsoc_padmux i2s_no_din_padmux = {
446 .muxmask_counts = ARRAY_SIZE(i2s_no_din_muxmask),
447 .muxmask = i2s_no_din_muxmask,
448 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
449};
450
451static const unsigned i2s_no_din_pins[] = { 43, 44, 46 };
452
453static const struct sirfsoc_muxmask i2s_6chn_muxmask[] = {
454 {
455 .group = 1,
456 .mask = BIT(11) | BIT(12) | BIT(13) | BIT(14)
457 | BIT(23) | BIT(28),
458 },
459};
460
461static const struct sirfsoc_padmux i2s_6chn_padmux = {
462 .muxmask_counts = ARRAY_SIZE(i2s_6chn_muxmask),
463 .muxmask = i2s_6chn_muxmask,
464 .ctrlreg = SIRFSOC_RSC_PIN_MUX,
465 .funcmask = BIT(1) | BIT(9),
466 .funcval = BIT(1) | BIT(9),
467};
468
469static const unsigned i2s_6chn_pins[] = { 43, 44, 45, 46, 55, 60 };
401 470
402static const struct sirfsoc_muxmask ac97_muxmask[] = { 471static const struct sirfsoc_muxmask ac97_muxmask[] = {
403 { 472 {
@@ -685,7 +754,8 @@ static const struct sirfsoc_padmux vip_padmux = {
685 .funcval = 0, 754 .funcval = 0,
686}; 755};
687 756
688static const unsigned vip_pins[] = { 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 }; 757static const unsigned vip_pins[] = { 79, 80, 81, 82, 83, 84, 85, 86, 87,
758 88, 89 };
689 759
690static const struct sirfsoc_muxmask i2c0_muxmask[] = { 760static const struct sirfsoc_muxmask i2c0_muxmask[] = {
691 { 761 {
@@ -735,7 +805,8 @@ static const struct sirfsoc_padmux viprom_padmux = {
735 .funcval = BIT(0), 805 .funcval = BIT(0),
736}; 806};
737 807
738static const unsigned viprom_pins[] = { 12, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 }; 808static const unsigned viprom_pins[] = { 12, 79, 80, 81, 82, 83, 84, 85, 86,
809 87, 88, 89 };
739 810
740static const struct sirfsoc_muxmask pwm0_muxmask[] = { 811static const struct sirfsoc_muxmask pwm0_muxmask[] = {
741 { 812 {
@@ -918,7 +989,11 @@ static const struct sirfsoc_pin_group sirfsoc_pin_groups[] = {
918 SIRFSOC_PIN_GROUP("usb1_dp_dngrp", usb1_dp_dn_pins), 989 SIRFSOC_PIN_GROUP("usb1_dp_dngrp", usb1_dp_dn_pins),
919 SIRFSOC_PIN_GROUP("uart1_route_io_usb1grp", uart1_route_io_usb1_pins), 990 SIRFSOC_PIN_GROUP("uart1_route_io_usb1grp", uart1_route_io_usb1_pins),
920 SIRFSOC_PIN_GROUP("pulse_countgrp", pulse_count_pins), 991 SIRFSOC_PIN_GROUP("pulse_countgrp", pulse_count_pins),
992 SIRFSOC_PIN_GROUP("i2smclkgrp", i2s_mclk_pins),
993 SIRFSOC_PIN_GROUP("i2s_ext_clk_inputgrp", i2s_ext_clk_input_pins),
921 SIRFSOC_PIN_GROUP("i2sgrp", i2s_pins), 994 SIRFSOC_PIN_GROUP("i2sgrp", i2s_pins),
995 SIRFSOC_PIN_GROUP("i2s_no_dingrp", i2s_no_din_pins),
996 SIRFSOC_PIN_GROUP("i2s_6chngrp", i2s_6chn_pins),
922 SIRFSOC_PIN_GROUP("ac97grp", ac97_pins), 997 SIRFSOC_PIN_GROUP("ac97grp", ac97_pins),
923 SIRFSOC_PIN_GROUP("nandgrp", nand_pins), 998 SIRFSOC_PIN_GROUP("nandgrp", nand_pins),
924 SIRFSOC_PIN_GROUP("spi0grp", spi0_pins), 999 SIRFSOC_PIN_GROUP("spi0grp", spi0_pins),
@@ -936,16 +1011,19 @@ static const char * const uart1grp[] = { "uart1grp" };
936static const char * const uart2grp[] = { "uart2grp" }; 1011static const char * const uart2grp[] = { "uart2grp" };
937static const char * const uart2_nostreamctrlgrp[] = { "uart2_nostreamctrlgrp" }; 1012static const char * const uart2_nostreamctrlgrp[] = { "uart2_nostreamctrlgrp" };
938static const char * const usp0grp[] = { "usp0grp" }; 1013static const char * const usp0grp[] = { "usp0grp" };
939static const char * const usp0_uart_nostreamctrl_grp[] = 1014static const char * const usp0_uart_nostreamctrl_grp[] = {
940 { "usp0_uart_nostreamctrl_grp" }; 1015 "usp0_uart_nostreamctrl_grp"
1016};
941static const char * const usp0_only_utfs_grp[] = { "usp0_only_utfs_grp" }; 1017static const char * const usp0_only_utfs_grp[] = { "usp0_only_utfs_grp" };
942static const char * const usp0_only_urfs_grp[] = { "usp0_only_urfs_grp" }; 1018static const char * const usp0_only_urfs_grp[] = { "usp0_only_urfs_grp" };
943static const char * const usp1grp[] = { "usp1grp" }; 1019static const char * const usp1grp[] = { "usp1grp" };
944static const char * const usp1_uart_nostreamctrl_grp[] = 1020static const char * const usp1_uart_nostreamctrl_grp[] = {
945 { "usp1_uart_nostreamctrl_grp" }; 1021 "usp1_uart_nostreamctrl_grp"
1022};
946static const char * const usp2grp[] = { "usp2grp" }; 1023static const char * const usp2grp[] = { "usp2grp" };
947static const char * const usp2_uart_nostreamctrl_grp[] = 1024static const char * const usp2_uart_nostreamctrl_grp[] = {
948 { "usp2_uart_nostreamctrl_grp" }; 1025 "usp2_uart_nostreamctrl_grp"
1026};
949static const char * const i2c0grp[] = { "i2c0grp" }; 1027static const char * const i2c0grp[] = { "i2c0grp" };
950static const char * const i2c1grp[] = { "i2c1grp" }; 1028static const char * const i2c1grp[] = { "i2c1grp" };
951static const char * const pwm0grp[] = { "pwm0grp" }; 1029static const char * const pwm0grp[] = { "pwm0grp" };
@@ -966,9 +1044,14 @@ static const char * const sdmmc5grp[] = { "sdmmc5grp" };
966static const char * const usb0_utmi_drvbusgrp[] = { "usb0_utmi_drvbusgrp" }; 1044static const char * const usb0_utmi_drvbusgrp[] = { "usb0_utmi_drvbusgrp" };
967static const char * const usb1_utmi_drvbusgrp[] = { "usb1_utmi_drvbusgrp" }; 1045static const char * const usb1_utmi_drvbusgrp[] = { "usb1_utmi_drvbusgrp" };
968static const char * const usb1_dp_dngrp[] = { "usb1_dp_dngrp" }; 1046static const char * const usb1_dp_dngrp[] = { "usb1_dp_dngrp" };
969static const char * const uart1_route_io_usb1grp[] = { "uart1_route_io_usb1grp" }; 1047static const char * const
1048 uart1_route_io_usb1grp[] = { "uart1_route_io_usb1grp" };
970static const char * const pulse_countgrp[] = { "pulse_countgrp" }; 1049static const char * const pulse_countgrp[] = { "pulse_countgrp" };
1050static const char * const i2smclkgrp[] = { "i2smclkgrp" };
1051static const char * const i2s_ext_clk_inputgrp[] = { "i2s_ext_clk_inputgrp" };
971static const char * const i2sgrp[] = { "i2sgrp" }; 1052static const char * const i2sgrp[] = { "i2sgrp" };
1053static const char * const i2s_no_dingrp[] = { "i2s_no_dingrp" };
1054static const char * const i2s_6chngrp[] = { "i2s_6chngrp" };
972static const char * const ac97grp[] = { "ac97grp" }; 1055static const char * const ac97grp[] = { "ac97grp" };
973static const char * const nandgrp[] = { "nandgrp" }; 1056static const char * const nandgrp[] = { "nandgrp" };
974static const char * const spi0grp[] = { "spi0grp" }; 1057static const char * const spi0grp[] = { "spi0grp" };
@@ -981,15 +1064,19 @@ static const struct sirfsoc_pmx_func sirfsoc_pmx_functions[] = {
981 SIRFSOC_PMX_FUNCTION("lcd_24bits", lcd_24bitsgrp, lcd_24bits_padmux), 1064 SIRFSOC_PMX_FUNCTION("lcd_24bits", lcd_24bitsgrp, lcd_24bits_padmux),
982 SIRFSOC_PMX_FUNCTION("lcdrom", lcdromgrp, lcdrom_padmux), 1065 SIRFSOC_PMX_FUNCTION("lcdrom", lcdromgrp, lcdrom_padmux),
983 SIRFSOC_PMX_FUNCTION("uart0", uart0grp, uart0_padmux), 1066 SIRFSOC_PMX_FUNCTION("uart0", uart0grp, uart0_padmux),
984 SIRFSOC_PMX_FUNCTION("uart0_nostreamctrl", uart0_nostreamctrlgrp, uart0_nostreamctrl_padmux), 1067 SIRFSOC_PMX_FUNCTION("uart0_nostreamctrl",
1068 uart0_nostreamctrlgrp, uart0_nostreamctrl_padmux),
985 SIRFSOC_PMX_FUNCTION("uart1", uart1grp, uart1_padmux), 1069 SIRFSOC_PMX_FUNCTION("uart1", uart1grp, uart1_padmux),
986 SIRFSOC_PMX_FUNCTION("uart2", uart2grp, uart2_padmux), 1070 SIRFSOC_PMX_FUNCTION("uart2", uart2grp, uart2_padmux),
987 SIRFSOC_PMX_FUNCTION("uart2_nostreamctrl", uart2_nostreamctrlgrp, uart2_nostreamctrl_padmux), 1071 SIRFSOC_PMX_FUNCTION("uart2_nostreamctrl",
1072 uart2_nostreamctrlgrp, uart2_nostreamctrl_padmux),
988 SIRFSOC_PMX_FUNCTION("usp0", usp0grp, usp0_padmux), 1073 SIRFSOC_PMX_FUNCTION("usp0", usp0grp, usp0_padmux),
989 SIRFSOC_PMX_FUNCTION("usp0_uart_nostreamctrl", 1074 SIRFSOC_PMX_FUNCTION("usp0_uart_nostreamctrl",
990 usp0_uart_nostreamctrl_grp, usp0_uart_nostreamctrl_padmux), 1075 usp0_uart_nostreamctrl_grp, usp0_uart_nostreamctrl_padmux),
991 SIRFSOC_PMX_FUNCTION("usp0_only_utfs", usp0_only_utfs_grp, usp0_only_utfs_padmux), 1076 SIRFSOC_PMX_FUNCTION("usp0_only_utfs",
992 SIRFSOC_PMX_FUNCTION("usp0_only_urfs", usp0_only_urfs_grp, usp0_only_urfs_padmux), 1077 usp0_only_utfs_grp, usp0_only_utfs_padmux),
1078 SIRFSOC_PMX_FUNCTION("usp0_only_urfs",
1079 usp0_only_urfs_grp, usp0_only_urfs_padmux),
993 SIRFSOC_PMX_FUNCTION("usp1", usp1grp, usp1_padmux), 1080 SIRFSOC_PMX_FUNCTION("usp1", usp1grp, usp1_padmux),
994 SIRFSOC_PMX_FUNCTION("usp1_uart_nostreamctrl", 1081 SIRFSOC_PMX_FUNCTION("usp1_uart_nostreamctrl",
995 usp1_uart_nostreamctrl_grp, usp1_uart_nostreamctrl_padmux), 1082 usp1_uart_nostreamctrl_grp, usp1_uart_nostreamctrl_padmux),
@@ -1013,12 +1100,20 @@ static const struct sirfsoc_pmx_func sirfsoc_pmx_functions[] = {
1013 SIRFSOC_PMX_FUNCTION("sdmmc3", sdmmc3grp, sdmmc3_padmux), 1100 SIRFSOC_PMX_FUNCTION("sdmmc3", sdmmc3grp, sdmmc3_padmux),
1014 SIRFSOC_PMX_FUNCTION("sdmmc4", sdmmc4grp, sdmmc4_padmux), 1101 SIRFSOC_PMX_FUNCTION("sdmmc4", sdmmc4grp, sdmmc4_padmux),
1015 SIRFSOC_PMX_FUNCTION("sdmmc5", sdmmc5grp, sdmmc5_padmux), 1102 SIRFSOC_PMX_FUNCTION("sdmmc5", sdmmc5grp, sdmmc5_padmux),
1016 SIRFSOC_PMX_FUNCTION("usb0_utmi_drvbus", usb0_utmi_drvbusgrp, usb0_utmi_drvbus_padmux), 1103 SIRFSOC_PMX_FUNCTION("usb0_utmi_drvbus",
1017 SIRFSOC_PMX_FUNCTION("usb1_utmi_drvbus", usb1_utmi_drvbusgrp, usb1_utmi_drvbus_padmux), 1104 usb0_utmi_drvbusgrp, usb0_utmi_drvbus_padmux),
1105 SIRFSOC_PMX_FUNCTION("usb1_utmi_drvbus",
1106 usb1_utmi_drvbusgrp, usb1_utmi_drvbus_padmux),
1018 SIRFSOC_PMX_FUNCTION("usb1_dp_dn", usb1_dp_dngrp, usb1_dp_dn_padmux), 1107 SIRFSOC_PMX_FUNCTION("usb1_dp_dn", usb1_dp_dngrp, usb1_dp_dn_padmux),
1019 SIRFSOC_PMX_FUNCTION("uart1_route_io_usb1", uart1_route_io_usb1grp, uart1_route_io_usb1_padmux), 1108 SIRFSOC_PMX_FUNCTION("uart1_route_io_usb1",
1109 uart1_route_io_usb1grp, uart1_route_io_usb1_padmux),
1020 SIRFSOC_PMX_FUNCTION("pulse_count", pulse_countgrp, pulse_count_padmux), 1110 SIRFSOC_PMX_FUNCTION("pulse_count", pulse_countgrp, pulse_count_padmux),
1111 SIRFSOC_PMX_FUNCTION("i2s_mclk", i2smclkgrp, i2s_mclk_padmux),
1112 SIRFSOC_PMX_FUNCTION("i2s_ext_clk_input", i2s_ext_clk_inputgrp,
1113 i2s_ext_clk_input_padmux),
1021 SIRFSOC_PMX_FUNCTION("i2s", i2sgrp, i2s_padmux), 1114 SIRFSOC_PMX_FUNCTION("i2s", i2sgrp, i2s_padmux),
1115 SIRFSOC_PMX_FUNCTION("i2s_no_din", i2s_no_dingrp, i2s_no_din_padmux),
1116 SIRFSOC_PMX_FUNCTION("i2s_6chn", i2s_6chngrp, i2s_6chn_padmux),
1022 SIRFSOC_PMX_FUNCTION("ac97", ac97grp, ac97_padmux), 1117 SIRFSOC_PMX_FUNCTION("ac97", ac97grp, ac97_padmux),
1023 SIRFSOC_PMX_FUNCTION("nand", nandgrp, nand_padmux), 1118 SIRFSOC_PMX_FUNCTION("nand", nandgrp, nand_padmux),
1024 SIRFSOC_PMX_FUNCTION("spi0", spi0grp, spi0_padmux), 1119 SIRFSOC_PMX_FUNCTION("spi0", spi0grp, spi0_padmux),
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c
index 4c1d7c68666d..b713bd59ffbb 100644
--- a/drivers/pinctrl/sirf/pinctrl-sirf.c
+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
@@ -58,17 +58,18 @@ static const char *sirfsoc_get_group_name(struct pinctrl_dev *pctldev,
58 return sirfsoc_pin_groups[selector].name; 58 return sirfsoc_pin_groups[selector].name;
59} 59}
60 60
61static int sirfsoc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, 61static int sirfsoc_get_group_pins(struct pinctrl_dev *pctldev,
62 const unsigned **pins, 62 unsigned selector,
63 unsigned *num_pins) 63 const unsigned **pins,
64 unsigned *num_pins)
64{ 65{
65 *pins = sirfsoc_pin_groups[selector].pins; 66 *pins = sirfsoc_pin_groups[selector].pins;
66 *num_pins = sirfsoc_pin_groups[selector].num_pins; 67 *num_pins = sirfsoc_pin_groups[selector].num_pins;
67 return 0; 68 return 0;
68} 69}
69 70
70static void sirfsoc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, 71static void sirfsoc_pin_dbg_show(struct pinctrl_dev *pctldev,
71 unsigned offset) 72 struct seq_file *s, unsigned offset)
72{ 73{
73 seq_printf(s, " " DRIVER_NAME); 74 seq_printf(s, " " DRIVER_NAME);
74} 75}
@@ -138,22 +139,25 @@ static struct pinctrl_ops sirfsoc_pctrl_ops = {
138static struct sirfsoc_pmx_func *sirfsoc_pmx_functions; 139static struct sirfsoc_pmx_func *sirfsoc_pmx_functions;
139static int sirfsoc_pmxfunc_cnt; 140static int sirfsoc_pmxfunc_cnt;
140 141
141static void sirfsoc_pinmux_endisable(struct sirfsoc_pmx *spmx, unsigned selector, 142static void sirfsoc_pinmux_endisable(struct sirfsoc_pmx *spmx,
142 bool enable) 143 unsigned selector, bool enable)
143{ 144{
144 int i; 145 int i;
145 const struct sirfsoc_padmux *mux = sirfsoc_pmx_functions[selector].padmux; 146 const struct sirfsoc_padmux *mux =
147 sirfsoc_pmx_functions[selector].padmux;
146 const struct sirfsoc_muxmask *mask = mux->muxmask; 148 const struct sirfsoc_muxmask *mask = mux->muxmask;
147 149
148 for (i = 0; i < mux->muxmask_counts; i++) { 150 for (i = 0; i < mux->muxmask_counts; i++) {
149 u32 muxval; 151 u32 muxval;
150 if (!spmx->is_marco) { 152 if (!spmx->is_marco) {
151 muxval = readl(spmx->gpio_virtbase + SIRFSOC_GPIO_PAD_EN(mask[i].group)); 153 muxval = readl(spmx->gpio_virtbase +
154 SIRFSOC_GPIO_PAD_EN(mask[i].group));
152 if (enable) 155 if (enable)
153 muxval = muxval & ~mask[i].mask; 156 muxval = muxval & ~mask[i].mask;
154 else 157 else
155 muxval = muxval | mask[i].mask; 158 muxval = muxval | mask[i].mask;
156 writel(muxval, spmx->gpio_virtbase + SIRFSOC_GPIO_PAD_EN(mask[i].group)); 159 writel(muxval, spmx->gpio_virtbase +
160 SIRFSOC_GPIO_PAD_EN(mask[i].group));
157 } else { 161 } else {
158 if (enable) 162 if (enable)
159 writel(mask[i].mask, spmx->gpio_virtbase + 163 writel(mask[i].mask, spmx->gpio_virtbase +
@@ -175,8 +179,9 @@ static void sirfsoc_pinmux_endisable(struct sirfsoc_pmx *spmx, unsigned selector
175 } 179 }
176} 180}
177 181
178static int sirfsoc_pinmux_enable(struct pinctrl_dev *pmxdev, unsigned selector, 182static int sirfsoc_pinmux_set_mux(struct pinctrl_dev *pmxdev,
179 unsigned group) 183 unsigned selector,
184 unsigned group)
180{ 185{
181 struct sirfsoc_pmx *spmx; 186 struct sirfsoc_pmx *spmx;
182 187
@@ -197,9 +202,10 @@ static const char *sirfsoc_pinmux_get_func_name(struct pinctrl_dev *pctldev,
197 return sirfsoc_pmx_functions[selector].name; 202 return sirfsoc_pmx_functions[selector].name;
198} 203}
199 204
200static int sirfsoc_pinmux_get_groups(struct pinctrl_dev *pctldev, unsigned selector, 205static int sirfsoc_pinmux_get_groups(struct pinctrl_dev *pctldev,
201 const char * const **groups, 206 unsigned selector,
202 unsigned * const num_groups) 207 const char * const **groups,
208 unsigned * const num_groups)
203{ 209{
204 *groups = sirfsoc_pmx_functions[selector].groups; 210 *groups = sirfsoc_pmx_functions[selector].groups;
205 *num_groups = sirfsoc_pmx_functions[selector].num_groups; 211 *num_groups = sirfsoc_pmx_functions[selector].num_groups;
@@ -218,9 +224,11 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
218 spmx = pinctrl_dev_get_drvdata(pmxdev); 224 spmx = pinctrl_dev_get_drvdata(pmxdev);
219 225
220 if (!spmx->is_marco) { 226 if (!spmx->is_marco) {
221 muxval = readl(spmx->gpio_virtbase + SIRFSOC_GPIO_PAD_EN(group)); 227 muxval = readl(spmx->gpio_virtbase +
228 SIRFSOC_GPIO_PAD_EN(group));
222 muxval = muxval | (1 << (offset - range->pin_base)); 229 muxval = muxval | (1 << (offset - range->pin_base));
223 writel(muxval, spmx->gpio_virtbase + SIRFSOC_GPIO_PAD_EN(group)); 230 writel(muxval, spmx->gpio_virtbase +
231 SIRFSOC_GPIO_PAD_EN(group));
224 } else { 232 } else {
225 writel(1 << (offset - range->pin_base), spmx->gpio_virtbase + 233 writel(1 << (offset - range->pin_base), spmx->gpio_virtbase +
226 SIRFSOC_GPIO_PAD_EN(group)); 234 SIRFSOC_GPIO_PAD_EN(group));
@@ -230,7 +238,7 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
230} 238}
231 239
232static struct pinmux_ops sirfsoc_pinmux_ops = { 240static struct pinmux_ops sirfsoc_pinmux_ops = {
233 .enable = sirfsoc_pinmux_enable, 241 .set_mux = sirfsoc_pinmux_set_mux,
234 .get_functions_count = sirfsoc_pinmux_get_funcs_count, 242 .get_functions_count = sirfsoc_pinmux_get_funcs_count,
235 .get_function_name = sirfsoc_pinmux_get_func_name, 243 .get_function_name = sirfsoc_pinmux_get_func_name,
236 .get_function_groups = sirfsoc_pinmux_get_groups, 244 .get_function_groups = sirfsoc_pinmux_get_groups,
@@ -518,24 +526,29 @@ static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
518 case IRQ_TYPE_NONE: 526 case IRQ_TYPE_NONE:
519 break; 527 break;
520 case IRQ_TYPE_EDGE_RISING: 528 case IRQ_TYPE_EDGE_RISING:
521 val |= SIRFSOC_GPIO_CTL_INTR_HIGH_MASK | SIRFSOC_GPIO_CTL_INTR_TYPE_MASK; 529 val |= SIRFSOC_GPIO_CTL_INTR_HIGH_MASK |
530 SIRFSOC_GPIO_CTL_INTR_TYPE_MASK;
522 val &= ~SIRFSOC_GPIO_CTL_INTR_LOW_MASK; 531 val &= ~SIRFSOC_GPIO_CTL_INTR_LOW_MASK;
523 break; 532 break;
524 case IRQ_TYPE_EDGE_FALLING: 533 case IRQ_TYPE_EDGE_FALLING:
525 val &= ~SIRFSOC_GPIO_CTL_INTR_HIGH_MASK; 534 val &= ~SIRFSOC_GPIO_CTL_INTR_HIGH_MASK;
526 val |= SIRFSOC_GPIO_CTL_INTR_LOW_MASK | SIRFSOC_GPIO_CTL_INTR_TYPE_MASK; 535 val |= SIRFSOC_GPIO_CTL_INTR_LOW_MASK |
536 SIRFSOC_GPIO_CTL_INTR_TYPE_MASK;
527 break; 537 break;
528 case IRQ_TYPE_EDGE_BOTH: 538 case IRQ_TYPE_EDGE_BOTH:
529 val |= SIRFSOC_GPIO_CTL_INTR_HIGH_MASK | SIRFSOC_GPIO_CTL_INTR_LOW_MASK | 539 val |= SIRFSOC_GPIO_CTL_INTR_HIGH_MASK |
530 SIRFSOC_GPIO_CTL_INTR_TYPE_MASK; 540 SIRFSOC_GPIO_CTL_INTR_LOW_MASK |
541 SIRFSOC_GPIO_CTL_INTR_TYPE_MASK;
531 break; 542 break;
532 case IRQ_TYPE_LEVEL_LOW: 543 case IRQ_TYPE_LEVEL_LOW:
533 val &= ~(SIRFSOC_GPIO_CTL_INTR_HIGH_MASK | SIRFSOC_GPIO_CTL_INTR_TYPE_MASK); 544 val &= ~(SIRFSOC_GPIO_CTL_INTR_HIGH_MASK |
545 SIRFSOC_GPIO_CTL_INTR_TYPE_MASK);
534 val |= SIRFSOC_GPIO_CTL_INTR_LOW_MASK; 546 val |= SIRFSOC_GPIO_CTL_INTR_LOW_MASK;
535 break; 547 break;
536 case IRQ_TYPE_LEVEL_HIGH: 548 case IRQ_TYPE_LEVEL_HIGH:
537 val |= SIRFSOC_GPIO_CTL_INTR_HIGH_MASK; 549 val |= SIRFSOC_GPIO_CTL_INTR_HIGH_MASK;
538 val &= ~(SIRFSOC_GPIO_CTL_INTR_LOW_MASK | SIRFSOC_GPIO_CTL_INTR_TYPE_MASK); 550 val &= ~(SIRFSOC_GPIO_CTL_INTR_LOW_MASK |
551 SIRFSOC_GPIO_CTL_INTR_TYPE_MASK);
539 break; 552 break;
540 } 553 }
541 554
@@ -694,7 +707,8 @@ static inline void sirfsoc_gpio_set_output(struct sirfsoc_gpio_chip *sgpio,
694 spin_unlock_irqrestore(&bank->lock, flags); 707 spin_unlock_irqrestore(&bank->lock, flags);
695} 708}
696 709
697static int sirfsoc_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value) 710static int sirfsoc_gpio_direction_output(struct gpio_chip *chip,
711 unsigned gpio, int value)
698{ 712{
699 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 713 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip);
700 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, gpio); 714 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, gpio);
@@ -839,7 +853,7 @@ static int sirfsoc_gpio_probe(struct device_node *np)
839 if (err) { 853 if (err) {
840 dev_err(&pdev->dev, 854 dev_err(&pdev->dev,
841 "could not connect irqchip to gpiochip\n"); 855 "could not connect irqchip to gpiochip\n");
842 goto out; 856 goto out_banks;
843 } 857 }
844 858
845 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { 859 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
@@ -898,8 +912,8 @@ static int __init sirfsoc_gpio_init(void)
898} 912}
899subsys_initcall(sirfsoc_gpio_init); 913subsys_initcall(sirfsoc_gpio_init);
900 914
901MODULE_AUTHOR("Rongjun Ying <rongjun.ying@csr.com>, " 915MODULE_AUTHOR("Rongjun Ying <rongjun.ying@csr.com>");
902 "Yuping Luo <yuping.luo@csr.com>, " 916MODULE_AUTHOR("Yuping Luo <yuping.luo@csr.com>");
903 "Barry Song <baohua.song@csr.com>"); 917MODULE_AUTHOR("Barry Song <baohua.song@csr.com>");
904MODULE_DESCRIPTION("SIRFSOC pin control driver"); 918MODULE_DESCRIPTION("SIRFSOC pin control driver");
905MODULE_LICENSE("GPL"); 919MODULE_LICENSE("GPL");
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index f72cc4e192bd..abdb05ac43dc 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -268,7 +268,7 @@ static int spear_pinctrl_endisable(struct pinctrl_dev *pctldev,
268 return 0; 268 return 0;
269} 269}
270 270
271static int spear_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function, 271static int spear_pinctrl_set_mux(struct pinctrl_dev *pctldev, unsigned function,
272 unsigned group) 272 unsigned group)
273{ 273{
274 return spear_pinctrl_endisable(pctldev, function, group, true); 274 return spear_pinctrl_endisable(pctldev, function, group, true);
@@ -338,7 +338,7 @@ static const struct pinmux_ops spear_pinmux_ops = {
338 .get_functions_count = spear_pinctrl_get_funcs_count, 338 .get_functions_count = spear_pinctrl_get_funcs_count,
339 .get_function_name = spear_pinctrl_get_func_name, 339 .get_function_name = spear_pinctrl_get_func_name,
340 .get_function_groups = spear_pinctrl_get_func_groups, 340 .get_function_groups = spear_pinctrl_get_func_groups,
341 .enable = spear_pinctrl_enable, 341 .set_mux = spear_pinctrl_set_mux,
342 .gpio_request_enable = gpio_request_enable, 342 .gpio_request_enable = gpio_request_enable,
343 .gpio_disable_free = gpio_disable_free, 343 .gpio_disable_free = gpio_disable_free,
344}; 344};
diff --git a/drivers/pinctrl/spear/pinctrl-spear1310.c b/drivers/pinctrl/spear/pinctrl-spear1310.c
index 1a8bbfec60ca..6d57d43ab640 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1310.c
@@ -2692,7 +2692,7 @@ static struct spear_pinctrl_machdata spear1310_machdata = {
2692 .modes_supported = false, 2692 .modes_supported = false,
2693}; 2693};
2694 2694
2695static struct of_device_id spear1310_pinctrl_of_match[] = { 2695static const struct of_device_id spear1310_pinctrl_of_match[] = {
2696 { 2696 {
2697 .compatible = "st,spear1310-pinmux", 2697 .compatible = "st,spear1310-pinmux",
2698 }, 2698 },
diff --git a/drivers/pinctrl/spear/pinctrl-spear1340.c b/drivers/pinctrl/spear/pinctrl-spear1340.c
index 873966e2b99f..d243e43e7f6d 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1340.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1340.c
@@ -2008,7 +2008,7 @@ static struct spear_pinctrl_machdata spear1340_machdata = {
2008 .modes_supported = false, 2008 .modes_supported = false,
2009}; 2009};
2010 2010
2011static struct of_device_id spear1340_pinctrl_of_match[] = { 2011static const struct of_device_id spear1340_pinctrl_of_match[] = {
2012 { 2012 {
2013 .compatible = "st,spear1340-pinmux", 2013 .compatible = "st,spear1340-pinmux",
2014 }, 2014 },
diff --git a/drivers/pinctrl/spear/pinctrl-spear300.c b/drivers/pinctrl/spear/pinctrl-spear300.c
index 4777c0d0e730..9db83e9ee18c 100644
--- a/drivers/pinctrl/spear/pinctrl-spear300.c
+++ b/drivers/pinctrl/spear/pinctrl-spear300.c
@@ -646,7 +646,7 @@ static struct spear_function *spear300_functions[] = {
646 &gpio1_function, 646 &gpio1_function,
647}; 647};
648 648
649static struct of_device_id spear300_pinctrl_of_match[] = { 649static const struct of_device_id spear300_pinctrl_of_match[] = {
650 { 650 {
651 .compatible = "st,spear300-pinmux", 651 .compatible = "st,spear300-pinmux",
652 }, 652 },
diff --git a/drivers/pinctrl/spear/pinctrl-spear310.c b/drivers/pinctrl/spear/pinctrl-spear310.c
index ed1d3608f486..db775a414b7a 100644
--- a/drivers/pinctrl/spear/pinctrl-spear310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear310.c
@@ -371,7 +371,7 @@ static struct spear_function *spear310_functions[] = {
371 &tdm_function, 371 &tdm_function,
372}; 372};
373 373
374static struct of_device_id spear310_pinctrl_of_match[] = { 374static const struct of_device_id spear310_pinctrl_of_match[] = {
375 { 375 {
376 .compatible = "st,spear310-pinmux", 376 .compatible = "st,spear310-pinmux",
377 }, 377 },
diff --git a/drivers/pinctrl/spear/pinctrl-spear320.c b/drivers/pinctrl/spear/pinctrl-spear320.c
index b8e290a8c8c9..80fbd68e17bc 100644
--- a/drivers/pinctrl/spear/pinctrl-spear320.c
+++ b/drivers/pinctrl/spear/pinctrl-spear320.c
@@ -3410,7 +3410,7 @@ static struct spear_function *spear320_functions[] = {
3410 &i2c2_function, 3410 &i2c2_function,
3411}; 3411};
3412 3412
3413static struct of_device_id spear320_pinctrl_of_match[] = { 3413static const struct of_device_id spear320_pinctrl_of_match[] = {
3414 { 3414 {
3415 .compatible = "st,spear320-pinmux", 3415 .compatible = "st,spear320-pinmux",
3416 }, 3416 },
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 3df66e366c87..ef9d804e55de 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -393,9 +393,9 @@ static void sunxi_pmx_set(struct pinctrl_dev *pctldev,
393 spin_unlock_irqrestore(&pctl->lock, flags); 393 spin_unlock_irqrestore(&pctl->lock, flags);
394} 394}
395 395
396static int sunxi_pmx_enable(struct pinctrl_dev *pctldev, 396static int sunxi_pmx_set_mux(struct pinctrl_dev *pctldev,
397 unsigned function, 397 unsigned function,
398 unsigned group) 398 unsigned group)
399{ 399{
400 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); 400 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
401 struct sunxi_pinctrl_group *g = pctl->groups + group; 401 struct sunxi_pinctrl_group *g = pctl->groups + group;
@@ -441,7 +441,7 @@ static const struct pinmux_ops sunxi_pmx_ops = {
441 .get_functions_count = sunxi_pmx_get_funcs_cnt, 441 .get_functions_count = sunxi_pmx_get_funcs_cnt,
442 .get_function_name = sunxi_pmx_get_func_name, 442 .get_function_name = sunxi_pmx_get_func_name,
443 .get_function_groups = sunxi_pmx_get_func_groups, 443 .get_function_groups = sunxi_pmx_get_func_groups,
444 .enable = sunxi_pmx_enable, 444 .set_mux = sunxi_pmx_set_mux,
445 .gpio_set_direction = sunxi_pmx_gpio_set_direction, 445 .gpio_set_direction = sunxi_pmx_gpio_set_direction,
446}; 446};
447 447
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index 8cea355f9a81..d055d63309e4 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -131,9 +131,9 @@ static int wmt_set_pinmux(struct wmt_pinctrl_data *data, unsigned func,
131 return 0; 131 return 0;
132} 132}
133 133
134static int wmt_pmx_enable(struct pinctrl_dev *pctldev, 134static int wmt_pmx_set_mux(struct pinctrl_dev *pctldev,
135 unsigned func_selector, 135 unsigned func_selector,
136 unsigned group_selector) 136 unsigned group_selector)
137{ 137{
138 struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 138 struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
139 u32 pinnum = data->pins[group_selector].number; 139 u32 pinnum = data->pins[group_selector].number;
@@ -168,7 +168,7 @@ static struct pinmux_ops wmt_pinmux_ops = {
168 .get_functions_count = wmt_pmx_get_functions_count, 168 .get_functions_count = wmt_pmx_get_functions_count,
169 .get_function_name = wmt_pmx_get_function_name, 169 .get_function_name = wmt_pmx_get_function_name,
170 .get_function_groups = wmt_pmx_get_function_groups, 170 .get_function_groups = wmt_pmx_get_function_groups,
171 .enable = wmt_pmx_enable, 171 .set_mux = wmt_pmx_set_mux,
172 .gpio_disable_free = wmt_pmx_gpio_disable_free, 172 .gpio_disable_free = wmt_pmx_gpio_disable_free,
173 .gpio_set_direction = wmt_pmx_gpio_set_direction, 173 .gpio_set_direction = wmt_pmx_gpio_set_direction,
174}; 174};
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 79788a12712d..02e69e7ee4a3 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1647,7 +1647,7 @@ static int cxgbi_inet6addr_handler(struct notifier_block *this,
1647 if (event_dev->priv_flags & IFF_802_1Q_VLAN) 1647 if (event_dev->priv_flags & IFF_802_1Q_VLAN)
1648 event_dev = vlan_dev_real_dev(event_dev); 1648 event_dev = vlan_dev_real_dev(event_dev);
1649 1649
1650 cdev = cxgbi_device_find_by_netdev(event_dev, NULL); 1650 cdev = cxgbi_device_find_by_netdev_rcu(event_dev, NULL);
1651 1651
1652 if (!cdev) 1652 if (!cdev)
1653 return ret; 1653 return ret;
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index d65df6dc106f..addd1dddce14 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -57,6 +57,9 @@ MODULE_PARM_DESC(dbg_level, "libiscsi debug level (default=0)");
57static LIST_HEAD(cdev_list); 57static LIST_HEAD(cdev_list);
58static DEFINE_MUTEX(cdev_mutex); 58static DEFINE_MUTEX(cdev_mutex);
59 59
60static LIST_HEAD(cdev_rcu_list);
61static DEFINE_SPINLOCK(cdev_rcu_lock);
62
60int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base, 63int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
61 unsigned int max_conn) 64 unsigned int max_conn)
62{ 65{
@@ -142,6 +145,10 @@ struct cxgbi_device *cxgbi_device_register(unsigned int extra,
142 list_add_tail(&cdev->list_head, &cdev_list); 145 list_add_tail(&cdev->list_head, &cdev_list);
143 mutex_unlock(&cdev_mutex); 146 mutex_unlock(&cdev_mutex);
144 147
148 spin_lock(&cdev_rcu_lock);
149 list_add_tail_rcu(&cdev->rcu_node, &cdev_rcu_list);
150 spin_unlock(&cdev_rcu_lock);
151
145 log_debug(1 << CXGBI_DBG_DEV, 152 log_debug(1 << CXGBI_DBG_DEV,
146 "cdev 0x%p, p# %u.\n", cdev, nports); 153 "cdev 0x%p, p# %u.\n", cdev, nports);
147 return cdev; 154 return cdev;
@@ -153,9 +160,16 @@ void cxgbi_device_unregister(struct cxgbi_device *cdev)
153 log_debug(1 << CXGBI_DBG_DEV, 160 log_debug(1 << CXGBI_DBG_DEV,
154 "cdev 0x%p, p# %u,%s.\n", 161 "cdev 0x%p, p# %u,%s.\n",
155 cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : ""); 162 cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : "");
163
156 mutex_lock(&cdev_mutex); 164 mutex_lock(&cdev_mutex);
157 list_del(&cdev->list_head); 165 list_del(&cdev->list_head);
158 mutex_unlock(&cdev_mutex); 166 mutex_unlock(&cdev_mutex);
167
168 spin_lock(&cdev_rcu_lock);
169 list_del_rcu(&cdev->rcu_node);
170 spin_unlock(&cdev_rcu_lock);
171 synchronize_rcu();
172
159 cxgbi_device_destroy(cdev); 173 cxgbi_device_destroy(cdev);
160} 174}
161EXPORT_SYMBOL_GPL(cxgbi_device_unregister); 175EXPORT_SYMBOL_GPL(cxgbi_device_unregister);
@@ -167,12 +181,9 @@ void cxgbi_device_unregister_all(unsigned int flag)
167 mutex_lock(&cdev_mutex); 181 mutex_lock(&cdev_mutex);
168 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { 182 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) {
169 if ((cdev->flags & flag) == flag) { 183 if ((cdev->flags & flag) == flag) {
170 log_debug(1 << CXGBI_DBG_DEV, 184 mutex_unlock(&cdev_mutex);
171 "cdev 0x%p, p# %u,%s.\n", 185 cxgbi_device_unregister(cdev);
172 cdev, cdev->nports, cdev->nports ? 186 mutex_lock(&cdev_mutex);
173 cdev->ports[0]->name : "");
174 list_del(&cdev->list_head);
175 cxgbi_device_destroy(cdev);
176 } 187 }
177 } 188 }
178 mutex_unlock(&cdev_mutex); 189 mutex_unlock(&cdev_mutex);
@@ -191,6 +202,7 @@ struct cxgbi_device *cxgbi_device_find_by_lldev(void *lldev)
191 } 202 }
192 } 203 }
193 mutex_unlock(&cdev_mutex); 204 mutex_unlock(&cdev_mutex);
205
194 log_debug(1 << CXGBI_DBG_DEV, 206 log_debug(1 << CXGBI_DBG_DEV,
195 "lldev 0x%p, NO match found.\n", lldev); 207 "lldev 0x%p, NO match found.\n", lldev);
196 return NULL; 208 return NULL;
@@ -230,6 +242,39 @@ struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev,
230} 242}
231EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev); 243EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev);
232 244
245struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *ndev,
246 int *port)
247{
248 struct net_device *vdev = NULL;
249 struct cxgbi_device *cdev;
250 int i;
251
252 if (ndev->priv_flags & IFF_802_1Q_VLAN) {
253 vdev = ndev;
254 ndev = vlan_dev_real_dev(ndev);
255 pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name);
256 }
257
258 rcu_read_lock();
259 list_for_each_entry_rcu(cdev, &cdev_rcu_list, rcu_node) {
260 for (i = 0; i < cdev->nports; i++) {
261 if (ndev == cdev->ports[i]) {
262 cdev->hbas[i]->vdev = vdev;
263 rcu_read_unlock();
264 if (port)
265 *port = i;
266 return cdev;
267 }
268 }
269 }
270 rcu_read_unlock();
271
272 log_debug(1 << CXGBI_DBG_DEV,
273 "ndev 0x%p, %s, NO match found.\n", ndev, ndev->name);
274 return NULL;
275}
276EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev_rcu);
277
233static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev, 278static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev,
234 int *port) 279 int *port)
235{ 280{
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index b3e6e7541cc5..1d98fad6a0ab 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -527,6 +527,7 @@ struct cxgbi_ports_map {
527#define CXGBI_FLAG_IPV4_SET 0x10 527#define CXGBI_FLAG_IPV4_SET 0x10
528struct cxgbi_device { 528struct cxgbi_device {
529 struct list_head list_head; 529 struct list_head list_head;
530 struct list_head rcu_node;
530 unsigned int flags; 531 unsigned int flags;
531 struct net_device **ports; 532 struct net_device **ports;
532 void *lldev; 533 void *lldev;
@@ -709,6 +710,8 @@ void cxgbi_device_unregister(struct cxgbi_device *);
709void cxgbi_device_unregister_all(unsigned int flag); 710void cxgbi_device_unregister_all(unsigned int flag);
710struct cxgbi_device *cxgbi_device_find_by_lldev(void *); 711struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
711struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *); 712struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
713struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
714 int *);
712int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int, 715int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
713 struct scsi_host_template *, 716 struct scsi_host_template *,
714 struct scsi_transport_template *); 717 struct scsi_transport_template *);
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 1d42dba6121d..bd672948f2f1 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -3587,7 +3587,7 @@ static void __used s8250_options(void)
3587#ifdef CONFIG_SERIAL_8250_RSA 3587#ifdef CONFIG_SERIAL_8250_RSA
3588 __module_param_call(MODULE_PARAM_PREFIX, probe_rsa, 3588 __module_param_call(MODULE_PARAM_PREFIX, probe_rsa,
3589 &param_array_ops, .arr = &__param_arr_probe_rsa, 3589 &param_array_ops, .arr = &__param_arr_probe_rsa,
3590 0444, -1); 3590 0444, -1, 0);
3591#endif 3591#endif
3592} 3592}
3593#else 3593#else
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 3f42785f653c..9bfa7252f7f9 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -970,6 +970,13 @@ static struct scsi_host_template uas_host_template = {
970 .cmd_per_lun = 1, /* until we override it */ 970 .cmd_per_lun = 1, /* until we override it */
971 .skip_settle_delay = 1, 971 .skip_settle_delay = 1,
972 .ordered_tag = 1, 972 .ordered_tag = 1,
973
974 /*
975 * The uas drivers expects tags not to be bigger than the maximum
976 * per-device queue depth, which is not true with the blk-mq tag
977 * allocator.
978 */
979 .disable_blk_mq = true,
973}; 980};
974 981
975#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ 982#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 7c018a1c52f7..5f29354b072a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3568 lru_cache_add_file(page); 3568 lru_cache_add_file(page);
3569 unlock_page(page); 3569 unlock_page(page);
3570 page_cache_release(page); 3570 page_cache_release(page);
3571 if (rc == -EAGAIN)
3572 list_add_tail(&page->lru, &tmplist);
3573 } 3571 }
3572 /* Fallback to the readpage in error/reconnect cases */
3574 kref_put(&rdata->refcount, cifs_readdata_release); 3573 kref_put(&rdata->refcount, cifs_readdata_release);
3575 if (rc == -EAGAIN) {
3576 /* Re-add pages to the page_list and retry */
3577 list_splice(&tmplist, page_list);
3578 continue;
3579 }
3580 break; 3574 break;
3581 } 3575 }
3582 3576
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 1a6df4b03f67..52131d8cb4d5 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -586,7 +586,7 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
586 tmprc = CIFS_open(xid, &oparms, &oplock, NULL); 586 tmprc = CIFS_open(xid, &oparms, &oplock, NULL);
587 if (tmprc == -EOPNOTSUPP) 587 if (tmprc == -EOPNOTSUPP)
588 *symlink = true; 588 *symlink = true;
589 else 589 else if (tmprc == 0)
590 CIFSSMBClose(xid, tcon, fid.netfid); 590 CIFSSMBClose(xid, tcon, fid.netfid);
591 } 591 }
592 592
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c
index af59d03db492..8257a5a97cc0 100644
--- a/fs/cifs/smb2maperror.c
+++ b/fs/cifs/smb2maperror.c
@@ -256,6 +256,8 @@ static const struct status_to_posix_error smb2_error_map_table[] = {
256 {STATUS_DLL_MIGHT_BE_INCOMPATIBLE, -EIO, 256 {STATUS_DLL_MIGHT_BE_INCOMPATIBLE, -EIO,
257 "STATUS_DLL_MIGHT_BE_INCOMPATIBLE"}, 257 "STATUS_DLL_MIGHT_BE_INCOMPATIBLE"},
258 {STATUS_STOPPED_ON_SYMLINK, -EOPNOTSUPP, "STATUS_STOPPED_ON_SYMLINK"}, 258 {STATUS_STOPPED_ON_SYMLINK, -EOPNOTSUPP, "STATUS_STOPPED_ON_SYMLINK"},
259 {STATUS_IO_REPARSE_TAG_NOT_HANDLED, -EOPNOTSUPP,
260 "STATUS_REPARSE_NOT_HANDLED"},
259 {STATUS_DEVICE_REQUIRES_CLEANING, -EIO, 261 {STATUS_DEVICE_REQUIRES_CLEANING, -EIO,
260 "STATUS_DEVICE_REQUIRES_CLEANING"}, 262 "STATUS_DEVICE_REQUIRES_CLEANING"},
261 {STATUS_DEVICE_DOOR_OPEN, -EIO, "STATUS_DEVICE_DOOR_OPEN"}, 263 {STATUS_DEVICE_DOOR_OPEN, -EIO, "STATUS_DEVICE_DOOR_OPEN"},
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index e94457c33ad6..b01f6e100ee8 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3104,7 +3104,8 @@ static __be32 nfsd4_encode_splice_read(
3104 3104
3105 buf->page_len = maxcount; 3105 buf->page_len = maxcount;
3106 buf->len += maxcount; 3106 buf->len += maxcount;
3107 xdr->page_ptr += (maxcount + PAGE_SIZE - 1) / PAGE_SIZE; 3107 xdr->page_ptr += (buf->page_base + maxcount + PAGE_SIZE - 1)
3108 / PAGE_SIZE;
3108 3109
3109 /* Use rest of head for padding and remaining ops: */ 3110 /* Use rest of head for padding and remaining ops: */
3110 buf->tail[0].iov_base = xdr->p; 3111 buf->tail[0].iov_base = xdr->p;
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index e3cfa0227026..12ba682fc53c 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2039,6 +2039,10 @@ kill:
2039 "and killing the other node now! This node is OK and can continue.\n"); 2039 "and killing the other node now! This node is OK and can continue.\n");
2040 __dlm_print_one_lock_resource(res); 2040 __dlm_print_one_lock_resource(res);
2041 spin_unlock(&res->spinlock); 2041 spin_unlock(&res->spinlock);
2042 spin_lock(&dlm->master_lock);
2043 if (mle)
2044 __dlm_put_mle(mle);
2045 spin_unlock(&dlm->master_lock);
2042 spin_unlock(&dlm->spinlock); 2046 spin_unlock(&dlm->spinlock);
2043 *ret_data = (void *)res; 2047 *ret_data = (void *)res;
2044 dlm_put(dlm); 2048 dlm_put(dlm);
diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h
index 0fee6ff77ffc..bbca3d038900 100644
--- a/include/dt-bindings/pinctrl/at91.h
+++ b/include/dt-bindings/pinctrl/at91.h
@@ -20,6 +20,11 @@
20 20
21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH) 21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH)
22 22
23#define AT91_PINCTRL_DRIVE_STRENGTH_DEFAULT (0x0 << 5)
24#define AT91_PINCTRL_DRIVE_STRENGTH_LOW (0x1 << 5)
25#define AT91_PINCTRL_DRIVE_STRENGTH_MED (0x2 << 5)
26#define AT91_PINCTRL_DRIVE_STRENGTH_HI (0x3 << 5)
27
23#define AT91_PIOA 0 28#define AT91_PIOA 0
24#define AT91_PIOB 1 29#define AT91_PIOB 1
25#define AT91_PIOC 2 30#define AT91_PIOC 2
diff --git a/include/dt-bindings/pinctrl/rockchip.h b/include/dt-bindings/pinctrl/rockchip.h
index cd5788be82ce..743e66a95e13 100644
--- a/include/dt-bindings/pinctrl/rockchip.h
+++ b/include/dt-bindings/pinctrl/rockchip.h
@@ -28,5 +28,7 @@
28#define RK_FUNC_GPIO 0 28#define RK_FUNC_GPIO 0
29#define RK_FUNC_1 1 29#define RK_FUNC_1 1
30#define RK_FUNC_2 2 30#define RK_FUNC_2 2
31#define RK_FUNC_3 3
32#define RK_FUNC_4 4
31 33
32#endif 34#endif
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 1f9e642c66ad..212c5b9ac106 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -900,18 +900,6 @@ static inline void dmaengine_put(void)
900} 900}
901#endif 901#endif
902 902
903#ifdef CONFIG_NET_DMA
904#define net_dmaengine_get() dmaengine_get()
905#define net_dmaengine_put() dmaengine_put()
906#else
907static inline void net_dmaengine_get(void)
908{
909}
910static inline void net_dmaengine_put(void)
911{
912}
913#endif
914
915#ifdef CONFIG_ASYNC_TX_DMA 903#ifdef CONFIG_ASYNC_TX_DMA
916#define async_dmaengine_get() dmaengine_get() 904#define async_dmaengine_get() dmaengine_get()
917#define async_dmaengine_put() dmaengine_put() 905#define async_dmaengine_put() dmaengine_put()
@@ -933,16 +921,8 @@ async_dma_find_channel(enum dma_transaction_type type)
933 return NULL; 921 return NULL;
934} 922}
935#endif /* CONFIG_ASYNC_TX_DMA */ 923#endif /* CONFIG_ASYNC_TX_DMA */
936
937dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
938 void *dest, void *src, size_t len);
939dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
940 struct page *page, unsigned int offset, void *kdata, size_t len);
941dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
942 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
943 unsigned int src_off, size_t len);
944void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, 924void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
945 struct dma_chan *chan); 925 struct dma_chan *chan);
946 926
947static inline void async_tx_ack(struct dma_async_tx_descriptor *tx) 927static inline void async_tx_ack(struct dma_async_tx_descriptor *tx)
948{ 928{
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 494f99e852da..b43f4752304e 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -42,7 +42,7 @@ struct kernel_param;
42 * NOARG - the parameter allows for no argument (foo instead of foo=1) 42 * NOARG - the parameter allows for no argument (foo instead of foo=1)
43 */ 43 */
44enum { 44enum {
45 KERNEL_PARAM_FL_NOARG = (1 << 0) 45 KERNEL_PARAM_OPS_FL_NOARG = (1 << 0)
46}; 46};
47 47
48struct kernel_param_ops { 48struct kernel_param_ops {
@@ -56,11 +56,21 @@ struct kernel_param_ops {
56 void (*free)(void *arg); 56 void (*free)(void *arg);
57}; 57};
58 58
59/*
60 * Flags available for kernel_param
61 *
62 * UNSAFE - the parameter is dangerous and setting it will taint the kernel
63 */
64enum {
65 KERNEL_PARAM_FL_UNSAFE = (1 << 0)
66};
67
59struct kernel_param { 68struct kernel_param {
60 const char *name; 69 const char *name;
61 const struct kernel_param_ops *ops; 70 const struct kernel_param_ops *ops;
62 u16 perm; 71 u16 perm;
63 s16 level; 72 s8 level;
73 u8 flags;
64 union { 74 union {
65 void *arg; 75 void *arg;
66 const struct kparam_string *str; 76 const struct kparam_string *str;
@@ -113,6 +123,12 @@ struct kparam_array
113 module_param_named(name, name, type, perm) 123 module_param_named(name, name, type, perm)
114 124
115/** 125/**
126 * module_param_unsafe - same as module_param but taints kernel
127 */
128#define module_param_unsafe(name, type, perm) \
129 module_param_named_unsafe(name, name, type, perm)
130
131/**
116 * module_param_named - typesafe helper for a renamed module/cmdline parameter 132 * module_param_named - typesafe helper for a renamed module/cmdline parameter
117 * @name: a valid C identifier which is the parameter name. 133 * @name: a valid C identifier which is the parameter name.
118 * @value: the actual lvalue to alter. 134 * @value: the actual lvalue to alter.
@@ -129,6 +145,14 @@ struct kparam_array
129 __MODULE_PARM_TYPE(name, #type) 145 __MODULE_PARM_TYPE(name, #type)
130 146
131/** 147/**
148 * module_param_named_unsafe - same as module_param_named but taints kernel
149 */
150#define module_param_named_unsafe(name, value, type, perm) \
151 param_check_##type(name, &(value)); \
152 module_param_cb_unsafe(name, &param_ops_##type, &value, perm); \
153 __MODULE_PARM_TYPE(name, #type)
154
155/**
132 * module_param_cb - general callback for a module/cmdline parameter 156 * module_param_cb - general callback for a module/cmdline parameter
133 * @name: a valid C identifier which is the parameter name. 157 * @name: a valid C identifier which is the parameter name.
134 * @ops: the set & get operations for this parameter. 158 * @ops: the set & get operations for this parameter.
@@ -137,7 +161,11 @@ struct kparam_array
137 * The ops can have NULL set or get functions. 161 * The ops can have NULL set or get functions.
138 */ 162 */
139#define module_param_cb(name, ops, arg, perm) \ 163#define module_param_cb(name, ops, arg, perm) \
140 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1) 164 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
165
166#define module_param_cb_unsafe(name, ops, arg, perm) \
167 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
168 KERNEL_PARAM_FL_UNSAFE)
141 169
142/** 170/**
143 * <level>_param_cb - general callback for a module/cmdline parameter 171 * <level>_param_cb - general callback for a module/cmdline parameter
@@ -149,7 +177,7 @@ struct kparam_array
149 * The ops can have NULL set or get functions. 177 * The ops can have NULL set or get functions.
150 */ 178 */
151#define __level_param_cb(name, ops, arg, perm, level) \ 179#define __level_param_cb(name, ops, arg, perm, level) \
152 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level) 180 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
153 181
154#define core_param_cb(name, ops, arg, perm) \ 182#define core_param_cb(name, ops, arg, perm) \
155 __level_param_cb(name, ops, arg, perm, 1) 183 __level_param_cb(name, ops, arg, perm, 1)
@@ -184,22 +212,22 @@ struct kparam_array
184 212
185/* This is the fundamental function for registering boot/module 213/* This is the fundamental function for registering boot/module
186 parameters. */ 214 parameters. */
187#define __module_param_call(prefix, name, ops, arg, perm, level) \ 215#define __module_param_call(prefix, name, ops, arg, perm, level, flags) \
188 /* Default value instead of permissions? */ \ 216 /* Default value instead of permissions? */ \
189 static const char __param_str_##name[] = prefix #name; \ 217 static const char __param_str_##name[] = prefix #name; \
190 static struct kernel_param __moduleparam_const __param_##name \ 218 static struct kernel_param __moduleparam_const __param_##name \
191 __used \ 219 __used \
192 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 220 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
193 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \ 221 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \
194 level, { arg } } 222 level, flags, { arg } }
195 223
196/* Obsolete - use module_param_cb() */ 224/* Obsolete - use module_param_cb() */
197#define module_param_call(name, set, get, arg, perm) \ 225#define module_param_call(name, set, get, arg, perm) \
198 static struct kernel_param_ops __param_ops_##name = \ 226 static struct kernel_param_ops __param_ops_##name = \
199 { 0, (void *)set, (void *)get }; \ 227 { .flags = 0, (void *)set, (void *)get }; \
200 __module_param_call(MODULE_PARAM_PREFIX, \ 228 __module_param_call(MODULE_PARAM_PREFIX, \
201 name, &__param_ops_##name, arg, \ 229 name, &__param_ops_##name, arg, \
202 (perm) + sizeof(__check_old_set_param(set))*0, -1) 230 (perm) + sizeof(__check_old_set_param(set))*0, -1, 0)
203 231
204/* We don't get oldget: it's often a new-style param_get_uint, etc. */ 232/* We don't get oldget: it's often a new-style param_get_uint, etc. */
205static inline int 233static inline int
@@ -279,7 +307,7 @@ static inline void __kernel_param_unlock(void)
279 */ 307 */
280#define core_param(name, var, type, perm) \ 308#define core_param(name, var, type, perm) \
281 param_check_##type(name, &(var)); \ 309 param_check_##type(name, &(var)); \
282 __module_param_call("", name, &param_ops_##type, &var, perm, -1) 310 __module_param_call("", name, &param_ops_##type, &var, perm, -1, 0)
283#endif /* !MODULE */ 311#endif /* !MODULE */
284 312
285/** 313/**
@@ -297,7 +325,7 @@ static inline void __kernel_param_unlock(void)
297 = { len, string }; \ 325 = { len, string }; \
298 __module_param_call(MODULE_PARAM_PREFIX, name, \ 326 __module_param_call(MODULE_PARAM_PREFIX, name, \
299 &param_ops_string, \ 327 &param_ops_string, \
300 .str = &__param_string_##name, perm, -1); \ 328 .str = &__param_string_##name, perm, -1, 0);\
301 __MODULE_PARM_TYPE(name, "string") 329 __MODULE_PARM_TYPE(name, "string")
302 330
303/** 331/**
@@ -444,7 +472,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
444 __module_param_call(MODULE_PARAM_PREFIX, name, \ 472 __module_param_call(MODULE_PARAM_PREFIX, name, \
445 &param_array_ops, \ 473 &param_array_ops, \
446 .arr = &__param_arr_##name, \ 474 .arr = &__param_arr_##name, \
447 perm, -1); \ 475 perm, -1, 0); \
448 __MODULE_PARM_TYPE(name, "array of " #type) 476 __MODULE_PARM_TYPE(name, "array of " #type)
449 477
450extern struct kernel_param_ops param_array_ops; 478extern struct kernel_param_ops param_array_ops;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index a15f10727eb8..d578a60eff23 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -57,7 +57,7 @@
57 * which are then pulled up with an external resistor. Setting this 57 * which are then pulled up with an external resistor. Setting this
58 * config will enable open drain mode, the argument is ignored. 58 * config will enable open drain mode, the argument is ignored.
59 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 59 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
60 * (open emitter). Setting this config will enable open drain mode, the 60 * (open emitter). Setting this config will enable open source mode, the
61 * argument is ignored. 61 * argument is ignored.
62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current 62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current
63 * passed as argument. The argument is in mA. 63 * passed as argument. The argument is in mA.
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 3097aafbeb24..511bda9ed4bf 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -39,13 +39,12 @@ struct pinctrl_dev;
39 * name can be used with the generic @pinctrl_ops to retrieve the 39 * name can be used with the generic @pinctrl_ops to retrieve the
40 * actual pins affected. The applicable groups will be returned in 40 * actual pins affected. The applicable groups will be returned in
41 * @groups and the number of groups in @num_groups 41 * @groups and the number of groups in @num_groups
42 * @enable: enable a certain muxing function with a certain pin group. The 42 * @set_mux: enable a certain muxing function with a certain pin group. The
43 * driver does not need to figure out whether enabling this function 43 * driver does not need to figure out whether enabling this function
44 * conflicts some other use of the pins in that group, such collisions 44 * conflicts some other use of the pins in that group, such collisions
45 * are handled by the pinmux subsystem. The @func_selector selects a 45 * are handled by the pinmux subsystem. The @func_selector selects a
46 * certain function whereas @group_selector selects a certain set of pins 46 * certain function whereas @group_selector selects a certain set of pins
47 * to be used. On simple controllers the latter argument may be ignored 47 * to be used. On simple controllers the latter argument may be ignored
48 * @disable: disable a certain muxing selector with a certain pin group
49 * @gpio_request_enable: requests and enables GPIO on a certain pin. 48 * @gpio_request_enable: requests and enables GPIO on a certain pin.
50 * Implement this only if you can mux every pin individually as GPIO. The 49 * Implement this only if you can mux every pin individually as GPIO. The
51 * affected GPIO range is passed along with an offset(pin number) into that 50 * affected GPIO range is passed along with an offset(pin number) into that
@@ -68,8 +67,8 @@ struct pinmux_ops {
68 unsigned selector, 67 unsigned selector,
69 const char * const **groups, 68 const char * const **groups,
70 unsigned * const num_groups); 69 unsigned * const num_groups);
71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector, 70 int (*set_mux) (struct pinctrl_dev *pctldev, unsigned func_selector,
72 unsigned group_selector); 71 unsigned group_selector);
73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 72 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
74 struct pinctrl_gpio_range *range, 73 struct pinctrl_gpio_range *range,
75 unsigned offset); 74 unsigned offset);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index abde271c18ae..a17ba0881afb 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -28,7 +28,6 @@
28#include <linux/textsearch.h> 28#include <linux/textsearch.h>
29#include <net/checksum.h> 29#include <net/checksum.h>
30#include <linux/rcupdate.h> 30#include <linux/rcupdate.h>
31#include <linux/dmaengine.h>
32#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
33#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
34#include <linux/netdev_features.h> 33#include <linux/netdev_features.h>
@@ -581,11 +580,8 @@ struct sk_buff {
581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */ 580 /* 2/4 bit hole (depending on ndisc_nodetype presence) */
582 kmemcheck_bitfield_end(flags2); 581 kmemcheck_bitfield_end(flags2);
583 582
584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 583#ifdef CONFIG_NET_RX_BUSY_POLL
585 union { 584 unsigned int napi_id;
586 unsigned int napi_id;
587 dma_cookie_t dma_cookie;
588 };
589#endif 585#endif
590#ifdef CONFIG_NETWORK_SECMARK 586#ifdef CONFIG_NETWORK_SECMARK
591 __u32 secmark; 587 __u32 secmark;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index fa5258f322e7..ac82c5ea955b 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -19,7 +19,6 @@
19 19
20 20
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/dmaengine.h>
23#include <net/sock.h> 22#include <net/sock.h>
24#include <net/inet_connection_sock.h> 23#include <net/inet_connection_sock.h>
25#include <net/inet_timewait_sock.h> 24#include <net/inet_timewait_sock.h>
@@ -166,13 +165,6 @@ struct tcp_sock {
166 struct iovec *iov; 165 struct iovec *iov;
167 int memory; 166 int memory;
168 int len; 167 int len;
169#ifdef CONFIG_NET_DMA
170 /* members for async copy */
171 struct dma_chan *dma_chan;
172 int wakeup;
173 struct dma_pinned_list *pinned_list;
174 dma_cookie_t dma_cookie;
175#endif
176 } ucopy; 168 } ucopy;
177 169
178 u32 snd_wl1; /* Sequence for window update */ 170 u32 snd_wl1; /* Sequence for window update */
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 9bcb220bd4ad..cf485f9aa563 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -114,16 +114,13 @@ struct rt6_info {
114 u32 rt6i_flags; 114 u32 rt6i_flags;
115 struct rt6key rt6i_src; 115 struct rt6key rt6i_src;
116 struct rt6key rt6i_prefsrc; 116 struct rt6key rt6i_prefsrc;
117 u32 rt6i_metric;
118 117
119 struct inet6_dev *rt6i_idev; 118 struct inet6_dev *rt6i_idev;
120 unsigned long _rt6i_peer; 119 unsigned long _rt6i_peer;
121 120
122 u32 rt6i_genid; 121 u32 rt6i_metric;
123
124 /* more non-fragment space at head required */ 122 /* more non-fragment space at head required */
125 unsigned short rt6i_nfheader_len; 123 unsigned short rt6i_nfheader_len;
126
127 u8 rt6i_protocol; 124 u8 rt6i_protocol;
128}; 125};
129 126
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 361d26077196..e0d64667a4b3 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -352,26 +352,12 @@ static inline void rt_genid_bump_ipv4(struct net *net)
352 atomic_inc(&net->ipv4.rt_genid); 352 atomic_inc(&net->ipv4.rt_genid);
353} 353}
354 354
355#if IS_ENABLED(CONFIG_IPV6) 355extern void (*__fib6_flush_trees)(struct net *net);
356static inline int rt_genid_ipv6(struct net *net)
357{
358 return atomic_read(&net->ipv6.rt_genid);
359}
360
361static inline void rt_genid_bump_ipv6(struct net *net)
362{
363 atomic_inc(&net->ipv6.rt_genid);
364}
365#else
366static inline int rt_genid_ipv6(struct net *net)
367{
368 return 0;
369}
370
371static inline void rt_genid_bump_ipv6(struct net *net) 356static inline void rt_genid_bump_ipv6(struct net *net)
372{ 357{
358 if (__fib6_flush_trees)
359 __fib6_flush_trees(net);
373} 360}
374#endif
375 361
376#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) 362#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
377static inline struct netns_ieee802154_lowpan * 363static inline struct netns_ieee802154_lowpan *
diff --git a/include/net/netdma.h b/include/net/netdma.h
deleted file mode 100644
index 8ba8ce284eeb..000000000000
--- a/include/net/netdma.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef NETDMA_H
22#define NETDMA_H
23#ifdef CONFIG_NET_DMA
24#include <linux/dmaengine.h>
25#include <linux/skbuff.h>
26
27int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
28 struct sk_buff *skb, int offset, struct iovec *to,
29 size_t len, struct dma_pinned_list *pinned_list);
30
31#endif /* CONFIG_NET_DMA */
32#endif /* NETDMA_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index b9a5bd0ed9f3..591e607cca35 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -233,7 +233,6 @@ struct cg_proto;
233 * @sk_receive_queue: incoming packets 233 * @sk_receive_queue: incoming packets
234 * @sk_wmem_alloc: transmit queue bytes committed 234 * @sk_wmem_alloc: transmit queue bytes committed
235 * @sk_write_queue: Packet sending queue 235 * @sk_write_queue: Packet sending queue
236 * @sk_async_wait_queue: DMA copied packets
237 * @sk_omem_alloc: "o" is "option" or "other" 236 * @sk_omem_alloc: "o" is "option" or "other"
238 * @sk_wmem_queued: persistent queue size 237 * @sk_wmem_queued: persistent queue size
239 * @sk_forward_alloc: space allocated forward 238 * @sk_forward_alloc: space allocated forward
@@ -362,10 +361,6 @@ struct sock {
362 struct sk_filter __rcu *sk_filter; 361 struct sk_filter __rcu *sk_filter;
363 struct socket_wq __rcu *sk_wq; 362 struct socket_wq __rcu *sk_wq;
364 363
365#ifdef CONFIG_NET_DMA
366 struct sk_buff_head sk_async_wait_queue;
367#endif
368
369#ifdef CONFIG_XFRM 364#ifdef CONFIG_XFRM
370 struct xfrm_policy *sk_policy[2]; 365 struct xfrm_policy *sk_policy[2];
371#endif 366#endif
@@ -2206,27 +2201,15 @@ void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags);
2206 * sk_eat_skb - Release a skb if it is no longer needed 2201 * sk_eat_skb - Release a skb if it is no longer needed
2207 * @sk: socket to eat this skb from 2202 * @sk: socket to eat this skb from
2208 * @skb: socket buffer to eat 2203 * @skb: socket buffer to eat
2209 * @copied_early: flag indicating whether DMA operations copied this data early
2210 * 2204 *
2211 * This routine must be called with interrupts disabled or with the socket 2205 * This routine must be called with interrupts disabled or with the socket
2212 * locked so that the sk_buff queue operation is ok. 2206 * locked so that the sk_buff queue operation is ok.
2213*/ 2207*/
2214#ifdef CONFIG_NET_DMA 2208static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
2215static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2216{
2217 __skb_unlink(skb, &sk->sk_receive_queue);
2218 if (!copied_early)
2219 __kfree_skb(skb);
2220 else
2221 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
2222}
2223#else
2224static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2225{ 2209{
2226 __skb_unlink(skb, &sk->sk_receive_queue); 2210 __skb_unlink(skb, &sk->sk_receive_queue);
2227 __kfree_skb(skb); 2211 __kfree_skb(skb);
2228} 2212}
2229#endif
2230 2213
2231static inline 2214static inline
2232struct net *sock_net(const struct sock *sk) 2215struct net *sock_net(const struct sock *sk)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 590e01a476ac..7523c325673e 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -27,7 +27,6 @@
27#include <linux/cache.h> 27#include <linux/cache.h>
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/dmaengine.h>
31#include <linux/crypto.h> 30#include <linux/crypto.h>
32#include <linux/cryptohash.h> 31#include <linux/cryptohash.h>
33#include <linux/kref.h> 32#include <linux/kref.h>
@@ -262,7 +261,6 @@ extern int sysctl_tcp_adv_win_scale;
262extern int sysctl_tcp_tw_reuse; 261extern int sysctl_tcp_tw_reuse;
263extern int sysctl_tcp_frto; 262extern int sysctl_tcp_frto;
264extern int sysctl_tcp_low_latency; 263extern int sysctl_tcp_low_latency;
265extern int sysctl_tcp_dma_copybreak;
266extern int sysctl_tcp_nometrics_save; 264extern int sysctl_tcp_nometrics_save;
267extern int sysctl_tcp_moderate_rcvbuf; 265extern int sysctl_tcp_moderate_rcvbuf;
268extern int sysctl_tcp_tso_win_divisor; 266extern int sysctl_tcp_tso_win_divisor;
@@ -368,7 +366,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
368void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 366void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
369 const struct tcphdr *th, unsigned int len); 367 const struct tcphdr *th, unsigned int len);
370void tcp_rcv_space_adjust(struct sock *sk); 368void tcp_rcv_space_adjust(struct sock *sk);
371void tcp_cleanup_rbuf(struct sock *sk, int copied);
372int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 369int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
373void tcp_twsk_destructor(struct sock *sk); 370void tcp_twsk_destructor(struct sock *sk);
374ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, 371ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
@@ -1031,12 +1028,6 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1031 tp->ucopy.len = 0; 1028 tp->ucopy.len = 0;
1032 tp->ucopy.memory = 0; 1029 tp->ucopy.memory = 0;
1033 skb_queue_head_init(&tp->ucopy.prequeue); 1030 skb_queue_head_init(&tp->ucopy.prequeue);
1034#ifdef CONFIG_NET_DMA
1035 tp->ucopy.dma_chan = NULL;
1036 tp->ucopy.wakeup = 0;
1037 tp->ucopy.pinned_list = NULL;
1038 tp->ucopy.dma_cookie = 0;
1039#endif
1040} 1031}
1041 1032
1042bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); 1033bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
diff --git a/init/Kconfig b/init/Kconfig
index e84c6423a2e5..e25a82a291a6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -811,6 +811,7 @@ config LOG_BUF_SHIFT
811 int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" 811 int "Kernel log buffer size (16 => 64KB, 17 => 128KB)"
812 range 12 21 812 range 12 21
813 default 17 813 default 17
814 depends on PRINTK
814 help 815 help
815 Select the minimal kernel log buffer size as a power of 2. 816 Select the minimal kernel log buffer size as a power of 2.
816 The final size is affected by LOG_CPU_MAX_BUF_SHIFT config 817 The final size is affected by LOG_CPU_MAX_BUF_SHIFT config
@@ -830,6 +831,7 @@ config LOG_CPU_MAX_BUF_SHIFT
830 range 0 21 831 range 0 21
831 default 12 if !BASE_SMALL 832 default 12 if !BASE_SMALL
832 default 0 if BASE_SMALL 833 default 0 if BASE_SMALL
834 depends on PRINTK
833 help 835 help
834 This option allows to increase the default ring buffer size 836 This option allows to increase the default ring buffer size
835 according to the number of CPUs. The value defines the contribution 837 according to the number of CPUs. The value defines the contribution
@@ -1475,6 +1477,7 @@ config FUTEX
1475 1477
1476config HAVE_FUTEX_CMPXCHG 1478config HAVE_FUTEX_CMPXCHG
1477 bool 1479 bool
1480 depends on FUTEX
1478 help 1481 help
1479 Architectures should select this if futex_atomic_cmpxchg_inatomic() 1482 Architectures should select this if futex_atomic_cmpxchg_inatomic()
1480 is implemented and always working. This removes a couple of runtime 1483 is implemented and always working. This removes a couple of runtime
@@ -1537,6 +1540,16 @@ config AIO
1537 by some high performance threaded applications. Disabling 1540 by some high performance threaded applications. Disabling
1538 this option saves about 7k. 1541 this option saves about 7k.
1539 1542
1543config ADVISE_SYSCALLS
1544 bool "Enable madvise/fadvise syscalls" if EXPERT
1545 default y
1546 help
1547 This option enables the madvise and fadvise syscalls, used by
1548 applications to advise the kernel about their future memory or file
1549 usage, improving performance. If building an embedded system where no
1550 applications use these syscalls, you can disable this option to save
1551 space.
1552
1540config PCI_QUIRKS 1553config PCI_QUIRKS
1541 default y 1554 default y
1542 bool "Enable PCI quirk workarounds" if EXPERT 1555 bool "Enable PCI quirk workarounds" if EXPERT
@@ -1906,6 +1919,49 @@ config MODULE_SIG_HASH
1906 default "sha384" if MODULE_SIG_SHA384 1919 default "sha384" if MODULE_SIG_SHA384
1907 default "sha512" if MODULE_SIG_SHA512 1920 default "sha512" if MODULE_SIG_SHA512
1908 1921
1922config MODULE_COMPRESS
1923 bool "Compress modules on installation"
1924 depends on MODULES
1925 help
1926 This option compresses the kernel modules when 'make
1927 modules_install' is run.
1928
1929 The modules will be compressed either using gzip or xz depend on the
1930 choice made in "Compression algorithm".
1931
1932 module-init-tools has support for gzip format while kmod handle gzip
1933 and xz compressed modules.
1934
1935 When a kernel module is installed from outside of the main kernel
1936 source and uses the Kbuild system for installing modules then that
1937 kernel module will also be compressed when it is installed.
1938
1939 This option provides little benefit when the modules are to be used inside
1940 an initrd or initramfs, it generally is more efficient to compress the whole
1941 initrd or initramfs instead.
1942
1943 This is fully compatible with signed modules while the signed module is
1944 compressed. module-init-tools or kmod handles decompression and provide to
1945 other layer the uncompressed but signed payload.
1946
1947choice
1948 prompt "Compression algorithm"
1949 depends on MODULE_COMPRESS
1950 default MODULE_COMPRESS_GZIP
1951 help
1952 This determines which sort of compression will be used during
1953 'make modules_install'.
1954
1955 GZIP (default) and XZ are supported.
1956
1957config MODULE_COMPRESS_GZIP
1958 bool "GZIP"
1959
1960config MODULE_COMPRESS_XZ
1961 bool "XZ"
1962
1963endchoice
1964
1909endif # MODULES 1965endif # MODULES
1910 1966
1911config INIT_ALL_POSSIBLE 1967config INIT_ALL_POSSIBLE
diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config
new file mode 100644
index 000000000000..c2de56ab0fce
--- /dev/null
+++ b/kernel/configs/tiny.config
@@ -0,0 +1,4 @@
1CONFIG_CC_OPTIMIZE_FOR_SIZE=y
2CONFIG_KERNEL_XZ=y
3CONFIG_OPTIMIZE_INLINING=y
4CONFIG_SLOB=y
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d640a8b4dcbc..963bf139e2b2 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7948,8 +7948,10 @@ int perf_event_init_task(struct task_struct *child)
7948 7948
7949 for_each_task_context_nr(ctxn) { 7949 for_each_task_context_nr(ctxn) {
7950 ret = perf_event_init_context(child, ctxn); 7950 ret = perf_event_init_context(child, ctxn);
7951 if (ret) 7951 if (ret) {
7952 perf_event_free_task(child);
7952 return ret; 7953 return ret;
7954 }
7953 } 7955 }
7954 7956
7955 return 0; 7957 return 0;
diff --git a/kernel/fork.c b/kernel/fork.c
index 0cf9cdb6e491..a91e47d86de2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1360,7 +1360,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1360 goto bad_fork_cleanup_policy; 1360 goto bad_fork_cleanup_policy;
1361 retval = audit_alloc(p); 1361 retval = audit_alloc(p);
1362 if (retval) 1362 if (retval)
1363 goto bad_fork_cleanup_policy; 1363 goto bad_fork_cleanup_perf;
1364 /* copy all the process information */ 1364 /* copy all the process information */
1365 shm_init_task(p); 1365 shm_init_task(p);
1366 retval = copy_semundo(clone_flags, p); 1366 retval = copy_semundo(clone_flags, p);
@@ -1566,8 +1566,9 @@ bad_fork_cleanup_semundo:
1566 exit_sem(p); 1566 exit_sem(p);
1567bad_fork_cleanup_audit: 1567bad_fork_cleanup_audit:
1568 audit_free(p); 1568 audit_free(p);
1569bad_fork_cleanup_policy: 1569bad_fork_cleanup_perf:
1570 perf_event_free_task(p); 1570 perf_event_free_task(p);
1571bad_fork_cleanup_policy:
1571#ifdef CONFIG_NUMA 1572#ifdef CONFIG_NUMA
1572 mpol_put(p->mempolicy); 1573 mpol_put(p->mempolicy);
1573bad_fork_cleanup_threadgroup_lock: 1574bad_fork_cleanup_threadgroup_lock:
diff --git a/kernel/module.c b/kernel/module.c
index 03214bd288e9..8a0dc91eddbc 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -135,7 +135,7 @@ static int param_set_bool_enable_only(const char *val,
135} 135}
136 136
137static const struct kernel_param_ops param_ops_bool_enable_only = { 137static const struct kernel_param_ops param_ops_bool_enable_only = {
138 .flags = KERNEL_PARAM_FL_NOARG, 138 .flags = KERNEL_PARAM_OPS_FL_NOARG,
139 .set = param_set_bool_enable_only, 139 .set = param_set_bool_enable_only,
140 .get = param_get_bool, 140 .get = param_get_bool,
141}; 141};
diff --git a/kernel/params.c b/kernel/params.c
index 34f527023794..041b5899d5e2 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -83,6 +83,15 @@ bool parameq(const char *a, const char *b)
83 return parameqn(a, b, strlen(a)+1); 83 return parameqn(a, b, strlen(a)+1);
84} 84}
85 85
86static void param_check_unsafe(const struct kernel_param *kp)
87{
88 if (kp->flags & KERNEL_PARAM_FL_UNSAFE) {
89 pr_warn("Setting dangerous option %s - tainting kernel\n",
90 kp->name);
91 add_taint(TAINT_USER, LOCKDEP_STILL_OK);
92 }
93}
94
86static int parse_one(char *param, 95static int parse_one(char *param,
87 char *val, 96 char *val,
88 const char *doing, 97 const char *doing,
@@ -104,11 +113,12 @@ static int parse_one(char *param,
104 return 0; 113 return 0;
105 /* No one handled NULL, so do it here. */ 114 /* No one handled NULL, so do it here. */
106 if (!val && 115 if (!val &&
107 !(params[i].ops->flags & KERNEL_PARAM_FL_NOARG)) 116 !(params[i].ops->flags & KERNEL_PARAM_OPS_FL_NOARG))
108 return -EINVAL; 117 return -EINVAL;
109 pr_debug("handling %s with %p\n", param, 118 pr_debug("handling %s with %p\n", param,
110 params[i].ops->set); 119 params[i].ops->set);
111 mutex_lock(&param_lock); 120 mutex_lock(&param_lock);
121 param_check_unsafe(&params[i]);
112 err = params[i].ops->set(val, &params[i]); 122 err = params[i].ops->set(val, &params[i]);
113 mutex_unlock(&param_lock); 123 mutex_unlock(&param_lock);
114 return err; 124 return err;
@@ -318,7 +328,7 @@ int param_get_bool(char *buffer, const struct kernel_param *kp)
318EXPORT_SYMBOL(param_get_bool); 328EXPORT_SYMBOL(param_get_bool);
319 329
320struct kernel_param_ops param_ops_bool = { 330struct kernel_param_ops param_ops_bool = {
321 .flags = KERNEL_PARAM_FL_NOARG, 331 .flags = KERNEL_PARAM_OPS_FL_NOARG,
322 .set = param_set_bool, 332 .set = param_set_bool,
323 .get = param_get_bool, 333 .get = param_get_bool,
324}; 334};
@@ -369,7 +379,7 @@ int param_set_bint(const char *val, const struct kernel_param *kp)
369EXPORT_SYMBOL(param_set_bint); 379EXPORT_SYMBOL(param_set_bint);
370 380
371struct kernel_param_ops param_ops_bint = { 381struct kernel_param_ops param_ops_bint = {
372 .flags = KERNEL_PARAM_FL_NOARG, 382 .flags = KERNEL_PARAM_OPS_FL_NOARG,
373 .set = param_set_bint, 383 .set = param_set_bint,
374 .get = param_get_int, 384 .get = param_get_int,
375}; 385};
@@ -552,6 +562,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr,
552 return -EPERM; 562 return -EPERM;
553 563
554 mutex_lock(&param_lock); 564 mutex_lock(&param_lock);
565 param_check_unsafe(attribute->param);
555 err = attribute->param->ops->set(buf, attribute->param); 566 err = attribute->param->ops->set(buf, attribute->param);
556 mutex_unlock(&param_lock); 567 mutex_unlock(&param_lock);
557 if (!err) 568 if (!err)
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 391d4ddb6f4b..d4709d481053 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -156,6 +156,9 @@ cond_syscall(sys_process_vm_writev);
156cond_syscall(compat_sys_process_vm_readv); 156cond_syscall(compat_sys_process_vm_readv);
157cond_syscall(compat_sys_process_vm_writev); 157cond_syscall(compat_sys_process_vm_writev);
158cond_syscall(sys_uselib); 158cond_syscall(sys_uselib);
159cond_syscall(sys_fadvise64);
160cond_syscall(sys_fadvise64_64);
161cond_syscall(sys_madvise);
159 162
160/* arch-specific weak syscall entries */ 163/* arch-specific weak syscall entries */
161cond_syscall(sys_pciconfig_read); 164cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index e4ba9a5a5ccb..9a4f750a2963 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -390,7 +390,6 @@ static const struct bin_table bin_net_ipv4_table[] = {
390 { CTL_INT, NET_TCP_MTU_PROBING, "tcp_mtu_probing" }, 390 { CTL_INT, NET_TCP_MTU_PROBING, "tcp_mtu_probing" },
391 { CTL_INT, NET_TCP_BASE_MSS, "tcp_base_mss" }, 391 { CTL_INT, NET_TCP_BASE_MSS, "tcp_base_mss" },
392 { CTL_INT, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, "tcp_workaround_signed_windows" }, 392 { CTL_INT, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, "tcp_workaround_signed_windows" },
393 { CTL_INT, NET_TCP_DMA_COPYBREAK, "tcp_dma_copybreak" },
394 { CTL_INT, NET_TCP_SLOW_START_AFTER_IDLE, "tcp_slow_start_after_idle" }, 393 { CTL_INT, NET_TCP_SLOW_START_AFTER_IDLE, "tcp_slow_start_after_idle" },
395 { CTL_INT, NET_CIPSOV4_CACHE_ENABLE, "cipso_cache_enable" }, 394 { CTL_INT, NET_CIPSOV4_CACHE_ENABLE, "cipso_cache_enable" },
396 { CTL_INT, NET_CIPSOV4_CACHE_BUCKET_SIZE, "cipso_cache_bucket_size" }, 395 { CTL_INT, NET_CIPSOV4_CACHE_BUCKET_SIZE, "cipso_cache_bucket_size" },
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index b38fb2b9e237..2d75c94ae87d 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3359,7 +3359,7 @@ static void rb_iter_reset(struct ring_buffer_iter *iter)
3359 iter->head = cpu_buffer->reader_page->read; 3359 iter->head = cpu_buffer->reader_page->read;
3360 3360
3361 iter->cache_reader_page = iter->head_page; 3361 iter->cache_reader_page = iter->head_page;
3362 iter->cache_read = iter->head; 3362 iter->cache_read = cpu_buffer->read;
3363 3363
3364 if (iter->head) 3364 if (iter->head)
3365 iter->read_stamp = cpu_buffer->read_stamp; 3365 iter->read_stamp = cpu_buffer->read_stamp;
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 7b36e4d40ed7..16d02639d334 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -588,13 +588,13 @@ EXPORT_SYMBOL_GPL(rhashtable_init);
588 * rhashtable_destroy - destroy hash table 588 * rhashtable_destroy - destroy hash table
589 * @ht: the hash table to destroy 589 * @ht: the hash table to destroy
590 * 590 *
591 * Frees the bucket array. 591 * Frees the bucket array. This function is not rcu safe, therefore the caller
592 * has to make sure that no resizing may happen by unpublishing the hashtable
593 * and waiting for the quiescent cycle before releasing the bucket array.
592 */ 594 */
593void rhashtable_destroy(const struct rhashtable *ht) 595void rhashtable_destroy(const struct rhashtable *ht)
594{ 596{
595 const struct bucket_table *tbl = rht_dereference(ht->tbl, ht); 597 bucket_table_free(ht->tbl);
596
597 bucket_table_free(tbl);
598} 598}
599EXPORT_SYMBOL_GPL(rhashtable_destroy); 599EXPORT_SYMBOL_GPL(rhashtable_destroy);
600 600
diff --git a/mm/Makefile b/mm/Makefile
index 632ae77e6070..fe7a053c0f45 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5mmu-y := nommu.o 5mmu-y := nommu.o
6mmu-$(CONFIG_MMU) := fremap.o gup.o highmem.o madvise.o memory.o mincore.o \ 6mmu-$(CONFIG_MMU) := fremap.o gup.o highmem.o memory.o mincore.o \
7 mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \ 7 mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
8 vmalloc.o pagewalk.o pgtable-generic.o 8 vmalloc.o pagewalk.o pgtable-generic.o
9 9
@@ -11,7 +11,7 @@ ifdef CONFIG_CROSS_MEMORY_ATTACH
11mmu-$(CONFIG_MMU) += process_vm_access.o 11mmu-$(CONFIG_MMU) += process_vm_access.o
12endif 12endif
13 13
14obj-y := filemap.o mempool.o oom_kill.o fadvise.o \ 14obj-y := filemap.o mempool.o oom_kill.o \
15 maccess.o page_alloc.o page-writeback.o \ 15 maccess.o page_alloc.o page-writeback.o \
16 readahead.o swap.o truncate.o vmscan.o shmem.o \ 16 readahead.o swap.o truncate.o vmscan.o shmem.o \
17 util.o mmzone.o vmstat.o backing-dev.o \ 17 util.o mmzone.o vmstat.o backing-dev.o \
@@ -28,6 +28,9 @@ else
28 obj-y += bootmem.o 28 obj-y += bootmem.o
29endif 29endif
30 30
31ifdef CONFIG_MMU
32 obj-$(CONFIG_ADVISE_SYSCALLS) += fadvise.o madvise.o
33endif
31obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o 34obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
32 35
33obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o 36obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index d9a21d06b862..f8ffd9412ec5 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1795,14 +1795,17 @@ static int __split_huge_page_map(struct page *page,
1795 for (i = 0; i < HPAGE_PMD_NR; i++, haddr += PAGE_SIZE) { 1795 for (i = 0; i < HPAGE_PMD_NR; i++, haddr += PAGE_SIZE) {
1796 pte_t *pte, entry; 1796 pte_t *pte, entry;
1797 BUG_ON(PageCompound(page+i)); 1797 BUG_ON(PageCompound(page+i));
1798 /*
1799 * Note that pmd_numa is not transferred deliberately
1800 * to avoid any possibility that pte_numa leaks to
1801 * a PROT_NONE VMA by accident.
1802 */
1798 entry = mk_pte(page + i, vma->vm_page_prot); 1803 entry = mk_pte(page + i, vma->vm_page_prot);
1799 entry = maybe_mkwrite(pte_mkdirty(entry), vma); 1804 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
1800 if (!pmd_write(*pmd)) 1805 if (!pmd_write(*pmd))
1801 entry = pte_wrprotect(entry); 1806 entry = pte_wrprotect(entry);
1802 if (!pmd_young(*pmd)) 1807 if (!pmd_young(*pmd))
1803 entry = pte_mkold(entry); 1808 entry = pte_mkold(entry);
1804 if (pmd_numa(*pmd))
1805 entry = pte_mknuma(entry);
1806 pte = pte_offset_map(&_pmd, haddr); 1809 pte = pte_offset_map(&_pmd, haddr);
1807 BUG_ON(!pte_none(*pte)); 1810 BUG_ON(!pte_none(*pte));
1808 set_pte_at(mm, haddr, pte, entry); 1811 set_pte_at(mm, haddr, pte, entry);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 085dc6d2f876..28928ce9b07f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -292,6 +292,9 @@ struct mem_cgroup {
292 /* vmpressure notifications */ 292 /* vmpressure notifications */
293 struct vmpressure vmpressure; 293 struct vmpressure vmpressure;
294 294
295 /* css_online() has been completed */
296 int initialized;
297
295 /* 298 /*
296 * the counter to account for mem+swap usage. 299 * the counter to account for mem+swap usage.
297 */ 300 */
@@ -1099,10 +1102,21 @@ skip_node:
1099 * skipping css reference should be safe. 1102 * skipping css reference should be safe.
1100 */ 1103 */
1101 if (next_css) { 1104 if (next_css) {
1102 if ((next_css == &root->css) || 1105 struct mem_cgroup *memcg = mem_cgroup_from_css(next_css);
1103 ((next_css->flags & CSS_ONLINE) && 1106
1104 css_tryget_online(next_css))) 1107 if (next_css == &root->css)
1105 return mem_cgroup_from_css(next_css); 1108 return memcg;
1109
1110 if (css_tryget_online(next_css)) {
1111 /*
1112 * Make sure the memcg is initialized:
1113 * mem_cgroup_css_online() orders the the
1114 * initialization against setting the flag.
1115 */
1116 if (smp_load_acquire(&memcg->initialized))
1117 return memcg;
1118 css_put(next_css);
1119 }
1106 1120
1107 prev_css = next_css; 1121 prev_css = next_css;
1108 goto skip_node; 1122 goto skip_node;
@@ -5549,6 +5563,7 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
5549{ 5563{
5550 struct mem_cgroup *memcg = mem_cgroup_from_css(css); 5564 struct mem_cgroup *memcg = mem_cgroup_from_css(css);
5551 struct mem_cgroup *parent = mem_cgroup_from_css(css->parent); 5565 struct mem_cgroup *parent = mem_cgroup_from_css(css->parent);
5566 int ret;
5552 5567
5553 if (css->id > MEM_CGROUP_ID_MAX) 5568 if (css->id > MEM_CGROUP_ID_MAX)
5554 return -ENOSPC; 5569 return -ENOSPC;
@@ -5585,7 +5600,18 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
5585 } 5600 }
5586 mutex_unlock(&memcg_create_mutex); 5601 mutex_unlock(&memcg_create_mutex);
5587 5602
5588 return memcg_init_kmem(memcg, &memory_cgrp_subsys); 5603 ret = memcg_init_kmem(memcg, &memory_cgrp_subsys);
5604 if (ret)
5605 return ret;
5606
5607 /*
5608 * Make sure the memcg is initialized: mem_cgroup_iter()
5609 * orders reading memcg->initialized against its callers
5610 * reading the memcg members.
5611 */
5612 smp_store_release(&memcg->initialized, 1);
5613
5614 return 0;
5589} 5615}
5590 5616
5591/* 5617/*
diff --git a/mm/migrate.c b/mm/migrate.c
index f78ec9bd454d..2740360cd216 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -146,8 +146,11 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
146 pte = pte_mkold(mk_pte(new, vma->vm_page_prot)); 146 pte = pte_mkold(mk_pte(new, vma->vm_page_prot));
147 if (pte_swp_soft_dirty(*ptep)) 147 if (pte_swp_soft_dirty(*ptep))
148 pte = pte_mksoft_dirty(pte); 148 pte = pte_mksoft_dirty(pte);
149
150 /* Recheck VMA as permissions can change since migration started */
149 if (is_write_migration_entry(entry)) 151 if (is_write_migration_entry(entry))
150 pte = pte_mkwrite(pte); 152 pte = maybe_mkwrite(pte, vma);
153
151#ifdef CONFIG_HUGETLB_PAGE 154#ifdef CONFIG_HUGETLB_PAGE
152 if (PageHuge(new)) { 155 if (PageHuge(new)) {
153 pte = pte_mkhuge(pte); 156 pte = pte_mkhuge(pte);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 18cee0d4c8a2..eee961958021 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1612,7 +1612,7 @@ again:
1612 } 1612 }
1613 1613
1614 __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order)); 1614 __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));
1615 if (zone_page_state(zone, NR_ALLOC_BATCH) == 0 && 1615 if (atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH]) <= 0 &&
1616 !zone_is_fair_depleted(zone)) 1616 !zone_is_fair_depleted(zone))
1617 zone_set_flag(zone, ZONE_FAIR_DEPLETED); 1617 zone_set_flag(zone, ZONE_FAIR_DEPLETED);
1618 1618
@@ -5701,9 +5701,8 @@ static void __setup_per_zone_wmarks(void)
5701 zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + (tmp >> 1); 5701 zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + (tmp >> 1);
5702 5702
5703 __mod_zone_page_state(zone, NR_ALLOC_BATCH, 5703 __mod_zone_page_state(zone, NR_ALLOC_BATCH,
5704 high_wmark_pages(zone) - 5704 high_wmark_pages(zone) - low_wmark_pages(zone) -
5705 low_wmark_pages(zone) - 5705 atomic_long_read(&zone->vm_stat[NR_ALLOC_BATCH]));
5706 zone_page_state(zone, NR_ALLOC_BATCH));
5707 5706
5708 setup_zone_migrate_reserve(zone); 5707 setup_zone_migrate_reserve(zone);
5709 spin_unlock_irqrestore(&zone->lock, flags); 5708 spin_unlock_irqrestore(&zone->lock, flags);
diff --git a/net/core/Makefile b/net/core/Makefile
index 71093d94ad2b..235e6c50708d 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -16,7 +16,6 @@ obj-y += net-sysfs.o
16obj-$(CONFIG_PROC_FS) += net-procfs.o 16obj-$(CONFIG_PROC_FS) += net-procfs.o
17obj-$(CONFIG_NET_PKTGEN) += pktgen.o 17obj-$(CONFIG_NET_PKTGEN) += pktgen.o
18obj-$(CONFIG_NETPOLL) += netpoll.o 18obj-$(CONFIG_NETPOLL) += netpoll.o
19obj-$(CONFIG_NET_DMA) += user_dma.o
20obj-$(CONFIG_FIB_RULES) += fib_rules.o 19obj-$(CONFIG_FIB_RULES) += fib_rules.o
21obj-$(CONFIG_TRACEPOINTS) += net-traces.o 20obj-$(CONFIG_TRACEPOINTS) += net-traces.o
22obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o 21obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
diff --git a/net/core/dev.c b/net/core/dev.c
index cf8a95f48cff..130d64220229 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1284,7 +1284,6 @@ static int __dev_open(struct net_device *dev)
1284 clear_bit(__LINK_STATE_START, &dev->state); 1284 clear_bit(__LINK_STATE_START, &dev->state);
1285 else { 1285 else {
1286 dev->flags |= IFF_UP; 1286 dev->flags |= IFF_UP;
1287 net_dmaengine_get();
1288 dev_set_rx_mode(dev); 1287 dev_set_rx_mode(dev);
1289 dev_activate(dev); 1288 dev_activate(dev);
1290 add_device_randomness(dev->dev_addr, dev->addr_len); 1289 add_device_randomness(dev->dev_addr, dev->addr_len);
@@ -1363,7 +1362,6 @@ static int __dev_close_many(struct list_head *head)
1363 ops->ndo_stop(dev); 1362 ops->ndo_stop(dev);
1364 1363
1365 dev->flags &= ~IFF_UP; 1364 dev->flags &= ~IFF_UP;
1366 net_dmaengine_put();
1367 netpoll_poll_enable(dev); 1365 netpoll_poll_enable(dev);
1368 } 1366 }
1369 1367
@@ -4505,14 +4503,6 @@ static void net_rx_action(struct softirq_action *h)
4505out: 4503out:
4506 net_rps_action_and_irq_enable(sd); 4504 net_rps_action_and_irq_enable(sd);
4507 4505
4508#ifdef CONFIG_NET_DMA
4509 /*
4510 * There may not be any more sk_buffs coming right now, so push
4511 * any pending DMA copies to hardware
4512 */
4513 dma_issue_pending_all();
4514#endif
4515
4516 return; 4506 return;
4517 4507
4518softnet_break: 4508softnet_break:
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index da1378a3e2c7..8d289697cc7a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3152,6 +3152,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
3152 NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD; 3152 NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD;
3153 goto done; 3153 goto done;
3154 } 3154 }
3155 /* switch back to head shinfo */
3156 pinfo = skb_shinfo(p);
3157
3155 if (pinfo->frag_list) 3158 if (pinfo->frag_list)
3156 goto merge; 3159 goto merge;
3157 if (skb_gro_len(p) != pinfo->gso_size) 3160 if (skb_gro_len(p) != pinfo->gso_size)
diff --git a/net/core/sock.c b/net/core/sock.c
index 9c3f823e76a9..611f424fb76b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1489,9 +1489,6 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1489 atomic_set(&newsk->sk_omem_alloc, 0); 1489 atomic_set(&newsk->sk_omem_alloc, 0);
1490 skb_queue_head_init(&newsk->sk_receive_queue); 1490 skb_queue_head_init(&newsk->sk_receive_queue);
1491 skb_queue_head_init(&newsk->sk_write_queue); 1491 skb_queue_head_init(&newsk->sk_write_queue);
1492#ifdef CONFIG_NET_DMA
1493 skb_queue_head_init(&newsk->sk_async_wait_queue);
1494#endif
1495 1492
1496 spin_lock_init(&newsk->sk_dst_lock); 1493 spin_lock_init(&newsk->sk_dst_lock);
1497 rwlock_init(&newsk->sk_callback_lock); 1494 rwlock_init(&newsk->sk_callback_lock);
@@ -2308,9 +2305,6 @@ void sock_init_data(struct socket *sock, struct sock *sk)
2308 skb_queue_head_init(&sk->sk_receive_queue); 2305 skb_queue_head_init(&sk->sk_receive_queue);
2309 skb_queue_head_init(&sk->sk_write_queue); 2306 skb_queue_head_init(&sk->sk_write_queue);
2310 skb_queue_head_init(&sk->sk_error_queue); 2307 skb_queue_head_init(&sk->sk_error_queue);
2311#ifdef CONFIG_NET_DMA
2312 skb_queue_head_init(&sk->sk_async_wait_queue);
2313#endif
2314 2308
2315 sk->sk_send_head = NULL; 2309 sk->sk_send_head = NULL;
2316 2310
diff --git a/net/core/user_dma.c b/net/core/user_dma.c
deleted file mode 100644
index 1b5fefdb8198..000000000000
--- a/net/core/user_dma.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 * Portions based on net/core/datagram.c and copyrighted by their authors.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59
17 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 * The full GNU General Public License is included in this distribution in the
20 * file called COPYING.
21 */
22
23/*
24 * This code allows the net stack to make use of a DMA engine for
25 * skb to iovec copies.
26 */
27
28#include <linux/dmaengine.h>
29#include <linux/socket.h>
30#include <linux/export.h>
31#include <net/tcp.h>
32#include <net/netdma.h>
33
34#define NET_DMA_DEFAULT_COPYBREAK 4096
35
36int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK;
37EXPORT_SYMBOL(sysctl_tcp_dma_copybreak);
38
39/**
40 * dma_skb_copy_datagram_iovec - Copy a datagram to an iovec.
41 * @skb - buffer to copy
42 * @offset - offset in the buffer to start copying from
43 * @iovec - io vector to copy to
44 * @len - amount of data to copy from buffer to iovec
45 * @pinned_list - locked iovec buffer data
46 *
47 * Note: the iovec is modified during the copy.
48 */
49int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
50 struct sk_buff *skb, int offset, struct iovec *to,
51 size_t len, struct dma_pinned_list *pinned_list)
52{
53 int start = skb_headlen(skb);
54 int i, copy = start - offset;
55 struct sk_buff *frag_iter;
56 dma_cookie_t cookie = 0;
57
58 /* Copy header. */
59 if (copy > 0) {
60 if (copy > len)
61 copy = len;
62 cookie = dma_memcpy_to_iovec(chan, to, pinned_list,
63 skb->data + offset, copy);
64 if (cookie < 0)
65 goto fault;
66 len -= copy;
67 if (len == 0)
68 goto end;
69 offset += copy;
70 }
71
72 /* Copy paged appendix. Hmm... why does this look so complicated? */
73 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
74 int end;
75 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
76
77 WARN_ON(start > offset + len);
78
79 end = start + skb_frag_size(frag);
80 copy = end - offset;
81 if (copy > 0) {
82 struct page *page = skb_frag_page(frag);
83
84 if (copy > len)
85 copy = len;
86
87 cookie = dma_memcpy_pg_to_iovec(chan, to, pinned_list, page,
88 frag->page_offset + offset - start, copy);
89 if (cookie < 0)
90 goto fault;
91 len -= copy;
92 if (len == 0)
93 goto end;
94 offset += copy;
95 }
96 start = end;
97 }
98
99 skb_walk_frags(skb, frag_iter) {
100 int end;
101
102 WARN_ON(start > offset + len);
103
104 end = start + frag_iter->len;
105 copy = end - offset;
106 if (copy > 0) {
107 if (copy > len)
108 copy = len;
109 cookie = dma_skb_copy_datagram_iovec(chan, frag_iter,
110 offset - start,
111 to, copy,
112 pinned_list);
113 if (cookie < 0)
114 goto fault;
115 len -= copy;
116 if (len == 0)
117 goto end;
118 offset += copy;
119 }
120 start = end;
121 }
122
123end:
124 if (!len) {
125 skb->dma_cookie = cookie;
126 return cookie;
127 }
128
129fault:
130 return -EFAULT;
131}
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index de2c1e719305..f440cc7c9f72 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -848,7 +848,7 @@ int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
848 default: 848 default:
849 dccp_pr_debug("packet_type=%s\n", 849 dccp_pr_debug("packet_type=%s\n",
850 dccp_packet_name(dh->dccph_type)); 850 dccp_packet_name(dh->dccph_type));
851 sk_eat_skb(sk, skb, false); 851 sk_eat_skb(sk, skb);
852 } 852 }
853verify_sock_status: 853verify_sock_status:
854 if (sock_flag(sk, SOCK_DONE)) { 854 if (sock_flag(sk, SOCK_DONE)) {
@@ -905,7 +905,7 @@ verify_sock_status:
905 len = skb->len; 905 len = skb->len;
906 found_fin_ok: 906 found_fin_ok:
907 if (!(flags & MSG_PEEK)) 907 if (!(flags & MSG_PEEK))
908 sk_eat_skb(sk, skb, false); 908 sk_eat_skb(sk, skb);
909 break; 909 break;
910 } while (1); 910 } while (1);
911out: 911out:
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index bd41dd1948b6..bda4bb8ae260 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -764,9 +764,14 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)
764 764
765 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); 765 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type);
766 766
767 if (!t && (cmd == SIOCADDTUNNEL)) { 767 if (cmd == SIOCADDTUNNEL) {
768 t = ip_tunnel_create(net, itn, p); 768 if (!t) {
769 err = PTR_ERR_OR_ZERO(t); 769 t = ip_tunnel_create(net, itn, p);
770 err = PTR_ERR_OR_ZERO(t);
771 break;
772 }
773
774 err = -EEXIST;
770 break; 775 break;
771 } 776 }
772 if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { 777 if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 173e7ea54c70..cbadb942c332 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -746,7 +746,7 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow
746 } 746 }
747 747
748 n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw); 748 n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw);
749 if (n) { 749 if (!IS_ERR(n)) {
750 if (!(n->nud_state & NUD_VALID)) { 750 if (!(n->nud_state & NUD_VALID)) {
751 neigh_event_send(n, NULL); 751 neigh_event_send(n, NULL);
752 } else { 752 } else {
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 79a007c52558..a9fde0eef77c 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -628,15 +628,6 @@ static struct ctl_table ipv4_table[] = {
628 .mode = 0644, 628 .mode = 0644,
629 .proc_handler = proc_dointvec 629 .proc_handler = proc_dointvec
630 }, 630 },
631#ifdef CONFIG_NET_DMA
632 {
633 .procname = "tcp_dma_copybreak",
634 .data = &sysctl_tcp_dma_copybreak,
635 .maxlen = sizeof(int),
636 .mode = 0644,
637 .proc_handler = proc_dointvec
638 },
639#endif
640 { 631 {
641 .procname = "tcp_slow_start_after_idle", 632 .procname = "tcp_slow_start_after_idle",
642 .data = &sysctl_tcp_slow_start_after_idle, 633 .data = &sysctl_tcp_slow_start_after_idle,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 541f26a67ba2..8ee43ae90396 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -274,7 +274,6 @@
274#include <net/tcp.h> 274#include <net/tcp.h>
275#include <net/xfrm.h> 275#include <net/xfrm.h>
276#include <net/ip.h> 276#include <net/ip.h>
277#include <net/netdma.h>
278#include <net/sock.h> 277#include <net/sock.h>
279 278
280#include <asm/uaccess.h> 279#include <asm/uaccess.h>
@@ -1394,7 +1393,7 @@ static int tcp_peek_sndq(struct sock *sk, struct msghdr *msg, int len)
1394 * calculation of whether or not we must ACK for the sake of 1393 * calculation of whether or not we must ACK for the sake of
1395 * a window update. 1394 * a window update.
1396 */ 1395 */
1397void tcp_cleanup_rbuf(struct sock *sk, int copied) 1396static void tcp_cleanup_rbuf(struct sock *sk, int copied)
1398{ 1397{
1399 struct tcp_sock *tp = tcp_sk(sk); 1398 struct tcp_sock *tp = tcp_sk(sk);
1400 bool time_to_ack = false; 1399 bool time_to_ack = false;
@@ -1470,39 +1469,6 @@ static void tcp_prequeue_process(struct sock *sk)
1470 tp->ucopy.memory = 0; 1469 tp->ucopy.memory = 0;
1471} 1470}
1472 1471
1473#ifdef CONFIG_NET_DMA
1474static void tcp_service_net_dma(struct sock *sk, bool wait)
1475{
1476 dma_cookie_t done, used;
1477 dma_cookie_t last_issued;
1478 struct tcp_sock *tp = tcp_sk(sk);
1479
1480 if (!tp->ucopy.dma_chan)
1481 return;
1482
1483 last_issued = tp->ucopy.dma_cookie;
1484 dma_async_issue_pending(tp->ucopy.dma_chan);
1485
1486 do {
1487 if (dma_async_is_tx_complete(tp->ucopy.dma_chan,
1488 last_issued, &done,
1489 &used) == DMA_COMPLETE) {
1490 /* Safe to free early-copied skbs now */
1491 __skb_queue_purge(&sk->sk_async_wait_queue);
1492 break;
1493 } else {
1494 struct sk_buff *skb;
1495 while ((skb = skb_peek(&sk->sk_async_wait_queue)) &&
1496 (dma_async_is_complete(skb->dma_cookie, done,
1497 used) == DMA_COMPLETE)) {
1498 __skb_dequeue(&sk->sk_async_wait_queue);
1499 kfree_skb(skb);
1500 }
1501 }
1502 } while (wait);
1503}
1504#endif
1505
1506static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) 1472static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off)
1507{ 1473{
1508 struct sk_buff *skb; 1474 struct sk_buff *skb;
@@ -1520,7 +1486,7 @@ static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off)
1520 * splitted a fat GRO packet, while we released socket lock 1486 * splitted a fat GRO packet, while we released socket lock
1521 * in skb_splice_bits() 1487 * in skb_splice_bits()
1522 */ 1488 */
1523 sk_eat_skb(sk, skb, false); 1489 sk_eat_skb(sk, skb);
1524 } 1490 }
1525 return NULL; 1491 return NULL;
1526} 1492}
@@ -1586,11 +1552,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1586 continue; 1552 continue;
1587 } 1553 }
1588 if (tcp_hdr(skb)->fin) { 1554 if (tcp_hdr(skb)->fin) {
1589 sk_eat_skb(sk, skb, false); 1555 sk_eat_skb(sk, skb);
1590 ++seq; 1556 ++seq;
1591 break; 1557 break;
1592 } 1558 }
1593 sk_eat_skb(sk, skb, false); 1559 sk_eat_skb(sk, skb);
1594 if (!desc->count) 1560 if (!desc->count)
1595 break; 1561 break;
1596 tp->copied_seq = seq; 1562 tp->copied_seq = seq;
@@ -1628,7 +1594,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1628 int target; /* Read at least this many bytes */ 1594 int target; /* Read at least this many bytes */
1629 long timeo; 1595 long timeo;
1630 struct task_struct *user_recv = NULL; 1596 struct task_struct *user_recv = NULL;
1631 bool copied_early = false;
1632 struct sk_buff *skb; 1597 struct sk_buff *skb;
1633 u32 urg_hole = 0; 1598 u32 urg_hole = 0;
1634 1599
@@ -1674,28 +1639,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1674 1639
1675 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 1640 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
1676 1641
1677#ifdef CONFIG_NET_DMA
1678 tp->ucopy.dma_chan = NULL;
1679 preempt_disable();
1680 skb = skb_peek_tail(&sk->sk_receive_queue);
1681 {
1682 int available = 0;
1683
1684 if (skb)
1685 available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
1686 if ((available < target) &&
1687 (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
1688 !sysctl_tcp_low_latency &&
1689 net_dma_find_channel()) {
1690 preempt_enable();
1691 tp->ucopy.pinned_list =
1692 dma_pin_iovec_pages(msg->msg_iov, len);
1693 } else {
1694 preempt_enable();
1695 }
1696 }
1697#endif
1698
1699 do { 1642 do {
1700 u32 offset; 1643 u32 offset;
1701 1644
@@ -1826,16 +1769,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1826 /* __ Set realtime policy in scheduler __ */ 1769 /* __ Set realtime policy in scheduler __ */
1827 } 1770 }
1828 1771
1829#ifdef CONFIG_NET_DMA
1830 if (tp->ucopy.dma_chan) {
1831 if (tp->rcv_wnd == 0 &&
1832 !skb_queue_empty(&sk->sk_async_wait_queue)) {
1833 tcp_service_net_dma(sk, true);
1834 tcp_cleanup_rbuf(sk, copied);
1835 } else
1836 dma_async_issue_pending(tp->ucopy.dma_chan);
1837 }
1838#endif
1839 if (copied >= target) { 1772 if (copied >= target) {
1840 /* Do not sleep, just process backlog. */ 1773 /* Do not sleep, just process backlog. */
1841 release_sock(sk); 1774 release_sock(sk);
@@ -1843,11 +1776,6 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1843 } else 1776 } else
1844 sk_wait_data(sk, &timeo); 1777 sk_wait_data(sk, &timeo);
1845 1778
1846#ifdef CONFIG_NET_DMA
1847 tcp_service_net_dma(sk, false); /* Don't block */
1848 tp->ucopy.wakeup = 0;
1849#endif
1850
1851 if (user_recv) { 1779 if (user_recv) {
1852 int chunk; 1780 int chunk;
1853 1781
@@ -1905,43 +1833,13 @@ do_prequeue:
1905 } 1833 }
1906 1834
1907 if (!(flags & MSG_TRUNC)) { 1835 if (!(flags & MSG_TRUNC)) {
1908#ifdef CONFIG_NET_DMA 1836 err = skb_copy_datagram_iovec(skb, offset,
1909 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) 1837 msg->msg_iov, used);
1910 tp->ucopy.dma_chan = net_dma_find_channel(); 1838 if (err) {
1911 1839 /* Exception. Bailout! */
1912 if (tp->ucopy.dma_chan) { 1840 if (!copied)
1913 tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( 1841 copied = -EFAULT;
1914 tp->ucopy.dma_chan, skb, offset, 1842 break;
1915 msg->msg_iov, used,
1916 tp->ucopy.pinned_list);
1917
1918 if (tp->ucopy.dma_cookie < 0) {
1919
1920 pr_alert("%s: dma_cookie < 0\n",
1921 __func__);
1922
1923 /* Exception. Bailout! */
1924 if (!copied)
1925 copied = -EFAULT;
1926 break;
1927 }
1928
1929 dma_async_issue_pending(tp->ucopy.dma_chan);
1930
1931 if ((offset + used) == skb->len)
1932 copied_early = true;
1933
1934 } else
1935#endif
1936 {
1937 err = skb_copy_datagram_iovec(skb, offset,
1938 msg->msg_iov, used);
1939 if (err) {
1940 /* Exception. Bailout! */
1941 if (!copied)
1942 copied = -EFAULT;
1943 break;
1944 }
1945 } 1843 }
1946 } 1844 }
1947 1845
@@ -1961,19 +1859,15 @@ skip_copy:
1961 1859
1962 if (tcp_hdr(skb)->fin) 1860 if (tcp_hdr(skb)->fin)
1963 goto found_fin_ok; 1861 goto found_fin_ok;
1964 if (!(flags & MSG_PEEK)) { 1862 if (!(flags & MSG_PEEK))
1965 sk_eat_skb(sk, skb, copied_early); 1863 sk_eat_skb(sk, skb);
1966 copied_early = false;
1967 }
1968 continue; 1864 continue;
1969 1865
1970 found_fin_ok: 1866 found_fin_ok:
1971 /* Process the FIN. */ 1867 /* Process the FIN. */
1972 ++*seq; 1868 ++*seq;
1973 if (!(flags & MSG_PEEK)) { 1869 if (!(flags & MSG_PEEK))
1974 sk_eat_skb(sk, skb, copied_early); 1870 sk_eat_skb(sk, skb);
1975 copied_early = false;
1976 }
1977 break; 1871 break;
1978 } while (len > 0); 1872 } while (len > 0);
1979 1873
@@ -1996,16 +1890,6 @@ skip_copy:
1996 tp->ucopy.len = 0; 1890 tp->ucopy.len = 0;
1997 } 1891 }
1998 1892
1999#ifdef CONFIG_NET_DMA
2000 tcp_service_net_dma(sk, true); /* Wait for queue to drain */
2001 tp->ucopy.dma_chan = NULL;
2002
2003 if (tp->ucopy.pinned_list) {
2004 dma_unpin_iovec_pages(tp->ucopy.pinned_list);
2005 tp->ucopy.pinned_list = NULL;
2006 }
2007#endif
2008
2009 /* According to UNIX98, msg_name/msg_namelen are ignored 1893 /* According to UNIX98, msg_name/msg_namelen are ignored
2010 * on connected socket. I was just happy when found this 8) --ANK 1894 * on connected socket. I was just happy when found this 8) --ANK
2011 */ 1895 */
@@ -2349,9 +2233,6 @@ int tcp_disconnect(struct sock *sk, int flags)
2349 __skb_queue_purge(&sk->sk_receive_queue); 2233 __skb_queue_purge(&sk->sk_receive_queue);
2350 tcp_write_queue_purge(sk); 2234 tcp_write_queue_purge(sk);
2351 __skb_queue_purge(&tp->out_of_order_queue); 2235 __skb_queue_purge(&tp->out_of_order_queue);
2352#ifdef CONFIG_NET_DMA
2353 __skb_queue_purge(&sk->sk_async_wait_queue);
2354#endif
2355 2236
2356 inet->inet_dport = 0; 2237 inet->inet_dport = 0;
2357 2238
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a906e0200ff2..0185eea59342 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -73,7 +73,6 @@
73#include <net/inet_common.h> 73#include <net/inet_common.h>
74#include <linux/ipsec.h> 74#include <linux/ipsec.h>
75#include <asm/unaligned.h> 75#include <asm/unaligned.h>
76#include <net/netdma.h>
77#include <linux/errqueue.h> 76#include <linux/errqueue.h>
78 77
79int sysctl_tcp_timestamps __read_mostly = 1; 78int sysctl_tcp_timestamps __read_mostly = 1;
@@ -4951,53 +4950,6 @@ static inline bool tcp_checksum_complete_user(struct sock *sk,
4951 __tcp_checksum_complete_user(sk, skb); 4950 __tcp_checksum_complete_user(sk, skb);
4952} 4951}
4953 4952
4954#ifdef CONFIG_NET_DMA
4955static bool tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb,
4956 int hlen)
4957{
4958 struct tcp_sock *tp = tcp_sk(sk);
4959 int chunk = skb->len - hlen;
4960 int dma_cookie;
4961 bool copied_early = false;
4962
4963 if (tp->ucopy.wakeup)
4964 return false;
4965
4966 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
4967 tp->ucopy.dma_chan = net_dma_find_channel();
4968
4969 if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) {
4970
4971 dma_cookie = dma_skb_copy_datagram_iovec(tp->ucopy.dma_chan,
4972 skb, hlen,
4973 tp->ucopy.iov, chunk,
4974 tp->ucopy.pinned_list);
4975
4976 if (dma_cookie < 0)
4977 goto out;
4978
4979 tp->ucopy.dma_cookie = dma_cookie;
4980 copied_early = true;
4981
4982 tp->ucopy.len -= chunk;
4983 tp->copied_seq += chunk;
4984 tcp_rcv_space_adjust(sk);
4985
4986 if ((tp->ucopy.len == 0) ||
4987 (tcp_flag_word(tcp_hdr(skb)) & TCP_FLAG_PSH) ||
4988 (atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1))) {
4989 tp->ucopy.wakeup = 1;
4990 sk->sk_data_ready(sk);
4991 }
4992 } else if (chunk > 0) {
4993 tp->ucopy.wakeup = 1;
4994 sk->sk_data_ready(sk);
4995 }
4996out:
4997 return copied_early;
4998}
4999#endif /* CONFIG_NET_DMA */
5000
5001/* Does PAWS and seqno based validation of an incoming segment, flags will 4953/* Does PAWS and seqno based validation of an incoming segment, flags will
5002 * play significant role here. 4954 * play significant role here.
5003 */ 4955 */
@@ -5177,27 +5129,15 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
5177 } 5129 }
5178 } else { 5130 } else {
5179 int eaten = 0; 5131 int eaten = 0;
5180 int copied_early = 0;
5181 bool fragstolen = false; 5132 bool fragstolen = false;
5182 5133
5183 if (tp->copied_seq == tp->rcv_nxt && 5134 if (tp->ucopy.task == current &&
5184 len - tcp_header_len <= tp->ucopy.len) { 5135 tp->copied_seq == tp->rcv_nxt &&
5185#ifdef CONFIG_NET_DMA 5136 len - tcp_header_len <= tp->ucopy.len &&
5186 if (tp->ucopy.task == current && 5137 sock_owned_by_user(sk)) {
5187 sock_owned_by_user(sk) && 5138 __set_current_state(TASK_RUNNING);
5188 tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
5189 copied_early = 1;
5190 eaten = 1;
5191 }
5192#endif
5193 if (tp->ucopy.task == current &&
5194 sock_owned_by_user(sk) && !copied_early) {
5195 __set_current_state(TASK_RUNNING);
5196 5139
5197 if (!tcp_copy_to_iovec(sk, skb, tcp_header_len)) 5140 if (!tcp_copy_to_iovec(sk, skb, tcp_header_len)) {
5198 eaten = 1;
5199 }
5200 if (eaten) {
5201 /* Predicted packet is in window by definition. 5141 /* Predicted packet is in window by definition.
5202 * seq == rcv_nxt and rcv_wup <= rcv_nxt. 5142 * seq == rcv_nxt and rcv_wup <= rcv_nxt.
5203 * Hence, check seq<=rcv_wup reduces to: 5143 * Hence, check seq<=rcv_wup reduces to:
@@ -5213,9 +5153,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
5213 __skb_pull(skb, tcp_header_len); 5153 __skb_pull(skb, tcp_header_len);
5214 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 5154 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
5215 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITSTOUSER); 5155 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITSTOUSER);
5156 eaten = 1;
5216 } 5157 }
5217 if (copied_early)
5218 tcp_cleanup_rbuf(sk, skb->len);
5219 } 5158 }
5220 if (!eaten) { 5159 if (!eaten) {
5221 if (tcp_checksum_complete_user(sk, skb)) 5160 if (tcp_checksum_complete_user(sk, skb))
@@ -5252,14 +5191,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
5252 goto no_ack; 5191 goto no_ack;
5253 } 5192 }
5254 5193
5255 if (!copied_early || tp->rcv_nxt != tp->rcv_wup) 5194 __tcp_ack_snd_check(sk, 0);
5256 __tcp_ack_snd_check(sk, 0);
5257no_ack: 5195no_ack:
5258#ifdef CONFIG_NET_DMA
5259 if (copied_early)
5260 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
5261 else
5262#endif
5263 if (eaten) 5196 if (eaten)
5264 kfree_skb_partial(skb, fragstolen); 5197 kfree_skb_partial(skb, fragstolen);
5265 sk->sk_data_ready(sk); 5198 sk->sk_data_ready(sk);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index cd17f009aede..fbea536cf5c0 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -72,7 +72,6 @@
72#include <net/inet_common.h> 72#include <net/inet_common.h>
73#include <net/timewait_sock.h> 73#include <net/timewait_sock.h>
74#include <net/xfrm.h> 74#include <net/xfrm.h>
75#include <net/netdma.h>
76#include <net/secure_seq.h> 75#include <net/secure_seq.h>
77#include <net/tcp_memcontrol.h> 76#include <net/tcp_memcontrol.h>
78#include <net/busy_poll.h> 77#include <net/busy_poll.h>
@@ -1670,18 +1669,8 @@ process:
1670 bh_lock_sock_nested(sk); 1669 bh_lock_sock_nested(sk);
1671 ret = 0; 1670 ret = 0;
1672 if (!sock_owned_by_user(sk)) { 1671 if (!sock_owned_by_user(sk)) {
1673#ifdef CONFIG_NET_DMA 1672 if (!tcp_prequeue(sk, skb))
1674 struct tcp_sock *tp = tcp_sk(sk);
1675 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1676 tp->ucopy.dma_chan = net_dma_find_channel();
1677 if (tp->ucopy.dma_chan)
1678 ret = tcp_v4_do_rcv(sk, skb); 1673 ret = tcp_v4_do_rcv(sk, skb);
1679 else
1680#endif
1681 {
1682 if (!tcp_prequeue(sk, skb))
1683 ret = tcp_v4_do_rcv(sk, skb);
1684 }
1685 } else if (unlikely(sk_add_backlog(sk, skb, 1674 } else if (unlikely(sk_add_backlog(sk, skb,
1686 sk->sk_rcvbuf + sk->sk_sndbuf))) { 1675 sk->sk_rcvbuf + sk->sk_sndbuf))) {
1687 bh_unlock_sock(sk); 1676 bh_unlock_sock(sk);
@@ -1841,11 +1830,6 @@ void tcp_v4_destroy_sock(struct sock *sk)
1841 } 1830 }
1842#endif 1831#endif
1843 1832
1844#ifdef CONFIG_NET_DMA
1845 /* Cleans up our sk_async_wait_queue */
1846 __skb_queue_purge(&sk->sk_async_wait_queue);
1847#endif
1848
1849 /* Clean prequeue, it must be empty really */ 1833 /* Clean prequeue, it must be empty really */
1850 __skb_queue_purge(&tp->ucopy.prequeue); 1834 __skb_queue_purge(&tp->ucopy.prequeue);
1851 1835
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3342ee64f2e3..3e118dfddd02 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4780,10 +4780,11 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
4780 4780
4781 if (ip6_del_rt(ifp->rt)) 4781 if (ip6_del_rt(ifp->rt))
4782 dst_free(&ifp->rt->dst); 4782 dst_free(&ifp->rt->dst);
4783
4784 rt_genid_bump_ipv6(net);
4783 break; 4785 break;
4784 } 4786 }
4785 atomic_inc(&net->ipv6.dev_addr_genid); 4787 atomic_inc(&net->ipv6.dev_addr_genid);
4786 rt_genid_bump_ipv6(net);
4787} 4788}
4788 4789
4789static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 4790static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index e6960457f625..98cc4cd570e2 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -8,6 +8,13 @@
8#include <net/addrconf.h> 8#include <net/addrconf.h>
9#include <net/ip.h> 9#include <net/ip.h>
10 10
11/* if ipv6 module registers this function is used by xfrm to force all
12 * sockets to relookup their nodes - this is fairly expensive, be
13 * careful
14 */
15void (*__fib6_flush_trees)(struct net *);
16EXPORT_SYMBOL(__fib6_flush_trees);
17
11#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) 18#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16)
12 19
13static inline unsigned int ipv6_addr_scope2type(unsigned int scope) 20static inline unsigned int ipv6_addr_scope2type(unsigned int scope)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 76b7f5ee8f4c..97b9fa8de377 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1605,6 +1605,24 @@ static void fib6_prune_clones(struct net *net, struct fib6_node *fn)
1605 fib6_clean_tree(net, fn, fib6_prune_clone, 1, NULL); 1605 fib6_clean_tree(net, fn, fib6_prune_clone, 1, NULL);
1606} 1606}
1607 1607
1608static int fib6_update_sernum(struct rt6_info *rt, void *arg)
1609{
1610 __u32 sernum = *(__u32 *)arg;
1611
1612 if (rt->rt6i_node &&
1613 rt->rt6i_node->fn_sernum != sernum)
1614 rt->rt6i_node->fn_sernum = sernum;
1615
1616 return 0;
1617}
1618
1619static void fib6_flush_trees(struct net *net)
1620{
1621 __u32 new_sernum = fib6_new_sernum();
1622
1623 fib6_clean_all(net, fib6_update_sernum, &new_sernum);
1624}
1625
1608/* 1626/*
1609 * Garbage collection 1627 * Garbage collection
1610 */ 1628 */
@@ -1788,6 +1806,8 @@ int __init fib6_init(void)
1788 NULL); 1806 NULL);
1789 if (ret) 1807 if (ret)
1790 goto out_unregister_subsys; 1808 goto out_unregister_subsys;
1809
1810 __fib6_flush_trees = fib6_flush_trees;
1791out: 1811out:
1792 return ret; 1812 return ret;
1793 1813
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 5f19dfbc4c6a..f304471477dc 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -314,6 +314,8 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
314 struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); 314 struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
315 315
316 t = ip6gre_tunnel_find(net, parms, ARPHRD_IP6GRE); 316 t = ip6gre_tunnel_find(net, parms, ARPHRD_IP6GRE);
317 if (t && create)
318 return NULL;
317 if (t || !create) 319 if (t || !create)
318 return t; 320 return t;
319 321
@@ -1724,4 +1726,5 @@ MODULE_LICENSE("GPL");
1724MODULE_AUTHOR("D. Kozlov (xeb@mail.ru)"); 1726MODULE_AUTHOR("D. Kozlov (xeb@mail.ru)");
1725MODULE_DESCRIPTION("GRE over IPv6 tunneling device"); 1727MODULE_DESCRIPTION("GRE over IPv6 tunneling device");
1726MODULE_ALIAS_RTNL_LINK("ip6gre"); 1728MODULE_ALIAS_RTNL_LINK("ip6gre");
1729MODULE_ALIAS_RTNL_LINK("ip6gretap");
1727MODULE_ALIAS_NETDEV("ip6gre0"); 1730MODULE_ALIAS_NETDEV("ip6gre0");
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index f9de5a695072..69a84b464009 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -364,8 +364,12 @@ static struct ip6_tnl *ip6_tnl_locate(struct net *net,
364 (t = rtnl_dereference(*tp)) != NULL; 364 (t = rtnl_dereference(*tp)) != NULL;
365 tp = &t->next) { 365 tp = &t->next) {
366 if (ipv6_addr_equal(local, &t->parms.laddr) && 366 if (ipv6_addr_equal(local, &t->parms.laddr) &&
367 ipv6_addr_equal(remote, &t->parms.raddr)) 367 ipv6_addr_equal(remote, &t->parms.raddr)) {
368 if (create)
369 return NULL;
370
368 return t; 371 return t;
372 }
369 } 373 }
370 if (!create) 374 if (!create)
371 return NULL; 375 return NULL;
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 7f52fd9fa7b0..5833a2244467 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -253,8 +253,12 @@ static struct ip6_tnl *vti6_locate(struct net *net, struct __ip6_tnl_parm *p,
253 (t = rtnl_dereference(*tp)) != NULL; 253 (t = rtnl_dereference(*tp)) != NULL;
254 tp = &t->next) { 254 tp = &t->next) {
255 if (ipv6_addr_equal(local, &t->parms.laddr) && 255 if (ipv6_addr_equal(local, &t->parms.laddr) &&
256 ipv6_addr_equal(remote, &t->parms.raddr)) 256 ipv6_addr_equal(remote, &t->parms.raddr)) {
257 if (create)
258 return NULL;
259
257 return t; 260 return t;
261 }
258 } 262 }
259 if (!create) 263 if (!create)
260 return NULL; 264 return NULL;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f23fbd28a501..bafde82324c5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -314,7 +314,6 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
314 314
315 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); 315 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
316 rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); 316 rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
317 rt->rt6i_genid = rt_genid_ipv6(net);
318 INIT_LIST_HEAD(&rt->rt6i_siblings); 317 INIT_LIST_HEAD(&rt->rt6i_siblings);
319 } 318 }
320 return rt; 319 return rt;
@@ -1098,9 +1097,6 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
1098 * DST_OBSOLETE_FORCE_CHK which forces validation calls down 1097 * DST_OBSOLETE_FORCE_CHK which forces validation calls down
1099 * into this function always. 1098 * into this function always.
1100 */ 1099 */
1101 if (rt->rt6i_genid != rt_genid_ipv6(dev_net(rt->dst.dev)))
1102 return NULL;
1103
1104 if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie)) 1100 if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie))
1105 return NULL; 1101 return NULL;
1106 1102
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 29964c3d363c..03a5d1ed3340 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -59,7 +59,6 @@
59#include <net/snmp.h> 59#include <net/snmp.h>
60#include <net/dsfield.h> 60#include <net/dsfield.h>
61#include <net/timewait_sock.h> 61#include <net/timewait_sock.h>
62#include <net/netdma.h>
63#include <net/inet_common.h> 62#include <net/inet_common.h>
64#include <net/secure_seq.h> 63#include <net/secure_seq.h>
65#include <net/tcp_memcontrol.h> 64#include <net/tcp_memcontrol.h>
@@ -1446,18 +1445,8 @@ process:
1446 bh_lock_sock_nested(sk); 1445 bh_lock_sock_nested(sk);
1447 ret = 0; 1446 ret = 0;
1448 if (!sock_owned_by_user(sk)) { 1447 if (!sock_owned_by_user(sk)) {
1449#ifdef CONFIG_NET_DMA 1448 if (!tcp_prequeue(sk, skb))
1450 struct tcp_sock *tp = tcp_sk(sk);
1451 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1452 tp->ucopy.dma_chan = net_dma_find_channel();
1453 if (tp->ucopy.dma_chan)
1454 ret = tcp_v6_do_rcv(sk, skb); 1449 ret = tcp_v6_do_rcv(sk, skb);
1455 else
1456#endif
1457 {
1458 if (!tcp_prequeue(sk, skb))
1459 ret = tcp_v6_do_rcv(sk, skb);
1460 }
1461 } else if (unlikely(sk_add_backlog(sk, skb, 1450 } else if (unlikely(sk_add_backlog(sk, skb,
1462 sk->sk_rcvbuf + sk->sk_sndbuf))) { 1451 sk->sk_rcvbuf + sk->sk_sndbuf))) {
1463 bh_unlock_sock(sk); 1452 bh_unlock_sock(sk);
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 0080d2b0a8ae..bb9cbc17d926 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -839,7 +839,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
839 839
840 if (!(flags & MSG_PEEK)) { 840 if (!(flags & MSG_PEEK)) {
841 spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags); 841 spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags);
842 sk_eat_skb(sk, skb, false); 842 sk_eat_skb(sk, skb);
843 spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); 843 spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags);
844 *seq = 0; 844 *seq = 0;
845 } 845 }
@@ -861,10 +861,10 @@ copy_uaddr:
861 llc_cmsg_rcv(msg, skb); 861 llc_cmsg_rcv(msg, skb);
862 862
863 if (!(flags & MSG_PEEK)) { 863 if (!(flags & MSG_PEEK)) {
864 spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags); 864 spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags);
865 sk_eat_skb(sk, skb, false); 865 sk_eat_skb(sk, skb);
866 spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); 866 spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags);
867 *seq = 0; 867 *seq = 0;
868 } 868 }
869 869
870 goto out; 870 goto out;
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index b5c1d3aadb41..6d77cce481d5 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -847,6 +847,7 @@ config NETFILTER_XT_TARGET_TPROXY
847 tristate '"TPROXY" target transparent proxying support' 847 tristate '"TPROXY" target transparent proxying support'
848 depends on NETFILTER_XTABLES 848 depends on NETFILTER_XTABLES
849 depends on NETFILTER_ADVANCED 849 depends on NETFILTER_ADVANCED
850 depends on (IPV6 || IPV6=n)
850 depends on IP_NF_MANGLE 851 depends on IP_NF_MANGLE
851 select NF_DEFRAG_IPV4 852 select NF_DEFRAG_IPV4
852 select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES 853 select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index c138b8fbe280..f37f0716a9fc 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -222,6 +222,51 @@ replay:
222 } 222 }
223} 223}
224 224
225struct nfnl_err {
226 struct list_head head;
227 struct nlmsghdr *nlh;
228 int err;
229};
230
231static int nfnl_err_add(struct list_head *list, struct nlmsghdr *nlh, int err)
232{
233 struct nfnl_err *nfnl_err;
234
235 nfnl_err = kmalloc(sizeof(struct nfnl_err), GFP_KERNEL);
236 if (nfnl_err == NULL)
237 return -ENOMEM;
238
239 nfnl_err->nlh = nlh;
240 nfnl_err->err = err;
241 list_add_tail(&nfnl_err->head, list);
242
243 return 0;
244}
245
246static void nfnl_err_del(struct nfnl_err *nfnl_err)
247{
248 list_del(&nfnl_err->head);
249 kfree(nfnl_err);
250}
251
252static void nfnl_err_reset(struct list_head *err_list)
253{
254 struct nfnl_err *nfnl_err, *next;
255
256 list_for_each_entry_safe(nfnl_err, next, err_list, head)
257 nfnl_err_del(nfnl_err);
258}
259
260static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb)
261{
262 struct nfnl_err *nfnl_err, *next;
263
264 list_for_each_entry_safe(nfnl_err, next, err_list, head) {
265 netlink_ack(skb, nfnl_err->nlh, nfnl_err->err);
266 nfnl_err_del(nfnl_err);
267 }
268}
269
225static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, 270static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
226 u_int16_t subsys_id) 271 u_int16_t subsys_id)
227{ 272{
@@ -230,6 +275,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
230 const struct nfnetlink_subsystem *ss; 275 const struct nfnetlink_subsystem *ss;
231 const struct nfnl_callback *nc; 276 const struct nfnl_callback *nc;
232 bool success = true, done = false; 277 bool success = true, done = false;
278 static LIST_HEAD(err_list);
233 int err; 279 int err;
234 280
235 if (subsys_id >= NFNL_SUBSYS_COUNT) 281 if (subsys_id >= NFNL_SUBSYS_COUNT)
@@ -287,6 +333,7 @@ replay:
287 type = nlh->nlmsg_type; 333 type = nlh->nlmsg_type;
288 if (type == NFNL_MSG_BATCH_BEGIN) { 334 if (type == NFNL_MSG_BATCH_BEGIN) {
289 /* Malformed: Batch begin twice */ 335 /* Malformed: Batch begin twice */
336 nfnl_err_reset(&err_list);
290 success = false; 337 success = false;
291 goto done; 338 goto done;
292 } else if (type == NFNL_MSG_BATCH_END) { 339 } else if (type == NFNL_MSG_BATCH_END) {
@@ -333,6 +380,7 @@ replay:
333 * original skb. 380 * original skb.
334 */ 381 */
335 if (err == -EAGAIN) { 382 if (err == -EAGAIN) {
383 nfnl_err_reset(&err_list);
336 ss->abort(skb); 384 ss->abort(skb);
337 nfnl_unlock(subsys_id); 385 nfnl_unlock(subsys_id);
338 kfree_skb(nskb); 386 kfree_skb(nskb);
@@ -341,11 +389,24 @@ replay:
341 } 389 }
342ack: 390ack:
343 if (nlh->nlmsg_flags & NLM_F_ACK || err) { 391 if (nlh->nlmsg_flags & NLM_F_ACK || err) {
392 /* Errors are delivered once the full batch has been
393 * processed, this avoids that the same error is
394 * reported several times when replaying the batch.
395 */
396 if (nfnl_err_add(&err_list, nlh, err) < 0) {
397 /* We failed to enqueue an error, reset the
398 * list of errors and send OOM to userspace
399 * pointing to the batch header.
400 */
401 nfnl_err_reset(&err_list);
402 netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM);
403 success = false;
404 goto done;
405 }
344 /* We don't stop processing the batch on errors, thus, 406 /* We don't stop processing the batch on errors, thus,
345 * userspace gets all the errors that the batch 407 * userspace gets all the errors that the batch
346 * triggers. 408 * triggers.
347 */ 409 */
348 netlink_ack(skb, nlh, err);
349 if (err) 410 if (err)
350 success = false; 411 success = false;
351 } 412 }
@@ -361,6 +422,7 @@ done:
361 else 422 else
362 ss->abort(skb); 423 ss->abort(skb);
363 424
425 nfnl_err_deliver(&err_list, oskb);
364 nfnl_unlock(subsys_id); 426 nfnl_unlock(subsys_id);
365 kfree_skb(nskb); 427 kfree_skb(nskb);
366} 428}
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index 28fb8f38e6ba..8892b7b6184a 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -180,15 +180,17 @@ static int nft_hash_init(const struct nft_set *set,
180static void nft_hash_destroy(const struct nft_set *set) 180static void nft_hash_destroy(const struct nft_set *set)
181{ 181{
182 const struct rhashtable *priv = nft_set_priv(set); 182 const struct rhashtable *priv = nft_set_priv(set);
183 const struct bucket_table *tbl; 183 const struct bucket_table *tbl = priv->tbl;
184 struct nft_hash_elem *he, *next; 184 struct nft_hash_elem *he, *next;
185 unsigned int i; 185 unsigned int i;
186 186
187 tbl = rht_dereference(priv->tbl, priv); 187 for (i = 0; i < tbl->size; i++) {
188 for (i = 0; i < tbl->size; i++) 188 for (he = rht_entry(tbl->buckets[i], struct nft_hash_elem, node);
189 rht_for_each_entry_safe(he, next, tbl->buckets[i], priv, node) 189 he != NULL; he = next) {
190 next = rht_entry(he->node.next, struct nft_hash_elem, node);
190 nft_hash_elem_destroy(set, he); 191 nft_hash_elem_destroy(set, he);
191 192 }
193 }
192 rhashtable_destroy(priv); 194 rhashtable_destroy(priv);
193} 195}
194 196
diff --git a/net/netfilter/nft_rbtree.c b/net/netfilter/nft_rbtree.c
index e1836ff88199..46214f245665 100644
--- a/net/netfilter/nft_rbtree.c
+++ b/net/netfilter/nft_rbtree.c
@@ -234,13 +234,11 @@ static void nft_rbtree_destroy(const struct nft_set *set)
234 struct nft_rbtree_elem *rbe; 234 struct nft_rbtree_elem *rbe;
235 struct rb_node *node; 235 struct rb_node *node;
236 236
237 spin_lock_bh(&nft_rbtree_lock);
238 while ((node = priv->root.rb_node) != NULL) { 237 while ((node = priv->root.rb_node) != NULL) {
239 rb_erase(node, &priv->root); 238 rb_erase(node, &priv->root);
240 rbe = rb_entry(node, struct nft_rbtree_elem, node); 239 rbe = rb_entry(node, struct nft_rbtree_elem, node);
241 nft_rbtree_elem_destroy(set, rbe); 240 nft_rbtree_elem_destroy(set, rbe);
242 } 241 }
243 spin_unlock_bh(&nft_rbtree_lock);
244} 242}
245 243
246static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features, 244static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features,
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index 3a633debb6df..ad57f4444b9c 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -526,9 +526,11 @@ pop_stack:
526 match_idx = stack[--stackp]; 526 match_idx = stack[--stackp];
527 cur_match = tcf_em_get_match(tree, match_idx); 527 cur_match = tcf_em_get_match(tree, match_idx);
528 528
529 if (tcf_em_early_end(cur_match, res)) 529 if (tcf_em_early_end(cur_match, res)) {
530 if (tcf_em_is_inverted(cur_match))
531 res = !res;
530 goto pop_stack; 532 goto pop_stack;
531 else { 533 } else {
532 match_idx++; 534 match_idx++;
533 goto proceed; 535 goto proceed;
534 } 536 }
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 95ec7b35e8b6..e48a4e9d8868 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -18,7 +18,12 @@ __modinst: $(modules)
18 18
19# Don't stop modules_install if we can't sign external modules. 19# Don't stop modules_install if we can't sign external modules.
20quiet_cmd_modules_install = INSTALL $@ 20quiet_cmd_modules_install = INSTALL $@
21 cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) 21 cmd_modules_install = \
22 mkdir -p $(2) ; \
23 cp $@ $(2) ; \
24 $(mod_strip_cmd) $(2)/$(notdir $@) ; \
25 $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \
26 $(mod_compress_cmd) $(2)/$(notdir $@)
22 27
23# Modules built outside the kernel source tree go into extra by default 28# Modules built outside the kernel source tree go into extra by default
24INSTALL_MOD_DIR ?= extra 29INSTALL_MOD_DIR ?= extra
diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign
index abfda626dbad..b6ac7084da79 100644
--- a/scripts/Makefile.modsign
+++ b/scripts/Makefile.modsign
@@ -7,7 +7,7 @@ __modsign:
7 7
8include scripts/Kbuild.include 8include scripts/Kbuild.include
9 9
10__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 10__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
11modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) 11modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
12 12
13PHONY += $(modules) 13PHONY += $(modules)
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 549d0ab8c662..23e78dcd12bf 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -20,6 +20,8 @@ def getsizes(file):
20 if type in "tTdDbBrR": 20 if type in "tTdDbBrR":
21 # strip generated symbols 21 # strip generated symbols
22 if name.startswith("__mod_"): continue 22 if name.startswith("__mod_"): continue
23 if name.startswith("SyS_"): continue
24 if name.startswith("compat_SyS_"): continue
23 if name == "linux_banner": continue 25 if name == "linux_banner": continue
24 # statics and some other optimizations adds random .NUMBER 26 # statics and some other optimizations adds random .NUMBER
25 name = re.sub(r'\.[0-9]+', '', name) 27 name = re.sub(r'\.[0-9]+', '', name)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 9c4d2412fb72..ebf40f6edb4d 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -104,6 +104,23 @@ endif
104%_defconfig: $(obj)/conf 104%_defconfig: $(obj)/conf
105 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) 105 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
106 106
107configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config $(srctree)/arch/$(SRCARCH)/configs/$(1).config)
108
109define mergeconfig
110$(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
111$(if $(call configfiles,$(1)),, $(error No configuration exists for this target on this architecture))
112$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(call configfiles,$(1))
113$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
114endef
115
116PHONY += kvmconfig
117kvmconfig:
118 $(call mergeconfig,kvm_guest)
119
120PHONY += tinyconfig
121tinyconfig: allnoconfig
122 $(call mergeconfig,tiny)
123
107# Help text used by make help 124# Help text used by make help
108help: 125help:
109 @echo ' config - Update current config utilising a line-oriented program' 126 @echo ' config - Update current config utilising a line-oriented program'
@@ -124,6 +141,8 @@ help:
124 @echo ' randconfig - New config with random answer to all options' 141 @echo ' randconfig - New config with random answer to all options'
125 @echo ' listnewconfig - List new options' 142 @echo ' listnewconfig - List new options'
126 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value' 143 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
144 @echo ' kvmconfig - Enable additional options for guest kernel support'
145 @echo ' tinyconfig - Configure the tiniest possible kernel'
127 146
128# lxdialog stuff 147# lxdialog stuff
129check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 148check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 091d90573b63..3b405c726ec5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -24,9 +24,9 @@
24#include "../../include/linux/export.h" 24#include "../../include/linux/export.h"
25 25
26/* Are we using CONFIG_MODVERSIONS? */ 26/* Are we using CONFIG_MODVERSIONS? */
27int modversions = 0; 27static int modversions = 0;
28/* Warn about undefined symbols? (do so if we have vmlinux) */ 28/* Warn about undefined symbols? (do so if we have vmlinux) */
29int have_vmlinux = 0; 29static int have_vmlinux = 0;
30/* Is CONFIG_MODULE_SRCVERSION_ALL set? */ 30/* Is CONFIG_MODULE_SRCVERSION_ALL set? */
31static int all_versions = 0; 31static int all_versions = 0;
32/* If we are modposting external module set to 1 */ 32/* If we are modposting external module set to 1 */
@@ -229,7 +229,7 @@ static struct symbol *find_symbol(const char *name)
229 return NULL; 229 return NULL;
230} 230}
231 231
232static struct { 232static const struct {
233 const char *str; 233 const char *str;
234 enum export export; 234 enum export export;
235} export_list[] = { 235} export_list[] = {
@@ -805,7 +805,7 @@ static int match(const char *sym, const char * const pat[])
805} 805}
806 806
807/* sections that we do not want to do full section mismatch check on */ 807/* sections that we do not want to do full section mismatch check on */
808static const char *section_white_list[] = 808static const char *const section_white_list[] =
809{ 809{
810 ".comment*", 810 ".comment*",
811 ".debug*", 811 ".debug*",
@@ -882,17 +882,18 @@ static void check_section(const char *modname, struct elf_info *elf,
882#define MEM_EXIT_SECTIONS ".memexit.*" 882#define MEM_EXIT_SECTIONS ".memexit.*"
883 883
884/* init data sections */ 884/* init data sections */
885static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; 885static const char *const init_data_sections[] =
886 { ALL_INIT_DATA_SECTIONS, NULL };
886 887
887/* all init sections */ 888/* all init sections */
888static const char *init_sections[] = { ALL_INIT_SECTIONS, NULL }; 889static const char *const init_sections[] = { ALL_INIT_SECTIONS, NULL };
889 890
890/* All init and exit sections (code + data) */ 891/* All init and exit sections (code + data) */
891static const char *init_exit_sections[] = 892static const char *const init_exit_sections[] =
892 {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }; 893 {ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL };
893 894
894/* data section */ 895/* data section */
895static const char *data_sections[] = { DATA_SECTIONS, NULL }; 896static const char *const data_sections[] = { DATA_SECTIONS, NULL };
896 897
897 898
898/* symbols in .data that may refer to init/exit sections */ 899/* symbols in .data that may refer to init/exit sections */
@@ -906,8 +907,8 @@ static const char *data_sections[] = { DATA_SECTIONS, NULL };
906 "*_probe_one", \ 907 "*_probe_one", \
907 "*_console" 908 "*_console"
908 909
909static const char *head_sections[] = { ".head.text*", NULL }; 910static const char *const head_sections[] = { ".head.text*", NULL };
910static const char *linker_symbols[] = 911static const char *const linker_symbols[] =
911 { "__init_begin", "_sinittext", "_einittext", NULL }; 912 { "__init_begin", "_sinittext", "_einittext", NULL };
912 913
913enum mismatch { 914enum mismatch {
@@ -929,7 +930,7 @@ struct sectioncheck {
929 const char *symbol_white_list[20]; 930 const char *symbol_white_list[20];
930}; 931};
931 932
932const struct sectioncheck sectioncheck[] = { 933static const struct sectioncheck sectioncheck[] = {
933/* Do not reference init/exit code/data from 934/* Do not reference init/exit code/data from
934 * normal code and data 935 * normal code and data
935 */ 936 */
@@ -2211,7 +2212,7 @@ int main(int argc, char **argv)
2211 err = 0; 2212 err = 0;
2212 2213
2213 for (mod = modules; mod; mod = mod->next) { 2214 for (mod = modules; mod; mod = mod->next) {
2214 char fname[strlen(mod->name) + 10]; 2215 char fname[PATH_MAX];
2215 2216
2216 if (mod->skip) 2217 if (mod->skip)
2217 continue; 2218 continue;
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 998100093332..65ca451a764d 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -668,7 +668,7 @@ static int param_set_aabool(const char *val, const struct kernel_param *kp);
668static int param_get_aabool(char *buffer, const struct kernel_param *kp); 668static int param_get_aabool(char *buffer, const struct kernel_param *kp);
669#define param_check_aabool param_check_bool 669#define param_check_aabool param_check_bool
670static struct kernel_param_ops param_ops_aabool = { 670static struct kernel_param_ops param_ops_aabool = {
671 .flags = KERNEL_PARAM_FL_NOARG, 671 .flags = KERNEL_PARAM_OPS_FL_NOARG,
672 .set = param_set_aabool, 672 .set = param_set_aabool,
673 .get = param_get_aabool 673 .get = param_get_aabool
674}; 674};
@@ -685,7 +685,7 @@ static int param_set_aalockpolicy(const char *val, const struct kernel_param *kp
685static int param_get_aalockpolicy(char *buffer, const struct kernel_param *kp); 685static int param_get_aalockpolicy(char *buffer, const struct kernel_param *kp);
686#define param_check_aalockpolicy param_check_bool 686#define param_check_aalockpolicy param_check_bool
687static struct kernel_param_ops param_ops_aalockpolicy = { 687static struct kernel_param_ops param_ops_aalockpolicy = {
688 .flags = KERNEL_PARAM_FL_NOARG, 688 .flags = KERNEL_PARAM_OPS_FL_NOARG,
689 .set = param_set_aalockpolicy, 689 .set = param_set_aalockpolicy,
690 .get = param_get_aalockpolicy 690 .get = param_get_aalockpolicy
691}; 691};
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index e4f6102efc1a..b86b426f159d 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -51,7 +51,7 @@ static struct reg_default rt286_index_def[] = {
51 { 0x04, 0xaf01 }, 51 { 0x04, 0xaf01 },
52 { 0x08, 0x000d }, 52 { 0x08, 0x000d },
53 { 0x09, 0xd810 }, 53 { 0x09, 0xd810 },
54 { 0x0a, 0x0060 }, 54 { 0x0a, 0x0120 },
55 { 0x0b, 0x0000 }, 55 { 0x0b, 0x0000 },
56 { 0x0d, 0x2800 }, 56 { 0x0d, 0x2800 },
57 { 0x0f, 0x0000 }, 57 { 0x0f, 0x0000 },
@@ -60,7 +60,7 @@ static struct reg_default rt286_index_def[] = {
60 { 0x33, 0x0208 }, 60 { 0x33, 0x0208 },
61 { 0x49, 0x0004 }, 61 { 0x49, 0x0004 },
62 { 0x4f, 0x50e9 }, 62 { 0x4f, 0x50e9 },
63 { 0x50, 0x2c00 }, 63 { 0x50, 0x2000 },
64 { 0x63, 0x2902 }, 64 { 0x63, 0x2902 },
65 { 0x67, 0x1111 }, 65 { 0x67, 0x1111 },
66 { 0x68, 0x1016 }, 66 { 0x68, 0x1016 },
@@ -104,7 +104,6 @@ static const struct reg_default rt286_reg[] = {
104 { 0x02170700, 0x00000000 }, 104 { 0x02170700, 0x00000000 },
105 { 0x02270100, 0x00000000 }, 105 { 0x02270100, 0x00000000 },
106 { 0x02370100, 0x00000000 }, 106 { 0x02370100, 0x00000000 },
107 { 0x02040000, 0x00004002 },
108 { 0x01870700, 0x00000020 }, 107 { 0x01870700, 0x00000020 },
109 { 0x00830000, 0x000000c3 }, 108 { 0x00830000, 0x000000c3 },
110 { 0x00930000, 0x000000c3 }, 109 { 0x00930000, 0x000000c3 },
@@ -192,7 +191,6 @@ static int rt286_hw_write(void *context, unsigned int reg, unsigned int value)
192 /*handle index registers*/ 191 /*handle index registers*/
193 if (reg <= 0xff) { 192 if (reg <= 0xff) {
194 rt286_hw_write(client, RT286_COEF_INDEX, reg); 193 rt286_hw_write(client, RT286_COEF_INDEX, reg);
195 reg = RT286_PROC_COEF;
196 for (i = 0; i < INDEX_CACHE_SIZE; i++) { 194 for (i = 0; i < INDEX_CACHE_SIZE; i++) {
197 if (reg == rt286->index_cache[i].reg) { 195 if (reg == rt286->index_cache[i].reg) {
198 rt286->index_cache[i].def = value; 196 rt286->index_cache[i].def = value;
@@ -200,6 +198,7 @@ static int rt286_hw_write(void *context, unsigned int reg, unsigned int value)
200 } 198 }
201 199
202 } 200 }
201 reg = RT286_PROC_COEF;
203 } 202 }
204 203
205 data[0] = (reg >> 24) & 0xff; 204 data[0] = (reg >> 24) & 0xff;
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 484b3bbe8624..4021cd435740 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -647,7 +647,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type,
647 return -ENOMEM; 647 return -ENOMEM;
648 648
649 dev_set_drvdata(dev, ssm2602); 649 dev_set_drvdata(dev, ssm2602);
650 ssm2602->type = SSM2602; 650 ssm2602->type = type;
651 ssm2602->regmap = regmap; 651 ssm2602->regmap = regmap;
652 652
653 return snd_soc_register_codec(dev, &soc_codec_dev_ssm2602, 653 return snd_soc_register_codec(dev, &soc_codec_dev_ssm2602,
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb5776a39b..de6ab06f58a5 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
748 return 0; 748 return 0;
749} 749}
750 750
751static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, 751static int _fsl_ssi_set_dai_fmt(struct device *dev,
752 unsigned int fmt) 752 struct fsl_ssi_private *ssi_private,
753 unsigned int fmt)
753{ 754{
754 struct regmap *regs = ssi_private->regs; 755 struct regmap *regs = ssi_private->regs;
755 u32 strcr = 0, stcr, srcr, scr, mask; 756 u32 strcr = 0, stcr, srcr, scr, mask;
@@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
758 ssi_private->dai_fmt = fmt; 759 ssi_private->dai_fmt = fmt;
759 760
760 if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) { 761 if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
761 dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n"); 762 dev_err(dev, "baudclk is missing which is necessary for master mode\n");
762 return -EINVAL; 763 return -EINVAL;
763 } 764 }
764 765
@@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
913{ 914{
914 struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); 915 struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
915 916
916 return _fsl_ssi_set_dai_fmt(ssi_private, fmt); 917 return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
917} 918}
918 919
919/** 920/**
@@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
1387 1388
1388done: 1389done:
1389 if (ssi_private->dai_fmt) 1390 if (ssi_private->dai_fmt)
1390 _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt); 1391 _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
1392 ssi_private->dai_fmt);
1391 1393
1392 return 0; 1394 return 0;
1393 1395
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 3092b58fede6..cecfab3cc948 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -102,13 +102,11 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
102 fe->dpcm[stream].runtime = fe_substream->runtime; 102 fe->dpcm[stream].runtime = fe_substream->runtime;
103 103
104 ret = dpcm_path_get(fe, stream, &list); 104 ret = dpcm_path_get(fe, stream, &list);
105 if (ret < 0) { 105 if (ret < 0)
106 mutex_unlock(&fe->card->mutex);
107 goto fe_err; 106 goto fe_err;
108 } else if (ret == 0) { 107 else if (ret == 0)
109 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", 108 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
110 fe->dai_link->name, stream ? "capture" : "playback"); 109 fe->dai_link->name, stream ? "capture" : "playback");
111 }
112 110
113 /* calculate valid and active FE <-> BE dpcms */ 111 /* calculate valid and active FE <-> BE dpcms */
114 dpcm_process_paths(fe, stream, &list, 1); 112 dpcm_process_paths(fe, stream, &list, 1);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 889f4e3d35dc..d074aa91b023 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3203,7 +3203,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3203 unsigned int val, mask; 3203 unsigned int val, mask;
3204 void *data; 3204 void *data;
3205 3205
3206 if (!component->regmap) 3206 if (!component->regmap || !params->num_regs)
3207 return -EINVAL; 3207 return -EINVAL;
3208 3208
3209 len = params->num_regs * component->val_bytes; 3209 len = params->num_regs * component->val_bytes;